providers

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const CodexHomeEnvVar = cliprovider.CodexHomeEnvVar

Variables

This section is empty.

Functions

func CreateCodexCliTokenSource

func CreateCodexCliTokenSource() func() (string, string, error)

func DefaultAPIBaseForProtocol

func DefaultAPIBaseForProtocol(protocol string) string

DefaultAPIBaseForProtocol returns the configured default API base for a protocol. It returns empty string if the protocol has no default base.

func ExtractProtocol

func ExtractProtocol(cfg *config.ModelConfig) (protocol, modelID string)

ExtractProtocol extracts the effective protocol and model identifier from a model configuration.

The explicit Provider field takes precedence. When Provider is empty, the protocol is inferred from Model. Plain model names default to "openai". Provider-prefixed models strip the first slash-separated segment from the returned model ID.

The returned protocol is normalized to the provider's canonical spelling. Examples:

  • Model "openai/gpt-4o" -> ("openai", "gpt-4o")
  • Model "nvidia/z-ai/glm-5.1" -> ("nvidia", "z-ai/glm-5.1")
  • Provider "nvidia", Model "z-ai/glm-5.1" -> ("nvidia", "z-ai/glm-5.1")
  • Provider "openai", Model "openai/gpt-4o" -> ("openai", "openai/gpt-4o")
  • Model "gpt-4o" -> ("openai", "gpt-4o")

func FetchAntigravityProjectID

func FetchAntigravityProjectID(accessToken string) (string, error)

func IsCreatableModelProvider

func IsCreatableModelProvider(provider string) bool

IsCreatableModelProvider reports whether provider can be selected for a new model entry from the Web UI.

func IsDefaultModelProvider

func IsDefaultModelProvider(provider string) bool

IsDefaultModelProvider reports whether provider can be used as the default chat model. Some providers such as ASR-only entries are intentionally exposed in model_list management but cannot drive the gateway default model.

func IsEmptyAPIKeyAllowedForProtocol

func IsEmptyAPIKeyAllowedForProtocol(protocol string) bool

IsEmptyAPIKeyAllowedForProtocol reports whether a protocol allows requests without api_key when using its default local endpoint.

func IsHTTPAPIProtocol

func IsHTTPAPIProtocol(protocol string) bool

IsHTTPAPIProtocol reports whether a provider uses an HTTP API base in the model configuration path. This excludes providers such as Bedrock, CLI bridges, and OAuth-only managed providers even if they do not require an explicit api_key field.

func IsImageDimensionError

func IsImageDimensionError(msg string) bool

IsImageDimensionError returns true if the message indicates an image dimension error.

func IsImageSizeError

func IsImageSizeError(msg string) bool

IsImageSizeError returns true if the message indicates an image file size error.

func IsModelProviderFetchable

func IsModelProviderFetchable(provider string) bool

IsModelProviderFetchable reports whether provider supports upstream /models listing through the launcher fetch endpoint.

func IsSupportedModelProvider

func IsSupportedModelProvider(provider string) bool

IsSupportedModelProvider reports whether provider resolves to a provider ID returned by ModelProviderOptions.

func ModelKey

func ModelKey(provider, model string) string

ModelKey returns a canonical "provider/model" key for deduplication.

func NormalizeProvider

func NormalizeProvider(provider string) string

NormalizeProvider normalizes provider identifiers to canonical form.

func ReadCodexCliCredentials

func ReadCodexCliCredentials() (accessToken, accountID string, expiresAt time.Time, err error)

func ResolveAPIBase

func ResolveAPIBase(cfg *config.ModelConfig) string

ResolveAPIBase returns the configured API base, or the protocol default when the model uses an HTTP-based provider family with a known default endpoint.

func ResolveModelConfig

func ResolveModelConfig(cfg *config.Config, model string) (*config.ModelConfig, error)

ResolveModelConfig resolves an alias or raw model reference to a configured provider. Raw references may reuse credentials and endpoint settings from another model entry for the same provider.

func SplitModelProviderAndID

func SplitModelProviderAndID(model, defaultProvider string) (provider, modelID string)

SplitModelProviderAndID separates a legacy "provider/model" string into its effective provider and canonical model ID. Unknown prefixes are treated as part of the model ID and fall back to defaultProvider.

Types

type AntigravityModelInfo

type AntigravityModelInfo = oauthprovider.AntigravityModelInfo

func FetchAntigravityModels

func FetchAntigravityModels(accessToken, projectID string) ([]AntigravityModelInfo, error)

