Documentation
¶
Index ¶
- func PromptWithTextAttachments(prompt string, attachments []Attachment) string
- type Attachment
- type BinaryContent
- type ContentPart
- type CreateMessageParams
- type Finish
- type FinishReason
- type ImageURLContent
- type Message
- func (m *Message) AddBinary(mimeType string, data []byte)
- func (m *Message) AddFinish(reason FinishReason, message, details string)
- func (m *Message) AddImageURL(url, detail string)
- func (m *Message) AddToolCall(tc ToolCall)
- func (m *Message) AddToolResult(tr ToolResult)
- func (m *Message) AppendContent(delta string)
- func (m *Message) AppendReasoningContent(delta string)
- func (m *Message) AppendReasoningSignature(signature string)
- func (m *Message) AppendThoughtSignature(signature string, toolCallID string)
- func (m *Message) AppendToolCallInput(toolCallID string, inputDelta string)
- func (m *Message) BinaryContent() []BinaryContent
- func (m *Message) Clone() Message
- func (m *Message) Content() TextContent
- func (m *Message) FinishPart() *Finish
- func (m *Message) FinishReason() FinishReason
- func (m *Message) FinishThinking()
- func (m *Message) FinishToolCall(toolCallID string)
- func (m *Message) ImageURLContent() []ImageURLContent
- func (m *Message) IsFinished() bool
- func (m *Message) IsThinking() bool
- func (m *Message) ReasoningContent() ReasoningContent
- func (m *Message) SetReasoningResponsesData(data *openai.ResponsesReasoningMetadata)
- func (m *Message) SetToolCalls(tc []ToolCall)
- func (m *Message) SetToolResults(tr []ToolResult)
- func (m *Message) ThinkingDuration() time.Duration
- func (m *Message) ToAIMessage() []fantasy.Message
- func (m *Message) ToolCalls() []ToolCall
- func (m *Message) ToolResults() []ToolResult
- type MessageRole
- type ReasoningContent
- type Service
- type TextContent
- type ToolCall
- type ToolResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PromptWithTextAttachments ¶
func PromptWithTextAttachments(prompt string, attachments []Attachment) string
Types ¶
type Attachment ¶
func NewTextAttachment ¶
func NewTextAttachment(filePath, content string) Attachment
func (Attachment) IsImage ¶
func (a Attachment) IsImage() bool
func (Attachment) IsText ¶
func (a Attachment) IsText() bool
type BinaryContent ¶
func (BinaryContent) String ¶
func (bc BinaryContent) String(p catwalk.InferenceProvider) string
type ContentPart ¶
type ContentPart interface {
// contains filtered or unexported methods
}
type CreateMessageParams ¶
type CreateMessageParams struct {
Role MessageRole
Parts []ContentPart
Model string
Provider string
IsSummaryMessage bool
}
type Finish ¶
type Finish struct {
Reason FinishReason `json:"reason"`
Time int64 `json:"time"`
Message string `json:"message,omitempty"`
Details string `json:"details,omitempty"`
}
type FinishReason ¶
type FinishReason string
const ( FinishReasonEndTurn FinishReason = "end_turn" FinishReasonMaxTokens FinishReason = "max_tokens" FinishReasonToolUse FinishReason = "tool_use" FinishReasonCanceled FinishReason = "canceled" FinishReasonError FinishReason = "error" FinishReasonPermissionDenied FinishReason = "permission_denied" // Should never happen FinishReasonUnknown FinishReason = "unknown" )
type ImageURLContent ¶
func (ImageURLContent) String ¶
func (iuc ImageURLContent) String() string
type Message ¶
type Message struct {
ID string
Role MessageRole
SessionID string
Parts []ContentPart
Model string
Provider string
CreatedAt int64
UpdatedAt int64
IsSummaryMessage bool
}
func (*Message) AddFinish ¶
func (m *Message) AddFinish(reason FinishReason, message, details string)
func (*Message) AddImageURL ¶
func (*Message) AddToolCall ¶
func (*Message) AddToolResult ¶
func (m *Message) AddToolResult(tr ToolResult)
func (*Message) AppendContent ¶
func (*Message) AppendReasoningContent ¶
func (*Message) AppendReasoningSignature ¶
func (*Message) AppendThoughtSignature ¶
func (*Message) AppendToolCallInput ¶
func (*Message) BinaryContent ¶
func (m *Message) BinaryContent() []BinaryContent
func (*Message) Clone ¶
Clone returns a deep copy of the message with an independent Parts slice. This prevents race conditions when the message is modified concurrently.
func (*Message) Content ¶
func (m *Message) Content() TextContent
func (*Message) FinishPart ¶
func (*Message) FinishReason ¶
func (m *Message) FinishReason() FinishReason
func (*Message) FinishThinking ¶
func (m *Message) FinishThinking()
func (*Message) FinishToolCall ¶
func (*Message) ImageURLContent ¶
func (m *Message) ImageURLContent() []ImageURLContent
func (*Message) IsFinished ¶
func (*Message) IsThinking ¶
func (*Message) ReasoningContent ¶
func (m *Message) ReasoningContent() ReasoningContent
func (*Message) SetReasoningResponsesData ¶
func (m *Message) SetReasoningResponsesData(data *openai.ResponsesReasoningMetadata)
func (*Message) SetToolCalls ¶
func (*Message) SetToolResults ¶
func (m *Message) SetToolResults(tr []ToolResult)
func (*Message) ThinkingDuration ¶
func (*Message) ToAIMessage ¶
func (*Message) ToolResults ¶
func (m *Message) ToolResults() []ToolResult
type MessageRole ¶
type MessageRole string
const ( Assistant MessageRole = "assistant" User MessageRole = "user" System MessageRole = "system" Tool MessageRole = "tool" )
type ReasoningContent ¶
type ReasoningContent struct {
Thinking string `json:"thinking"`
Signature string `json:"signature"`
ThoughtSignature string `json:"thought_signature"` // Used for google
ToolID string `json:"tool_id"` // Used for openrouter google models
ResponsesData *openai.ResponsesReasoningMetadata `json:"responses_data"`
StartedAt int64 `json:"started_at,omitempty"`
FinishedAt int64 `json:"finished_at,omitempty"`
}
func (ReasoningContent) String ¶
func (tc ReasoningContent) String() string
type Service ¶
type Service interface {
pubsub.Subscriber[Message]
Create(ctx context.Context, sessionID string, params CreateMessageParams) (Message, error)
Update(ctx context.Context, message Message) error
Get(ctx context.Context, id string) (Message, error)
List(ctx context.Context, sessionID string) ([]Message, error)
Delete(ctx context.Context, id string) error
DeleteSessionMessages(ctx context.Context, sessionID string) error
}
func NewService ¶
type TextContent ¶
type TextContent struct {
Text string `json:"text"`
}
func (TextContent) String ¶
func (tc TextContent) String() string
Click to show internal directories.
Click to hide internal directories.