Skip to content

types

ChatRequest dataclass

A request for chat completion.

Attributes:

Name Type Description
messages list[Message]

The list of messages in the conversation.

model Optional[str]

The model to use for completion.

temperature float

Sampling temperature for response generation.

max_tokens Optional[int]

Maximum tokens to generate in the response.

tools Optional[Sequence[ToolSpec]]

Tools available for the LLM to call.

tool_choice Literal['auto', 'none', 'required']

Tool calling behavior.

response_format Literal['text', 'json']

Desired response format.

stream bool

Whether to stream the response.

task_tag Optional[str]

Optional tag for tracking the request.

Source code in wintermute/ai/types.py
 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
@dataclass(frozen=True)
class ChatRequest:
    """A request for chat completion.

    Attributes:
        messages (list[Message]): The list of messages in the conversation.
        model (Optional[str]): The model to use for completion.
        temperature (float): Sampling temperature for response generation.
        max_tokens (Optional[int]): Maximum tokens to generate in the response.
        tools (Optional[Sequence[ToolSpec]]): Tools available for the LLM to call.
        tool_choice (Literal["auto", "none", "required"]): Tool calling behavior.
        response_format (Literal["text", "json"]): Desired response format.
        stream (bool): Whether to stream the response.
        task_tag (Optional[str]): Optional tag for tracking the request.
    """

    messages: list[Message]
    model: Optional[str] = None
    temperature: float = 0.2
    max_tokens: Optional[int] = None
    tools: Optional[Sequence[ToolSpec]] = None
    tool_choice: Literal["auto", "none", "required"] = "auto"
    response_format: Literal["text", "json"] = "text"
    stream: bool = False
    task_tag: Optional[str] = None

ChatResponse dataclass

A response from a chat completion.

Attributes:

Name Type Description
content str

The content of the response.

tool_calls Optional[list[ToolCall]]

List of tool calls made by the LLM.

model Optional[str]

The model used for the response.

provider Optional[str]

The provider of the model.

prompt_tokens Optional[int]

Number of tokens in the prompt.

completion_tokens Optional[int]

Number of tokens in the completion.

latency_ms Optional[int]

Latency of the request in milliseconds.

Source code in wintermute/ai/types.py
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
@dataclass(frozen=True)
class ChatResponse:
    """A response from a chat completion.

    Attributes:
        content (str): The content of the response.
        tool_calls (Optional[list[ToolCall]]): List of tool calls made by the LLM.
        model (Optional[str]): The model used for the response.
        provider (Optional[str]): The provider of the model.
        prompt_tokens (Optional[int]): Number of tokens in the prompt.
        completion_tokens (Optional[int]): Number of tokens in the completion.
        latency_ms (Optional[int]): Latency of the request in milliseconds.
    """

    content: str
    tool_calls: Optional[list[ToolCall]] = None
    model: Optional[str] = None
    provider: Optional[str] = None
    prompt_tokens: Optional[int] = None
    completion_tokens: Optional[int] = None
    latency_ms: Optional[int] = None

Message dataclass

A message in a chat conversation.

Attributes:

Name Type Description
role Role

The role of the message sender.

content str

The content of the message.

tool_name Optional[str]

Name of the tool if role is "tool".

tool_call_id Optional[str]

ID of the tool call if role is "tool".

Source code in wintermute/ai/types.py
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
@dataclass(frozen=True)
class Message:
    """A message in a chat conversation.

    Attributes:
        role (Role): The role of the message sender.
        content (str): The content of the message.
        tool_name (Optional[str]): Name of the tool if role is "tool".
        tool_call_id (Optional[str]): ID of the tool call if role is "tool".
    """

    role: Role
    content: str
    tool_name: Optional[str] = None
    tool_call_id: Optional[str] = None

ToolCall dataclass

A tool call made by the LLM during chat completion.

Attributes:

Name Type Description
id str

Unique identifier for the tool call.

name str

Name of the tool being called.

arguments JSONObject

The arguments passed to the tool as a JSON object.

Source code in wintermute/ai/types.py
71
72
73
74
75
76
77
78
79
80
81
82
83
@dataclass(frozen=True)
class ToolCall:
    """A tool call made by the LLM during chat completion.

    Attributes:
        id (str): Unique identifier for the tool call.
        name (str): Name of the tool being called.
        arguments (JSONObject): The arguments passed to the tool as a JSON object.
    """

    id: str
    name: str
    arguments: JSONObject  # parsed JSON args

ToolSpec dataclass

Specification for a tool that can be called by the LLM.

Attributes:

Name Type Description
name str

Name of the tool.

description str

Description of the tool's purpose.

input_schema JSONObject

JSON schema defining the tool's input.

output_schema Optional[JSONObject]

Optional JSON schema for the tool's output.

Source code in wintermute/ai/types.py
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
@dataclass(frozen=True)
class ToolSpec:
    """Specification for a tool that can be called by the LLM.

    Attributes:
        name (str): Name of the tool.
        description (str): Description of the tool's purpose.
        input_schema (JSONObject): JSON schema defining the tool's input.
        output_schema (Optional[JSONObject]): Optional JSON schema for the tool's output.
    """

    name: str
    description: str
    input_schema: JSONObject
    # Optional: you can validate model's JSON outputs against this if you want
    output_schema: Optional[JSONObject] = None