@@ -10,15 +10,34 @@ class ModelSettings:
10
10
11
11
This class holds optional model configuration parameters (e.g. temperature,
12
12
top_p, penalties, truncation, etc.).
13
+
14
+ Not all models/providers support all of these parameters, so please check the API documentation
15
+ for the specific model and provider you are using.
13
16
"""
14
17
15
18
temperature : float | None = None
19
+ """The temperature to use when calling the model."""
20
+
16
21
top_p : float | None = None
22
+ """The top_p to use when calling the model."""
23
+
17
24
frequency_penalty : float | None = None
25
+ """The frequency penalty to use when calling the model."""
26
+
18
27
presence_penalty : float | None = None
28
+ """The presence penalty to use when calling the model."""
29
+
19
30
tool_choice : Literal ["auto" , "required" , "none" ] | str | None = None
31
+ """The tool choice to use when calling the model."""
32
+
20
33
parallel_tool_calls : bool | None = False
34
+ """Whether to use parallel tool calls when calling the model."""
35
+
21
36
truncation : Literal ["auto" , "disabled" ] | None = None
37
+ """The truncation strategy to use when calling the model."""
38
+
39
+ max_tokens : int | None = None
40
+ """The maximum number of output tokens to generate."""
22
41
23
42
def resolve (self , override : ModelSettings | None ) -> ModelSettings :
24
43
"""Produce a new ModelSettings by overlaying any non-None values from the
@@ -33,4 +52,5 @@ def resolve(self, override: ModelSettings | None) -> ModelSettings:
33
52
tool_choice = override .tool_choice or self .tool_choice ,
34
53
parallel_tool_calls = override .parallel_tool_calls or self .parallel_tool_calls ,
35
54
truncation = override .truncation or self .truncation ,
55
+ max_tokens = override .max_tokens or self .max_tokens ,
36
56
)
0 commit comments