Model settings
ModelSettings
dataclass
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 documentation for the specific model and provider you are using.
Source code in src/agents/model_settings.py
temperature
class-attribute
instance-attribute
The temperature to use when calling the model.
top_p
class-attribute
instance-attribute
The top_p to use when calling the model.
frequency_penalty
class-attribute
instance-attribute
The frequency penalty to use when calling the model.
presence_penalty
class-attribute
instance-attribute
The presence penalty to use when calling the model.
tool_choice
class-attribute
instance-attribute
The tool choice to use when calling the model.
parallel_tool_calls
class-attribute
instance-attribute
Whether to use parallel tool calls when calling the model. Defaults to False if not provided.
truncation
class-attribute
instance-attribute
The truncation strategy to use when calling the model.
max_tokens
class-attribute
instance-attribute
The maximum number of output tokens to generate.
reasoning
class-attribute
instance-attribute
Configuration options for reasoning models.
metadata
class-attribute
instance-attribute
Metadata to include with the model response call.
store
class-attribute
instance-attribute
Whether to store the generated model response for later retrieval. Defaults to True if not provided.
include_usage
class-attribute
instance-attribute
Whether to include usage chunk. Defaults to True if not provided.
extra_query
class-attribute
instance-attribute
Additional query fields to provide with the request. Defaults to None if not provided.
extra_body
class-attribute
instance-attribute
Additional body fields to provide with the request. Defaults to None if not provided.
resolve
resolve(override: ModelSettings | None) -> ModelSettings
Produce a new ModelSettings by overlaying any non-None values from the override on top of this instance.