providers

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCodexCliTokenSource added in v0.1.2

func CreateCodexCliTokenSource() func() (string, string, error)

CreateCodexCliTokenSource creates a token source that reads from ~/.codex/auth.json. This allows the existing CodexProvider to reuse Codex CLI credentials.

func ReadCodexCliCredentials added in v0.1.2

func ReadCodexCliCredentials() (accessToken, accountID string, expiresAt time.Time, err error)

ReadCodexCliCredentials reads OAuth tokens from the Codex CLI's auth.json file. Expiry is estimated as file modification time + 1 hour (same approach as moltbot).

Types

type ClaudeCliProvider added in v0.1.1

type ClaudeCliProvider struct {
	// contains filtered or unexported fields
}

ClaudeCliProvider implements LLMProvider using the claude CLI as a subprocess.

func NewClaudeCliProvider added in v0.1.1

func NewClaudeCliProvider(workspace string) *ClaudeCliProvider

NewClaudeCliProvider creates a new Claude CLI provider.

func (*ClaudeCliProvider) Chat added in v0.1.1

func (p *ClaudeCliProvider) Chat(ctx context.Context, messages []Message, tools []ToolDefinition, model string, options map[string]interface{}) (*LLMResponse, error)

Chat implements LLMProvider.Chat by executing the claude CLI.

func (*ClaudeCliProvider) GetDefaultModel added in v0.1.1

func (p *ClaudeCliProvider) GetDefaultModel() string

GetDefaultModel returns the default model identifier.

type ClaudeProvider added in v0.1.1

type ClaudeProvider struct {
	// contains filtered or unexported fields
}

func NewClaudeProvider added in v0.1.1

func NewClaudeProvider(token string) *ClaudeProvider

func NewClaudeProviderWithTokenSource added in v0.1.1

func NewClaudeProviderWithTokenSource(token string, tokenSource func() (string, error)) *ClaudeProvider

func (*ClaudeProvider) Chat added in v0.1.1

func (p *ClaudeProvider) Chat(ctx context.Context, messages []Message, tools []ToolDefinition, model string, options map[string]interface{}) (*LLMResponse, error)

func (*ClaudeProvider) GetDefaultModel added in v0.1.1

func (p *ClaudeProvider) GetDefaultModel() string

type CodexCliAuth added in v0.1.2

type CodexCliAuth struct {
	Tokens struct {
		AccessToken  string `json:"access_token"`
		RefreshToken string `json:"refresh_token"`
		AccountID    string `json:"account_id"`
	} `json:"tokens"`
}

CodexCliAuth represents the ~/.codex/auth.json file structure.

type CodexCliProvider added in v0.1.2

type CodexCliProvider struct {
	// contains filtered or unexported fields
}

CodexCliProvider implements LLMProvider by wrapping the codex CLI as a subprocess.

func NewCodexCliProvider added in v0.1.2

func NewCodexCliProvider(workspace string) *CodexCliProvider

NewCodexCliProvider creates a new Codex CLI provider.

func (*CodexCliProvider) Chat added in v0.1.2

func (p *CodexCliProvider) Chat(ctx context.Context, messages []Message, tools []ToolDefinition, model string, options map[string]interface{}) (*LLMResponse, error)

Chat implements LLMProvider.Chat by executing the codex CLI in non-interactive mode.

func (*CodexCliProvider) GetDefaultModel added in v0.1.2

func (p *CodexCliProvider) GetDefaultModel() string

GetDefaultModel returns the default model identifier.

type CodexProvider added in v0.1.1

type CodexProvider struct {
	// contains filtered or unexported fields
}

func NewCodexProvider added in v0.1.1

func NewCodexProvider(token, accountID string) *CodexProvider

func NewCodexProviderWithTokenSource added in v0.1.1

func NewCodexProviderWithTokenSource(token, accountID string, tokenSource func() (string, string, error)) *CodexProvider

func (*CodexProvider) Chat added in v0.1.1

func (p *CodexProvider) Chat(ctx context.Context, messages []Message, tools []ToolDefinition, model string, options map[string]interface{}) (*LLMResponse, error)

func (*CodexProvider) GetDefaultModel added in v0.1.1

func (p *CodexProvider) GetDefaultModel() string

type FunctionCall

type FunctionCall struct {
	Name      string `json:"name"`
	Arguments string `json:"arguments"`
}

type GitHubCopilotProvider added in v0.1.2

type GitHubCopilotProvider struct {
	// contains filtered or unexported fields
}

func NewGitHubCopilotProvider added in v0.1.2

func NewGitHubCopilotProvider(uri string, connectMode string, model string) (*GitHubCopilotProvider, error)

func (*GitHubCopilotProvider) Chat added in v0.1.2

func (p *GitHubCopilotProvider) Chat(ctx context.Context, messages []Message, tools []ToolDefinition, model string, options map[string]interface{}) (*LLMResponse, error)

Chat sends a chat request to GitHub Copilot

func (*GitHubCopilotProvider) GetDefaultModel added in v0.1.2

func (p *GitHubCopilotProvider) GetDefaultModel() string

type HTTPProvider

type HTTPProvider struct {
	// contains filtered or unexported fields
}

func NewHTTPProvider

func NewHTTPProvider(apiKey, apiBase, proxy string) *HTTPProvider

func (*HTTPProvider) Chat

func (p *HTTPProvider) Chat(ctx context.Context, messages []Message, tools []ToolDefinition, model string, options map[string]interface{}) (*LLMResponse, error)

func (*HTTPProvider) GetDefaultModel

func (p *HTTPProvider) GetDefaultModel() string

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)

type LLMResponse

type LLMResponse struct {
	Content      string     `json:"content"`
	ToolCalls    []ToolCall `json:"tool_calls,omitempty"`
	FinishReason string     `json:"finish_reason"`
	Usage        *UsageInfo `json:"usage,omitempty"`
}

type Message

type Message struct {
	Role       string     `json:"role"`
	Content    string     `json:"content"`
	ToolCalls  []ToolCall `json:"tool_calls,omitempty"`
	ToolCallID string     `json:"tool_call_id,omitempty"`
}

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 ToolDefinition struct {
	Type     string                 `json:"type"`
	Function ToolFunctionDefinition `json:"function"`
}

type ToolFunctionDefinition

type ToolFunctionDefinition struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	Parameters  map[string]interface{} `json:"parameters"`
}

type UsageInfo

type UsageInfo struct {
	PromptTokens     int `json:"prompt_tokens"`
	CompletionTokens int `json:"completion_tokens"`
	TotalTokens      int `json:"total_tokens"`
}

Jump to

Keyboard shortcuts

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