Skip to content

When unmarshaling ChatCompletionChunk, the sdk doesn't check if the input is valid #379

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

Open
spacewander opened this issue Apr 23, 2025 · 1 comment

Comments

@spacewander
Copy link

Using the snippet below:

	chunk = openai.ChatCompletionChunk{}
	err := json.Unmarshal([]byte(`[]`), &chunk)
	fmt.Printf("%+v\n", err)

The err is nil and the chunk is successfully unmarshalled, though it will have empty value except that the raw field is [].

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

No branches or pull requests

1 participant