[GH-ISSUE #29] 当结尾 "finish_reason":"stop" 时,role 值为空 #28

Open
opened 2026-10-26 21:06:57 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @yttchan on GitHub (May 15, 2024).
Original GitHub issue: https://github.com/deepseek-ai/DeepSeek-V2/issues/29

data: {"id":"2c0e9145-0ef9-4037-a5b0-590c6df994b0","choices":[{"index":0,"delta":{"content":".","role":"assistant"},"finish_reason":null,"logprobs":null}],"created":1715667871,"model":"deepseek-chat","system_fingerprint":null,"object":"chat.completion.chunk"}

data: {"id":"2c0e9145-0ef9-4037-a5b0-590c6df994b0","choices":[{"index":0,"delta":{"content":"","role":null},"finish_reason":"stop","logprobs":null}],"created":1715667871,"model":"deepseek-chat","system_fingerprint":null,"object":"chat.completion.chunk","usage":{"prompt_tokens":8,"completion_tokens":27,"total_tokens":35}}

.Net在使用SemanticKernel框架流式输出, 会因为最后一行记录role =null 报错

Originally created by @yttchan on GitHub (May 15, 2024). Original GitHub issue: https://github.com/deepseek-ai/DeepSeek-V2/issues/29 data: {"id":"2c0e9145-0ef9-4037-a5b0-590c6df994b0","choices":[{"index":0,"delta":{"content":".","role":"assistant"},"finish_reason":null,"logprobs":null}],"created":1715667871,"model":"deepseek-chat","system_fingerprint":null,"object":"chat.completion.chunk"} data: {"id":"2c0e9145-0ef9-4037-a5b0-590c6df994b0","choices":[{"index":0,"delta":{"content":"","role":null},"finish_reason":"stop","logprobs":null}],"created":1715667871,"model":"deepseek-chat","system_fingerprint":null,"object":"chat.completion.chunk","usage":{"prompt_tokens":8,"completion_tokens":27,"total_tokens":35}} .Net在使用SemanticKernel框架流式输出, 会因为最后一行记录role =null 报错
Author
Owner

@xyh0202 commented on GitHub (May 28, 2024):

DeepSeep api 兼容 openai api 格式,流式输出内容只有第一个chunk有 role:assistant 字段

<!-- gh-comment-id:2134236568 --> @xyh0202 commented on GitHub (May 28, 2024): DeepSeep api 兼容 openai api 格式,流式输出内容只有第一个chunk有 role:assistant 字段
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/DeepSeek-V2#28
No description provided.