NewWorkflowAgent 创建新的 WorkflowAgent
(model, instructions string, addHistory bool, numRuns int)
| 27 | |
| 28 | // NewWorkflowAgent 创建新的 WorkflowAgent |
| 29 | func NewWorkflowAgent(model, instructions string, addHistory bool, numRuns int) *WorkflowAgent { |
| 30 | defaultInstructions := `You are a workflow orchestration agent. Your job is to help users by either: |
| 31 | 1. Answering directly from workflow history if the question can be answered |
| 32 | 2. Running the workflow when needed for new queries` |
| 33 | |
| 34 | if instructions == "" { |
| 35 | instructions = defaultInstructions |
| 36 | } |
| 37 | |
| 38 | return &WorkflowAgent{ |
| 39 | ID: uuid.New().String(), |
| 40 | Name: "WorkflowAgent", |
| 41 | Instructions: instructions, |
| 42 | Model: model, |
| 43 | AddWorkflowHistory: addHistory, |
| 44 | NumHistoryRuns: numRuns, |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | // AttachWorkflow 将 workflow 附加到 agent |
| 49 | func (wa *WorkflowAgent) AttachWorkflow(wf *Workflow) *WorkflowAgent { |
no test coverage detected