type AntigravityProvider

type AntigravityProvider = oauthprovider.AntigravityProvider

func NewAntigravityProvider

func NewAntigravityProvider() *AntigravityProvider

type Attachment

type Attachment = protocoltypes.Attachment

type AuthErrorKind

type AuthErrorKind string
const (
	AuthErrorInvalidAPIKey AuthErrorKind = "invalid_api_key"
	AuthErrorMissingAPIKey AuthErrorKind = "missing_api_key"
	AuthErrorExpiredToken  AuthErrorKind = "expired_token"
	AuthErrorGeneric       AuthErrorKind = "auth"
)

func ClassifyAuthError

func ClassifyAuthError(err error) (AuthErrorKind, bool)

type CacheControl

type CacheControl = protocoltypes.CacheControl

type ClaudeCliProvider

type ClaudeCliProvider = cliprovider.ClaudeCliProvider

func NewClaudeCliProvider

func NewClaudeCliProvider(workspace string) *ClaudeCliProvider

type ClaudeProvider

type ClaudeProvider = oauthprovider.ClaudeProvider

func NewClaudeProvider

func NewClaudeProvider(token string) *ClaudeProvider

func NewClaudeProviderWithBaseURL

func NewClaudeProviderWithBaseURL(token, apiBase string) *ClaudeProvider

func NewClaudeProviderWithTokenSource

func NewClaudeProviderWithTokenSource(token string, tokenSource func() (string, error)) *ClaudeProvider

func NewClaudeProviderWithTokenSourceAndBaseURL

func NewClaudeProviderWithTokenSourceAndBaseURL(
	token string, tokenSource func() (string, error), apiBase string,
) *ClaudeProvider

type CodexCliAuth

type CodexCliAuth = cliprovider.CodexCliAuth

type CodexCliProvider

type CodexCliProvider = cliprovider.CodexCliProvider

func NewCodexCliProvider

func NewCodexCliProvider(workspace string) *CodexCliProvider

type CodexProvider

type CodexProvider = oauthprovider.CodexProvider

func NewCodexProvider

func NewCodexProvider(token, accountID string) *CodexProvider

func NewCodexProviderWithTokenSource

func NewCodexProviderWithTokenSource(
	token, accountID string, tokenSource func() (string, string, error),
) *CodexProvider

type ContentBlock

type ContentBlock = protocoltypes.ContentBlock

type CooldownTracker

type CooldownTracker struct {
	// contains filtered or unexported fields
}

CooldownTracker manages per-provider cooldown state for the fallback chain. Thread-safe via sync.RWMutex. In-memory only (resets on restart).

func NewCooldownTracker

func NewCooldownTracker() *CooldownTracker

NewCooldownTracker creates a tracker with default 24h failure window.

func (*CooldownTracker) CooldownRemaining

func (ct *CooldownTracker) CooldownRemaining(provider string) time.Duration

CooldownRemaining returns how long until the provider becomes available. Returns 0 if already available.

func (*CooldownTracker) ErrorCount

func (ct *CooldownTracker) ErrorCount(provider string) int

ErrorCount returns the current error count for a provider.

func (*CooldownTracker) FailureCount

func (ct *CooldownTracker) FailureCount(provider string, reason FailoverReason) int

FailureCount returns the failure count for a specific reason.

func (*CooldownTracker) IsAvailable

func (ct *CooldownTracker) IsAvailable(provider string) bool

IsAvailable returns true if the provider is not in cooldown or disabled.

func (*CooldownTracker) MarkFailure

func (ct *CooldownTracker) MarkFailure(provider string, reason FailoverReason)

MarkFailure records a failure for a provider and sets appropriate cooldown. Resets error counts if last failure was more than failureWindow ago.

func (*CooldownTracker) MarkSuccess

func (ct *CooldownTracker) MarkSuccess(provider string)

MarkSuccess resets all counters and cooldowns for a provider.

type ExtraContent

type ExtraContent = protocoltypes.ExtraContent

type FailoverError

type FailoverError struct {
	Reason   FailoverReason
	Provider string
	Model    string
	Status   int
	Wrapped  error
}

FailoverError wraps an LLM provider error with classification metadata.

func ClassifyError

func ClassifyError(err error, provider, model string) *FailoverError

ClassifyError classifies an error into a FailoverError with reason. Returns nil if the error is not classifiable (unknown errors should not trigger fallback).

func (*FailoverError) Error

func (e *FailoverError) Error() string

func (*FailoverError) IsRetriable

