llm

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 10 Imported by: 0 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 ChatEvent

type ChatEvent struct {
	EventBase[*openai.ChatCompletion]
	// contains filtered or unexported fields
}

func (*ChatEvent) Cancel

func (c *ChatEvent) Cancel(ctx context.Context)

func (*ChatEvent) Consume

func (c *ChatEvent) Consume(ctx context.Context)

func (*ChatEvent) GetError

func (c *ChatEvent) GetError() error

func (*ChatEvent) GetResult

func (c *ChatEvent) GetResult() *openai.ChatCompletion

type ChatManager

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

func (*ChatManager) ClearHistory added in v0.3.0

func (cm *ChatManager) ClearHistory()

func (*ChatManager) Init

func (cm *ChatManager) Init(client *openai.Client, model string, systemPrompt string, mcpClients map[string]*McpClient)

func (*ChatManager) LoadHistory added in v0.3.0

func (cm *ChatManager) LoadHistory(r io.Reader)

func (*ChatManager) Post

func (cm *ChatManager) Post(ctx context.Context, message string, output chan Event) error

func (*ChatManager) Setup

func (cm *ChatManager) Setup()

type ConfirmEvent

type ConfirmEvent struct {
	EventBase[struct{}]
	ToolName string
	Approve  bool
}

func (*ConfirmEvent) Cancel

func (c *ConfirmEvent) Cancel(ctx context.Context)

func (*ConfirmEvent) Consume

func (c *ConfirmEvent) Consume(ctx context.Context)

func (*ConfirmEvent) GetError

func (c *ConfirmEvent) GetError() error

func (*ConfirmEvent) GetResult

func (c *ConfirmEvent) GetResult() struct{}

type ErrorEvent

type ErrorEvent struct {
	EventBase[error]
	// contains filtered or unexported fields
}

func (*ErrorEvent) Cancel

func (e *ErrorEvent) Cancel(ctx context.Context)

func (*ErrorEvent) Consume

func (e *ErrorEvent) Consume(ctx context.Context)

func (*ErrorEvent) GetError

func (e *ErrorEvent) GetError() error

func (*ErrorEvent) GetResult

func (e *ErrorEvent) GetResult() error

type Event

type Event interface {
	Consume(ctx context.Context)
	Cancel(ctx context.Context)
	GetError() error
}

type EventBase

type EventBase[T any] struct {
	// contains filtered or unexported fields
}

type LogEvent added in v0.3.0

func (*LogEvent) Cancel added in v0.3.0

func (l *LogEvent) Cancel(ctx context.Context)

func (*LogEvent) Consume added in v0.3.0

func (l *LogEvent) Consume(ctx context.Context)

func (*LogEvent) GetError added in v0.3.0

func (l *LogEvent) GetError() error

func (*LogEvent) GetResult added in v0.3.0

func (l *LogEvent) GetResult() LogResult

type LogResult added in v0.3.0

type LogResult struct {
}

type McpClient

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

func (*McpClient) Call

func (m *McpClient) Call(ctx context.Context, toolName string, args interface{}) (*mcp.CallToolResult, error)

func (*McpClient) Close

func (m *McpClient) Close()

func (*McpClient) Connect

func (m *McpClient) Connect(ctx context.Context, name string, args ...string) error

func (*McpClient) ConnectLocal

func (m *McpClient) ConnectLocal(ctx context.Context, server *mcp.Server) error

func (*McpClient) Init

func (m *McpClient) Init()

func (*McpClient) Tools

func (m *McpClient) Tools(ctx context.Context) ([]McpTool, error)

type McpTool

type McpTool struct {
	Name        string
	Description string
	Parameters  map[string]interface{}
}

type MessageEvent

type MessageEvent struct {
	EventBase[*openai.ChatCompletion]
}

func (*MessageEvent) Cancel

func (m *MessageEvent) Cancel(ctx context.Context)

func (*MessageEvent) Consume

func (m *MessageEvent) Consume(ctx context.Context)

func (*MessageEvent) GetError

func (m *MessageEvent) GetError() error

func (*MessageEvent) GetResult

func (m *MessageEvent) GetResult() *openai.ChatCompletion

type Status

type Status int
const (
	Complete Status = iota
	Error
	Cancel
)

type ToolEvent

type ToolEvent struct {
	EventBase[*mcp.CallToolResult]
	// contains filtered or unexported fields
}

func (*ToolEvent) Cancel

func (t *ToolEvent) Cancel(ctx context.Context)

func (*ToolEvent) Consume

func (t *ToolEvent) Consume(ctx context.Context)

func (*ToolEvent) GetError

func (t *ToolEvent) GetError() error

func (*ToolEvent) GetResult

func (t *ToolEvent) GetResult() *mcp.CallToolResult

Jump to

Keyboard shortcuts

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