| 12345678910111213141516171819202122232425262728293031323334353637 |
- package chat
- import "encoding/json"
- // Message represents a chat message.
- // Role is typically: "system", "user", "assistant", "tool".
- // ToolCalls is used for assistant messages that request tool/function calls.
- // ReasoningContent optionally carries chain-of-thought style content for templates that support it.
- // Content is the visible message content.
- //
- // Note: We intentionally keep this struct generic and close to common chat template expectations.
- //
- //nolint:revive // exported API
- type Message struct {
- Role string `json:"role"`
- Content string `json:"content"`
- ReasoningContent string `json:"reasoning_content,omitempty"`
- ToolCalls []ToolCall `json:"tool_calls,omitempty"`
- }
- // ToolCall represents a single tool/function call requested by the assistant.
- // Arguments may be either a raw JSON object or a string (some models emit stringified JSON).
- //
- //nolint:revive // exported API
- type ToolCall struct {
- Name string `json:"name"`
- Arguments json.RawMessage `json:"arguments"`
- }
- // Options control chat template rendering.
- //
- //nolint:revive // exported API
- type Options struct {
- AddGenerationPrompt bool
- EnableThinking bool
- Tools []any
- }
|