org.llm4s.imageprocessing.provider.geminiclient.GeminiVisionClient
Google Gemini Vision client for AI-powered image analysis.
Sends multimodal requests (image + text prompt) to the Gemini generateContent REST endpoint and returns structured analysis results.
The API key is sent in the x-goog-api-key request header, never in the URL, so it cannot reach a log line or an error message through the URL.
Failures are returned, not thrown: an HTTP error status is an org.llm4s.error.APIError carrying the status code; a timeout, connection failure or interruption is the typed org.llm4s.error.TimeoutError, org.llm4s.error.NetworkError or org.llm4s.error.CancelledError; a reply that carries no text (a blocked prompt, a candidate stopped for safety or recitation, a body that is not Gemini JSON) is an org.llm4s.error.APIError too, never a made-up description.
Value parameters
-
config
-
GeminiVisionConfig containing the API key, model, and base URL.
-
httpClient
-
the HTTP transport; defaults to the JDK client honouring config.connectTimeoutSeconds.
Attributes
-
Graph
-
-
Supertypes
-
class Object
trait Matchable
class Any
Members list
Analyses an image using the Google Gemini Vision API.
Analyses an image using the Google Gemini Vision API.
Value parameters
-
imagePath
-
Path to the image file to analyse.
-
prompt
-
Optional custom prompt; a default comprehensive prompt is used when absent.
Attributes
-
Returns
-
Either an LLMError on failure or an ImageAnalysisResult.
-
Definition Classes
-
Encodes the image at imagePath to a Base64 string.
Encodes the image at imagePath to a Base64 string.
Value parameters
-
imagePath
-
Absolute or relative path to the image file.
Attributes
-
Returns
-
scala.util.Try wrapping the Base64 string on success.
Preprocesses an image with specified operations.
Preprocesses an image with specified operations.
Value parameters
-
imagePath
-
Path to the input image
-
operations
-
List of preprocessing operations to apply
Attributes
-
Returns
-
Either error or processed image
-
Definition Classes
-
Resizes an image to specified dimensions.
Resizes an image to specified dimensions.
Value parameters
-
height
-
Target height
-
imagePath
-
Path to the input image
-
maintainAspectRatio
-
Whether to maintain aspect ratio
-
width
-
Target width
Attributes
-
Returns
-
Either error or resized image
-
Definition Classes
-
Asynchronously analyzes an image and returns a description.
Asynchronously analyzes an image and returns a description.
Default implementation wraps the synchronous call in a Future with an explicit blocking boundary to avoid starving compute pools.
Value parameters
-
ec
-
ExecutionContext for async execution
-
imagePath
-
Path to the image file
-
prompt
-
Optional prompt to guide the analysis
Attributes
-
Returns
-
Future containing either error or image analysis result
-
Inherited from:
-
ImageProcessingClient