Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeepSeek (OpenAIError: missing finish_reason for choice 0) #1292

Open
1 task done
Kenix157 opened this issue Jan 30, 2025 · 0 comments
Open
1 task done

DeepSeek (OpenAIError: missing finish_reason for choice 0) #1292

Kenix157 opened this issue Jan 30, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@Kenix157
Copy link

Kenix157 commented Jan 30, 2025

Confirm this is a Node library issue and not an underlying OpenAI API issue

  • This is an issue with the Node library

Describe the bug

I testing DeepSeek models (V3 & R1) using nebius studio (https://api.studio.nebius.ai/v1/)
this error outputs at end (output in stream works)
max_tokens 2048

err OpenAIError: missing finish_reason for choice 0
at (/Users/ilavolkov/Dev/heybro-backend/node_modules/openai/src/lib/ChatCompletionStream.ts:618:17)
at Array.map ()
at finalizeChatCompletion (/Users/ilavolkov/Dev/heybro-backend/node_modules/openai/src/lib/ChatCompletionStream.ts:615:22)
at ChatCompletionStream._ChatCompletionStream_endRequest (/Users/ilavolkov/Dev/heybro-backend/node_modules/openai/src/lib/ChatCompletionStream.ts:365:12)
at ChatCompletionStream._createChatCompletion (/Users/ilavolkov/Dev/heybro-backend/node_modules/openai/src/lib/ChatCompletionStream.ts:392:52)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at ChatCompletionStream._runChatCompletion (/Users/ilavolkov/Dev/heybro-backend/node_modules/openai/src/lib/AbstractChatCompletionRunner.ts:266:12)

To Reproduce

let options: ChatCompletionStreamParams = {
model: deepseek-ai/DeepSeek-R1,
"messages":[{"role":"system","content":"Ты ИИ-ассистент, который помогает людям находить информацию. Размышления выводи в специальный "},{"role":"user","content":[{"type":"text","text":"Где лучше жить в Рф?"}]}],
stream: true,
stream_options: {
include_usage: true,
},
};

try {
return await this.client.beta.chat.completions.stream(options, {
timeout: 1000 * 60 * 2,
stream: true
});
} catch (err) {
this.logger.error('Request to deepSeek failed', err);
throw err;
}

// call code

for await (const chunk of stream!) {
console.log('chunk w data', JSON.stringify(chunk))
}

const usageInfo = await stream?.totalUsage();
console.log('usageInfo', usageInfo);

Code snippets

OS

macOS

Node version

v21.7.3

Library version

openai 4.81.0

@Kenix157 Kenix157 added the bug Something isn't working label Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant