Skip to content

Commit

Permalink
fix: resolve typescript issue
Browse files Browse the repository at this point in the history
  • Loading branch information
meorphis committed Jun 4, 2024
1 parent dba4ffb commit 1129707
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lib/AbstractChatCompletionRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,12 @@ export abstract class AbstractChatCompletionRunner<
while (i-- > 0) {
const message = this.messages[i];
if (isAssistantMessage(message)) {
return { ...message, content: message.content ?? null };
const { function_call, ...rest } = message;
const ret: ChatCompletionMessage = { ...rest, content: message.content ?? null };
if (function_call) {
ret.function_call = function_call;
}
return ret;
}
}
throw new OpenAIError('stream ended without producing a ChatCompletionMessage with role=assistant');
Expand Down

0 comments on commit 1129707

Please sign in to comment.