Documentation
¶
Index ¶
- type ExtraContent
- type FunctionCall
- type GoogleExtra
- type LLMResponse
- type Message
- type Option
- type Provider
- func (p *Provider) Chat(ctx context.Context, messages []Message, tools []ToolDefinition, model string, ...) (*LLMResponse, error)
- func (p *Provider) ChatStream(ctx context.Context, messages []Message, tools []ToolDefinition, model string, ...) (*LLMResponse, error)
- func (p *Provider) ChatStreamEvents(ctx context.Context, messages []Message, tools []ToolDefinition, model string, ...) (*LLMResponse, error)
- func (p *Provider) GetDefaultModel() string
- func (p *Provider) SetProviderName(providerName string)
- func (p *Provider) SupportsNativeSearch() bool
- func (p *Provider) SupportsThinking() bool
- type ReasoningDetail
- type StreamChunk
- type ToolCall
- type ToolDefinition
- type ToolFunctionDefinition
- type UsageInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExtraContent ¶
type ExtraContent = protocoltypes.ExtraContent
type FunctionCall ¶
type FunctionCall = protocoltypes.FunctionCall
type GoogleExtra ¶
type GoogleExtra = protocoltypes.GoogleExtra
type LLMResponse ¶
type LLMResponse = protocoltypes.LLMResponse
type Message ¶
type Message = protocoltypes.Message
type Option ¶
type Option func(*Provider)
func WithExtraBody ¶
func WithMaxTokensField ¶
func WithProviderName ¶
func WithStreamedChat ¶
func WithStreamedChat() Option
WithStreamedChat makes Chat stream its request and return the answer the stream assembles, for an upstream whose streamed answer is complete where its plain one may not be.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is Compa's chat client: it shapes Chat Completions requests from the agent's messages, tools and options, and parses the answers, streamed or not, tool calls and reasoning included. It never addresses an upstream itself: its HTTP client's transport hands every request to the provider instance's llmgw-core provider (see coretransport), which owns the endpoint, the credential, the proxy and the vendor's wire.
func NewProvider ¶
NewProvider returns the chat client of an instance at endpoint, sending its requests with client, whose transport reaches the instance's core provider.
func (*Provider) Chat ¶
func (p *Provider) Chat( ctx context.Context, messages []Message, tools []ToolDefinition, model string, options map[string]any, ) (*LLMResponse, error)
func (*Provider) ChatStream ¶
func (p *Provider) ChatStream( ctx context.Context, messages []Message, tools []ToolDefinition, model string, options map[string]any, onChunk func(accumulated string), ) (*LLMResponse, error)
ChatStream implements streaming via OpenAI-compatible SSE (stream: true). onChunk receives the accumulated text so far on each text delta.
func (*Provider) ChatStreamEvents ¶
func (p *Provider) ChatStreamEvents( ctx context.Context, messages []Message, tools []ToolDefinition, model string, options map[string]any, onChunk func(StreamChunk), ) (*LLMResponse, error)
func (*Provider) GetDefaultModel ¶
GetDefaultModel returns "": every call names its model.
func (*Provider) SetProviderName ¶
func (*Provider) SupportsNativeSearch ¶
func (*Provider) SupportsThinking ¶
type ReasoningDetail ¶
type ReasoningDetail = protocoltypes.ReasoningDetail
type StreamChunk ¶
type StreamChunk = protocoltypes.StreamChunk
type ToolCall ¶
type ToolCall = protocoltypes.ToolCall
type ToolDefinition ¶
type ToolDefinition = protocoltypes.ToolDefinition
type ToolFunctionDefinition ¶
type ToolFunctionDefinition = protocoltypes.ToolFunctionDefinition
type UsageInfo ¶
type UsageInfo = protocoltypes.UsageInfo