Help us shape the future of Go! Take the 2026 Go Developer Survey

llm

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentConfig

type AgentConfig struct {
	WithModel string        `json:"with_model"`
	WithTools []string      `json:"with_tools"`
	MaxSteps  int           `json:"max_steps"`
	Prompt    prompt.Prompt `json:"prompt"`
}

type CallbackHandler

type CallbackHandler struct{}

func (CallbackHandler) OnEnd

func (CallbackHandler) OnEndWithStreamOutput

func (CallbackHandler) OnError

func (h CallbackHandler) OnError(ctx context.Context, info *callbacks.RunInfo, err error) context.Context

func (CallbackHandler) OnStart

func (CallbackHandler) OnStartWithStreamInput

type ChatModel

type ChatModel interface {
	model.ToolCallingChatModel
}

ChatModel is the interface for making LLM backend.

func NewChatModel

func NewChatModel(m ModelConfig) (model ChatModel)

type Generator

type Generator interface {
	// Call calls the LLM with the input.
	Call(ctx context.Context, input string) (string, error)
}

Generator is the interface for calling

func MakeAgent

func MakeAgent(source any, sysPrompt prompt.Prompt, models map[string]ChatModel, tools map[string]tool.Tool, executor AgentConfig) Generator

type ModelConfig

type ModelConfig struct {
	Name        string    `json:"name"` // alias of the config, not endpoint!
	APIType     ModelType `json:"type"`
	BaseURL     string    `json:"base_url"`
	APIKey      string    `json:"api_key"`
	ModelName   string    `json:"model_name"` // the endpoint of the model, like `claude-opus-4-20250514`
	Temperature *float32  `json:"temperature"`
	// TopP        *float32  `json:"top_p"`
	MaxTokens int `json:"max_tokens"`
}

type ModelType

type ModelType string
const (
	ModelTypeUnknown ModelType = ""
	ModelTypeOllama  ModelType = "ollama"
	ModelTypeARK     ModelType = "ark"
	ModelTypeOpenAI  ModelType = "openai" // Fixed typo in constant name
	ModelTypeClaude  ModelType = "claude"
)

func NewModelType

func NewModelType(t string) ModelType

type ReactAgent

type ReactAgent struct {
	*react.Agent
	// contains filtered or unexported fields
}

func NewReactAgent

func NewReactAgent(name string, opts ReactAgentOptions) *ReactAgent

func (*ReactAgent) Call

func (p *ReactAgent) Call(ctx context.Context, input string) (string, error)

type ReactAgentOptions

type ReactAgentOptions struct {
	SysPrompt prompt.Prompt `json:"-"`
	*react.AgentConfig
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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