All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Add new Vector Store endpoints - thanks to @willywg for this PR!
- Add parameters to batches.list endpoint so you can for example use
after
- thanks to @marckohlbrugge! - Add vision as permitted purpose for files - thanks again to @willywg for the PR.
- Add improved README example of tool calling - thanks @krschacht - check out his project HostedGPT!
- Fix broken link in README table of contents - thanks to @garrettgsb!
- Skip sending nil headers - thanks to @drnic!
- Update to v2 of Assistants in Messages, Runs, RunSteps and Threads - thanks to @willywg and others for pointing this out.
- Add support for Batches, thanks to @simonx1 for the PR!
- Allow use of local LLMs like Ollama! Thanks to @ThomasSevestre
- Update to v2 of the Assistants beta & add documentation on streaming from an Assistant.
- Add Assistants endpoint to create and run a thread in one go, thank you [@quocphien90](https://github.com/ quocphien90)
- Add missing parameters (order, limit, etc) to Runs, RunSteps and Messages - thanks to @shalecraig and @coezbek
- Add missing Messages#list spec - thanks @adammeghji
- Add Messages#modify to README - thanks to @nas887
- Don't add the api_version (
/v1/
) to base_uris that already include it - thanks to @kaiwren for raising this issue - Allow passing a
StringIO
to Files#upload - thanks again to @simonx1 - Add Ruby 3.3 to CI
- [BREAKING] ruby-openai will no longer log out API errors by default - you can reenable by passing
log_errors: true
to your client. This will help to prevent leaking secrets to logs. Thanks to @lalunamel for this PR.
- [BREAKING] Remove deprecated edits endpoint.
- Fix README DALL·E 3 error - thanks to @clayton
- Fix README tool_calls error and add missing tool_choice info - thanks to @Jbrito6492
- Add back the deprecated Completions endpoint that I removed a bit prematurely. Thanks, [@mishranant](https://github.com/ mishranant) and everyone who requested this.
- Add DALL·E 3 to specs and README - thanks to @Gary-H9
- Add Whisper transcription language selection parameter to README - thanks to @nfedyashev
- Add bundle exec rake lint and bundle exec rake test to make development easier - thanks to @ignacio-chiazzo
- Add link to https://github.com/sponsors/alexrudall when users run
bundle fund
- Update README and spec to use tool calls instead of functions - thanks to @mpallenjr
- Remove nonexistent Thread#list method - thanks again! to @ignacio-chiazzo
- Update finetunes docs in README to use chat instead of completions endpoint - thanks to @blefev
- Allow any kind of file (eg. PDFs) to be uploaded to the API, not just JSONL files. Thank you @stefan-kp for the PR!
- Add ability to pass Faraday middleware to the client in a block, eg. to enable verbose logging - shout out to @obie for pushing for this.
- Add better error logging to the client by default.
- Bump Event Source to v1, thank you @atesgoral @ Shopify!
- Add text-to-speech! Thank you @codergeek121
- Add support for Assistants, Threads, Messages and Runs. Thank you @Haegin for the excellent work on this PR, and many reviewers for their contributions!
- Gracefully handle the case where an HTTP error response may not have valid JSON in its body. Thank you @atesgoral!
- [BREAKING] HTTP errors will now be raised by ruby-openai as Faraday:Errors, including when streaming! Implemented by @atesgoral
- [BREAKING] Switch from legacy Finetunes to the new Fine-tune-jobs endpoints. Implemented by @lancecarlson
- [BREAKING] Remove deprecated Completions endpoints - use Chat instead.
- [BREAKING] Fix issue where :stream parameters were replaced by a boolean in the client application. Thanks to @martinjaimem, @vickymadrid03 and @nicastelo for spotting and fixing this issue.
- Added more spec-compliant SSE parsing: see here https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation
- Fixes issue where OpenAI or an intermediary returns only partial JSON per chunk of streamed data
- Huge thanks to @atesgoral for this important fix!
- Added rough_token_count to estimate tokens in a string according to OpenAI's "rules of thumb". Thank you to @jamiemccarthy for the idea and implementation!
- Support multi-tenant use of the gem! Each client now holds its own config, so you can create unlimited clients in the same project, for example to Azure and OpenAI, or for different headers, access keys, etc.
- [BREAKING-ish] This change should only break your usage of ruby-openai if you are directly calling class methods like
OpenAI::Client.get
for some reason, as they are now instance methods. Normal usage of the gem should be unaffected, just you can make new clients and they'll keep their own config if you want, overriding the global config. - Huge thanks to @petergoldstein for his original work on this, @cthulhu for testing and many others for reviews and suggestions.
- [BREAKING] Move audio related method to Audio model from Client model. You will need to update your code to handle this change, changing
client.translate
toclient.audio.translate
andclient.transcribe
toclient.audio.transcribe
.
- Don't overwrite config extra-headers when making a client without different ones. Thanks to @swistaczek for raising this!
- Include extra-headers for Azure requests.
- Tempfiles can now be sent to the API as well as Files, eg for Whisper. Thanks to @codergeek121 for the fix!
- Add extra-headers to config to allow setting openai-caching-proxy-worker TTL, Helicone Auth and anything else ya need. Ty to @deltaguita and @marckohlbrugge for the PR!
- Add Azure OpenAI Service support. Thanks to @rmachielse and @steffansluis for the PR and to everyone who requested this feature!
- Add the ability to trigger any callable object as stream chunks come through, not just Procs. Big thanks to @obie for this change.
- Add the ability to stream Chat responses from the API! Thanks to everyone who requested this and made suggestions.
- Added instructions for streaming to the README.
- Switch HTTP library from HTTParty to Faraday to allow streaming and future feature and performance improvements.
- [BREAKING] Endpoints now return JSON rather than HTTParty objects. You will need to update your code to handle this change, changing
JSON.parse(response.body)["key"]
andresponse.parsed_response["key"]
to justresponse["key"]
.
- Allow the usage of proxy base URIs like https://www.helicone.ai/. Thanks to @mmmaia for the PR!
- Add much-needed ability to increase HTTParty timeout, and set default to 120 seconds. Thanks to @mbackermann for the PR and to everyone who requested this!
- Add Client#transcribe and Client translate endpoints - Whisper over the wire! Thanks to @Clemalfroy
- Add Client#chat endpoint - ChatGPT over the wire!
- Replace ::Ruby::OpenAI namespace with ::OpenAI - thanks @kmcphillips for this work!
- To upgrade, change
require 'ruby/openai'
torequire 'openai'
and change all references toRuby::OpenAI
toOpenAI
.
- Add Files#content endpoint - thanks @unixneo for raising!
- Add Finetunes#delete endpoint - thanks @lancecarlson for flagging this.
- Add VCR header and body matching - thanks @petergoldstein!
- Update File#upload specs to remove deprecated
answers
purpose.
- Add ability to run the specs without VCR cassettes using
NO_VCR=true bundle exec rspec
. - Add Ruby 3.2 to CircleCI config - thanks @petergoldstein!
- A bit of detail added to the README on DALLE image sizes - thanks @ndemianc!
- Fix finetunes and files uploads endpoints - thanks @chaadow for your PR on this and @petergoldstein for the PR we ultimately went with.
- Fixed Images#generate and Finetunes#create which were broken by a double call of to_json.
- Thanks @konung for spotting this!
- [BREAKING] Remove deprecated answers, classifications, embeddings, engines and search endpoints.
- [BREAKING] Remove ability to pass engine to completions and embeddings outside of the parameters hash.
- Add ability to set access_token via gem configuration.
- Thanks @grjones and @aquaflamingo for raising this and @feministy for the excellent guide to adding config to a gem.
- [BREAKING] Remove ability to include access_token directly via ENV vars.
- [BREAKING] Remove ability to pass API version directly to endpoints.
- Add Images#edit and Images#variations endpoint to modify images with DALL·E.
- Add Organization ID to headers so users can charge credits to the correct organization.
- Thanks @mridul911 for raising this and @maks112v for adding it!
- Add Images#generate endpoint to generate images with DALL·E!
- Deprecate Client#answers endpoint.
- Deprecate Client#classifications endpoint.
- [BREAKING] Remove support for Ruby 2.5.
- [BREAKING] Remove support for passing
query
,documents
orfile
as top-level parameters toClient#search
. - Deprecate Client#search endpoint.
- Deprecate Client#engines endpoints.
- Add Client#models endpoints to list and query available models.
- Add Client#moderations endpoint to check OpenAI's Content Policy.
- Add Client#edits endpoints to transform inputs according to instructions.
- Add Client#engines endpoints to list and query available engines.
- Add Client#finetunes endpoints to create and use fine-tuned models.
- Add Client#embeddings endpoint to get vector representations of inputs.
- Add tests and examples for more engines.
- Add backwards compatibility from Ruby 2.5+.
- Add Client#classifications to predict the most likely labels based on examples or a file.
- Fixed Files#upload which was previously broken by the validation code!
- Add Client#search(parameters:) to allow passing
max_rerank
orreturn_metadata
. - Deprecate Client#search with query, file or document parameters at the top level.
- Thanks @stevegeek for pointing this issue out!
- Add validation of JSONL files to make it easier to debug during upload.
- Add Client#answers endpoint for question/answer response on documents or a file.
- Add Client#files to allow file upload.
- Add Client#search(file:) so you can search a file.
- Remove deprecated method Client#call - use Client#completions instead.
- Rename 'master' branch to 'main' branch.
- Bump dependencies.
- Add Client#completions to allow all parameters.
- Deprecate Client#call.
- Update README.
- Add method to use the search endpoint.
- Bump Rubocop to 3.9.2.
- Bump Webmock to 3.9.1.
- Add ability to change API version in the future.
- Fix README typos.
- Add tests and cached responses for the different engines.
- Add issue templates.
- Add README instructions for using the gem without dotenv.
- Add list of engines to README.
- Run Rubocop on pulls using CircleCI.
- Clean up CircleCI config file.
- Initialise repository.
- Add OpenAI::Client to connect to OpenAI API using user credentials.
- Add spec for Client with a cached response using VCR.
- Add CircleCI to run the specs on pull requests.