ParsesTextResponses
trait ParsesTextResponses
Traits
Methods
array
decodeStructuredOutput(string|null $text)
Decode a structured output payload, tolerating markdown code fences.
void
validateTextResponse(array $data)
Validate the Ollama response data.
parseTextResponse(array $data, Provider $provider, bool $structured)
Parse the Ollama response data into a single step response.
array
parseToolArguments(mixed $arguments)
Parse tool call arguments, handling both array and JSON string formats.
extractUsage(array $data)
Extract usage data from the Ollama response.
FinishReason
extractFinishReason(array $data)
Extract and map the finish reason from the Ollama response.
Details
in
DecodesStructuredOutput at line 12
protected array
decodeStructuredOutput(string|null $text)
Decode a structured output payload, tolerating markdown code fences.
at line 26
protected void
validateTextResponse(array $data)
Validate the Ollama response data.
at line 39
protected StepResponse
parseTextResponse(array $data, Provider $provider, bool $structured)
Parse the Ollama response data into a single step response.
at line 82
protected array
parseToolArguments(mixed $arguments)
Parse tool call arguments, handling both array and JSON string formats.
at line 94
protected TextUsage
extractUsage(array $data)
Extract usage data from the Ollama response.
at line 106
protected FinishReason
extractFinishReason(array $data)
Extract and map the finish reason from the Ollama response.