func (e *FailoverError) IsRetriable() bool

IsRetriable returns true if this error should trigger fallback to next candidate. Non-retriable: Format errors (bad request structure, image dimension/size).

func (*FailoverError) Unwrap

func (e *FailoverError) Unwrap() error

type FailoverReason

type FailoverReason string

FailoverReason classifies why an LLM request failed for fallback decisions.

const (
	FailoverAuth            FailoverReason = "auth"
	FailoverRateLimit       FailoverReason = "rate_limit"
	FailoverBilling         FailoverReason = "billing"
	FailoverNetwork         FailoverReason = "network"
	FailoverTimeout         FailoverReason = "timeout"
	FailoverFormat          FailoverReason = "format"
	FailoverContextOverflow FailoverReason = "context_overflow"
	FailoverOverloaded      FailoverReason = "overloaded"
	FailoverUnknown         FailoverReason = "unknown"
)

type FallbackAttempt

type FallbackAttempt struct {
	Provider string
	Model    string
	Error    error
	Reason   FailoverReason
	Duration time.Duration
	Skipped  bool // true if skipped due to cooldown
}

FallbackAttempt records one attempt in the fallback chain.

type FallbackCandidate

type FallbackCandidate struct {
	Provider    string
	Model       string
	DisplayName string // optional configured alias/raw model label for persistence/UI
	RPM         int    // requests per minute; 0 means unrestricted
	IdentityKey string // optional stable config identity for cooldown/rate limiting
	ConfigIndex int    // optional 1-based model_list index selected during resolution
	ConfigKey   string // optional hashed model_list identity, stable across reordering
}

FallbackCandidate represents one model/provider to try.

func ResolveCandidates

func ResolveCandidates(cfg ModelConfig, defaultProvider string) []FallbackCandidate

ResolveCandidates parses model config into a deduplicated candidate list.

func ResolveCandidatesWithLookup

func ResolveCandidatesWithLookup(
	cfg ModelConfig,
	defaultProvider string,
	lookup func(raw string) (resolved string, ok bool),
) []FallbackCandidate

func (FallbackCandidate) StableKey

func (c FallbackCandidate) StableKey() string

StableKey returns the candidate's config-level identity when available, otherwise it falls back to the runtime provider/model key.

type FallbackChain

type FallbackChain struct {
	// contains filtered or unexported fields
}

FallbackChain orchestrates model fallback across multiple candidates.

func NewFallbackChain

func NewFallbackChain(cooldown *CooldownTracker, rl *RateLimiterRegistry) *FallbackChain

NewFallbackChain creates a new fallback chain with the given cooldown tracker and rate limiter registry.

func (*FallbackChain) Execute

func (fc *FallbackChain) Execute(
	ctx context.Context,
	candidates []FallbackCandidate,
	run func(ctx context.Context, provider, model string) (*LLMResponse, error),
) (*FallbackResult, error)

Execute runs the fallback chain for text/chat requests. It tries each candidate in order, respecting cooldowns and error classification.

Behavior:

  • Candidates in cooldown are skipped (logged as skipped attempt).
  • context.Canceled aborts immediately (user abort, no fallback).
  • Non-retriable errors (format) abort immediately.
  • Retriable errors trigger fallback to next candidate.
  • Success marks provider as good (resets cooldown).
  • If all fail, returns aggregate error with all attempts.

func (*FallbackChain) ExecuteCandidate

func (fc *FallbackChain) ExecuteCandidate(
	ctx context.Context,
	candidates []FallbackCandidate,
	run func(ctx context.Context, candidate FallbackCandidate) (*LLMResponse, error),
) (*FallbackResult, error)

ExecuteCandidate runs the fallback chain and passes the complete candidate to the caller so model-list identity metadata remains available.

func (*FallbackChain) ExecuteImage

func (fc *FallbackChain) ExecuteImage(
	ctx context.Context,
	candidates []FallbackCandidate,
	run func(ctx context.Context, provider, model string) (*LLMResponse, error),
) (*FallbackResult, error)

ExecuteImage runs the fallback chain for image/vision requests. Simpler than Execute: no cooldown checks (image endpoints have different rate limits). Image dimension/size errors abort immediately (non-retriable).

func (*FallbackChain) ExecuteImageCandidate

func (fc *FallbackChain) ExecuteImageCandidate(
	ctx context.Context,
	candidates []FallbackCandidate,
	run func(ctx context.Context, candidate FallbackCandidate) (*LLMResponse, error),
) (*FallbackResult, error)

