Documentation
¶
Index ¶
- func MakeContentKey(content string) string
- func NormalizeContent(s string) string
- func ToolResultLLMMessages(msg *Message) []llm.Message
- type Attachment
- type Binding
- type Document
- type Documents
- type Elicitation
- type Flags
- type History
- type Kind
- type Message
- type MessageKind
- type Meta
- type Persona
- type Prompt
- type Task
- type Tools
- type Trace
- type Turn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeContentKey ¶
MakeContentKey builds a stable key for text contents by hashing normalized content.
func NormalizeContent ¶
NormalizeContent trims whitespace and, if content is valid JSON, returns its minified canonical form.
func ToolResultLLMMessages ¶
Types ¶
type Attachment ¶
type Attachment struct {
Name string `yaml:"name,omitempty" json:"name,omitempty"`
URI string `yaml:"uri,omitempty" json:"uri,omitempty"`
StagingFolder string `yaml:"stagingFolder,omitempty" json:"stagingFolder,omitempty"`
Mime string `yaml:"mime,omitempty" json:"mime,omitempty"`
Content string `yaml:"content,omitempty" json:"content,omitempty"`
Data []byte `yaml:"data,omitempty" json:"data,omitempty"`
}
func (*Attachment) MIMEType ¶
func (a *Attachment) MIMEType() string
func (*Attachment) Type ¶
func (a *Attachment) Type() string
type Binding ¶
type Binding struct {
Task Task `yaml:"task" json:"task"`
Model string `yaml:"model,omitempty" json:"model,omitempty"`
Persona Persona `yaml:"persona,omitempty" json:"persona,omitempty"`
History History `yaml:"history,omitempty" json:"history,omitempty"`
Tools Tools `yaml:"tools,omitempty" json:"tools,omitempty"`
Meta Meta `yaml:"meta,omitempty" json:"meta,omitempty"`
SystemDocuments Documents `yaml:"systemDocuments,omitempty" json:"systemDocuments,omitempty"`
Documents Documents `yaml:"documents,omitempty" json:"documents,omitempty"`
Flags Flags `yaml:"flags,omitempty" json:"flags,omitempty"`
Context map[string]interface{} `yaml:"context,omitempty" json:"context,omitempty"`
// Elicitation contains a generic, prompt-friendly view of agent-required inputs
// so templates can instruct the LLM to elicit missing data when necessary.
Elicitation Elicitation `yaml:"elicitation,omitempty" json:"elicitation,omitempty"`
}
func (*Binding) ContextJSON ¶
ContextJSON returns a stable JSON rendering of binding context for prompts. Templates should prefer this over printing the raw map to avoid Go's map[...] format.
func (*Binding) SystemBinding ¶
type Document ¶
type Document struct {
Title string `yaml:"title,omitempty" json:"title,omitempty"`
PageContent string `yaml:"pageContent,omitempty" json:"pageContent,omitempty"`
SourceURI string `yaml:"sourceURI,omitempty" json:"sourceURI,omitempty"`
Score float64 `yaml:"score,omitempty" json:"score,omitempty"`
MimeType string `yaml:"mimeType,omitempty" json:"mimeType,omitempty"`
Metadata map[string]string `yaml:"metadata,omitempty" json:"metadata,omitempty"`
}
type Documents ¶
type Documents struct {
Items []*Document `yaml:"items,omitempty" json:"items,omitempty"`
}
type Elicitation ¶
type Elicitation struct {
Required bool `yaml:"required,omitempty" json:"required,omitempty"`
Missing []string `yaml:"missing,omitempty" json:"missing,omitempty"`
Message string `yaml:"message,omitempty" json:"message,omitempty"`
Schema map[string]interface{} `yaml:"schema,omitempty" json:"schema,omitempty"`
// SchemaJSON is a pre-serialized JSON of Schema for templates without JSON helpers
SchemaJSON string `yaml:"schemaJSON,omitempty" json:"schemaJSON,omitempty"`
}
Elicitation is a generic holder for required-input prompts used by templates. It intentionally avoids coupling to agent plan types.
type Flags ¶
type Flags struct {
CanUseTool bool `yaml:"canUseTool,omitempty" json:"canUseTool,omitempty"`
CanStream bool `yaml:"canStream,omitempty" json:"canStream,omitempty"`
IsMultimodal bool `yaml:"isMultimodal,omitempty" json:"isMultimodal,omitempty"`
IsSystem bool `yaml:"isSystemPath,omitempty" json:"isSystemPath,omitempty"`
// HasMessageOverflow indicates that a message content (tool result or otherwise)
// exceeded the preview limit and the binding may expose message helpers.
HasMessageOverflow bool `yaml:"hasMessageOverflow,omitempty" json:"hasMessageOverflow,omitempty"`
// MaxOverflowBytes records the maximum original byte size of any
// message that triggered overflow in this binding (history or tool
// results). When zero, no size information was recorded.
MaxOverflowBytes int `yaml:"maxOverflowBytes,omitempty" json:"maxOverflowBytes,omitempty"`
}
type History ¶
type History struct {
// Past contains committed conversation turns in chronological order.
Past []*Turn `yaml:"past,omitempty" json:"past,omitempty"`
// Current holds the in-flight turn for the ongoing request
// (React loop step). It is intentionally separated from Past
// so we can distinguish persisted history from the current
// LLM call context.
Current *Turn `yaml:"current,omitempty" json:"current,omitempty"`
// CurrentTurnID, when non-empty, carries the id of the in-flight
// turn associated with the Current messages. It is typically
// aligned with memory.TurnMeta.TurnID and is provided for
// observability and explicitness; Past remains the committed
// transcript.
CurrentTurnID string `yaml:"currentTurnID,omitempty" json:"currentTurnID,omitempty"`
// Messages is a legacy flat view of persisted history kept for
// template compatibility and internal tooling. New code should
// prefer Past/Current and helper methods.
Messages []*Message `yaml:"messages,omitempty" json:"messages,omitempty"`
LastResponse *Trace `yaml:"lastResponse,omitempty" json:"lastResponse,omitempty"`
Traces map[string]*Trace `yaml:"traces,omitempty" json:"traces,omitempty"`
ToolExposure string
}
func (*History) LLMMessages ¶
LLMMessages flattens history turns into a chronological slice of llm.Messages. When Past/Current are present, they are used as the source; otherwise the legacy flat Messages field is used.
type Message ¶
type Message struct {
Kind MessageKind `yaml:"kind,omitempty" json:"kind,omitempty"`
Role string `yaml:"role,omitempty" json:"role,omitempty"`
MimeType string `yaml:"mimeType,omitempty" json:"mimeType,omitempty"`
Content string `yaml:"content,omitempty" json:"content,omitempty"`
Attachment []*Attachment `yaml:"attachment,omitempty" json:"attachment,omitempty"`
CreatedAt time.Time `yaml:"createdAt,omitempty" json:"createdAt,omitempty"`
ID string `yaml:"id,omitempty" json:"id,omitempty"`
// Optional tool metadata for tool result messages.
ToolOpID string `yaml:"toolOpId,omitempty" json:"toolOpId,omitempty"`
ToolName string `yaml:"toolName,omitempty" json:"toolName,omitempty"`
ToolArgs map[string]interface{} `yaml:"toolArgs,omitempty" json:"toolArgs,omitempty"`
ToolTraceID string `yaml:"toolTraceId,omitempty" json:"toolTraceId,omitempty"`
}
type MessageKind ¶
type MessageKind string
MessageKind classifies high-level message semantics in history for LLM binding purposes.
const ( MessageKindChatUser MessageKind = "chat_user" MessageKindChatAssistant MessageKind = "chat_assistant" MessageKindToolResult MessageKind = "tool_result" MessageKindElicitPrompt MessageKind = "elicit_prompt" MessageKindElicitAnswer MessageKind = "elicit_answer" )
type Prompt ¶
type Prompt struct {
Text string `yaml:"text,omitempty" json:"text,omitempty"`
URI string `yaml:"uri,omitempty" json:"uri,omitempty"`
Engine string `yaml:"engine,omitempty" json:"engine,omitempty"`
// contains filtered or unexported fields
}
type Task ¶
type Task struct {
Prompt string `yaml:"prompt,omitempty" json:"prompt,omitempty"`
Attachments []*Attachment `yaml:"attachments,omitempty" json:"attachments,omitempty"`
}
type Tools ¶
type Tools struct {
Signatures []*llm.ToolDefinition `yaml:"signatures,omitempty" json:"signatures,omitempty"`
}