Skip to content

Conversation

ming08108
Copy link
Contributor

finish_reason can sometimes be null in CreateChatCompletionResponse.

@64bit
Copy link
Owner

64bit commented Mar 3, 2023

Hi @ming08108 , thank you for PR.

Is this always the case or its intermittent?

In my testing I did not observe that otherwise examples/chat would have crashed gotten deserialization error .

One exception is Chat API with SSE streaming, where I did notice it to be null, which is already an Option<String> here https://github.com/64bit/async-openai/blob/main/async-openai/src/types/types.rs#L803

@jonaro00
Copy link
Contributor

jonaro00 commented Mar 4, 2023

@64bit I am also getting null on this field. In my case, the chance seems to be around 1 in 15.

@zurawiki
Copy link
Contributor

zurawiki commented Mar 4, 2023

+1 this is happening for me too

@ming08108
Copy link
Contributor Author

Hi @ming08108 , thank you for PR.

Is this always the case or its intermittent?

In my testing I did not observe that otherwise examples/chat would have crashed gotten deserialization error .

One exception is Chat API with SSE streaming, where I did notice it to be null, which is already an Option<String> here https://github.com/64bit/async-openai/blob/main/async-openai/src/types/types.rs#L803

Seems to be intermittent/random.

Some other reports of it here:
openai-php/client#50
openai-php/client#52

@64bit
Copy link
Owner

64bit commented Mar 4, 2023

aha, that's no good, lets ship this

@64bit 64bit merged commit 411ae1e into 64bit:main Mar 4, 2023
@64bit
Copy link
Owner

64bit commented Mar 4, 2023

Its released in 0.9.0. Thank you everyone

harsh-98 pushed a commit to harsh-98/async-openai that referenced this pull request Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants