models

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent interface {
	Generate(context.Context, string) (any, error)
	GenerateWithFiles(context.Context, string, []File) (any, error)
}

func NewGeminiLLM

func NewGeminiLLM(ctx context.Context, model string, promptPrefix string) (Agent, error)

func NewLLMProvider

func NewLLMProvider(ctx context.Context, provider string, model string, promptPrefix string) (Agent, error)

NewLLMProvider returns a concrete Agent.

type AnthropicLLM

type AnthropicLLM struct {
	Client       *anthropic.Client
	Model        string
	MaxTokens    int
	PromptPrefix string
}

AnthropicLLM implements your Agent interface using Anthropic's Messages API.

func NewAnthropicLLM

func NewAnthropicLLM(model, promptPrefix string) *AnthropicLLM

NewAnthropicLLM constructs a client. It reads ANTHROPIC_API_KEY from the env.

func (*AnthropicLLM) Generate

func (a *AnthropicLLM) Generate(ctx context.Context, prompt string) (any, error)

Generate performs a single-turn completion and returns concatenated text.

func (*AnthropicLLM) GenerateWithFiles

func (a *AnthropicLLM) GenerateWithFiles(ctx context.Context, prompt string, files []File) (any, error)

type DummyLLM

type DummyLLM struct {
	Prefix string
}

DummyLLM is a lightweight model implementation useful for local testing without API calls.

func NewDummyLLM

func NewDummyLLM(prefix string) *DummyLLM

func (*DummyLLM) Generate

func (d *DummyLLM) Generate(_ context.Context, prompt string) (any, error)

func (*DummyLLM) GenerateWithFiles

func (d *DummyLLM) GenerateWithFiles(ctx context.Context, prompt string, files []File) (any, error)

type File

type File struct {
	Name string
	MIME string
	Data []byte
}

File is a lightweight in-memory attachment. Name is used for display; MIME should be best-effort (e.g., "text/markdown").

type GeminiLLM

type GeminiLLM struct {
	Client       *genai.Client
	Model        string
	PromptPrefix string
}

func (*GeminiLLM) Generate

func (g *GeminiLLM) Generate(ctx context.Context, prompt string) (any, error)

func (*GeminiLLM) GenerateWithFiles

func (g *GeminiLLM) GenerateWithFiles(ctx context.Context, prompt string, files []File) (any, error)

type OllamaLLM

type OllamaLLM struct {
	Client       *ollama.Client
	Model        string
	PromptPrefix string
	// contains filtered or unexported fields
}

func NewOllamaLLM

func NewOllamaLLM(model string, promptPrefix string) (*OllamaLLM, error)

func (*OllamaLLM) Generate

func (o *OllamaLLM) Generate(ctx context.Context, prompt string) (any, error)

func (*OllamaLLM) GenerateWithFiles

func (o *OllamaLLM) GenerateWithFiles(ctx context.Context, prompt string, files []File) (any, error)

func (*OllamaLLM) WebSearch added in v0.6.5

func (o *OllamaLLM) WebSearch(ctx context.Context, query string, limit int) ([]map[string]string, error)

WebSearch queries the Ollama Web Search API and returns top results.

type OpenAILLM

type OpenAILLM struct {
	Client       *openai.Client
	Model        string
	PromptPrefix string
}

func NewOpenAILLM

func NewOpenAILLM(model string, promptPrefix string) *OpenAILLM

func (*OpenAILLM) Generate

func (o *OpenAILLM) Generate(ctx context.Context, prompt string) (any, error)

func (*OpenAILLM) GenerateWithFiles

func (o *OpenAILLM) GenerateWithFiles(ctx context.Context, prompt string, files []File) (any, error)

Jump to

Keyboard shortcuts

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