Skip to content

Commit 876a940

Browse files
fix: inaccuracies in the README.md
1 parent 5965652 commit 876a940

File tree

2 files changed

+18
-28
lines changed

2 files changed

+18
-28
lines changed

README.md

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ gem "openai", "~> 0.1.0.pre.alpha.3"
2020

2121
<!-- x-release-please-end -->
2222

23-
To fetch an initial copy of the gem:
24-
25-
```sh
26-
bundle install
27-
```
28-
2923
## Usage
3024

3125
```ruby
@@ -36,14 +30,13 @@ openai = OpenAI::Client.new(
3630
api_key: "My API Key" # defaults to ENV["OPENAI_API_KEY"]
3731
)
3832

39-
chat_completion =
40-
openai.chat.completions.create(
41-
messages: [{
42-
role: "user",
43-
content: "Say this is a test"
44-
}],
45-
model: "gpt-4o"
46-
)
33+
chat_completion = openai.chat.completions.create(
34+
messages: [{
35+
role: "user",
36+
content: "Say this is a test"
37+
}],
38+
model: "gpt-4o"
39+
)
4740

4841
puts(chat_completion)
4942
```
@@ -74,14 +67,13 @@ We provide support for streaming responses using Server Side Events (SSE).
7467
**coming soon:** `openai.chat.completions.stream` will soon come with Python SDK style higher level streaming responses support.
7568

7669
```ruby
77-
stream =
78-
openai.chat.completions.stream_raw(
79-
messages: [{
80-
role: "user",
81-
content: "Say this is a test"
82-
}],
83-
model: "gpt-4o"
84-
)
70+
stream = openai.chat.completions.stream_raw(
71+
messages: [{
72+
role: "user",
73+
content: "Say this is a test"
74+
}],
75+
model: "gpt-4o"
76+
)
8577

8678
stream.each do |completion|
8779
puts(completion)
@@ -107,7 +99,7 @@ puts(file_object.id)
10799

108100
### Errors
109101

110-
When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `OpenAI::Error` will be thrown:
102+
When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `OpenAI::Errors::APIError` will be thrown:
111103

112104
```ruby
113105
begin
@@ -219,8 +211,7 @@ Due to limitations with the Sorbet type system, where a method otherwise can tak
219211
Please follow Sorbet's [setup guides](https://sorbet.org/docs/adopting) for best experience.
220212

221213
```ruby
222-
params =
223-
OpenAI::Models::Chat::CompletionCreateParams.new(
214+
params = OpenAI::Models::Chat::CompletionCreateParams.new(
224215
messages: [
225216
OpenAI::Models::ChatCompletionUserMessageParam.new(
226217
role: "user",
@@ -256,8 +247,7 @@ If you want to explicitly send an extra param, you can do so with the `extra_que
256247
To make requests to undocumented endpoints, you can make requests using `client.request`. Options on the client will be respected (such as retries) when making this request.
257248

258249
```ruby
259-
response =
260-
client.request(
250+
response = client.request(
261251
method: :post,
262252
path: '/undocumented/endpoint',
263253
query: {"dog": "woof"},

openai.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
88
s.summary = "Ruby library to access the OpenAI API"
99
s.authors = ["OpenAI"]
1010
s.email = "[email protected]"
11-
s.files = Dir["lib/**/*.rb", "rbi/**/*.rbi", "sig/**/*.rbs", "manifest.yaml"]
11+
s.files = Dir["lib/**/*.rb", "rbi/**/*.rbi", "sig/**/*.rbs", "manifest.yaml", "CHANGELOG.md", "SECURITY.md"]
1212
s.extra_rdoc_files = ["README.md"]
1313
s.required_ruby_version = ">= 3.0.0"
1414
s.add_dependency "connection_pool"

0 commit comments

Comments
 (0)