Skip to content
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

Fix decoding error on assistants response #31

Merged
merged 2 commits into from
Apr 25, 2024

Conversation

lzell
Copy link
Contributor

@lzell lzell commented Apr 24, 2024

The response_format and tool_choice fields of an assistant's run can either be objects or strings.

Previously, if the tool_choice was a string (e.g. 'auto') in the run response, we failed to decode the response. Similarly, if the responses_type was a string (e.g. 'auto') in the run response, we failed to decode the response.

This bug was reported by @mbrian23, with a full repro here. Thank you Martin!
https://gist.github.com/mbrian23/6863ffa705ccbb5097bd07efb2355a30

I added regression tests for the failing case.

References:
https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-response_format
https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-tool_choice

Copy link
Owner

@jamesrochabrun jamesrochabrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much @lzell ! Also huge thanks dding tests!

@jamesrochabrun jamesrochabrun merged commit 3847516 into jamesrochabrun:main Apr 25, 2024
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.

None yet

2 participants