Documentation
¶
Index ¶
- Variables
- type FallbackGateway
- func (g *FallbackGateway) Chat(ctx context.Context, profile string, req llm.ChatRequest) (llm.ChatResponse, error)
- func (g *FallbackGateway) ChatWithTools(ctx context.Context, profile string, req llm.ToolCallRequest) (llm.ToolCallResponse, error)
- func (g *FallbackGateway) StructuredChat(ctx context.Context, profile string, schema json.RawMessage, ...) (json.RawMessage, error)
- type Gateway
- func (g *Gateway) Chat(ctx context.Context, profile string, req llm.ChatRequest) (llm.ChatResponse, error)
- func (g *Gateway) ChatWithTools(ctx context.Context, profile string, req llm.ToolCallRequest) (llm.ToolCallResponse, error)
- func (g *Gateway) Embed(ctx context.Context, profile string, input []string) ([][]float32, error)
- func (g *Gateway) QueueChat(profile string, response llm.ChatResponse)
- func (g *Gateway) QueueEmbedding(profile string, response [][]float32)
- func (g *Gateway) QueueStructured(profile string, response json.RawMessage)
- func (g *Gateway) QueueToolCall(profile string, response llm.ToolCallResponse)
- func (g *Gateway) SetCapabilities(profile string, caps ...llm.Capability)
- func (g *Gateway) StreamChat(ctx context.Context, profile string, req llm.ChatRequest) (<-chan llm.ChatChunk, error)
- func (g *Gateway) StructuredChat(ctx context.Context, profile string, schema json.RawMessage, ...) (json.RawMessage, error)
- func (g *Gateway) Supports(profile string, cap llm.Capability) bool
- func (g *Gateway) ToolRequests(profile string) []llm.ToolCallRequest
Constants ¶
This section is empty.
Variables ¶
var ErrNoResponse = errors.New("mock llm: no response queued")
ErrNoResponse indicates the mock gateway has no queued response for a profile.
Functions ¶
This section is empty.
Types ¶
type FallbackGateway ¶
type FallbackGateway struct {
*Gateway
}
FallbackGateway wraps a mock gateway and returns a deterministic assistant reply when no queued response is available. This makes local development usable without manually seeding mock responses.
func NewFallbackGateway ¶
func NewFallbackGateway() *FallbackGateway
NewFallbackGateway creates a mock gateway with echo-style fallbacks.
func (*FallbackGateway) Chat ¶
func (g *FallbackGateway) Chat(ctx context.Context, profile string, req llm.ChatRequest) (llm.ChatResponse, error)
func (*FallbackGateway) ChatWithTools ¶
func (g *FallbackGateway) ChatWithTools(ctx context.Context, profile string, req llm.ToolCallRequest) (llm.ToolCallResponse, error)
func (*FallbackGateway) StructuredChat ¶
func (g *FallbackGateway) StructuredChat(ctx context.Context, profile string, schema json.RawMessage, req llm.ChatRequest) (json.RawMessage, error)
type Gateway ¶
type Gateway struct {
// contains filtered or unexported fields
}
Gateway is a test double for llm.Gateway with queued responses.
func NewGateway ¶
func NewGateway() *Gateway
NewGateway creates a mock LLM gateway for tests and local development.
func (*Gateway) Chat ¶
func (g *Gateway) Chat(ctx context.Context, profile string, req llm.ChatRequest) (llm.ChatResponse, error)
Chat returns the next queued chat response for a profile.
func (*Gateway) ChatWithTools ¶
func (g *Gateway) ChatWithTools(ctx context.Context, profile string, req llm.ToolCallRequest) (llm.ToolCallResponse, error)
ChatWithTools returns the next queued tool-call response for a profile.
func (*Gateway) QueueChat ¶
func (g *Gateway) QueueChat(profile string, response llm.ChatResponse)
QueueChat appends a chat response for a profile.
func (*Gateway) QueueEmbedding ¶
QueueEmbedding appends an embedding response for a profile.
func (*Gateway) QueueStructured ¶
func (g *Gateway) QueueStructured(profile string, response json.RawMessage)
QueueStructured appends a structured response for a profile.
func (*Gateway) QueueToolCall ¶
func (g *Gateway) QueueToolCall(profile string, response llm.ToolCallResponse)
QueueToolCall appends a tool-call response for a profile.
func (*Gateway) SetCapabilities ¶
func (g *Gateway) SetCapabilities(profile string, caps ...llm.Capability)
SetCapabilities registers supported capabilities for a profile.
func (*Gateway) StreamChat ¶
func (g *Gateway) StreamChat(ctx context.Context, profile string, req llm.ChatRequest) (<-chan llm.ChatChunk, error)
StreamChat streams a single chunk from the queued chat response.
func (*Gateway) StructuredChat ¶
func (g *Gateway) StructuredChat(ctx context.Context, profile string, schema json.RawMessage, req llm.ChatRequest) (json.RawMessage, error)
StructuredChat returns the next queued structured response for a profile.
func (*Gateway) Supports ¶
func (g *Gateway) Supports(profile string, cap llm.Capability) bool
Supports reports whether a profile supports a capability.
func (*Gateway) ToolRequests ¶
func (g *Gateway) ToolRequests(profile string) []llm.ToolCallRequest
ToolRequests returns tool-call requests recorded for a profile.