From 2376ef05c77a24a22cd693ef80245adecab9511c Mon Sep 17 00:00:00 2001 From: Nicolas Bonamy Date: Thu, 16 May 2024 11:46:44 -0500 Subject: [PATCH] fix --- src/services/google.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/services/google.ts b/src/services/google.ts index bcdc081..4e226cb 100644 --- a/src/services/google.ts +++ b/src/services/google.ts @@ -14,7 +14,6 @@ export const isGoogleReady = (engineConfig: EngineConfig): boolean => { export default class extends LlmEngine { client: GoogleGenerativeAI - currentChat: ChatSession toolCalls: LlmToolCall[] constructor(config: Configuration) { @@ -59,12 +58,12 @@ export default class extends LlmEngine { const modelName = opts?.model || this.config.engines.google.model.chat console.log(`[google] prompting model ${modelName}`) const model = this.getModel(modelName, thread[0].content) - const chat = model.startChat({ + const chatSession = model.startChat({ history: this.threadToHistory(thread, modelName) }) // done - const result = await chat.sendMessage(this.getPrompt(thread)) + const result = await chatSession.sendMessage(this.getPrompt(thread)) return { type: 'text', content: result.response.text() @@ -82,12 +81,12 @@ export default class extends LlmEngine { // call console.log(`[google] prompting model ${modelName}`) const model = this.getModel(modelName, thread[0].content) - this.currentChat = model.startChat({ + const chatSession = model.startChat({ history: this.threadToHistory(thread, modelName) }) // done - const result = await this.currentChat.sendMessageStream(this.getPrompt(thread)) + const result = await chatSession.sendMessageStream(this.getPrompt(thread)) return result.stream }