Documentation
¶
Index ¶
- Variables
- func GetImageProviderNames() []string
- func GetProviderCompletions(toComplete string, isImage bool) []string
- func GetProviderNames() []string
- func IsCodexModel(model string) bool
- func ParseProviderModel(s string) (string, string, error)
- type AnthropicProvider
- func (p *AnthropicProvider) GetEdits(ctx context.Context, systemPrompt, userPrompt string, debug bool) ([]EditToolCall, error)
- func (p *AnthropicProvider) Name() string
- func (p *AnthropicProvider) StreamResponse(ctx context.Context, req AskRequest, output chan<- string) error
- func (p *AnthropicProvider) SuggestCommands(ctx context.Context, req SuggestRequest) ([]CommandSuggestion, error)
- type AskRequest
- type CodeAssistProvider
- type CodexProvider
- func (p *CodexProvider) GetEdits(ctx context.Context, systemPrompt, userPrompt string, debug bool) ([]EditToolCall, error)
- func (p *CodexProvider) GetUnifiedDiff(ctx context.Context, systemPrompt, userPrompt string, debug bool) (string, error)
- func (p *CodexProvider) Name() string
- func (p *CodexProvider) StreamResponse(ctx context.Context, req AskRequest, output chan<- string) error
- func (p *CodexProvider) SuggestCommands(ctx context.Context, req SuggestRequest) ([]CommandSuggestion, error)
- type CommandSuggestion
- type EditToolCall
- type EditToolProvider
- type GeminiOAuthCredentials
- type GeminiProvider
- type OpenAIProvider
- func (p *OpenAIProvider) GetEdits(ctx context.Context, systemPrompt, userPrompt string, debug bool) ([]EditToolCall, error)
- func (p *OpenAIProvider) GetUnifiedDiff(ctx context.Context, systemPrompt, userPrompt string, debug bool) (string, error)
- func (p *OpenAIProvider) Name() string
- func (p *OpenAIProvider) StreamResponse(ctx context.Context, req AskRequest, output chan<- string) error
- func (p *OpenAIProvider) SuggestCommands(ctx context.Context, req SuggestRequest) ([]CommandSuggestion, error)
- type Provider
- type SuggestRequest
- type UnifiedDiffProvider
- type ZenProvider
- func (p *ZenProvider) GetEdits(ctx context.Context, systemPrompt, userPrompt string, debug bool) ([]EditToolCall, error)
- func (p *ZenProvider) Name() string
- func (p *ZenProvider) StreamResponse(ctx context.Context, req AskRequest, output chan<- string) error
- func (p *ZenProvider) SuggestCommands(ctx context.Context, req SuggestRequest) ([]CommandSuggestion, error)
Constants ¶
This section is empty.
Variables ¶
var ImageProviderModels = map[string][]string{
"gemini": {"gemini-2.5-flash-image", "gemini-3-pro-image-preview"},
"openai": {"gpt-image-1.5", "gpt-image-1-mini"},
"flux": {"flux-2-pro", "flux-kontext-pro", "flux-2-max"},
}
var ProviderModels = map[string][]string{
"anthropic": {
"claude-sonnet-4-5",
"claude-sonnet-4-5-thinking",
"claude-opus-4-5",
"claude-opus-4-5-thinking",
"claude-haiku-4-5",
"claude-haiku-4-5-thinking",
},
"openai": {
"gpt-5.2",
"gpt-5.2-high",
"gpt-5.2-codex",
"gpt-5.2-codex-medium",
"gpt-5.2-codex-high",
"gpt-5.2-codex-xhigh",
"gpt-4.1",
},
"gemini": {
"gemini-3-pro-preview",
"gemini-3-flash-preview",
"gemini-2.5-flash",
"gemini-2.5-flash-lite",
},
"zen": {
"glm-4.7-free",
"grok-code",
"minimax-m2.1-free",
"big-pickle",
"gpt-5-nano",
},
}
ProviderModels contains the curated list of common models per LLM provider
Functions ¶
func GetImageProviderNames ¶ added in v0.0.6
func GetImageProviderNames() []string
GetImageProviderNames returns valid provider names for image generation
func GetProviderCompletions ¶ added in v0.0.6
GetProviderCompletions returns completions for the --provider flag It handles both provider-only and provider:model completion scenarios
func GetProviderNames ¶ added in v0.0.6
func GetProviderNames() []string
GetProviderNames returns valid provider names for LLM
func IsCodexModel ¶ added in v0.0.6
IsCodexModel returns true if the model name indicates a Codex model which works better with unified diff format (single tool call).
Types ¶
type AnthropicProvider ¶
type AnthropicProvider struct {
// contains filtered or unexported fields
}
AnthropicProvider implements Provider using the Anthropic API
func NewAnthropicProvider ¶
func NewAnthropicProvider(apiKey, model string) *AnthropicProvider
func (*AnthropicProvider) GetEdits ¶ added in v0.0.5
func (p *AnthropicProvider) GetEdits(ctx context.Context, systemPrompt, userPrompt string, debug bool) ([]EditToolCall, error)
GetEdits calls the LLM once with the edit tool and returns all proposed edits
func (*AnthropicProvider) Name ¶
func (p *AnthropicProvider) Name() string
func (*AnthropicProvider) StreamResponse ¶
func (p *AnthropicProvider) StreamResponse(ctx context.Context, req AskRequest, output chan<- string) error
func (*AnthropicProvider) SuggestCommands ¶
func (p *AnthropicProvider) SuggestCommands(ctx context.Context, req SuggestRequest) ([]CommandSuggestion, error)
type AskRequest ¶
type AskRequest struct {
Question string
Instructions string // Custom system prompt
EnableSearch bool
Debug bool
Files []input.FileContent // Files to include as context
Stdin string // Content piped via stdin
}
AskRequest contains parameters for asking a question
type CodeAssistProvider ¶
type CodeAssistProvider struct {
// contains filtered or unexported fields
}
CodeAssistProvider implements Provider using Google Code Assist API with OAuth
func NewCodeAssistProvider ¶
func NewCodeAssistProvider(creds *GeminiOAuthCredentials, model string) *CodeAssistProvider
func (*CodeAssistProvider) Name ¶
func (p *CodeAssistProvider) Name() string
func (*CodeAssistProvider) StreamResponse ¶
func (p *CodeAssistProvider) StreamResponse(ctx context.Context, req AskRequest, output chan<- string) error
func (*CodeAssistProvider) SuggestCommands ¶
func (p *CodeAssistProvider) SuggestCommands(ctx context.Context, req SuggestRequest) ([]CommandSuggestion, error)
type CodexProvider ¶
type CodexProvider struct {
// contains filtered or unexported fields
}
CodexProvider implements Provider using the ChatGPT backend API with Codex OAuth
func NewCodexProvider ¶
func NewCodexProvider(accessToken, model, accountID string) *CodexProvider
func (*CodexProvider) GetEdits ¶ added in v0.0.6
func (p *CodexProvider) GetEdits(ctx context.Context, systemPrompt, userPrompt string, debug bool) ([]EditToolCall, error)
GetEdits calls the LLM with the edit tool and returns all proposed edits
func (*CodexProvider) GetUnifiedDiff ¶ added in v0.0.6
func (p *CodexProvider) GetUnifiedDiff(ctx context.Context, systemPrompt, userPrompt string, debug bool) (string, error)
GetUnifiedDiff calls the LLM with the unified_diff tool and returns the diff string. This is more efficient for Codex models which are fine-tuned for single tool calls.
func (*CodexProvider) Name ¶
func (p *CodexProvider) Name() string
func (*CodexProvider) StreamResponse ¶
func (p *CodexProvider) StreamResponse(ctx context.Context, req AskRequest, output chan<- string) error
func (*CodexProvider) SuggestCommands ¶
func (p *CodexProvider) SuggestCommands(ctx context.Context, req SuggestRequest) ([]CommandSuggestion, error)
type CommandSuggestion ¶
type CommandSuggestion struct {
Command string `json:"command"`
Explanation string `json:"explanation"`
Likelihood int `json:"likelihood"` // 1-10, how likely this matches user intent
}
CommandSuggestion represents a single command suggestion from the LLM
type EditToolCall ¶ added in v0.0.5
type EditToolCall struct {
FilePath string `json:"file_path"`
OldString string `json:"old_string"`
NewString string `json:"new_string"`
}
EditToolCall represents a single edit tool call (find/replace)
type EditToolProvider ¶ added in v0.0.5
type EditToolProvider interface {
GetEdits(ctx context.Context, systemPrompt, userPrompt string, debug bool) ([]EditToolCall, error)
}
EditToolProvider is an optional interface for providers that support the edit tool
type GeminiOAuthCredentials ¶
type GeminiOAuthCredentials struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiryDate int64 `json:"expiry_date"`
}
GeminiOAuthCredentials holds the OAuth credentials loaded from ~/.gemini/oauth_creds.json
type GeminiProvider ¶
type GeminiProvider struct {
// contains filtered or unexported fields
}
GeminiProvider implements Provider using the Google Gemini API
func NewGeminiProvider ¶
func NewGeminiProvider(apiKey, model string, _ bool) *GeminiProvider
func (*GeminiProvider) Name ¶
func (p *GeminiProvider) Name() string
func (*GeminiProvider) StreamResponse ¶
func (p *GeminiProvider) StreamResponse(ctx context.Context, req AskRequest, output chan<- string) error
func (*GeminiProvider) SuggestCommands ¶
func (p *GeminiProvider) SuggestCommands(ctx context.Context, req SuggestRequest) ([]CommandSuggestion, error)
type OpenAIProvider ¶
type OpenAIProvider struct {
// contains filtered or unexported fields
}
OpenAIProvider implements Provider using the standard OpenAI API
func NewOpenAIProvider ¶
func NewOpenAIProvider(apiKey, model string) *OpenAIProvider
func (*OpenAIProvider) GetEdits ¶ added in v0.0.5
func (p *OpenAIProvider) GetEdits(ctx context.Context, systemPrompt, userPrompt string, debug bool) ([]EditToolCall, error)
GetEdits calls the LLM with the edit tool and returns all proposed edits
func (*OpenAIProvider) GetUnifiedDiff ¶ added in v0.0.6
func (p *OpenAIProvider) GetUnifiedDiff(ctx context.Context, systemPrompt, userPrompt string, debug bool) (string, error)
GetUnifiedDiff calls the LLM with the unified_diff tool and returns the diff string. This is more efficient for Codex models which are fine-tuned for single tool calls.
func (*OpenAIProvider) Name ¶
func (p *OpenAIProvider) Name() string
func (*OpenAIProvider) StreamResponse ¶
func (p *OpenAIProvider) StreamResponse(ctx context.Context, req AskRequest, output chan<- string) error
func (*OpenAIProvider) SuggestCommands ¶
func (p *OpenAIProvider) SuggestCommands(ctx context.Context, req SuggestRequest) ([]CommandSuggestion, error)
type Provider ¶
type Provider interface {
// Name returns the provider name for logging/debugging
Name() string
// SuggestCommands generates command suggestions based on user input
SuggestCommands(ctx context.Context, req SuggestRequest) ([]CommandSuggestion, error)
// StreamResponse streams a text response for the ask command
StreamResponse(ctx context.Context, req AskRequest, output chan<- string) error
}
Provider is the interface for LLM providers
type SuggestRequest ¶
type SuggestRequest struct {
UserInput string
Shell string
Instructions string // Custom user instructions/context
NumSuggestions int // Number of suggestions to request (default 3)
EnableSearch bool
Debug bool
Files []input.FileContent // Files to include as context
Stdin string // Content piped via stdin
}
SuggestRequest contains all parameters for a suggestion request
type UnifiedDiffProvider ¶ added in v0.0.6
type UnifiedDiffProvider interface {
GetUnifiedDiff(ctx context.Context, systemPrompt, userPrompt string, debug bool) (string, error)
}
UnifiedDiffProvider is an optional interface for providers that support unified diff format. This is more efficient for models fine-tuned on single tool calls (e.g., Codex models).
type ZenProvider ¶ added in v0.0.2
type ZenProvider struct {
// contains filtered or unexported fields
}
ZenProvider implements Provider using the OpenCode Zen API Zen provides free access to models like GLM 4.7 via opencode.ai API key is optional: empty for free tier, or set for paid models
func NewZenProvider ¶ added in v0.0.2
func NewZenProvider(apiKey, model string) *ZenProvider
func (*ZenProvider) GetEdits ¶ added in v0.0.5
func (p *ZenProvider) GetEdits(ctx context.Context, systemPrompt, userPrompt string, debug bool) ([]EditToolCall, error)
GetEdits calls the LLM with the edit tool and returns all proposed edits
func (*ZenProvider) Name ¶ added in v0.0.2
func (p *ZenProvider) Name() string
func (*ZenProvider) StreamResponse ¶ added in v0.0.2
func (p *ZenProvider) StreamResponse(ctx context.Context, req AskRequest, output chan<- string) error
func (*ZenProvider) SuggestCommands ¶ added in v0.0.2
func (p *ZenProvider) SuggestCommands(ctx context.Context, req SuggestRequest) ([]CommandSuggestion, error)