Model settings
ModelSettings
Settings to use when calling an LLM.
This class holds optional model configuration parameters (e.g. temperature,top_p, penalties, truncation, etc.).
Not all models/providers support all of these parameters, so please check the API documentationfor the specific model and provider you are using.
Source code insrc/agents/model_settings.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 | |
temperatureclass-attributeinstance-attribute
The temperature to use when calling the model.
frequency_penaltyclass-attributeinstance-attribute
The frequency penalty to use when calling the model.
presence_penaltyclass-attributeinstance-attribute
The presence penalty to use when calling the model.
tool_choiceclass-attributeinstance-attribute
The tool choice to use when calling the model.
parallel_tool_callsclass-attributeinstance-attribute
Controls whether the model can make multiple parallel tool calls in a single turn.If not provided (i.e., set to None), this behavior defers to the underlyingmodel provider's default. For most current providers (e.g., OpenAI), this typicallymeans parallel tool calls are enabled (True).Set to True to explicitly enable parallel tool calls, or False to restrict themodel to at most one tool call per turn.
truncationclass-attributeinstance-attribute
The truncation strategy to use when calling the model.SeeResponses API documentationfor more details.
max_tokensclass-attributeinstance-attribute
The maximum number of output tokens to generate.
reasoningclass-attributeinstance-attribute
Configuration options forreasoning models.
verbosityclass-attributeinstance-attribute
Constrains the verbosity of the model's response.
metadataclass-attributeinstance-attribute
Metadata to include with the model response call.
storeclass-attributeinstance-attribute
Whether to store the generated model response for later retrieval.For Responses API: automatically enabled when not specified.For Chat Completions API: disabled when not specified.
prompt_cache_retentionclass-attributeinstance-attribute
The retention policy for the prompt cache. Set to24h to enable extendedprompt caching, which keeps cached prefixes active for longer, up to a maximumof 24 hours.Learn more.
include_usageclass-attributeinstance-attribute
Whether to include usage chunk.Only available for Chat Completions API.
response_includeclass-attributeinstance-attribute
Additional output data to include in the model response.include parameter
top_logprobsclass-attributeinstance-attribute
Number of top tokens to return logprobs for. Setting this willautomatically include"message.output_text.logprobs" in the response.
extra_queryclass-attributeinstance-attribute
Additional query fields to provide with the request.Defaults to None if not provided.
extra_bodyclass-attributeinstance-attribute
Additional body fields to provide with the request.Defaults to None if not provided.
extra_headersclass-attributeinstance-attribute
Additional headers to provide with the request.Defaults to None if not provided.
extra_argsclass-attributeinstance-attribute
Arbitrary keyword arguments to pass to the model API call.These will be passed directly to the underlying model provider's API.Use with caution as not all models support all parameters.
resolve
resolve(override:ModelSettings|None)->ModelSettingsProduce a new ModelSettings by overlaying any non-None values from theoverride on top of this instance.