simpleai

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AITerminal

type AITerminal struct {
	Config       *ChatConfig
	Completer    *readline.PrefixCompleter
	CurrentTopic string
}

func (*AITerminal) Run

func (at *AITerminal) Run()

type ChatConfig

type ChatConfig struct {
	Temperature float32
	MaxTokens   int
	APITimeout  time.Duration
	Model       string
	Provider    string
}

ChatConfig 基础设置

type ChatSession

type ChatSession struct {
	Context []string
	History []string

	// ContextLimit value
	ContextLimit int
	CurrentTopic string
	// contains filtered or unexported fields
}

func (*ChatSession) CreateTopic

func (s *ChatSession) CreateTopic(name string)

func (*ChatSession) SwitchTopic

func (s *ChatSession) SwitchTopic(name string)

type ChatTopic

type ChatTopic struct {
	ID      string
	Name    string
	Context []string
	History []string
}

type DefaultValidator

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

func (*DefaultValidator) Validate

func (v *DefaultValidator) Validate(call FunctionCall) error

type FunctionCall

type FunctionCall = openai.FunctionCall

FunctionCall 函数调用请求

type FunctionHandler

type FunctionHandler func(ctx context.Context, params maputil.Map) (any, error)

type FunctionSpec

type FunctionSpec = openai.FunctionDefinition

FunctionSpec 函数调用元数据

type SessionManager

type SessionManager struct {
}

type ToolCallValidator

type ToolCallValidator interface {
	Validate(call FunctionCall) error
}

type ToolRegistry

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

ToolRegistry 工具函数注册表

func NewToolRegistry

func NewToolRegistry() *ToolRegistry

NewToolRegistry 初始化函数注册表

func (*ToolRegistry) CallHandler

func (tr *ToolRegistry) CallHandler(ctx context.Context, call FunctionCall) (any, error)

CallHandler 处理函数调用

func (*ToolRegistry) Handler

func (tr *ToolRegistry) Handler(name string) (FunctionHandler, bool)

Handler get by name

func (*ToolRegistry) Register

func (tr *ToolRegistry) Register(spec FunctionSpec, handler FunctionHandler) error

Register 注册函数

func (*ToolRegistry) Specs

func (tr *ToolRegistry) Specs() []FunctionSpec

type TopicManager

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

Jump to

Keyboard shortcuts

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