Skip to content

release: 0.1.0-alpha.5 #130

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

Merged
merged 17 commits into from
Apr 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
43 changes: 43 additions & 0 deletions .github/workflows/create-releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Create releases
on:
push:
branches:
- main
workflow_dispatch:

jobs:
release:
name: release
if: github.ref == 'refs/heads/main' && github.repository == 'openai/openai-ruby'
runs-on: ubuntu-latest
environment: publish
permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4

- uses: stainless-api/trigger-release-please@v1
id: release
with:
repo: ${{ github.event.repository.full_name }}
stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}

- name: Set up Ruby
if: ${{ steps.release.outputs.releases_created }}
uses: ruby/setup-ruby@v1
with:
bundler-cache: false
ruby-version: '3.1'
- run: |-
bundle install

- name: Publish to RubyGems.org
if: ${{ steps.release.outputs.releases_created }}
run: |
bash ./bin/publish-gem
env:
# `RUBYGEMS_HOST` is only required for private gem repositories, not https://rubygems.org
RUBYGEMS_HOST: ${{ secrets.OPENAI_RUBYGEMS_HOST || secrets.RUBYGEMS_HOST }}
GEM_HOST_API_KEY: ${{ secrets.OPENAI_GEM_HOST_API_KEY || secrets.GEM_HOST_API_KEY }}
6 changes: 1 addition & 5 deletions .github/workflows/publish-gem.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# This workflow is triggered when a GitHub release is created.
# It can also be run manually to re-publish to rubygems.org in case it failed for some reason.
# Workflow for re-publishing to rubygems.org in case it failed for some reason.
# You can run this workflow by navigating to https://www.github.com/openai/openai-python/actions/workflows/publish-gem.yml
name: Publish Gem
on:
workflow_dispatch:

release:
types: [published]

