-
Notifications
You must be signed in to change notification settings - Fork 767
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 R1 with JSON returns partial message text (a bunch of new lines) #5816
Comments
What is chatClient here? How is it constructed? Please share a full repro. |
(Separately, you might consider using |
It's just an injected I'll try CompleteAsync and report back, but I don't think it'll matter for this, though it might simplify things which will be nice -- the issue is before deserialization to help with the actual message in the chat client. Regardless, I'll give it a whirl and see 🙂 |
Will make a sample repo too |
Right, but which concrete type. There are many different implementations of IChatClient; I'm wondering which you're using. A simple repro would be most helpful. |
gotcha -- here's a simple console app repro -- can reliably show successes with llama 3.2 and repro successes and failures with deepseek |
I tried |
This appears to just be an issue with the model / Ollama's support for enforcing JSON object returns. I suspect deepseek's chain-of-thought reasonining makes it harder for it to produce just a JSON response object, as responses the model issues will generally be prefixed by a ... block. @SteveSandersonMS, it might be interesting to think through what, if anything, we should do in |
Description
When making a curl call with deepseek r1 like this
you get a response like
This is fine other than the weird new lines at the end -- they're causing a problem when interacting with MS AI though as they are the only part of the message text response.
Note
fwiw, i get that maybe this is a bug that needs to be resolved by them but wanted to at least call it out for y'all and other's awareness
Reproduction Steps
When doing a comparable call (at least i believe so) with MS AI:
You just get the new lines as the message text response:
![Image](https://private-user-images.githubusercontent.com/24260530/406750992-59beb3a8-8e38-458a-8218-f1d16c29d076.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5OTM4MzksIm5iZiI6MTczODk5MzUzOSwicGF0aCI6Ii8yNDI2MDUzMC80MDY3NTA5OTItNTliZWIzYTgtOGUzOC00NThhLTgyMTgtZjFkMTZjMjlkMDc2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDA1NDUzOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE1MjcxNDBjMTNkZWExM2QxYzdhMDVmYjUyOTFhMjkxYTFhNDkwZDcyYmVjYzU0Zjg1ZTAyZDg4ZTI3MWQwY2ImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.7yWCInkwFJ5wKTLespoQzaJP0MNtdVshJ0nVTq2zSeU)
Expected behavior
get the full text response
Actual behavior
getting a partial response with just new lines
Regression?
Kind of if you're talking overall capabilities of parsing a message -- message text comes back fine for other models, but not deepseek, but could be classified as an enhancement to handle more scenarios like the deepseek one
Known Workarounds
None with MS AI that I know of, I'd need to manually make the http call like the curl call and parse the response from there.
Configuration
.NET 9
Mac Sequoia 15.2
AFAIK, not specific to this config
Other information
No response
The text was updated successfully, but these errors were encountered: