Skip to content

Commit

Permalink
fix: wrong gemini streaming chat response (#791)
Browse files Browse the repository at this point in the history
  • Loading branch information
thucpn authored May 2, 2024
1 parent 051b4dd commit e8c41c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/seven-days-occur.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"llamaindex": patch
---

fix: wrong gemini streaming chat response
10 changes: 4 additions & 6 deletions packages/core/src/llm/gemini.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,10 @@ export class Gemini extends ToolCallLLM<GeminiAdditionalChatOptions> {
): GeminiChatStreamResponse {
const { chat, messageContent } = this.prepareChat(params);
const result = await chat.sendMessageStream(messageContent);
return streamConverter(result.stream, (response) => {
return {
text: response.text(),
raw: response,
};
});
yield* streamConverter(result.stream, (response) => ({
delta: response.text(),
raw: response,
}));
}

chat(params: GeminiChatParamsStreaming): Promise<GeminiChatStreamResponse>;
Expand Down

0 comments on commit e8c41c5

Please sign in to comment.