ParsesTextResponses
trait ParsesTextResponses
Traits
Methods
Decode a structured output payload, tolerating markdown code fences.
Join reasoning blocks, separating each block with a blank line.
Validate the Mistral response data.
Parse the Mistral response data into a single step response.
Extract the reasoning text from the thinking chunks of a message content value.
Extract the text from a message content value, which may be a list of content chunks.
Extract usage data from the response.
Extract and map the finish reason from the response.
Details
in
DecodesStructuredOutput at line 12
protected array
decodeStructuredOutput(string|null $text)
Decode a structured output payload, tolerating markdown code fences.
in
JoinsReasoning at line 16
static protected string
joinReasoning(iterable $blocks)
Join reasoning blocks, separating each block with a blank line.
at line 27
protected void
validateTextResponse(array $data)
Validate the Mistral response data.
at line 41
protected StepResponse
parseTextResponse(array $data, Provider $provider, bool $structured)
Parse the Mistral response data into a single step response.
at line 75
protected string
extractReasoning(mixed $content)
Extract the reasoning text from the thinking chunks of a message content value.
at line 90
protected string
extractContentText(mixed $content)
Extract the text from a message content value, which may be a list of content chunks.
at line 105
protected TextUsage
extractUsage(array $data)
Extract usage data from the response.
at line 119
protected FinishReason
extractFinishReason(array $choice)
Extract and map the finish reason from the response.