NewExecutor 创建执行计划执行器 toolMap: 工具名称到工具实例的映射
(toolMap map[string]tools.Tool, opts ...ExecutorOption)
| 56 | // NewExecutor 创建执行计划执行器 |
| 57 | // toolMap: 工具名称到工具实例的映射 |
| 58 | func NewExecutor(toolMap map[string]tools.Tool, opts ...ExecutorOption) *Executor { |
| 59 | e := &Executor{ |
| 60 | tools: toolMap, |
| 61 | } |
| 62 | |
| 63 | for _, opt := range opts { |
| 64 | opt(e) |
| 65 | } |
| 66 | |
| 67 | return e |
| 68 | } |
| 69 | |
| 70 | // Execute 执行计划 |
| 71 | func (e *Executor) Execute(ctx context.Context, plan *ExecutionPlan, toolCtx *tools.ToolContext) error { |
no outgoing calls