Documentation
¶
Overview ¶
Package call defines the tool call type used in LLM messages.
Index ¶
- Constants
- type Call
- func (c *Call) Complete(result string, resultTokens int)
- func (c Call) DisplayFull() (header, args string)
- func (c Call) DisplayHeader() string
- func (c Call) DisplayResult() string
- func (c *Call) Fail(err error, resultTokens int)
- func (c Call) ForLog() string
- func (c Call) ForTranscript() string
- func (c *Call) MarkRunning()
- func (c *Call) SetArgs(args map[string]any)
- type State
Constants ¶
const ( MaxArgsLen = 400 MaxResultLen = 400 )
Display length limits.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Call ¶
type Call struct {
// ID uniquely identifies this tool call (from LLM response).
ID string `json:"id"`
// Name is the tool function name.
Name string `json:"name"`
// Arguments contains the tool parameters (raw data for API calls).
Arguments map[string]any `json:"arguments,omitempty"`
// ArgumentsDisplay is the pre-formatted argument string for UI display.
ArgumentsDisplay string `json:"-"`
// Preview is the truncated tool result for UI display (not the full output).
Preview string `json:"-"`
// FullOutput stores the untruncated tool result for pager access.
FullOutput string `json:"-"`
// State indicates the current execution state.
State State `json:"-"`
// Error is set if State == Error.
Error error `json:"-"`
// ResultTokens is the rough token estimate of the full (untruncated) result.
ResultTokens int `json:"-"`
}
Call represents a tool invocation request from the LLM and its result.
func (*Call) Complete ¶
Complete marks the call as successfully completed with a truncated result. resultTokens is the pre-computed token estimate of the full result.
func (Call) DisplayFull ¶
DisplayFull returns the tool name header and arguments as separate strings, allowing callers to format them on separate lines.
func (Call) DisplayHeader ¶
DisplayHeader returns the tool call header for UI display (e.g. "[Tool: name] args").
func (Call) DisplayResult ¶
DisplayResult returns the formatted result or error string for UI display.
func (*Call) Fail ¶
Fail marks the call as failed with the given error. resultTokens is the pre-computed token estimate of the error message.
func (Call) ForTranscript ¶
ForTranscript returns a compact representation for compaction transcripts.
func (*Call) MarkRunning ¶
func (c *Call) MarkRunning()
MarkRunning marks the call as currently executing.