VisionService
- class VisionService
-
- Fully qualified name
-
\Netresearch\
Nr Llm\ Service\ Feature\ Vision Service
Image analysis with specialized prompts.
- generateAltText(string|array $imageUrl, ?VisionOptions $options = null): string|array ( )
-
Generate WCAG-compliant alt text.
Optimized for screen readers and WCAG 2.1 Level AA compliance. Output is concise (under 125 characters) and focuses on essential information.
- param string|array $imageUrl
-
URL, local path, or array of URLs for batch processing
- 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(string|array $imageUrl, ?VisionOptions $options = null): string|array ( )
-
Generate SEO-optimized image title.
Creates compelling, keyword-rich titles under 60 characters for improved search rankings.
- param string|array $imageUrl
-
URL, local path, or array of URLs for batch processing
- param VisionOptions|null $options
-
Vision options (defaults: maxTokens=50, temperature=0.7)
- Returns
-
string|array Title or array of titles for batch input
- generateDescription(string|array $imageUrl, ?VisionOptions $options = null): string|array ( )
-
Generate detailed image description.
Provides comprehensive analysis including subjects, setting, colors, mood, composition, and notable details.
- param string|array $imageUrl
-
URL, local path, or array of URLs for batch processing
- param VisionOptions|null $options
-
Vision options (defaults: maxTokens=500, temperature=0.7)
- Returns
-
string|array Description or array of descriptions for batch input
- analyzeImage(string|array $imageUrl, string $customPrompt, ?VisionOptions $options = null): string|array ( )
-
Custom image analysis with specific prompt.
- param string|array $imageUrl
-
URL, local path, or array of URLs for batch processing
- 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