agent

package
v0.0.13 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractInterruptInfo

func ExtractInterruptInfo(err error) (*compose.InterruptInfo, bool)

func NewChatModel

func NewChatModel(ctx context.Context, modelName, apiKey, baseURL string) (einomodel.ToolCallingChatModel, error)

NewChatModel creates a ToolCallingChatModel for the given model name.

Provider selection:

  • Pass a non-empty baseURL to force the OpenAI-compatible path (any provider).
  • Otherwise the provider is inferred from the model name via DetectProvider.

Required environment variables per provider (when apiKey is empty):

OpenAI/Grok  OPENAI_API_KEY / XAI_API_KEY
Anthropic    ANTHROPIC_API_KEY
Gemini       GOOGLE_API_KEY (or ADC credentials)

func WithCheckPointID

func WithCheckPointID(id string) compose.Option

func WithStateModifier

func WithStateModifier(fn func(ctx context.Context, path compose.NodePath, s any) error) compose.Option

Types

type Agent

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

func New

func New(ctx context.Context, wasmEnabled bool, chatModel model.ToolCallingChatModel, agentTools []tool.BaseTool) (*Agent, error)

func (*Agent) Close

func (a *Agent) Close() error

func (*Agent) Invoke

func (a *Agent) Invoke(ctx context.Context, input string, opts ...compose.Option) (string, error)

type InMemoryStore

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

func (*InMemoryStore) Get

func (s *InMemoryStore) Get(_ context.Context, checkPointID string) ([]byte, bool, error)

func (*InMemoryStore) Set

func (s *InMemoryStore) Set(_ context.Context, checkPointID string, checkPoint []byte) error

type Provider

type Provider string

Provider identifies the LLM backend.

const (
	ProviderOpenAI    Provider = "openai"
	ProviderAnthropic Provider = "anthropic"
	ProviderGemini    Provider = "gemini"
	ProviderGrok      Provider = "grok"
)

func DetectProvider

func DetectProvider(modelName string) Provider

DetectProvider infers the provider from the model name when the caller has not set an explicit base URL or provider hint.

  • "claude-*" → Anthropic
  • "gemini-*" → Gemini
  • "grok-*" → Grok (xAI)
  • everything else → OpenAI

type State

type State struct {
	History   []*schema.Message
	UserInput string
}

Directories

Path Synopsis
Package tui provides the interactive terminal UI for the memsh AI agent.
Package tui provides the interactive terminal UI for the memsh AI agent.

Jump to

Keyboard shortcuts

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