trait BuildsTextRequests

Traits

Methods

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

Add structured output requirements to the instructions.

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

string|null
mapCohereToolChoice(ToolChoice $choice)

Map a tool choice to the Cohere tool_choice value.

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 22
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 Cohere Chat API.

Parameters

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

Return Value

array

at line 91
protected string|null mapCohereToolChoice(ToolChoice $choice)

Map a tool choice to the Cohere tool_choice value.

Parameters

ToolChoice $choice

Return Value

string|null