Response objects
CompletionResponse
-
class
CompletionResponse
-
- Fully qualified name
-
\Netresearch\NrLlm\Domain\Model\CompletionResponse
Response from chat/completion operations.
-
string
content
-
The generated text content.
-
string
model
-
The model used for generation.
-
UsageStatistics
usage
-
Token usage statistics.
-
string
finishReason
-
Why generation stopped: 'stop', 'length', 'content_filter', 'tool_calls'
-
string
provider
-
The provider identifier.
-
array|null
toolCalls
-
Tool calls if any were made.
-
array|null
metadata
-
Provider-specific metadata. Structure varies by provider.
-
string|null
thinking
-
Thinking/reasoning content from models that support extended thinking
(e.g., Claude with thinking enabled).
isComplete(): bool
-
Check if response finished normally.
wasTruncated(): bool
-
Check if response hit max_tokens limit.
wasFiltered(): bool
-
Check if content was filtered.
hasToolCalls(): bool
-
Check if response contains tool calls.
hasThinking(): bool
-
Check if response contains thinking/reasoning content.
getText(): string
-
Alias for content property.
VisionResponse
-
class
VisionResponse
-
- Fully qualified name
-
\Netresearch\NrLlm\Domain\Model\VisionResponse
Response from vision/image analysis operations.
-
string
description
-
The generated image analysis text.
-
string
model
-
The model used for analysis.
-
UsageStatistics
usage
-
Token usage statistics.
-
string
provider
-
The provider identifier.
-
float|null
confidence
-
Confidence score for the analysis (if available).
-
array|null
detectedObjects
-
Detected objects in the image (if available).
-
array|null
metadata
-
Provider-specific metadata.
getText(): string
-
Get the analysis text. Alias for description property.
getDescription(): string
-
Alias for description property.
meetsConfidence(float $threshold): bool
-
Check if confidence score meets or exceeds a threshold.
- param float $threshold
-
Minimum confidence value
- Returns
-
bool True if confidence is not null and meets threshold
EmbeddingResponse
-
class
EmbeddingResponse
-
- Fully qualified name
-
\Netresearch\NrLlm\Domain\Model\EmbeddingResponse
Response from embedding operations.
-
array
embeddings
-
Array of embedding vectors.
-
string
model
-
The model used for embedding.
-
UsageStatistics
usage
-
Token usage statistics.
-
string
provider
-
The provider identifier.
getVector(): array
-
Get the first embedding vector.
- static
cosineSimilarity(array $a, array $b)
-
Calculate cosine similarity between vectors.
- returns
-
float
TranslationResult
-
class
TranslationResult
-
- Fully qualified name
-
\Netresearch\NrLlm\Domain\Model\TranslationResult
Response from translation operations.
-
string
translation
-
The translated text.
-
string
sourceLanguage
-
Detected or provided source language.
-
string
targetLanguage
-
The target language.
-
float
confidence
-
Finish-reason heuristic on the LLM translation path, not a measured
translation-quality probability. See TranslationService.
TranslatorResult
Netresearch\NrLlm\Specialized\Translation\TranslatorResult is separate
from the LLM TranslationResult. It exposes translatedText,
sourceLanguage, targetLanguage, translator, nullable confidence,
alternatives, charactersUsed and metadata. It has no LLM
UsageStatistics member. getText() returns the text;
isFromLlm() and isFromDeepL() describe the translator.
isPolished() reports whether an optional LLM revision was applied.
metadata['polish']['reason'] explains a skipped revision. A specialized
translator's nullable confidence is translator-specific; do not treat it as
an independently calibrated accuracy measure.
UsageStatistics
-
class
UsageStatistics
-
- Fully qualified name
-
\Netresearch\NrLlm\Domain\Model\UsageStatistics
Token usage and cost tracking.
-
int
promptTokens
-
Tokens in the prompt/input.
-
int
completionTokens
-
Tokens in the completion/output.
-
int
totalTokens
-
Total tokens used.
-
float|null
estimatedCost
-
Estimated cost in USD (if available).