model

package
v0.0.0-...-b74feab Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model interface {
	NewState() State
	Generate(ctx context.Context, modelName string, st State, tools map[string]Tool,
		opts *Options) error
}

func NewAnthropicModel

func NewAnthropicModel(apiKey string, opts *Options) (Model, error)

func NewGeminiModel

func NewGeminiModel(apiKey string, opts *Options) (Model, error)

func NewOpenAIModel

func NewOpenAIModel(apiKey string, opts *Options) (Model, error)

type ModelInfo

type ModelInfo struct {
	Name        string
	DisplayName string    // Optional
	Created     time.Time // Optional
}

func ListAnthropicModels

func ListAnthropicModels(ctx context.Context, apiKey string) ([]ModelInfo, error)

func ListGeminiModels

func ListGeminiModels(ctx context.Context, apiKey string) ([]ModelInfo, error)

func ListOpenAIModels

func ListOpenAIModels(ctx context.Context, apiKey string) ([]ModelInfo, error)

type Options

type Options struct {
	Verbose  bool
	Trace    bool
	Thinking bool
}

type State

type State interface {
	SystemPrompt(s string)
	Prompt(s string)
	Len() int
	Step(n int) Step
	Clear()
}

type Step

type Step struct {
	Type    StepType
	Content string          // Prompt, ModelResponse, Thinking, and ToolOutput
	Name    string          // ToolCall and ToolOutput
	Input   json.RawMessage // ToolCall
}

type StepType

type StepType int
const (
	PromptStep StepType = iota
	ModelResponseStep
	ThinkingStep
	ToolCallStep
	ToolOutputStep
)

func (StepType) String

func (st StepType) String() string

type Tool

type Tool struct {
	Name        string
	Description string
	Func        ToolFunc
	Schema      ToolSchema
}

type ToolFunc

type ToolFunc func(ctx context.Context, buf []byte) (string, error)

type ToolSchema

type ToolSchema map[string]any

func MustToolSchema

func MustToolSchema[T any]() ToolSchema

func NewToolSchema

func NewToolSchema[T any]() (ToolSchema, error)

Jump to

Keyboard shortcuts

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