Skip to content

Commit c2807d5

Browse files
Merge pull request #176 from askui/feat/configure-temperature
feat/configure temperature
2 parents b0e113f + 40feb91 commit c2807d5

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

src/askui/models/anthropic/messages_api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def create_message(
6464
system: str | list[BetaTextBlockParam] | Omit = omit,
6565
thinking: BetaThinkingConfigParam | Omit = omit,
6666
tool_choice: BetaToolChoiceParam | Omit = omit,
67+
temperature: float | Omit = omit,
6768
) -> MessageParam:
6869
_messages = [
6970
cast("BetaMessageParam", message.model_dump(exclude={"stop_reason"}))
@@ -78,6 +79,7 @@ def create_message(
7879
system=system,
7980
thinking=thinking,
8081
tool_choice=tool_choice,
82+
temperature=temperature,
8183
timeout=300.0,
8284
)
8385
return MessageParam.model_validate(response.model_dump())

src/askui/models/shared/agent.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def _step(
8686
system=settings.messages.system,
8787
thinking=settings.messages.thinking,
8888
tool_choice=settings.messages.tool_choice,
89+
temperature=settings.messages.temperature,
8990
)
9091
message_by_assistant = self._call_on_message(
9192
on_message, response_message, truncation_strategy.messages

src/askui/models/shared/messages_api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def create_message(
2626
system: str | list[BetaTextBlockParam] | Omit = omit,
2727
thinking: BetaThinkingConfigParam | Omit = omit,
2828
tool_choice: BetaToolChoiceParam | Omit = omit,
29+
temperature: float | Omit = omit,
2930
) -> MessageParam:
3031
"""Create a message using the Anthropic API.
3132
@@ -38,6 +39,7 @@ def create_message(
3839
system (str | list[BetaTextBlockParam] | Omit): The system to use.
3940
thinking (BetaThinkingConfigParam | Omit): The thinking to use.
4041
tool_choice (BetaToolChoiceParam | Omit): The tool choice to use.
42+
temperature (float | Omit): The temperature to use.
4143
4244
Returns:
4345
MessageParam: The created message.

src/askui/models/shared/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class MessageSettings(BaseModel):
1818
system: str | list[BetaTextBlockParam] | Omit = omit
1919
thinking: BetaThinkingConfigParam | Omit = omit
2020
tool_choice: BetaToolChoiceParam | Omit = omit
21+
temperature: float | Omit = Field(default=omit, ge=0.0, le=1.0)
2122

2223

2324
class ActSettings(BaseModel):

0 commit comments

Comments
 (0)