Documentation
¶
Overview ¶
Copyright 2026 Teradata
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Package message provides message types compatible with Crush's interface.
Index ¶
- type Attachment
- type BinaryContent
- type ContentPart
- type ContentText
- type Duration
- type FinishPart
- type FinishReason
- type Message
- func (m *Message) AddPart(part ContentPart)
- func (m Message) BinaryContent() []BinaryContent
- func (m Message) Content() ContentText
- func (m Message) FinishPart() *FinishPart
- func (m Message) IsFinished() bool
- func (m Message) IsSummaryMessage() bool
- func (m Message) IsThinking() bool
- func (m Message) Parts() []ContentPart
- func (m Message) ReasoningContent() ReasoningContent
- func (m Message) ThinkingDuration() Duration
- func (m Message) ToolCalls() []ToolCall
- func (m Message) ToolResults() []ToolResult
- type ReasoningContent
- type Role
- type Service
- type ToolCall
- type ToolResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment struct {
Type string
Name string
Path string
MimeType string
Data []byte
// Aliases for compatibility
FilePath string
FileName string
Content []byte
}
Attachment represents a file attachment.
type BinaryContent ¶
BinaryContent represents binary data in a message.
type ContentPart ¶
type ContentPart interface {
// contains filtered or unexported methods
}
ContentPart is a marker interface for content parts.
type ContentText ¶
type ContentText struct {
Text string
}
ContentText represents text content.
func (ContentText) String ¶
func (c ContentText) String() string
type FinishPart ¶
type FinishPart struct {
Reason FinishReason
Message string
Details string
Time int64
}
FinishPart represents the finish metadata.
type FinishReason ¶
type FinishReason string
FinishReason represents the reason a message finished.
const ( FinishReasonEndTurn FinishReason = "end_turn" FinishReasonCanceled FinishReason = "canceled" FinishReasonMaxTokens FinishReason = "max_tokens" FinishReasonError FinishReason = "error" )
type Message ¶
type Message struct {
ID string
SessionID string
Role Role
CreatedAt int64
Provider string // LLM provider
Model string // LLM model
// contains filtered or unexported fields
}
Message represents a chat message.
func NewMessage ¶
NewMessage creates a new message.
func (*Message) AddPart ¶
func (m *Message) AddPart(part ContentPart)
AddPart adds a content part to the message.
func (Message) BinaryContent ¶
func (m Message) BinaryContent() []BinaryContent
BinaryContent returns any binary content in the message.
func (Message) FinishPart ¶
func (m Message) FinishPart() *FinishPart
FinishPart returns the finish part if present.
func (Message) IsFinished ¶
IsFinished returns true if the message is finished.
func (Message) IsSummaryMessage ¶
IsSummaryMessage returns true if this is a summary message.
func (Message) IsThinking ¶
IsThinking returns true if the message is thinking.
func (Message) ReasoningContent ¶
func (m Message) ReasoningContent() ReasoningContent
ReasoningContent returns thinking content.
func (Message) ThinkingDuration ¶
ThinkingDuration returns the thinking duration.
func (Message) ToolResults ¶
func (m Message) ToolResults() []ToolResult
ToolResults returns tool results from the message.
type ReasoningContent ¶
type ReasoningContent struct {
Thinking string
StartedAt int64
EndedAt int64
FinishedAt int64 // Alias for EndedAt
}
ReasoningContent represents thinking content.
type Service ¶
type Service interface {
List(ctx context.Context, sessionID string) ([]Message, error)
Subscribe(ctx context.Context) <-chan pubsub.Event[Message]
}
Service defines the message service interface.