Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
udpate testing
Browse files Browse the repository at this point in the history
  • Loading branch information
patcher9 committed Mar 16, 2024
1 parent 7a99917 commit 7630a7d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/azure_openai.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export default function initAzureOpenAI({ llm, dokuUrl, apiKey, environment, app
let streaming = params.stream || false;
if (streaming) {
// Call original method
const originalResponseStream = await originalChatCreate.call(this, params);
const originalResponseStream = await originalCompletionsCreate.call(this, params);

// Create a pass-through stream
const passThroughStream = new Readable({
Expand All @@ -197,9 +197,8 @@ export default function initAzureOpenAI({ llm, dokuUrl, apiKey, environment, app
// Immediately-invoked async function to handle streaming
(async () => {
for await (const chunk of originalResponseStream) {
var content = chunk.choices[0].text;
if (content) {
dataResponse += content;
if (chunk.choices.length > 0) {
dataResponse += chunk.choices[0].text;
passThroughStream.push(chunk); // Push chunk to the pass-through stream
}
var responseId = chunk.id;
Expand Down

0 comments on commit 7630a7d

Please sign in to comment.