provider

package
v0.411.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AntigravityTokenNeedsRefresh added in v0.312.1

func AntigravityTokenNeedsRefresh(account config.ProviderAccount) bool

func CacheDisabledOptions added in v0.254.0

func CacheDisabledOptions() (anthropicOpts []AnthropicOption, openaiOpts []OpenAIOption, geminiOpts []GeminiOption)

CacheDisabledOptions returns provider options that disable LLM prompt caching, based on the global config. Returns nil slices if caching is enabled.

func ResetAntigravitySchedulerForTests added in v0.312.1

func ResetAntigravitySchedulerForTests()

func SelectAntigravityAccount added in v0.312.1

func SelectAntigravityAccount(model models.Model) (config.ProviderAccount, error)

Types

type AnthropicClient

type AnthropicClient ProviderClient

type AnthropicOption

type AnthropicOption func(*anthropicOptions)

func WithAnthropicBedrock

func WithAnthropicBedrock(useBedrock bool) AnthropicOption

func WithAnthropicDisableCache

func WithAnthropicDisableCache() AnthropicOption

func WithAnthropicOAuthToken added in v0.16.0

func WithAnthropicOAuthToken(token string) AnthropicOption

func WithAnthropicReasoningEffort added in v0.200.0

func WithAnthropicReasoningEffort(effort string) AnthropicOption

func WithAnthropicThinkingMode added in v0.200.0

func WithAnthropicThinkingMode(mode config.ThinkingMode) AnthropicOption

type AntigravityFailureAction added in v0.312.1

type AntigravityFailureAction struct {
	Kind             AntigravityFailureKind
	DisableAccount   bool
	Cooldown         time.Duration
	ExhaustPool      bool
	ExhaustModel     bool
	DisableGeminiCLI bool
	RequireReauth    bool
}

type AntigravityFailureKind added in v0.312.1

type AntigravityFailureKind string
const (
	AntigravityFailureUnknown        AntigravityFailureKind = "unknown"
	AntigravityFailureQuotaExhausted AntigravityFailureKind = "quota_exhausted"
	AntigravityFailureRateLimited    AntigravityFailureKind = "rate_limited"
	AntigravityFailureCapacity       AntigravityFailureKind = "capacity"
	AntigravityFailureInvalidGrant   AntigravityFailureKind = "invalid_grant"
	AntigravityFailureProjectAccess  AntigravityFailureKind = "project_access"
	AntigravityFailureVerification   AntigravityFailureKind = "verification_required"
)

type AntigravityQuotaState added in v0.312.1

type AntigravityQuotaState string
const (
	AntigravityQuotaStateAvailable AntigravityQuotaState = "available"
	AntigravityQuotaStateCooling   AntigravityQuotaState = "cooling"
	AntigravityQuotaStateExhausted AntigravityQuotaState = "exhausted"
)

type AntigravitySchedulerAccountState added in v0.312.1

type AntigravitySchedulerAccountState struct {
	AccountID           string
	Email               string
	Enabled             bool
	LastUsedAt          time.Time
	CooldownUntil       time.Time
	ConsecutiveFailures int
	LastFailureAt       time.Time
	HealthScore         float64
	QuotaByPool         map[string]AntigravityQuotaState
	QuotaByModelFamily  map[string]AntigravityQuotaState
	GeminiCLISupported  bool
}

type AntigravitySchedulingStrategy added in v0.312.1

type AntigravitySchedulingStrategy string
const (
	AntigravityPoolGateway   = "antigravity"
	AntigravityPoolGeminiCLI = "gemini-cli"

	AntigravityStrategySticky     AntigravitySchedulingStrategy = "sticky"
	AntigravityStrategyRoundRobin AntigravitySchedulingStrategy = "round-robin"
	AntigravityStrategyHybrid     AntigravitySchedulingStrategy = "hybrid"
)

type AntigravitySelection added in v0.312.1

type AntigravitySelection struct {
	Account      config.ProviderAccount
	Pool         string
	Strategy     AntigravitySchedulingStrategy
	ModelFamily  string
	RuntimeState AntigravitySchedulerAccountState
}

type AzureClient

type AzureClient ProviderClient

type BedrockClient

type BedrockClient ProviderClient

type BedrockOption

type BedrockOption func(*bedrockOptions)

type CopilotClient

type CopilotClient ProviderClient

type CopilotOption

type CopilotOption func(*copilotOptions)

func WithCopilotBaseURL added in v0.2.0

func WithCopilotBaseURL(baseURL string) CopilotOption

func WithCopilotBearerToken

func WithCopilotBearerToken(bearerToken string) CopilotOption

func WithCopilotExtraHeaders

func WithCopilotExtraHeaders(headers map[string]string) CopilotOption

func WithCopilotReasoningEffort

