Provider interface
-
interface
ProviderInterface -
- Fully qualified name
-
\Netresearch\Nr Llm\ Provider\ Contract\ Provider Interface
Contract for LLM providers.
configure(array $config): void-
Configure the provider with its Vault credential identifier and settings.
- param array $config
-
Configuration key-value pairs
supportsFeature(string|ModelCapability $feature): bool-
Check if provider supports a specific feature.
chatCompletion(array $messages, array $options = []): CompletionResponse-
Execute chat completion.
- param array $messages
-
A list of typed
Chatvalues or legacy arrays withMessage roleandcontent. Rich provider-specific arrays retain their additional fields, including tool results and multimodal content. Implementations normalize typed messages withto.Array ()
complete(string $prompt, array $options = []): CompletionResponse-
Execute simple completion from a prompt.
Synchronous Gemini text and thinking
For Gemini chat and chat, all string
text parts of the first candidate contribute in their original order. Native
parts with thought: true populate Completion;
other text parts populate $content. Neither sequence gains an invented
separator, and native text keeps its whitespace.
The joined visible text then uses the existing <think>...</ extraction
once, including a delimiter split across parts. Inline blocks keep their
existing trimming and whitespace normalization. If native and inline thinking
both contribute, $thinking contains native text, one newline and inline
thinking. With neither contribution, it is null. Native-only responses
have empty visible content. This does not change streaming or vision parsing,
and preserves tool calls, response fields and the unmodified native parts used
by the existing response capture or replay behavior. See ADR-223: Gemini separates native thoughts from text.
-
interface
VisionCapableInterface -
- Fully qualified name
-
\Netresearch\Nr Llm\ Provider\ Contract\ Vision Capable Interface
Contract for providers supporting vision/image analysis.
analyzeImage(array $content, array $options = []): VisionResponse-
Analyze an image.
- param array $content
-
A list of typed
Visionvalues.Content Llmnormalizes legacy content-part arrays before calling the provider; direct adapter calls use typed values.Service Manager:: vision () - param array $options
-
Optional configuration
- Returns
-
VisionResponse
-
interface
StreamingCapableInterface -
- Fully qualified name
-
\Netresearch\Nr Llm\ Provider\ Contract\ Streaming Capable Interface
Contract for providers supporting streaming.
-
interface
ToolCapableInterface -
- Fully qualified name
-
\Netresearch\Nr Llm\ Provider\ Contract\ Tool Capable Interface
Contract for providers supporting tool/function calling.
chatCompletionWithTools(array $messages, array $tools, array $options = []): CompletionResponse-
Chat with tool calling. Messages support multimodal content (string or array of content blocks).
- param array $messages
-
Typed
Chatvalues or provider-specific legacy message arraysMessage - param array $tools
-
A list of typed
Toolvalues.Spec Llmnormalizes legacy tool arrays before calling the provider.Service Manager:: chat With Tools ()
-
interface
DocumentCapableInterface -
- Fully qualified name
-
\Netresearch\Nr Llm\ Provider\ Contract\ Document Capable Interface
Optional capability for Base64 inline document content in chat messages. It adds capability discovery, not a separate completion method.
-
interface
DecisionCapableInterface -
- Fully qualified name
-
\Netresearch\Nr Llm\ Provider\ Contract\ Decision Capable Interface
Optional capability for providers that natively answer typed questions about a screened subject (ADR-211).
decide(DecisionSubject $subject, array $questions, array $options = []): DecisionResponse- param DecisionSubject $subject
-
Typed subject to evaluate
- param array $questions
-
A list of
DecisionvaluesQuestion - param array $options
-
Configuration call options, including
model - throws
-
InvalidDecisionResponseException for malformed answers; ProviderException for other provider failures
- Returns
-
Typed answers with one valid answer per question
Gemini known JSON-object slots
Gemini requests encode Function and
Function as JSON objects, including empty and numeric-key
maps. This applies to plain chat, tool chat and streaming requests that carry
existing assistant turns, including Gemini-owned replay parts restored after
an approval resume. The public Tool PHP array and the saved
replay carrier remain unchanged; conversion occurs in the final request copy.
Decoded list results retain their values under numeric object keys. Scalar or
invalid JSON tool results retain the existing result string fallback.
Only these two known object slots are restored. Arbitrary nested object/list
kinds already lost by associative decoding remain an open limitation; nested
lists retain their current shape. See ADR-224.