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 OpenAI-compatible response data.
parseTextResponse(array $data, Provider $provider, bool $structured)
Parse a single OpenAI-compatible response into a StepResponse.
extractUsage(array $data)
Extract usage data from the response.
FinishReason
extractFinishReason(array $choice)
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.
at line 25
protected void
validateTextResponse(array $data)
Validate the OpenAI-compatible response data.
at line 39
protected StepResponse
parseTextResponse(array $data, Provider $provider, bool $structured)
Parse a single OpenAI-compatible response into a StepResponse.
at line 79
protected TextUsage
extractUsage(array $data)
Extract usage data from the response.
at line 94
protected FinishReason
extractFinishReason(array $choice)
Extract and map the finish reason from the response.