slightly modifications on prompt

This commit is contained in:
Joao Moura
2023-12-04 00:12:36 -08:00
parent da00aa2668
commit 53f6b0f844
5 changed files with 358 additions and 299 deletions

View File

@@ -19,6 +19,10 @@ class Agent(BaseModel):
goal: str = Field(description="Objective of the agent")
backstory: str = Field(description="Backstory of the agent")
llm: Optional[Any] = Field(description="LLM that will run the agent")
memory: bool = Field(
description="Whether the agent should have memory or not",
default=True
)
verbose: bool = Field(
description="Verbose mode for the Agent Execution",
default=False
@@ -64,12 +68,18 @@ class Agent(BaseModel):
input_key="input"
)
args = {
"tools": self.tools,
"verbose": self.verbose,
"handle_parsing_errors": True,
}
if self.memory:
args['memory'] = summary_memory
self.agent_executor = AgentExecutor(
agent=inner_agent,
tools=self.tools,
memory=summary_memory,
verbose=self.verbose,
handle_parsing_errors=True,
**args
)
def execute_task(self, task: str, context: str = None, tools: List[Any] = None) -> str:

View File

@@ -17,7 +17,7 @@ class Prompts(BaseModel):
MEMORY_SLICE: ClassVar[str] = dedent("""\
This is the summary of your work so far:
{chat_history}
{chat_history}
""")
ROLE_PLAYING_SLICE: ClassVar[str] = dedent("""\
@@ -28,19 +28,20 @@ class Prompts(BaseModel):
""")
TOOLS_SLICE: ClassVar[str] = dedent("""\
TOOLS:
------
You have access to the following tools:
{tools}
To use a tool, please use the following format:
To use a tool, please use the exact following format:
```
Thought: Do I need to use a tool? Yes
Action: the action to take, should be one of [{tool_names}]
Action Input: the input to the action
---
Observation: the result of the action
```