VisionService
-
class
VisionService -
- Fully qualified name
-
\Netresearch\Nr Llm\ Service\ Feature\ Vision Service
Image analysis with specialized prompts.
generateAltText($imageUrl, ?VisionOptions $options = null)-
Request concise alt text intended for screen readers.
The prompt asks for essential information in under 125 characters. Provider output is returned verbatim: length and accessibility suitability require review by the caller.
- param string|array $imageUrl
-
URL, base64 image data URI, or an array of these for sequential per-image requests
- param VisionOptions|null $options
-
Vision options (defaults: maxTokens=100, temperature=0.5)
- Returns
-
string|array Alt text or array of alt texts for batch input
generateTitle($imageUrl, ?VisionOptions $options = null)-
Request an image title.
The prompt asks for a title under 60 characters. This is a prompt constraint; the service does not validate or truncate provider output.
- param string|array $imageUrl
-
URL, base64 image data URI, or an array of these for sequential per-image requests
- param VisionOptions|null $options
-
Vision options (defaults: maxTokens=50, temperature=0.7)
- Returns
-
string|array Title or array of titles for batch input
generateDescription($imageUrl, ?VisionOptions $options = null)-
Generate detailed image description.
Provides comprehensive analysis including subjects, setting, colors, mood, composition, and notable details.
- param string|array $imageUrl
-
URL, base64 image data URI, or an array of these for sequential per-image requests
- param VisionOptions|null $options
-
Vision options (defaults: maxTokens=500, temperature=0.7)
- Returns
-
string|array Description or array of descriptions for batch input
analyzeImage($imageUrl, string $customPrompt, ?VisionOptions $options = null)-
Custom image analysis with specific prompt.
- param string|array $imageUrl
-
URL, base64 image data URI, or an array of these for sequential per-image requests
- param string $customPrompt
-
Custom analysis prompt
- param VisionOptions|null $options
-
Vision options
- Returns
-
string|array Analysis result or array of results for batch input
analyzeImageFull(string $imageUrl, string $prompt, ?VisionOptions $options = null): VisionResponse-
Full image analysis returning complete response with usage statistics.
Returns a VisionResponse with metadata and usage data, unlike the other methods which return plain text.
- param string $imageUrl
-
Image URL or base64 data URI
- param string $prompt
-
Analysis prompt
- param VisionOptions|null $options
-
Vision options
- throws
-
InvalidArgumentException If image URL is invalid
- Returns
-
VisionResponse Complete response with usage data