-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
bug: [0.5.8] OpenAI .Net library chokes on "finish_reason": null in response from Jan server #3946
Comments
Hi @debruyckere, please update to version 0.5.8 and see if the issue persists. |
Same behavior in 0.5.8. |
@debruyckere Could you kindly share the stream response on your end? |
The JSON returned by the server is in the description. Or are you referring to something else? |
Yes, @debruyckere, please ensure that the JSON response from the server indicates a successful request. |
Hi @debruyckere, it would be great to have the response json so that we can take a look at. |
Thanks @debruyckere, we are going to replace that swagger page with a better one. #3895 |
Jan version
v0.5.6
Describe the Bug
The response from the Jan server looks like so (from the built-in example):
It is parsed by the OpenAI library (https://www.nuget.org/packages/OpenAI, v2.1.0-beta). The response contains 'null' for 'finish_reason' and the library attemps to parse that in ChatFinishReasonExtensions.ToChatFinishReason, using this code:
Consequently, an ArgumentOutOfRangeException is thrown because the value is null. The expected value is 'stop'.
Steps to Reproduce
var uri = new Uri("http://127.0.0.1:1337/v1");
var credential = new ApiKeyCredential("123");
var client = new ChatClient("llama3.2-3b-instruct", credential, new OpenAIClientOptions {Endpoint = uri});
var messages = new ChatMessage[] { ChatMessage.CreateUserMessage("Say something") };
var response = client.CompleteChat(messages);
Screenshots / Logs
What is your OS?
The text was updated successfully, but these errors were encountered: