AnthropicVisionClient

org.llm4s.imageprocessing.provider.anthropicclient.AnthropicVisionClient

Anthropic Claude Vision client for AI-powered image analysis. This client provides advanced image understanding capabilities using Claude's vision models.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def analyzeImage(imagePath: String, prompt: Option[String]): Either[LLMError, ImageAnalysisResult]

Analyzes an image using Anthropic's Claude Vision API.

Analyzes an image using Anthropic's Claude Vision API.

Value parameters

imagePath

Path to the image file to analyze

prompt

Optional custom prompt for the analysis. If not provided, uses a default comprehensive prompt

Attributes

Returns

Either an LLMError if the analysis fails, or an ImageAnalysisResult with the analysis details

Definition Classes
override def convertFormat(imagePath: String, targetFormat: ImageFormat): Either[LLMError, ProcessedImage]

Converts an image from one format to another.

Converts an image from one format to another.

Value parameters

imagePath

Path to the source image file

targetFormat

The desired output format (JPEG, PNG, GIF, BMP)

Attributes

Returns

Either an LLMError if conversion fails, or a ProcessedImage in the new format

Definition Classes
def detectMediaType(imagePath: String): MediaType

Detects the media type of an image file based on its extension.

Detects the media type of an image file based on its extension.

Value parameters

imagePath

Path to the image file

Attributes

Returns

MediaType representing the image format (JPEG, PNG, GIF, or WEBP)

def detectObjects(imagePath: String): Either[LLMError, List[DetectedObject]]

Identifies and describes objects in the image with confidence scores. Uses Claude Vision to detect and locate objects within the image.

Identifies and describes objects in the image with confidence scores. Uses Claude Vision to detect and locate objects within the image.

Value parameters

imagePath

Path to the image file to analyze

Attributes

Returns

Either an LLMError if detection fails, or a List of DetectedObject with labels and confidence scores

def encodeImageToBase64(imagePath: String): Try[String]

Encodes an image file to Base64 format for API transmission.

Encodes an image file to Base64 format for API transmission.

Value parameters

imagePath

Path to the image file to encode

Attributes

Returns

Try containing the Base64-encoded string, or failure if encoding fails

def extractText(imagePath: String): Either[LLMError, String]

Performs Optical Character Recognition (OCR) on the image using Claude Vision. Extracts and transcribes all visible text from the image.

Performs Optical Character Recognition (OCR) on the image using Claude Vision. Extracts and transcribes all visible text from the image.

Value parameters

imagePath

Path to the image file containing text

Attributes

Returns

Either an LLMError if extraction fails, or the extracted text as a String

def generateTags(imagePath: String): Either[LLMError, List[String]]

Generates descriptive tags for the image content. Creates semantic tags that categorize and describe the image's content, style, and mood.

Generates descriptive tags for the image content. Creates semantic tags that categorize and describe the image's content, style, and mood.

Value parameters

imagePath

Path to the image file to analyze

Attributes

Returns

Either an LLMError if tagging fails, or a List of descriptive tags

override def preprocessImage(imagePath: String, operations: List[ImageOperation]): Either[LLMError, ProcessedImage]

Preprocesses an image by applying a sequence of operations.

Preprocesses an image by applying a sequence of operations.

Value parameters

imagePath

Path to the image file to preprocess

operations

List of image operations to apply (resize, crop, rotate, etc.)

Attributes

Returns

Either an LLMError if preprocessing fails, or a ProcessedImage with the result

Definition Classes
override def resizeImage(imagePath: String, width: Int, height: Int, maintainAspectRatio: Boolean): Either[LLMError, ProcessedImage]

Resizes an image to specified dimensions.

Resizes an image to specified dimensions.

Value parameters

height

Target height in pixels

imagePath

Path to the image file to resize

maintainAspectRatio

If true, maintains the original aspect ratio (default: true)

width

Target width in pixels

Attributes

Returns

Either an LLMError if resizing fails, or a ProcessedImage with new dimensions

Definition Classes