Documentation
¶
Index ¶
- func ClearProviderAPICooldown(providerName string)
- func ClearProviderRuntimeHistory(providerName string)
- func ConfigureProviderRuntime(providerName string, pc config.ProviderConfig)
- func CreateProviders(cfg *config.Config) (map[string]LLMProvider, error)
- func GetProviderModels(cfg *config.Config, name string) []string
- func GetProviderRuntimeSnapshot(cfg *config.Config) map[string]interface{}
- func GetProviderRuntimeView(cfg *config.Config, query ProviderRuntimeQuery) map[string]interface{}
- func ListProviderNames(cfg *config.Config) []string
- func ProviderSupportsResponsesCompact(cfg *config.Config, name string) bool
- func RerankProviderRuntime(cfg *config.Config, providerName string) ([]providerRuntimeCandidate, error)
- type FunctionCall
- type HTTPProvider
- func (p *HTTPProvider) BuildSummaryViaResponsesCompact(ctx context.Context, model string, existingSummary string, messages []Message, ...) (string, error)
- func (p *HTTPProvider) Chat(ctx context.Context, messages []Message, tools []ToolDefinition, model string, ...) (*LLMResponse, error)
- func (p *HTTPProvider) ChatStream(ctx context.Context, messages []Message, tools []ToolDefinition, model string, ...) (*LLMResponse, error)
- func (p *HTTPProvider) GetDefaultModel() string
- func (p *HTTPProvider) SupportsResponsesCompact() bool
- type LLMProvider
- type LLMResponse
- type Message
- type MessageContentPart
- type OAuthAccountInfo
- type OAuthLoginManager
- func (m *OAuthLoginManager) ClearCooldown(credentialFile string) error
- func (m *OAuthLoginManager) CompleteManualFlow(ctx context.Context, apiBase string, flow *OAuthPendingFlow, ...) (*OAuthSessionInfo, []string, error)
- func (m *OAuthLoginManager) CompleteManualFlowWithOptions(ctx context.Context, apiBase string, flow *OAuthPendingFlow, ...) (*OAuthSessionInfo, []string, error)
- func (m *OAuthLoginManager) CredentialFile() string
- func (m *OAuthLoginManager) DeleteAccount(credentialFile string) error
- func (m *OAuthLoginManager) ImportAuthJSON(ctx context.Context, apiBase string, fileName string, data []byte) (*OAuthSessionInfo, []string, error)
- func (m *OAuthLoginManager) ImportAuthJSONWithOptions(ctx context.Context, apiBase string, fileName string, data []byte, ...) (*OAuthSessionInfo, []string, error)
- func (m *OAuthLoginManager) ListAccounts() ([]OAuthAccountInfo, error)
- func (m *OAuthLoginManager) Login(ctx context.Context, apiBase string, opts OAuthLoginOptions) (*OAuthSessionInfo, []string, error)
- func (m *OAuthLoginManager) RefreshAccount(ctx context.Context, credentialFile string) (*OAuthAccountInfo, error)
- func (m *OAuthLoginManager) StartManualFlow() (*OAuthPendingFlow, error)
- func (m *OAuthLoginManager) StartManualFlowWithOptions(opts OAuthLoginOptions) (*OAuthPendingFlow, error)
- type OAuthLoginOptions
- type OAuthPendingFlow
- type OAuthSessionInfo
- type ProviderRefreshAccountResult
- type ProviderRefreshResult
- type ProviderRuntimeQuery
- type ProviderRuntimeSummary
- type ProviderRuntimeSummaryItem
- type ResponsesCompactor
- type StreamingLLMProvider
- type ToolCall
- type ToolDefinition
- type ToolFunctionDefinition
- type UsageInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearProviderAPICooldown ¶
func ClearProviderAPICooldown(providerName string)
func ClearProviderRuntimeHistory ¶
func ClearProviderRuntimeHistory(providerName string)
func ConfigureProviderRuntime ¶
func ConfigureProviderRuntime(providerName string, pc config.ProviderConfig)
func CreateProviders ¶
func CreateProviders(cfg *config.Config) (map[string]LLMProvider, error)
func GetProviderRuntimeView ¶
func GetProviderRuntimeView(cfg *config.Config, query ProviderRuntimeQuery) map[string]interface{}
func ListProviderNames ¶
Types ¶
type FunctionCall ¶
type HTTPProvider ¶
type HTTPProvider struct {
// contains filtered or unexported fields
}
func NewHTTPProvider ¶
func (*HTTPProvider) BuildSummaryViaResponsesCompact ¶
func (*HTTPProvider) Chat ¶
func (p *HTTPProvider) Chat(ctx context.Context, messages []Message, tools []ToolDefinition, model string, options map[string]interface{}) (*LLMResponse, error)
func (*HTTPProvider) ChatStream ¶
func (p *HTTPProvider) ChatStream(ctx context.Context, messages []Message, tools []ToolDefinition, model string, options map[string]interface{}, onDelta func(string)) (*LLMResponse, error)
func (*HTTPProvider) GetDefaultModel ¶
func (p *HTTPProvider) GetDefaultModel() string
func (*HTTPProvider) SupportsResponsesCompact ¶
func (p *HTTPProvider) SupportsResponsesCompact() bool
type LLMProvider ¶
type LLMProvider interface {
Chat(ctx context.Context, messages []Message, tools []ToolDefinition, model string, options map[string]interface{}) (*LLMResponse, error)
GetDefaultModel() string
}
func CreateProvider ¶
func CreateProvider(cfg *config.Config) (LLMProvider, error)
func CreateProviderByName ¶
func CreateProviderByName(cfg *config.Config, name string) (LLMProvider, error)
type LLMResponse ¶
type Message ¶
type Message struct {
Role string `json:"role"`
Content string `json:"content"`
ContentParts []MessageContentPart `json:"content_parts,omitempty"`
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
}
type MessageContentPart ¶
type MessageContentPart struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
ImageURL string `json:"image_url,omitempty"`
Detail string `json:"detail,omitempty"`
MIMEType string `json:"mime_type,omitempty"`
Filename string `json:"filename,omitempty"`
FileData string `json:"file_data,omitempty"`
FileID string `json:"file_id,omitempty"`
FileURL string `json:"file_url,omitempty"`
}
type OAuthAccountInfo ¶
type OAuthAccountInfo struct {
Email string `json:"email"`
AccountID string `json:"account_id"`
CredentialFile string `json:"credential_file"`
Expire string `json:"expire,omitempty"`
LastRefresh string `json:"last_refresh,omitempty"`
ProjectID string `json:"project_id,omitempty"`
AccountLabel string `json:"account_label,omitempty"`
DeviceID string `json:"device_id,omitempty"`
ResourceURL string `json:"resource_url,omitempty"`
NetworkProxy string `json:"network_proxy,omitempty"`
CooldownUntil string `json:"cooldown_until,omitempty"`
FailureCount int `json:"failure_count,omitempty"`
LastFailure string `json:"last_failure,omitempty"`
HealthScore int `json:"health_score,omitempty"`
}
type OAuthLoginManager ¶
type OAuthLoginManager struct {
// contains filtered or unexported fields
}
func NewOAuthLoginManager ¶
func NewOAuthLoginManager(pc config.ProviderConfig, timeout time.Duration) (*OAuthLoginManager, error)
func (*OAuthLoginManager) ClearCooldown ¶
func (m *OAuthLoginManager) ClearCooldown(credentialFile string) error
func (*OAuthLoginManager) CompleteManualFlow ¶
func (m *OAuthLoginManager) CompleteManualFlow(ctx context.Context, apiBase string, flow *OAuthPendingFlow, callbackURL string) (*OAuthSessionInfo, []string, error)
func (*OAuthLoginManager) CompleteManualFlowWithOptions ¶
func (m *OAuthLoginManager) CompleteManualFlowWithOptions(ctx context.Context, apiBase string, flow *OAuthPendingFlow, callbackURL string, opts OAuthLoginOptions) (*OAuthSessionInfo, []string, error)
func (*OAuthLoginManager) CredentialFile ¶
func (m *OAuthLoginManager) CredentialFile() string
func (*OAuthLoginManager) DeleteAccount ¶
func (m *OAuthLoginManager) DeleteAccount(credentialFile string) error
func (*OAuthLoginManager) ImportAuthJSON ¶
func (m *OAuthLoginManager) ImportAuthJSON(ctx context.Context, apiBase string, fileName string, data []byte) (*OAuthSessionInfo, []string, error)
func (*OAuthLoginManager) ImportAuthJSONWithOptions ¶
func (m *OAuthLoginManager) ImportAuthJSONWithOptions(ctx context.Context, apiBase string, fileName string, data []byte, opts OAuthLoginOptions) (*OAuthSessionInfo, []string, error)
func (*OAuthLoginManager) ListAccounts ¶
func (m *OAuthLoginManager) ListAccounts() ([]OAuthAccountInfo, error)
func (*OAuthLoginManager) Login ¶
func (m *OAuthLoginManager) Login(ctx context.Context, apiBase string, opts OAuthLoginOptions) (*OAuthSessionInfo, []string, error)
func (*OAuthLoginManager) RefreshAccount ¶
func (m *OAuthLoginManager) RefreshAccount(ctx context.Context, credentialFile string) (*OAuthAccountInfo, error)
func (*OAuthLoginManager) StartManualFlow ¶
func (m *OAuthLoginManager) StartManualFlow() (*OAuthPendingFlow, error)
func (*OAuthLoginManager) StartManualFlowWithOptions ¶
func (m *OAuthLoginManager) StartManualFlowWithOptions(opts OAuthLoginOptions) (*OAuthPendingFlow, error)
type OAuthLoginOptions ¶
type OAuthPendingFlow ¶
type OAuthPendingFlow struct {
Mode string `json:"mode,omitempty"`
State string `json:"state,omitempty"`
PKCEVerifier string `json:"pkce_verifier,omitempty"`
AuthURL string `json:"auth_url,omitempty"`
UserCode string `json:"user_code,omitempty"`
Instructions string `json:"instructions,omitempty"`
DeviceCode string `json:"device_code,omitempty"`
IntervalSec int `json:"interval_sec,omitempty"`
ExpiresAt string `json:"expires_at,omitempty"`
}
type OAuthSessionInfo ¶
type ProviderRefreshResult ¶
type ProviderRefreshResult struct {
Provider string `json:"provider,omitempty"`
Checked int `json:"checked,omitempty"`
Refreshed int `json:"refreshed,omitempty"`
Skipped int `json:"skipped,omitempty"`
Failed int `json:"failed,omitempty"`
Accounts []ProviderRefreshAccountResult `json:"accounts,omitempty"`
}
type ProviderRuntimeQuery ¶
type ProviderRuntimeSummary ¶
type ProviderRuntimeSummary struct {
TotalProviders int `json:"total_providers"`
Healthy int `json:"healthy"`
Degraded int `json:"degraded"`
Critical int `json:"critical"`
InCooldown int `json:"in_cooldown"`
LowHealth int `json:"low_health"`
RecentErrors int `json:"recent_errors"`
Providers []ProviderRuntimeSummaryItem `json:"providers,omitempty"`
}
func GetProviderRuntimeSummary ¶
func GetProviderRuntimeSummary(cfg *config.Config, query ProviderRuntimeQuery) ProviderRuntimeSummary
type ProviderRuntimeSummaryItem ¶
type ProviderRuntimeSummaryItem struct {
Name string `json:"name,omitempty"`
Auth string `json:"auth,omitempty"`
Status string `json:"status,omitempty"`
APIState providerAPIRuntimeState `json:"api_state,omitempty"`
OAuthAccounts []OAuthAccountInfo `json:"oauth_accounts,omitempty"`
CandidateOrder []providerRuntimeCandidate `json:"candidate_order,omitempty"`
LastSuccess *providerRuntimeEvent `json:"last_success,omitempty"`
LastSuccessAt string `json:"last_success_at,omitempty"`
LastError *providerRuntimeEvent `json:"last_error,omitempty"`
LastErrorAt string `json:"last_error_at,omitempty"`
LastErrorReason string `json:"last_error_reason,omitempty"`
TopCandidateChangedAt string `json:"top_candidate_changed_at,omitempty"`
StaleForSec int64 `json:"stale_for_sec,omitempty"`
InCooldown bool `json:"in_cooldown"`
LowHealth bool `json:"low_health"`
HasRecentErrors bool `json:"has_recent_errors"`
TopCandidate *providerRuntimeCandidate `json:"top_candidate,omitempty"`
}
type ResponsesCompactor ¶
type ResponsesCompactor interface {
SupportsResponsesCompact() bool
BuildSummaryViaResponsesCompact(ctx context.Context, model string, existingSummary string, messages []Message, maxSummaryChars int) (string, error)
}
ResponsesCompactor is an optional capability interface. Providers that support OpenAI /v1/responses/compact can implement this.
type StreamingLLMProvider ¶
type StreamingLLMProvider interface {
ChatStream(ctx context.Context, messages []Message, tools []ToolDefinition, model string, options map[string]interface{}, onDelta func(string)) (*LLMResponse, error)
}
StreamingLLMProvider is an optional capability interface for token-level streaming.
type ToolCall ¶
type ToolCall struct {
ID string `json:"id"`
Type string `json:"type,omitempty"`
Function *FunctionCall `json:"function,omitempty"`
Name string `json:"name,omitempty"`
Arguments map[string]interface{} `json:"arguments,omitempty"`
}
type ToolDefinition ¶
type ToolFunctionDefinition ¶
Click to show internal directories.
Click to hide internal directories.