Skip to content

Commit e6bd47f

Browse files
authored
Merge pull request #350 from alexrudall/remove-completions
Remove deprecated completions endpoint
2 parents e30f5c2 + cf7454b commit e6bd47f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+33268
-17384
lines changed

README.md

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -257,21 +257,6 @@ end
257257
# => "The weather is nice 🌞"
258258
```
259259

260-
### Completions
261-
262-
Hit the OpenAI API for a completion using other GPT-3 models:
263-
264-
```ruby
265-
response = client.completions(
266-
parameters: {
267-
model: "text-davinci-001",
268-
prompt: "Once upon a time",
269-
max_tokens: 5
270-
})
271-
puts response["choices"].map { |c| c["text"] }
272-
# => [", there lived a great"]
273-
```
274-
275260
### Edits
276261

277262
Send a string and some instructions for what to do to the string:
@@ -357,16 +342,15 @@ response = client.finetunes.retrieve(id: fine_tune_id)
357342
fine_tuned_model = response["fine_tuned_model"]
358343
```
359344

360-
This fine-tuned model name can then be used in completions:
345+
This fine-tuned model name can then be used in chats:
361346

362347
```ruby
363-
response = client.completions(
348+
response = client.chat(
364349
parameters: {
365350
model: fine_tuned_model,
366-
prompt: "I love Mondays!"
367-
}
368-
)
369-
response.dig("choices", 0, "text")
351+
messages: [{ role: "user", content: "I love Mondays!"}]
352+
})
353+
puts response.dig("choices", 0, "message", "content")
370354
```
371355

372356
You can delete the fine-tuned model when you are done with it:

lib/openai/client.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ def chat(parameters: {})
2525
json_post(path: "/chat/completions", parameters: parameters)
2626
end
2727

28-
def completions(parameters: {})
29-
json_post(path: "/completions", parameters: parameters)
30-
end
31-
3228
def edits(parameters: {})
3329
json_post(path: "/edits", parameters: parameters)
3430
end

spec/fixtures/cassettes/audio_whisper-1_transcribe.yml

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/fixtures/cassettes/audio_whisper-1_translate.yml

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/fixtures/cassettes/babbage-similarity_embeddings_the_food_was_delicious_and_the_waiter_.yml

Lines changed: 19 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/fixtures/cassettes/edits_text-davinci-edit-001_there_are_7_days_in_a_wek_and_between_28_and_31_in_a_month_.yml

Lines changed: 30 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/fixtures/cassettes/files_content.yml

Lines changed: 58 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)