func WithCopilotReasoningEffort(effort string) CopilotOption

type EventType

type EventType string
const (
	EventContentStart  EventType = "content_start"
	EventToolUseStart  EventType = "tool_use_start"
	EventToolUseDelta  EventType = "tool_use_delta"
	EventToolUseStop   EventType = "tool_use_stop"
	EventContentDelta  EventType = "content_delta"
	EventThinkingDelta EventType = "thinking_delta"
	EventContentStop   EventType = "content_stop"
	EventComplete      EventType = "complete"
	EventError         EventType = "error"
	EventWarning       EventType = "warning"
)

type GeminiClient

type GeminiClient ProviderClient

type GeminiOption

type GeminiOption func(*geminiOptions)

func WithGeminiDisableCache

func WithGeminiDisableCache() GeminiOption

WithGeminiDisableCache sets the disableCache flag for Gemini providers. NOTE: Gemini uses implicit server-side caching with no public API to disable it. Explicit Context Caching (a separate feature) is not used by Pando. This option is kept for future compatibility when Gemini adds an opt-out mechanism.

type OpenAIClient

type OpenAIClient ProviderClient

type OpenAIOption

type OpenAIOption func(*openaiOptions)

func WithOpenAIBaseURL

func WithOpenAIBaseURL(baseURL string) OpenAIOption

func WithOpenAIDisableCache

func WithOpenAIDisableCache() OpenAIOption

WithOpenAIDisableCache sets the disableCache flag for OpenAI providers. NOTE: OpenAI uses automatic server-side caching that cannot be disabled via API. This option has no effect today but is kept for future compatibility.

func WithOpenAIExtraHeaders

func WithOpenAIExtraHeaders(headers map[string]string) OpenAIOption

func WithReasoningEffort

func WithReasoningEffort(effort string) OpenAIOption

type Provider

type Provider interface {
	SendMessages(ctx context.Context, messages []message.Message, tools []tools.BaseTool) (*ProviderResponse, error)

	StreamResponse(ctx context.Context, messages []message.Message, tools []tools.BaseTool) <-chan ProviderEvent

	Model() models.Model
}

func NewInstrumentedProvider added in v0.200.0

func NewInstrumentedProvider(p Provider) Provider

NewInstrumentedProvider wraps p with OpenTelemetry tracing if observability is enabled. If disabled, returns p unchanged (zero overhead).

func NewProvider

func NewProvider(providerName models.ModelProvider, opts ...ProviderClientOption) (Provider, error)

func NewProviderFromAccount added in v0.252.0

func NewProviderFromAccount(account config.ProviderAccount, model models.Model, maxTokens int64, systemMessage string) (Provider, error)

NewProviderFromAccount creates a Provider from a named ProviderAccount configuration. This is the preferred way to create providers when using the multi-account system.

type ProviderClient

type ProviderClient interface {
	// contains filtered or unexported methods
}

type ProviderClientOption

type ProviderClientOption func(*providerClientOptions)

func WithAPIKey

func WithAPIKey(apiKey string) ProviderClientOption

func WithAnthropicOptions

func WithAnthropicOptions(anthropicOptions ...AnthropicOption) ProviderClientOption

func WithBedrockOptions

func WithBedrockOptions(bedrockOptions ...BedrockOption) ProviderClientOption

func WithCopilotOptions

func WithCopilotOptions(copilotOptions ...CopilotOption) ProviderClientOption

func WithGeminiOptions

func WithGeminiOptions(geminiOptions ...GeminiOption) ProviderClientOption

func WithMaxTokens

func WithMaxTokens(maxTokens int64) ProviderClientOption

func WithModel

func WithModel(model models.Model) ProviderClientOption

func WithOAuthAccount added in v0.312.1

func WithOAuthAccount(account config.ProviderAccount) ProviderClientOption

func WithOpenAIOptions

func WithOpenAIOptions(openaiOptions ...OpenAIOption) ProviderClientOption

func WithSystemMessage

func WithSystemMessage(systemMessage string) ProviderClientOption

func WithUseOAuth added in v0.252.0

func WithUseOAuth(useOAuth bool) ProviderClientOption

type ProviderEvent

type ProviderEvent struct {
	Type EventType

	Content  string
	Thinking string
	Response *ProviderResponse
	ToolCall *message.ToolCall
	Error    error
}

type ProviderResponse

type ProviderResponse struct {
	Content      string
	ToolCalls    []message.ToolCall
	Usage        TokenUsage
	FinishReason message.FinishReason
}

type TokenUsage

type TokenUsage struct {
	InputTokens         int64
	OutputTokens        int64
	CacheCreationTokens int64
	CacheReadTokens     int64
}

type VertexAIClient

type VertexAIClient ProviderClient

Jump to

Keyboard shortcuts

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