BuildsTextRequests
trait BuildsTextRequests
Methods
Build the request body for the OpenAI Responses API.
Build the request body for a stateful Responses API continuation.
Extract the latest tool results for a stateful continuation request.
Merge shared Responses API options onto the given request body.
Determine if OpenAI should receive full stateless conversation history.
Determine if the model supports encrypted reasoning content.
Build the text format options for structured output.
Details
at line 21
protected array
buildTextRequestBody(Provider $provider, string $model, string|null $instructions, array $messages, array $tools, array|null $schema, TextGenerationOptions|null $options)
Build the request body for the OpenAI Responses API.
at line 41
protected array
buildContinuationBody(Provider $provider, string $model, string $continuationToken, array $messages, array $tools, array|null $schema, TextGenerationOptions|null $options = null)
Build the request body for a stateful Responses API continuation.
at line 62
protected array
extractToolResultsInput(array $messages)
Extract the latest tool results for a stateful continuation request.
at line 82
protected array
mergeSharedResponsesRequestOptions(array $body, array $tools, array|null $schema, TextGenerationOptions|null $options, Provider $provider)
Merge shared Responses API options onto the given request body.
at line 142
protected string|array
mapToolChoice(ToolChoice $choice)
Map a tool choice to the OpenAI Responses tool_choice shape.
at line 156
protected bool
isStateless(Provider $provider)
Determine if OpenAI should receive full stateless conversation history.
at line 168
protected bool
isReasoningModel(string $model)
Determine if the model supports encrypted reasoning content.
at line 180
protected array
buildSchemaFormat(array $schema, bool $strict)
Build the text format options for structured output.