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
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 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 |
|
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.
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.