Documentation
¶
Index ¶
- func HTTPStatusFromError(err error) int
- func IsContextOverflowError(err error) bool
- func IsRetryableError(err error) bool
- func MustToolCall(name, args string) agentkit.ToolCall
- func NewOpenAI(cfg OpenAIConfig, deps OpenAIDeps) (agentkit.LLMProvider, error)
- func NewScripted(cfg ScriptedConfig) (agentkit.LLMProvider, error)
- func SleepContext(ctx context.Context, delay time.Duration) error
- type LLMRetryConfig
- type OpenAI
- type OpenAIConfig
- type OpenAIDeps
- type OpenAIReasoningConfig
- type ProviderRetrySettings
- type Scripted
- type ScriptedConfig
- type ScriptedStep
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPStatusFromError ¶
func IsContextOverflowError ¶
IsContextOverflowError reports context-length failures that should use compaction instead of retry.
func IsRetryableError ¶
IsRetryableError reports whether an error looks transient and safe to retry. Context overflow and quota exhaustion are excluded.
func MustToolCall ¶
func NewOpenAI ¶
func NewOpenAI(cfg OpenAIConfig, deps OpenAIDeps) (agentkit.LLMProvider, error)
NewOpenAI registers llm/openai-compatible: OpenAI-compatible provider, chat or responses API.
Best practices:
- Token budgets and compaction/token-limit need reported usage; the chat API supplies it, the responses API may not.
func NewScripted ¶
func NewScripted(cfg ScriptedConfig) (agentkit.LLMProvider, error)
NewScripted registers llm/scripted: Deterministic canned responses. For tests and offline smoke runs.
Types ¶
type LLMRetryConfig ¶
type LLMRetryConfig struct {
Provider *ProviderRetrySettings `json:"provider,omitempty"`
}
type OpenAIConfig ¶
type OpenAIConfig struct {
// Model is model name.
Model string `json:"model"`
// BaseURL is API base URL, e.g. https://api.openai.com/v1.
BaseURL string `json:"baseUrl"`
// APIKey is inline key. Prefer APIKeyRef so the secret stays out of the config file.
APIKey string `json:"apiKey"`
// APIKeyRef is credentials reference, e.g. env:OPENAI_API_KEY.
APIKeyRef string `json:"apiKeyRef"`
// API is chat or responses.
API string `json:"api"`
// Reasoning is reasoning effort and summary settings, for models that support them.
Reasoning *OpenAIReasoningConfig `json:"reasoning,omitempty"`
// Retry is provider-level retry, separate from the agent's per-step retry.
Retry *LLMRetryConfig `json:"retry,omitempty"`
}
type OpenAIDeps ¶
type OpenAIDeps struct {
Credentials credentials.Store `json:"credentials,omitempty"`
}
type OpenAIReasoningConfig ¶
type ProviderRetrySettings ¶
type Scripted ¶
type Scripted struct {
// contains filtered or unexported fields
}
Scripted replays fixed assistant responses for tests. One instance can be shared by several sessions (a multiplex or concurrent-dispatch preset), so the step cursor is guarded.
type ScriptedConfig ¶
type ScriptedConfig struct {
// Model is name reported back to callers.
Model string `json:"model"`
// Steps are replies in order: text, tool calls, or both.
Steps []ScriptedStep `json:"steps"`
}
type ScriptedStep ¶
Click to show internal directories.
Click to hide internal directories.