From 6d514108dd6cd33f1ea41f5485a3dbbc7b39c2fa Mon Sep 17 00:00:00 2001 From: Enrico Ros Date: Tue, 2 May 2023 23:28:19 -0700 Subject: [PATCH] Cleanup --- src/common/llm-util/react.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/common/llm-util/react.ts b/src/common/llm-util/react.ts index 708fb9a4a..f6ed351cc 100644 --- a/src/common/llm-util/react.ts +++ b/src/common/llm-util/react.ts @@ -84,7 +84,7 @@ export class Agent { async step(S: State, modelId: ChatModelId, log: (...data: any[]) => void = console.log) { log('→ reAct [...' + (S.messages.length + 1) + ']: ' + S.nextPrompt); const result = await this.chat(S, S.nextPrompt, modelId); - log(result); + log(`← ${result}`); const actions = result .split('\n') .map((a: string) => actionRe.exec(a)) @@ -95,11 +95,10 @@ export class Agent { if (!(action in knownActions)) { throw new Error(`Unknown action: ${action}: ${actionInput}`); } - log(`→ running ${action} "${actionInput}"`); - const observation = await knownActions[action](actionInput); - log(`Observation: ${observation}`); - S.nextPrompt = `Observation: ${observation}`; - S.lastObservation = observation; + log(`⚡ ${action} "${actionInput}"`); + S.lastObservation = await knownActions[action](actionInput); + S.nextPrompt = `Observation: ${S.lastObservation}`; + log(S.nextPrompt); } else { log('↙ done'); // log(`Result: ${result}`);