llm

package
v0.0.0-...-d8be1ab Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadAgentsMD

func LoadAgentsMD() (string, error)

LoadAgentsMD loads the AGENTS.md file content from the current working directory

func PrependAgentsContext

func PrependAgentsContext(systemPrompt string) string

PrependAgentsContext prepends AGENTS.md content to the system prompt if available

Types

type AnthropicProvider

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

func NewAnthropicProvider

func NewAnthropicProvider(apiKey string, model string) (*AnthropicProvider, error)

func (*AnthropicProvider) Generate

func (p *AnthropicProvider) Generate(ctx context.Context, prompt string) (string, error)

func (*AnthropicProvider) GenerateWithHistory

func (p *AnthropicProvider) GenerateWithHistory(ctx context.Context, messages []Message, opts GenerateOptions) (string, error)

func (*AnthropicProvider) GenerateWithOptions

func (p *AnthropicProvider) GenerateWithOptions(ctx context.Context, prompt string, opts GenerateOptions) (string, error)

func (*AnthropicProvider) GetCurrentModel

func (p *AnthropicProvider) GetCurrentModel() Model

func (*AnthropicProvider) GetName

func (p *AnthropicProvider) GetName() string

func (*AnthropicProvider) ListModels

func (p *AnthropicProvider) ListModels(ctx context.Context) ([]Model, error)

func (*AnthropicProvider) SetModel

func (p *AnthropicProvider) SetModel(model Model)

func (*AnthropicProvider) Stream

func (p *AnthropicProvider) Stream(ctx context.Context, prompt string) (<-chan StreamResponse, error)

type GenerateOptions

type GenerateOptions struct {
	Temperature  float32
	MaxTokens    int
	SystemPrompt string
	Model        string
}

type Message

type Message struct {
	Role    string `json:"role"` // "user" or "assistant"
	Content string `json:"content"`
}

type Model

type Model struct {
	Name       string       `json:"name"`
	Size       int64        `json:"size"`
	Digest     string       `json:"digest"`
	ModifiedAt string       `json:"modified_at,omitempty"`
	Details    ModelDetails `json:"details,omitempty"`
}

type ModelDetails

type ModelDetails struct {
	Format            string   `json:"format"`
	Family            string   `json:"family"`
	Families          []string `json:"families"`
	ParameterSize     string   `json:"parameter_size"`
	QuantizationLevel string   `json:"quantization_level"`
}

type OllamaProvider

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

func NewOllamaProvider

func NewOllamaProvider(baseURL, model string) (*OllamaProvider, error)

func (*OllamaProvider) Generate

func (p *OllamaProvider) Generate(ctx context.Context, prompt string) (string, error)

func (*OllamaProvider) GenerateWithHistory

func (p *OllamaProvider) GenerateWithHistory(ctx context.Context, messages []Message, opts GenerateOptions) (string, error)

func (*OllamaProvider) GenerateWithOptions

func (p *OllamaProvider) GenerateWithOptions(ctx context.Context, prompt string, opts GenerateOptions) (string, error)

func (*OllamaProvider) GetCurrentModel

func (p *OllamaProvider) GetCurrentModel() Model

func (*OllamaProvider) GetName

func (p *OllamaProvider) GetName() string

func (*OllamaProvider) ListModels

func (p *OllamaProvider) ListModels(ctx context.Context) ([]Model, error)

func (*OllamaProvider) SetModel

func (p *OllamaProvider) SetModel(model Model)

func (*OllamaProvider) Stream

func (p *OllamaProvider) Stream(ctx context.Context, prompt string) (<-chan StreamResponse, error)

type Provider

type Provider interface {
	Generate(ctx context.Context, prompt string) (string, error)
	GenerateWithOptions(ctx context.Context, prompt string, opts GenerateOptions) (string, error)
	GenerateWithHistory(ctx context.Context, messages []Message, opts GenerateOptions) (string, error)
	Stream(ctx context.Context, prompt string) (<-chan StreamResponse, error)
	ListModels(ctx context.Context) ([]Model, error)
	GetCurrentModel() Model
	SetModel(model Model)
	GetName() string
}

func NewProvider

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

type StreamResponse

type StreamResponse struct {
	Content string
	Error   error
	Done    bool
}

Jump to

Keyboard shortcuts

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