executor

package
v0.0.0-...-52c304b Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextManager

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

ContextManager 上下文管理器

func NewContextManager

func NewContextManager(maxMessages, maxTokens int) *ContextManager

NewContextManager 创建上下文管理器

func (*ContextManager) AddMessage

func (cm *ContextManager) AddMessage(msg *schema.Message)

AddMessage 添加消息到上下文

func (*ContextManager) GetMessages

func (cm *ContextManager) GetMessages() []*schema.Message

GetMessages 获取当前上下文

type EventManager

type EventManager interface {
	SendToolPlanStart(messageID string) error
	SendToolPlanThinking(messageID, content string) error
	SendToolPlanComplete(messageID string, stepsCount int, needTools bool) error
}

EventManager 事件管理器接口

type SequentialToolExecutor

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

SequentialToolExecutor 顺序工具执行器

func NewSequentialToolExecutor

func NewSequentialToolExecutor(
	modelID string,
	toolManager ToolManager,
	eventMgr StreamEventManager,
	toolRegistry registry.ToolRegistry,
	historyManager *history.Manager,
	traceID string,
) *SequentialToolExecutor

NewSequentialToolExecutor 创建顺序工具执行器

func (*SequentialToolExecutor) ExecuteToolsWithPlan

func (e *SequentialToolExecutor) ExecuteToolsWithPlan(
	ctx context.Context,
	plan *schema.ToolExecutionPlan,
	toolConfigs []*v1.ToolConfig,
	convID string,
	modelID string,
	originalQuery string,
) ([]*schema.Message, []*schema.ToolResult, error)

ExecuteToolsWithPlan 按计划顺序执行工具

type StreamEventManager

type StreamEventManager interface {
	SendToolExecutionStart(messageID, stepID, toolName, reason string) error
	SendToolExecutionComplete(messageID, stepID, toolName, resultSummary string) error
	SendToolExecutionError(messageID, stepID, toolName, errorMsg string) error
}

StreamEventManager 流式事件管理器接口

type ToolManager

type ToolManager interface {
	ExecuteTool(ctx context.Context, toolName string, params map[string]interface{}) (*schema.ToolResult, error)
}

ToolManager 工具管理器接口

type ToolPlanGenerator

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

ToolPlanGenerator 工具执行计划生成器

func NewToolPlanGenerator

func NewToolPlanGenerator(modelID string) *ToolPlanGenerator

NewToolPlanGenerator 创建工具执行计划生成器

func (*ToolPlanGenerator) GeneratePlan

func (g *ToolPlanGenerator) GeneratePlan(
	ctx context.Context,
	originalQuery string,
	rewrittenQuery string,
	toolConfigs []*v1.ToolConfig,
	systemPrompt string,
	chatHistory []*schema.Message,
	eventMgr EventManager,
) (*schema.ToolExecutionPlan, error)

GeneratePlan 生成工具执行计划

func (*ToolPlanGenerator) LogPlan

func (gen *ToolPlanGenerator) LogPlan(ctx context.Context, plan *schema.ToolExecutionPlan)

LogPlan 记录工具执行计划

func (*ToolPlanGenerator) SetMCPTools

func (g *ToolPlanGenerator) SetMCPTools(mcpTools []*schema.ToolInfo)

SetMCPTools 设置MCP工具列表

func (*ToolPlanGenerator) ValidatePlan

func (g *ToolPlanGenerator) ValidatePlan(plan *schema.ToolExecutionPlan, toolConfigs []*v1.ToolConfig) error

ValidatePlan 验证工具执行计划

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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