llm

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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) 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
}

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) 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 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) 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

func NewProvider

func NewProvider(cfg *config.Config) (Provider, error)

NewProvider creates a new LLM provider based on the config

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
}

SuggestRequest contains all parameters for a suggestion request

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) 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)

Jump to

Keyboard shortcuts

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