trait BuildsTextRequests

Traits

Methods

string|null
composeInstructions(string|null $instructions, array|null $schema)

Add structured output requirements to the instructions.

array
buildStepBody(Provider $provider, string $model, string|null $instructions, array $messages, array $tools, array|null $schema, TextGenerationOptions|null $options, StepContext $stepContext)

Build the request body for the current text generation step.

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
buildResponseFormat()

Build the response format options for structured output.

Details

protected string|null composeInstructions(string|null $instructions, array|null $schema)

Add structured output requirements to the instructions.

Parameters

string|null $instructions
array|null $schema

Return Value

string|null

at line 21
protected array buildStepBody(Provider $provider, string $model, string|null $instructions, array $messages, array $tools, array|null $schema, TextGenerationOptions|null $options, StepContext $stepContext)

Build the request body for the current text generation step.

Parameters

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

Return Value

array

at line 37
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 90
protected array buildResponseFormat()

Build the response format options for structured output.

Return Value

array