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
49 50 51 52 53 54 55 56 57 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 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
|
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
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 underlying model provider's default. For most current providers (e.g., OpenAI), this typically means parallel tool calls are enabled (True). Set to True to explicitly enable parallel tool calls, or False to restrict the model to at most one tool call per turn.
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.
response_include
class-attribute
instance-attribute
Additional output data to include in the model response. include parameter
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.
extra_headers
class-attribute
instance-attribute
Additional headers to provide with the request. Defaults to None if not provided.
extra_args
class-attribute
instance-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) -> ModelSettings
Produce a new ModelSettings by overlaying any non-None values from the override on top of this instance.