jobs:
publish:
name: publish
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
*.gem
.idea/
.ignore
.prism.log
.ruby-lsp/
.yardoc/
Brewfile.lock.json
bin/tapioca
Brewfile.lock.json
doc/
sorbet/*
!/sorbet/config
sorbet/tapioca/*
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.4"
".": "0.1.0-alpha.5"
}
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.1.0
1 change: 1 addition & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--type-name-tag generic:Generic
--markup markdown
--markup-provider redcarpet
--exclude /rbi
Expand Down
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Changelog

## 0.1.0-alpha.5 (2025-04-18)

Full Changelog: [v0.1.0-alpha.4...v0.1.0-alpha.5](https://github.com/openai/openai-ruby/compare/v0.1.0-alpha.4...v0.1.0-alpha.5)

### Features

* implement `#hash` for data containers ([924fcb4](https://github.com/openai/openai-ruby/commit/924fcb42fa0991c491246df7667c72022190f1ee))


### Bug Fixes

* always send idempotency header when specified as a request option ([548bfaf](https://github.com/openai/openai-ruby/commit/548bfaf81a4947860ec35ff7efafb144da4863bb))
* **client:** send correct HTTP path ([896142a](https://github.com/openai/openai-ruby/commit/896142abf1bb03f1eb48e0754cbff04edd081a0e))


### Chores

* documentation improvements ([ff43d73](https://github.com/openai/openai-ruby/commit/ff43d73fe6e514d5b9f110892c3880998df8dacf))
* **internal:** configure releases ([7eb9185](https://github.com/openai/openai-ruby/commit/7eb91852c03eaba177464060631c2645d3db63d0))
* **internal:** contribute.md and contributor QoL improvements ([d060adf](https://github.com/openai/openai-ruby/commit/d060adf81aadb6b138428bdbde79633fd0dff230))
* make sorbet enums easier to read ([7c03213](https://github.com/openai/openai-ruby/commit/7c0321329658a6d2823f9022a77be5965186b94c))
* refine `#inspect` and `#to_s` for model classes ([84308a6](https://github.com/openai/openai-ruby/commit/84308a6683e6ed9d520b05e0ac828de662fe0198))
* simplify yard annotations by removing most `@!parse` directives ([16ec2e3](https://github.com/openai/openai-ruby/commit/16ec2e391b0cfdf49727099be9afa220c7ab16e5))
* update README with recommended editor plugins ([c745aef](https://github.com/openai/openai-ruby/commit/c745aef51359e1df2118006dd69470fc4714de5a))
* update readme with temporary install instructions ([8a79cc0](https://github.com/openai/openai-ruby/commit/8a79cc0a6396f0989feaefb2d4d30b6c1dc75dfe))
* use `@!method` instead of `@!parse` for virtual method type definitions ([b5fba2e](https://github.com/openai/openai-ruby/commit/b5fba2e689884dc011dec9fd2d8349c9c842d274))

## 0.1.0-alpha.4 (2025-04-16)

Full Changelog: [v0.1.0-alpha.3...v0.1.0-alpha.4](https://github.com/openai/openai-ruby/compare/v0.1.0-alpha.3...v0.1.0-alpha.4)
Expand Down
125 changes: 125 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
## Setting up the environment

This repository contains a `.ruby-version` file, which should work with either [rbenv](https://github.com/rbenv/rbenv) or [asdf](https://github.com/asdf-vm/asdf) with the [ruby plugin](https://github.com/asdf-vm/asdf-ruby).

Please follow the instructions for your preferred version manager to install the Ruby version specified in the `.ruby-version` file.

To set up the repository, run:

```bash
$ ./scripts/bootstrap
```

This will install all the required dependencies.

## Modifying/Adding code

Most of the SDK is generated code. Modifications to code will be persisted between generations, but may result in merge conflicts between manual patches and changes from the generator. The generator will never modify the contents `examples/` directory.

## Adding and running examples

All files in the `examples/` directory are not modified by the generator and can be freely edited or added to.

```ruby
#!/usr/bin/env ruby
# frozen_string_literal: true

require_relative "../lib/openai"

# ...
```

```bash
$ chmod +x './examples/<your-example>.rb'

# run the example against your api
$ ruby './examples/<your-example>.rb'
```

## Using the repository from source

If you’d like to use the repository from source, you can either install from git or reference a cloned repository:

To install via git in your `Gemfile`:

```ruby
gem "openai", git: "https://www.github.com/openai/openai-ruby"
```

Alternatively, reference local copy of the repo:

```bash
$ git clone -- 'https://www.github.com/openai/openai-ruby' '<path-to-repo>'
```

```ruby
gem "openai", path: "<path-to-repo>"
```

## Running commands

Running `rake` by itself will show all runnable commands.

```bash
$ bundle exec rake
```

## Running tests

Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.

```bash
$ npx prism mock path/to/your/openapi.yml
```

```bash
$ bundle exec rake test
```

## Linting and formatting

This repository uses [rubocop](https://github.com/rubocop/rubocop) for linting and formatting of `*.rb` and `*.rbi` files. [syntax_tree](https://github.com/ruby-syntax-tree/syntax_tree) is used for formatting `*.rbs` files.

There are two separate type checkers supported by this library: [sorbet](https://github.com/sorbet/sorbet) and [steep](https://github.com/soutaro/steep) are used for verifying `*.rbi` and `*.rbs` files respectively.

To lint and typecheck:

```bash
$ bundle exec rake lint
```

To format and fix all lint issues automatically:

```bash
$ bundle exec rake format
```

## Editor Support

### Ruby LSP

[Ruby LSP](https://github.com/Shopify/ruby-lsp) has quite good support for go to definition, but not auto-completion.

This can be installed along side Solargraph.

### Solargraph

[Solargraph](https://solargraph.org) has quite good support for auto-completion, but not go to definition.

This can be installed along side Ruby LSP.

### Sorbet

[Sorbet](https://sorbet.org) should mostly work out of the box when editing this library directly. However, there are a some caveats due to the colocation of `*.rb` and `*.rbi` files in the same project. These issues should not otherwise manifest when this library is used as a dependency.

1. For go to definition usages, sorbet might get confused and may not always navigate to the correct location.

2. For each generic type in `*.rbi` files, a spurious "Duplicate type member" error is present.

## Documentation Preview

To preview the documentation, run:

```bash
$ bundle exec rake docs:preview [PORT=8808]
```
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT
PATH
remote: .
specs:
openai (0.1.0.pre.alpha.4)
openai (0.1.0.pre.alpha.5)
connection_pool

GEM
Expand Down
Loading
Loading