ExecuteImageCandidate preserves model-list identity metadata for each image fallback attempt.

type FallbackExhaustedError

type FallbackExhaustedError struct {
	Attempts []FallbackAttempt
}

FallbackExhaustedError indicates all fallback candidates were tried and failed.

func (*FallbackExhaustedError) Error

func (e *FallbackExhaustedError) Error() string

type FallbackResult

type FallbackResult struct {
	Response    *LLMResponse
	Provider    string
	Model       string
	IdentityKey string
	Attempts    []FallbackAttempt
}

FallbackResult contains the successful response and metadata about all attempts.

type FunctionCall

type FunctionCall = protocoltypes.FunctionCall

type GeminiProvider

type GeminiProvider = httpapi.GeminiProvider

func NewGeminiProvider

func NewGeminiProvider(
	apiKey string,
	apiBase string,
	proxy string,
	userAgent string,
	requestTimeoutSeconds int,
	extraBody map[string]any,
	customHeaders map[string]string,
) *GeminiProvider

type GitHubCopilotHTTPProvider

type GitHubCopilotHTTPProvider struct {
	// contains filtered or unexported fields
}

GitHubCopilotHTTPProvider implements LLMProvider and StreamingProvider by exchanging GitHub OAuth credentials for dynamic Copilot session tokens and proxying OpenAI-compatible requests to the official Copilot endpoint (supporting individual, business, and enterprise).

func NewGitHubCopilotHTTPProvider

func NewGitHubCopilotHTTPProvider(oauthToken, customBase, defaultModel string) *GitHubCopilotHTTPProvider

NewGitHubCopilotHTTPProvider creates a new HTTP-based Copilot provider.

func (*GitHubCopilotHTTPProvider) Chat

func (p *GitHubCopilotHTTPProvider) Chat(
	ctx context.Context,
	messages []Message,
	tools []ToolDefinition,
	model string,
	options map[string]any,
) (*LLMResponse, error)

func (*GitHubCopilotHTTPProvider) ChatStream

func (p *GitHubCopilotHTTPProvider) ChatStream(
	ctx context.Context,
	messages []Message,
	tools []ToolDefinition,
	model string,
	options map[string]any,
	onChunk func(accumulated string),
) (*LLMResponse, error)

func (*GitHubCopilotHTTPProvider) ChatStreamEvents

func (p *GitHubCopilotHTTPProvider) ChatStreamEvents(
	ctx context.Context,
	messages []Message,
	tools []ToolDefinition,
	model string,
	options map[string]any,
	onChunk func(StreamChunk),
) (*LLMResponse, error)

func (*GitHubCopilotHTTPProvider) GetDefaultModel

func (p *GitHubCopilotHTTPProvider) GetDefaultModel() string

type GitHubCopilotProvider

type GitHubCopilotProvider = cliprovider.GitHubCopilotProvider

func NewGitHubCopilotProvider

func NewGitHubCopilotProvider(uri string, connectMode string, model string) (*GitHubCopilotProvider, error)

type GoogleExtra

type GoogleExtra = protocoltypes.GoogleExtra

type HTTPProvider

type HTTPProvider = httpapi.HTTPProvider

func NewHTTPProvider

func NewHTTPProvider(apiKey, apiBase, proxy string) *HTTPProvider

func NewHTTPProviderWithMaxTokensField

func NewHTTPProviderWithMaxTokensField(apiKey, apiBase, proxy, maxTokensField string) *HTTPProvider

func NewHTTPProviderWithMaxTokensFieldAndRequestTimeout

func NewHTTPProviderWithMaxTokensFieldAndRequestTimeout(
	apiKey, apiBase, proxy, maxTokensField, userAgent string,
	requestTimeoutSeconds int,
	extraBody map[string]any,
	customHeaders map[string]string,
) *HTTPProvider

type InstanceCatalog

type InstanceCatalog struct {
	InstanceID string
	Models     []string
}

InstanceCatalog is the model identity snapshot owned by one configured provider instance. Callers load this from their catalog persistence layer.

type InstanceCredentialResolver

type InstanceCredentialResolver func(ref string) (string, error)

InstanceCredentialResolver resolves an instance auth connection reference.

type InstanceProviderFactory

type InstanceProviderFactory func(
	instance *config.ProviderInstanceConfig,
	modelID string,
	secret string,
) (LLMProvider, error)

InstanceProviderFactory creates a runtime provider from one exact target's owning instance. secret is resolved from that instance's auth reference.

