openai_ruby 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 973ae690504a531c6b3b95415d622346a7fedca7e1fe7d2b509fe689fa733f7a
4
- data.tar.gz: ec6b40954dccffbed531aad98b79458061eb1cba7e88b370d30a639c891352c2
3
+ metadata.gz: 33013deb6a09941565ac13e9b3ee5de96d220b54c5c18f691201312237625ed1
4
+ data.tar.gz: f0e635b8af085b9111f83e3575e125a6de7a931793df2f75cca27f84abb6ccac
5
5
  SHA512:
6
- metadata.gz: 379578031e02141ee8ce4b7949cd08c84a98806cfdeb277a12e1a46f4a0394d59a402007b566ab4247bafda0daa646869866b6fc1bd29acebf338d312bbce76d
7
- data.tar.gz: e8a1fc7ee1822493e11b1e1b4eb318491af75252b2873040379f102ce997961d0afa23e1a9abff40459d89a7af6a81c29418f22487287c379bcf23aae8b83d3a
6
+ metadata.gz: e8b07aafb4694d054618c56808fd8e9fd12d246f24003c5d8ad1672dff02a75e9c91c2d656f0e537e9f25dfe2d1402a84ec3f0d0f8491a1310b06c936b483b09
7
+ data.tar.gz: f32b7a3a048742c1d2ec478ede1082176ad00a7351ee7b9de094ab2e2315e7153b2de3c641d5474ba85109b21eddbe334209c4800060dd87bb89e8433e553765
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![Build Status](https://travis-ci.org/renny-ren/openai_ruby.svg?branch=main)](https://travis-ci.org/renny-ren/openai_ruby)
5
5
  [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/renny-ren/openai_ruby/blob/main/LICENSE)
6
6
 
7
- This is a Ruby wrapper for [OpenAI API](https://openai.com/api/), which provides convenient access to the OpenAI API from applications written in Ruby.
7
+ This is a Ruby wrapper for [OpenAI API](https://platform.openai.com/docs/api-reference), which provides convenient access to the OpenAI API from applications written in Ruby.
8
8
 
9
9
  Let's build next-gen apps with OpenAI’s powerful models.
10
10
 
@@ -18,20 +18,18 @@ module OpenAI
18
18
  )
19
19
  end
20
20
 
21
- def create_chat_completion(params = {}, &block)
21
+ def create_chat_completion(params = {})
22
22
  if params[:stream]
23
23
  connection.post("/v1/chat/completions") do |req|
24
24
  req.body = params.to_json
25
- req.options.on_data = Proc.new do |chunk, overall_received_bytes, env|
26
- block.call(chunk, overall_received_bytes, env)
25
+ req.options.on_data = proc do |chunk, overall_received_bytes, env|
26
+ if block_given?
27
+ yield(chunk, overall_received_bytes, env)
28
+ end
27
29
  end
28
30
  end
29
31
  else
30
- connection.post(
31
- "/v1/chat/completions",
32
- params.to_json,
33
- headers
34
- )
32
+ connection.post("/v1/chat/completions", params.to_json, headers)
35
33
  end
36
34
  end
37
35
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenAI
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openai_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renny Ren
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-24 00:00:00.000000000 Z
11
+ date: 2023-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday