trait BuildsTextRequests

Methods

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 Chat Completions API.

array
applyTextOptions(array $body, Provider $provider, array $tools, array|null $schema, TextGenerationOptions|null $options)

Apply tools, schema, and generation options to a request body.

array
buildResponseFormat(array $schema, bool $strict)

Build the response format options for structured output.

Details

at line 19
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 Chat Completions API.

Parameters

Provider $provider
string $model
string|null $instructions
array $messages
array $tools
array|null $schema
TextGenerationOptions|null $options

Return Value

array

at line 39
protected array applyTextOptions(array $body, Provider $provider, array $tools, array|null $schema, TextGenerationOptions|null $options)

Apply tools, schema, and generation options to a request body.

Parameters

array $body
Provider $provider
array $tools
array|null $schema
TextGenerationOptions|null $options

Return Value

array

at line 82
protected array buildResponseFormat(array $schema, bool $strict)

Build the response format options for structured output.

Parameters

array $schema
bool $strict

Return Value

array