type InstanceResolution

type InstanceResolution struct {
	Candidates []FallbackCandidate
	// contains filtered or unexported fields
}

InstanceResolution contains ordered fallback candidates and their exact instance-owned providers, keyed by FallbackCandidate.StableKey().

func ResolveInstanceTargetOrRoute

func ResolveInstanceTargetOrRoute(
	cfg *config.Config,
	catalogs map[string]InstanceCatalog,
	selection string,
	resolveCredential InstanceCredentialResolver,
	createProvider InstanceProviderFactory,
) (*InstanceResolution, error)

ResolveInstanceTargetOrRoute resolves either an exact instance-id/model-id target or a named route. It never consults legacy ModelConfig templates.

func (*InstanceResolution) ModelConfigForCandidate

func (r *InstanceResolution) ModelConfigForCandidate(candidate FallbackCandidate) (*config.ModelConfig, error)

func (*InstanceResolution) ProviderForCandidate

func (r *InstanceResolution) ProviderForCandidate(candidate FallbackCandidate) (LLMProvider, error)

type LLMProvider

type LLMProvider interface {
	Chat(
		ctx context.Context,
		messages []Message,
		tools []ToolDefinition,
		model string,
		options map[string]any,
	) (*LLMResponse, error)
	GetDefaultModel() string
}

func CreateProvider

func CreateProvider(cfg *config.Config) (LLMProvider, string, error)

CreateProvider creates a provider based on the configuration. It uses the model_list configuration (new format) to create providers. The old providers config is automatically converted to model_list during config loading. Returns the provider, the model ID to use, and any error.

func CreateProviderFromConfig

func CreateProviderFromConfig(cfg *config.ModelConfig) (LLMProvider, string, error)

CreateProviderFromConfig creates a provider based on the ModelConfig. It uses ExtractProtocol to determine which provider to create. Supported protocol families include OpenAI-compatible prefixes (e.g., openai, openrouter, groq), Azure OpenAI, Amazon Bedrock, Anthropic (including messages), and various CLI/compatibility shims. See the switch on protocol in this function for the authoritative list. Returns the provider, the effective model ID from ExtractProtocol, and any error.

func CreateProviderFromInstance

func CreateProviderFromInstance(
	instance *config.ProviderInstanceConfig,
	modelID string,
	secret string,
) (LLMProvider, error)

CreateProviderFromInstance adapts one provider instance to Studio's existing provider factory without consulting another instance or legacy templates.

type LLMResponse

type LLMResponse = protocoltypes.LLMResponse

type Message

type Message = protocoltypes.Message

type ModelConfig

type ModelConfig struct {
	Primary   string
	Fallbacks []string
}

ModelConfig holds primary model and fallback list.

type ModelProviderOption

type ModelProviderOption struct {
	ID                  string   `json:"id"`
	DisplayName         string   `json:"display_name,omitempty"`
	IconSlug            string   `json:"icon_slug,omitempty"`
	Domain              string   `json:"domain,omitempty"`
	DefaultAPIBase      string   `json:"default_api_base"`
	EmptyAPIKeyAllowed  bool     `json:"empty_api_key_allowed"`
	CreateAllowed       bool     `json:"create_allowed"`
	DefaultModelAllowed bool     `json:"default_model_allowed"`
	SupportsFetch       bool     `json:"supports_fetch,omitempty"`
	DefaultAuthMethod   string   `json:"default_auth_method,omitempty"`
	AuthMethodLocked    bool     `json:"auth_method_locked,omitempty"`
	Local               bool     `json:"local,omitempty"`
	Priority            float64  `json:"priority,omitempty"`
	CommonModels        []string `json:"common_models,omitempty"`
	Aliases             []string `json:"aliases,omitempty"`
	// contains filtered or unexported fields
}

ModelProviderOption describes a canonical provider entry exposed to the Web UI. It also serves as the backend-owned source of truth for shared provider metadata.

func ModelProviderOptions

func ModelProviderOptions() []ModelProviderOption

ModelProviderOptions returns the canonical provider catalog exposed to the Web UI.

type ModelRef

type ModelRef struct {
	Provider string
	Model    string
}

ModelRef represents a parsed model reference with provider and model name.

func ParseModelRef

func ParseModelRef(raw string, defaultProvider string) *ModelRef

ParseModelRef parses "anthropic/claude-opus" into {Provider: "anthropic", Model: "claude-opus"}. If no slash present, uses defaultProvider. Returns nil for empty input.

type NativeSearchCapable

