FunctionAgent
定义于:.build/typescript/packages/workflow/src/agent/function-agent.ts:110
工作流智能体的基础接口
new FunctionAgent(
__namedParameters):FunctionAgent
定义于:.build/typescript/packages/workflow/src/agent/function-agent.ts:118
__namedParameters
Section titled “__namedParameters”FunctionAgent
readonly名称:string
定义于:.build/typescript/packages/workflow/src/agent/function-agent.ts:111
systemPrompt
Section titled “systemPrompt”
readonlysystemPrompt:string
定义于:.build/typescript/packages/workflow/src/agent/function-agent.ts:112
BaseWorkflowAgent.systemPrompt
readonly描述:string
定义于:.build/typescript/packages/workflow/src/agent/function-agent.ts:113
大语言模型
Section titled “llm”
readonlyllm:ToolCallLLM
定义于:.build/typescript/packages/workflow/src/agent/function-agent.ts:114
readonly工具:BaseToolWithCall[]
定义于:.build/typescript/packages/workflow/src/agent/function-agent.ts:115
canHandoffTo
Section titled “canHandoffTo”
readonly可转交给:string[]
定义于:.build/typescript/packages/workflow/src/agent/function-agent.ts:116
BaseWorkflowAgent.canHandoffTo
getStructuredOutput()
Section titled “getStructuredOutput()”getStructuredOutput(
responseFormat,response):Promise<any>
定义于:.build/typescript/packages/workflow/src/agent/function-agent.ts:139
获取最终响应并将其转换为结构化输出
responseFormat
Section titled “responseFormat”ZodSchema
ChatMessage
Promise<any>
BaseWorkflowAgent.getStructuredOutput
takeStep()
Section titled “takeStep()”takeStep(
ctx,state,llmInput,tools):Promise<AgentOutput>
定义于:.build/typescript/packages/workflow/src/agent/function-agent.ts:181
使用智能体执行单步操作 直接使用内存获取消息,无需传入消息
WorkflowContext
llmInput
Section titled “llmInput”ChatMessage[]
BaseToolWithCall[]
Promise<AgentOutput>
handleToolCallResults()
Section titled “handleToolCallResults()”handleToolCallResults(
state,results):Promise<void>
定义于:.build/typescript/packages/workflow/src/agent/function-agent.ts:242
处理工具调用的结果
Promise<void>
BaseWorkflowAgent.handleToolCallResults
finalize()
Section titled “finalize()”finalize(
state,output):Promise<AgentOutput>
定义于:.build/typescript/packages/workflow/src/agent/function-agent.ts:268
完成智能体的输出
Promise<AgentOutput>
fromWorkflowStep()
Section titled “fromWorkflowStep()”
staticfromWorkflowStep(__namedParameters):FunctionAgent
定义于:.build/typescript/packages/workflow/src/agent/function-agent.ts:339
创建一个FunctionAgent来处理工作流中的一个步骤。
__namedParameters
Section titled “__namedParameters”FunctionAgent
一个新的FunctionAgent实例