aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/ChatBox/Agent.ts
diff options
context:
space:
mode:
authorA.J. Shulman <Shulman.aj@gmail.com>2024-07-22 10:49:02 -0400
committerA.J. Shulman <Shulman.aj@gmail.com>2024-07-22 10:49:02 -0400
commit834ca4e21fead079e681b963e2d533d93a53cb91 (patch)
treeb091c4048db1473669011c3e35d0e2182281011c /src/client/views/nodes/ChatBox/Agent.ts
parentae4809cce727a056bdc648249c0f76174a496307 (diff)
fixing summaries by having them part of the ReAct prompt
Diffstat (limited to 'src/client/views/nodes/ChatBox/Agent.ts')
-rw-r--r--src/client/views/nodes/ChatBox/Agent.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/client/views/nodes/ChatBox/Agent.ts b/src/client/views/nodes/ChatBox/Agent.ts
index a3b1d083c..d494928f9 100644
--- a/src/client/views/nodes/ChatBox/Agent.ts
+++ b/src/client/views/nodes/ChatBox/Agent.ts
@@ -19,25 +19,27 @@ export class Agent {
private interMessages: AgentMessage[] = [];
private vectorstore: Vectorstore;
private _history: () => string;
+ private _summaries: () => string;
constructor(_vectorstore: Vectorstore, summaries: () => string, history: () => string) {
this.client = new OpenAI({ apiKey: process.env.OPENAI_KEY, dangerouslyAllowBrowser: true });
this.vectorstore = _vectorstore;
this._history = history;
+ this._summaries = summaries;
this.tools = {
wikipedia: new WikipediaTool(),
calculate: new CalculateTool(),
- rag: new RAGTool(this.vectorstore, summaries),
+ rag: new RAGTool(this.vectorstore),
no_tool: new NoTool(),
};
}
- async askAgent(question: string, maxTurns: number = 8): Promise<string> {
+ async askAgent(question: string, maxTurns: number = 10): Promise<string> {
console.log(`Starting query: ${question}`);
this.messages.push({ role: 'user', content: question });
const chatHistory = this._history();
console.log(`Chat history: ${chatHistory}`);
- const systemPrompt = getReactPrompt(Object.values(this.tools), chatHistory);
+ const systemPrompt = getReactPrompt(Object.values(this.tools), this._summaries, chatHistory);
console.log(`System prompt: ${systemPrompt}`);
this.interMessages = [{ role: 'system', content: systemPrompt }];