[AUR-431] Add ReAct Agent (#34)

* add base Tool

* minor update test_tool

* update test dependency

* update test dependency

* Fix namespace conflict

* update test

* add base Agent Interface, add ReWoo Agent

* minor update

* update test

* fix typo

* remove unneeded print

* update rewoo agent

* add LLMTool

* update BaseAgent type

* add ReAct agent

* add ReAct agent

* minor update

* minor update

* minor update

* minor update

* update docstring

* fix max_iteration

---------

Co-authored-by: trducng <trungduc1992@gmail.com>
This commit is contained in:
Tuan Anh Nguyen Dang (Tadashi_Cin)
2023-10-02 11:29:12 +07:00
committed by GitHub
parent 91048770fa
commit 3cceec63ef
9 changed files with 340 additions and 27 deletions

View File

@@ -1,5 +1,5 @@
from enum import Enum
from typing import Dict, List, Union
from typing import Dict, List, Optional, Union
from pydantic import BaseModel
@@ -50,7 +50,7 @@ class AgentOutput(BaseModel):
class BaseAgent(BaseTool):
name: str
"""Name of the agent."""
type: AgentType
agent_type: AgentType
"""Agent type, must be one of AgentType"""
description: str
"""Description used to tell the model how/when/why to use the agent.
@@ -59,7 +59,7 @@ class BaseAgent(BaseTool):
llm: Union[BaseLLM, Dict[str, BaseLLM]]
"""Specify LLM to be used in the model, cam be a dict to supply different
LLMs to multiple purposes in the agent"""
prompt_template: Union[PromptTemplate, Dict[str, PromptTemplate]]
prompt_template: Optional[Union[PromptTemplate, Dict[str, PromptTemplate]]]
"""A prompt template or a dict to supply different prompt to the agent
"""
plugins: List[BaseTool]