class TextGenerationOptions

Properties

array<int, object|string> $middleware

Methods

__construct(int|null $maxSteps = null, int|null $maxTokens = null, float|null $temperature = null, Agent|null $agent = null, float|null $topP = null, ToolChoice|null $toolChoice = null, CacheInstructions|null $cacheInstructions = null, CacheToolDefinitions|null $cacheToolDefinitions = null, array|null $providerOptions = null, array $middleware = [])

Create text generation options.

array|null
providerOptions(Lab|string $provider)

Get the provider-specific options for the given provider.

withToolChoice(ToolChoice|null $toolChoice)

Create a copy using a different tool choice.

withMaxTokens(int|null $maxTokens)

Create a copy using a different maximum token count.

withProviderOptions(array|null $providerOptions)

Create a copy using different provider options.

withMiddleware(array $middleware)

Create a copy using the given runtime middleware.

with(array $overrides)

Create a copy with the given property overrides.

forStep(int $stepNumber)

Resolve the options for the given step, releasing a forced tool choice after the first step so the model can answer.

forAgent(Agent $agent)

Create a new TextGenerationOptions instance for the given agent.

Details

at line 32
__construct(int|null $maxSteps = null, int|null $maxTokens = null, float|null $temperature = null, Agent|null $agent = null, float|null $topP = null, ToolChoice|null $toolChoice = null, CacheInstructions|null $cacheInstructions = null, CacheToolDefinitions|null $cacheToolDefinitions = null, array|null $providerOptions = null, array $middleware = [])

Create text generation options.

Parameters

int|null $maxSteps
int|null $maxTokens
float|null $temperature
Agent|null $agent
float|null $topP
ToolChoice|null $toolChoice
CacheInstructions|null $cacheInstructions
CacheToolDefinitions|null $cacheToolDefinitions
array|null $providerOptions
array $middleware

at line 58
array|null providerOptions(Lab|string $provider)

Get the provider-specific options for the given provider.

Parameters

Lab|string $provider

Return Value

array|null

at line 76
TextGenerationOptions withToolChoice(ToolChoice|null $toolChoice)

Create a copy using a different tool choice.

Parameters

ToolChoice|null $toolChoice

Return Value

TextGenerationOptions

at line 84
TextGenerationOptions withMaxTokens(int|null $maxTokens)

Create a copy using a different maximum token count.

Parameters

int|null $maxTokens

Return Value

TextGenerationOptions

at line 94
TextGenerationOptions withProviderOptions(array|null $providerOptions)

Create a copy using different provider options.

Parameters

array|null $providerOptions

Return Value

TextGenerationOptions

at line 104
TextGenerationOptions withMiddleware(array $middleware)

Create a copy using the given runtime middleware.

Parameters

array $middleware

Return Value

TextGenerationOptions

at line 114
protected TextGenerationOptions with(array $overrides)

Create a copy with the given property overrides.

Parameters

array $overrides

Return Value

TextGenerationOptions

at line 122
TextGenerationOptions forStep(int $stepNumber)

Resolve the options for the given step, releasing a forced tool choice after the first step so the model can answer.

Parameters

int $stepNumber

Return Value

TextGenerationOptions

at line 138
static TextGenerationOptions forAgent(Agent $agent)

Create a new TextGenerationOptions instance for the given agent.

Parameters

Agent $agent

Return Value

TextGenerationOptions