llm

package
v0.6.36 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ProviderClaude = "claude"
View Source
const ProviderCodex = "codex"
View Source
const ProviderGemini = "gemini"
View Source
const ProviderKimi = "kimi"

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Run(ctx context.Context, req RunRequest) (RunResult, error)
}

func NewBackend

func NewBackend(cfg FactoryConfig) (Backend, error)

type ClaudeConfig

type ClaudeConfig struct {
	Command      string
	Timeout      time.Duration
	Env          map[string]string
	PromptPrefix string
	WorkspaceDir string
	// ProfileOverrides maps outer profile name -> per-profile runner overrides.
	ProfileOverrides map[string]ProfileRunnerConfig
}

type CodexConfig

type CodexConfig struct {
	Command            string
	Timeout            time.Duration
	DefaultIdleTimeout time.Duration
	HighIdleTimeout    time.Duration
	XHighIdleTimeout   time.Duration
	Model              string
	ReasoningEffort    string
	Env                map[string]string
	PromptPrefix       string
	WorkspaceDir       string
	DefaultExecPolicy  ExecPolicyConfig
	// ProfileOverrides maps outer profile name -> per-profile runner overrides.
	ProfileOverrides map[string]ProfileRunnerConfig
}

type ExecPolicyConfig added in v0.4.0

type ExecPolicyConfig struct {
	Sandbox        string
	AskForApproval string
	AddDirs        []string
}

type FactoryConfig

type FactoryConfig struct {
	Provider string
	Prompts  *prompting.Loader
	Codex    CodexConfig
	Claude   ClaudeConfig
	Gemini   GeminiConfig
	Kimi     KimiConfig
}

type GeminiConfig added in v0.5.10

type GeminiConfig struct {
	Command      string
	Timeout      time.Duration
	Env          map[string]string
	PromptPrefix string
	WorkspaceDir string
	// ProfileOverrides maps outer profile name -> per-profile runner overrides.
	ProfileOverrides map[string]ProfileRunnerConfig
}

type KimiConfig

type KimiConfig struct {
	Command      string
	Timeout      time.Duration
	Env          map[string]string
	PromptPrefix string
	WorkspaceDir string
	// ProfileOverrides maps outer profile name -> per-profile runner overrides.
	ProfileOverrides map[string]ProfileRunnerConfig
}

type MultiBackend added in v0.5.18

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

func NewMultiBackend added in v0.5.18

func NewMultiBackend(defaultProvider string, backends map[string]Backend) (*MultiBackend, error)

func (*MultiBackend) Run added in v0.5.18

func (m *MultiBackend) Run(ctx context.Context, req RunRequest) (RunResult, error)

type ProfileRunnerConfig added in v0.6.3

type ProfileRunnerConfig struct {
	Command         string
	Timeout         time.Duration
	PromptPrefix    string
	ProviderProfile string
	ExecPolicy      ExecPolicyConfig
}

ProfileRunnerConfig carries per-profile overrides for command, timeout, prompt prefix, and provider-specific profile selectors. Keyed by the outer llm_profiles map name (e.g. "executor", "reviewer").

type ProgressFunc

type ProgressFunc func(step string)

type Provider

type Provider interface {
	Backend() Backend
}

func NewProvider

func NewProvider(cfg FactoryConfig) (Provider, error)

type RunRequest

type RunRequest struct {
	ThreadID        string
	AgentName       string
	UserText        string
	Scene           string
	Provider        string
	Model           string
	Profile         string
	ReasoningEffort string
	Personality     string
	NoReplyToken    string
	PromptPrefix    string
	WorkspaceDir    string
	ExecPolicy      ExecPolicyConfig
	Env             map[string]string
	OnProgress      ProgressFunc
}

type RunResult

type RunResult struct {
	Reply        string
	NextThreadID string
	Usage        Usage
}

type Usage added in v0.5.27

type Usage struct {
	InputTokens       int64
	CachedInputTokens int64
	OutputTokens      int64
}

func (Usage) HasUsage added in v0.5.27

func (u Usage) HasUsage() bool

func (Usage) TotalTokens added in v0.5.27

func (u Usage) TotalTokens() int64

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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