type NativeSearchCapable interface {
	SupportsNativeSearch() bool
}

NativeSearchCapable is an optional interface for providers that support built-in web search during LLM inference (e.g. OpenAI web_search_preview, xAI Grok search). When the active provider implements this interface and returns true, the agent loop can hide the client-side web_search tool to avoid duplicate search surfaces and use the provider's native search instead.

type RateLimiter

type RateLimiter struct {
	// contains filtered or unexported fields
}

RateLimiter implements a token-bucket rate limiter for a single key. Allows up to RPM requests per minute with a burst equal to RPM. Thread-safe.

func (*RateLimiter) TryAcquire

func (rl *RateLimiter) TryAcquire() bool

TryAcquire attempts to consume a token without blocking.

func (*RateLimiter) Wait

func (rl *RateLimiter) Wait(ctx context.Context) error

Wait blocks until a token is available or ctx is canceled. Returns ctx.Err() if canceled while waiting.

type RateLimiterRegistry

type RateLimiterRegistry struct {
	// contains filtered or unexported fields
}

RateLimiterRegistry holds per-candidate rate limiters. Candidates with RPM=0 are unrestricted. Thread-safe for concurrent reads/writes.

func NewRateLimiterRegistry

func NewRateLimiterRegistry() *RateLimiterRegistry

NewRateLimiterRegistry creates an empty registry.

func (*RateLimiterRegistry) Register

func (r *RateLimiterRegistry) Register(key string, rpm int)

Register adds a rate limiter for the given key at the given RPM. If rpm <= 0, no limiter is registered (unrestricted).

func (*RateLimiterRegistry) RegisterCandidates

func (r *RateLimiterRegistry) RegisterCandidates(candidates []FallbackCandidate)

RegisterCandidates registers rate limiters for all candidates that have RPM > 0. Candidates with RPM == 0 are ignored (no restriction).

func (*RateLimiterRegistry) TryAcquire

func (r *RateLimiterRegistry) TryAcquire(key string) bool

TryAcquire attempts to consume a token for the given key without blocking. If no limiter is registered for key, it returns true.

func (*RateLimiterRegistry) Wait

func (r *RateLimiterRegistry) Wait(ctx context.Context, key string) error

Wait acquires a token for the given key, blocking if needed. If no limiter is registered for key, returns immediately.

type StatefulProvider

type StatefulProvider interface {
	LLMProvider
	Close()
}

type StreamChunk

type StreamChunk = protocoltypes.StreamChunk

type StreamingEventProvider

type StreamingEventProvider interface {
	ChatStreamEvents(
		ctx context.Context,
		messages []Message,
		tools []ToolDefinition,
		model string,
		options map[string]any,
		onChunk func(StreamChunk),
	) (*LLMResponse, error)
}

type StreamingProvider

type StreamingProvider interface {
	ChatStream(
		ctx context.Context,
		messages []Message,
		tools []ToolDefinition,
		model string,
		options map[string]any,
		onChunk func(accumulated string),
	) (*LLMResponse, error)
}

StreamingProvider is an optional interface for providers that support token streaming. onChunk receives the accumulated text so far (not individual deltas). The returned LLMResponse is the same complete response for compatibility with tool-call handling.

type ThinkingCapable

type ThinkingCapable interface {
	SupportsThinking() bool
}

ThinkingCapable is an optional interface for providers that support extended thinking (e.g. Anthropic). Used by the agent loop to warn when thinking_level is configured but the active provider cannot use it.

type ToolCall

type ToolCall = protocoltypes.ToolCall

func NormalizeToolCall

func NormalizeToolCall(tc ToolCall) ToolCall

type ToolDefinition

type ToolDefinition = protocoltypes.ToolDefinition

type ToolFunctionDefinition

type ToolFunctionDefinition = protocoltypes.ToolFunctionDefinition

type UsageInfo

type UsageInfo = protocoltypes.UsageInfo

Directories

Path Synopsis
Package bedrock provides a stub implementation when built without the bedrock tag.
Package bedrock provides a stub implementation when built without the bedrock tag.
Package common provides shared utilities used by multiple LLM provider implementations (openai_compat, azure, etc.).
Package common provides shared utilities used by multiple LLM provider implementations (openai_compat, azure, etc.).
Package openai_responses_common provides shared utilities for providers that use the OpenAI Responses API (e.g., Azure, Codex).
Package openai_responses_common provides shared utilities for providers that use the OpenAI Responses API (e.g., Azure, Codex).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL