Documentation
¶
Overview ¶
Package event defines the persisted session event representation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
EventID int64 `json:"event_id" db:"event_id"`
SessionID string `json:"session_id" db:"session_id"`
TurnID string `json:"turn_id" db:"turn_id"`
Author string `json:"author" db:"author"`
Role string `json:"role" db:"role"`
Content string `json:"content" db:"text"`
Parts Parts `json:"parts" db:"parts"`
ReasoningContent string `json:"reasoning_content" db:"reasoning_text"`
ToolCalls ToolCalls `json:"tool_calls" db:"tool_calls"`
ToolResponse ToolResponse `json:"tool_response" db:"tool_result"`
ToolCallID string `json:"tool_call_id" db:"tool_call_id"`
FinishReason string `json:"finish_reason" db:"finish_reason"`
PromptTokens int64 `json:"prompt_tokens" db:"prompt_tokens"`
CompletionTokens int64 `json:"completion_tokens" db:"completion_tokens"`
TotalTokens int64 `json:"total_tokens" db:"total_tokens"`
UsageDetails UsageDetails `json:"usage_details" db:"usage_details"`
CreatedAt int64 `json:"created_at" db:"created_at"`
UpdatedAt int64 `json:"updated_at" db:"updated_at"`
// ArchivedAt is set when the event has been archived. A non-zero value means
// the event is no longer part of the active history.
ArchivedAt int64 `json:"archived_at" db:"archived_at"`
DeletedAt int64 `json:"deleted_at" db:"deleted_at"`
}
Event represents a persisted conversation event.
type Parts ¶
type Parts []model.ContentPart
Parts is a slice of ContentPart that serializes to/from JSON for database storage.
type ToolCall ¶
type ToolCall struct {
// ID is the unique identifier of this tool call, matching model.ToolCall.ID.
ID string `json:"id" db:"id"`
Name string `json:"name" db:"name"`
Arguments json.RawMessage `json:"arguments" db:"arguments"`
// ThoughtSignature is provider-supplied opaque state that must survive
// history persistence for subsequent Gemini tool-call turns.
ThoughtSignature []byte `json:"thought_signature,omitempty" db:"thought_signature"`
}
ToolCall represents a persisted tool call within an assistant event.
func (*ToolCall) UnmarshalJSON ¶ added in v0.0.7
UnmarshalJSON accepts both the current raw JSON argument value and the older JSON-string representation used by pre-structured tool calls.
type ToolCalls ¶
type ToolCalls []ToolCall
ToolCalls is a slice of ToolCall that serializes to/from JSON for database storage.
type ToolResponse ¶ added in v0.0.12
type ToolResponse struct {
ToolCallID string `json:"tool_call_id"`
Name string `json:"name,omitempty"`
Result *tool.Result `json:"result,omitempty"`
Error *tool.HandledError `json:"error,omitempty"`
}
ToolResponse is a persisted tool response within a tool event.
func (*ToolResponse) Scan ¶ added in v0.0.12
func (tr *ToolResponse) Scan(src any) error
Scan implements sql.Scanner so ToolResponse can be read from a JSON string. It accepts the legacy flat shape containing is_error for history compatibility.
type UsageDetails ¶ added in v0.0.9
type UsageDetails model.TokenUsageDetails
UsageDetails serializes model.TokenUsageDetails to/from JSON for database storage.
func (*UsageDetails) Scan ¶ added in v0.0.9
func (d *UsageDetails) Scan(src any) error
Scan implements sql.Scanner so UsageDetails can be read from a JSON string.