Documentation
¶
Overview ¶
Package proxy provides a ChatModel adapter that forwards LLM calls to a remote proxy server. The wire format ("frames") is bandwidth-optimized: frames carry only deltas, and the client reconstructs the full streaming message incrementally.
Index ¶
- type Frame
- type FrameType
- type Model
- func (p *Model) Generate(ctx context.Context, messages []agentcore.Message, tools []agentcore.ToolSpec, ...) (*agentcore.LLMResponse, error)
- func (p *Model) GenerateStream(ctx context.Context, messages []agentcore.Message, tools []agentcore.ToolSpec, ...) (<-chan agentcore.StreamEvent, error)
- func (p *Model) SupportsTools() bool
- type StreamFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Frame ¶
type Frame struct {
Type FrameType `json:"type"`
Delta string `json:"delta,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
ToolName string `json:"tool_name,omitempty"`
StopReason agentcore.StopReason `json:"stop_reason,omitempty"`
Usage *agentcore.Usage `json:"usage,omitempty"`
Err error `json:"-"`
}
Frame is a single bandwidth-optimized event from a remote proxy server.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model implements agentcore.ChatModel by forwarding to a proxy stream function. It reconstructs streaming events from incoming frames.
Usage:
m := proxy.New(myStreamFn) agent := agentcore.NewAgent(agentcore.WithModel(m))
func (*Model) Generate ¶
func (p *Model) Generate(ctx context.Context, messages []agentcore.Message, tools []agentcore.ToolSpec, opts ...agentcore.CallOption) (*agentcore.LLMResponse, error)
Generate collects the full streamed response synchronously.
func (*Model) GenerateStream ¶
func (p *Model) GenerateStream(ctx context.Context, messages []agentcore.Message, tools []agentcore.ToolSpec, opts ...agentcore.CallOption) (<-chan agentcore.StreamEvent, error)
GenerateStream converts proxy frames into standard StreamEvents.
func (*Model) SupportsTools ¶
SupportsTools reports that the proxy can handle tool calls.