Skip to content
Snippets Groups Projects
Unverified Commit 255ae7dc authored by Emanuel Ferreira's avatar Emanuel Ferreira Committed by GitHub
Browse files

fix: react agent history (#540)

parent b4c6d509
No related branches found
No related tags found
No related merge requests found
---
"llamaindex": patch
---
chore: update example (perfoms better with default model)
......@@ -64,8 +64,7 @@ async function main() {
// Chat with the agent
const response = await agent.chat({
message: "I want to sum 5 and 5 and divide by 2",
toolChoice: "auto",
message: "Divide 16 by 2 then add 20",
});
// Print the response
......
......@@ -76,8 +76,8 @@ export class ReActChatFormatter implements BaseAgentChatFormatter {
content: systemContent,
role: "system",
},
...reasoningHistory,
...chatHistory,
...reasoningHistory,
];
}
}
......@@ -82,7 +82,7 @@ export class ReActAgentWorker implements AgentWorker {
verbose,
toolRetriever,
}: ReActAgentWorkerParams) {
this.llm = llm ?? new OpenAI({ model: "gpt-3.5-turbo-1106" });
this.llm = llm ?? new OpenAI({ model: "gpt-3.5-turbo-0613" });
this.callbackManager = callbackManager || new CallbackManager();
this.maxInteractions = maxInteractions ?? 10;
......@@ -322,7 +322,7 @@ export class ReActAgentWorker implements AgentWorker {
const inputChat = this.reactChatFormatter.format(
tools,
[...task.memory.get(), ...task.extraState.newMemory.get()],
[...task.memory.getAll(), ...task.extraState.newMemory.getAll()],
task.extraState.currentReasoning,
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment