Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nbonamy committed May 16, 2024
1 parent fcd9d64 commit 2376ef0
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/services/google.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export const isGoogleReady = (engineConfig: EngineConfig): boolean => {
export default class extends LlmEngine {

client: GoogleGenerativeAI
currentChat: ChatSession
toolCalls: LlmToolCall[]

constructor(config: Configuration) {
Expand Down Expand Up @@ -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()
Expand All @@ -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

}
Expand Down

0 comments on commit 2376ef0

Please sign in to comment.