Skip to content

Conversation

alexrudall
Copy link
Owner

@alexrudall alexrudall commented Feb 14, 2025

[BREAKING CHANGE]

  • Try to parse all responses as JSON
  • If parsing JSON fails, return the original response as-is
  • Reproduction and fix for Fix - File content #544

To Test

Update gemfile:

gem 'ruby-openai', git: 'git://github.com/alexrudall/ruby-openai.git', branch: 'fix/non-json-content'

Run bundle install

Related Issues (?)

#277
#314
#416
#421
#562

Related PRs (?)

#474
#504
#540
#544

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?

@alexrudall alexrudall changed the title Fixes for various non-JSON content issues Fixes for various JSON/non-JSON content issues Feb 14, 2025
@alexrudall alexrudall marked this pull request as ready for review February 14, 2025 14:38
@alexrudall alexrudall mentioned this pull request Feb 14, 2025
3 tasks
@jprosevear
Copy link

Is this just about the files endpoint or is there others that don't return JSON?

@alexrudall
Copy link
Owner Author

@jprosevear Audio endpoints are another one

@jprosevear
Copy link

@jprosevear Audio endpoints are another one

My thought was to pass a named param to select the parsing option and default to json. Then change the default for files and audio to limit the breaking damage. Not sure if that's the right path though

@alexrudall
Copy link
Owner Author

@jprosevear Audio endpoints are another one

My thought was to pass a named param to select the parsing option and default to json. Then change the default for files and audio to limit the breaking damage. Not sure if that's the right path though

Yep, saw that in one of the PRs. I'd prefer just just always check if Strings can be JSON and always return raw if there are any errors - that way it should work for future endpoints, unforseen edge cases, etc. not sure of downsides to this approach

@alexrudall alexrudall merged commit ff331d9 into main Feb 21, 2025
7 checks passed
@alexrudall
Copy link
Owner Author

Released in ruby-openai v8

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.

3 participants