Documentation
¶
Overview ¶
Package provider defines the Provider interface, the contract between the core loop and concrete LLM provider adapters.
The provider contract is intentionally minimal: a single Invoke() method that streams artifacts on the supplied channel in the exact order they are received from the underlying LLM API. Adapters may accumulate only when the native response cannot be expressed as a single canonical ore artifact (for example, fragmented tool-call payloads). All other artifacts — TextDelta, ReasoningDelta, etc. — must be emitted immediately.
See the Provider interface in provider.go for the full contract and the artifact package for the list of canonical types.
Package provider defines the Provider interface, the contract between the core loop and concrete LLM provider adapters.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InvokeOption ¶
type InvokeOption interface {
IsInvokeOption()
}
InvokeOption is a marker interface for per-invocation configuration options. Concrete provider sub-packages define their own option types and exported constructors (e.g. openai.WithTools). Providers silently ignore options they do not recognize.
func WithTools ¶
func WithTools(tools []Tool) InvokeOption
WithTools returns an InvokeOption that configures the set of available tools for a single provider invocation.
type Provider ¶
type Provider interface {
// Invoke serializes the given state, calls the LLM API, and emits
// deserialized response artifacts to the provided channel.
//
// The adapter must emit each artifact as soon as the native API delivers a
// chunk, preserving that arrival order.
//
// Accumulation is allowed only when the native format cannot be
// represented directly as a canonical ore artifact (e.g. fragmented
// tool-call data). In such cases the adapter should assemble the
// complete artifact before sending it on the channel.
//
// The channel must not be closed by the adapter.
Invoke(ctx context.Context, s state.State, ch chan<- artifact.Artifact, opts ...InvokeOption) error
}
Provider is the interface implemented by LLM provider adapters.
type Tool ¶
type Tool struct {
Name string
Description string
// Schema defines the JSON Schema for the tool's parameters.
Schema map[string]any
}
Tool describes a callable tool exposed to an LLM provider.
type ToolsOption ¶
type ToolsOption struct {
Tools []Tool
}
ToolsOption is a per-invocation option that configures available tools.
func (ToolsOption) IsInvokeOption ¶
func (ToolsOption) IsInvokeOption()
IsInvokeOption marks ToolsOption as a provider.InvokeOption.