openai-chat 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 543ce4c08a3a9770e84a643b690239101aff7fc586a836524ba5a35fb2d9afc6
4
- data.tar.gz: 2ea37a2cef4aa16f9e8f659490fb890bc9fc369391708cb8539656ade79fc5a3
3
+ metadata.gz: 82f44ec692941bead59c002656f2bf520b4bfa61228ece8e885e2c96fb946e1a
4
+ data.tar.gz: e88e9127a305b73a6407f8cbb34725187c1c30f981c1008c672a8c18146673cd
5
5
  SHA512:
6
- metadata.gz: c3ae2d72a8c9280b2bfccbd46a00522abeef0e34744602e566f471f504347f79e3769e435fa8ac6087b0cf2cc57a1fdfbacdd888bf825df0335f273948b8578a
7
- data.tar.gz: d9f73de9aa9b3fb61f4edddbfc88787451c4be91e8c0a0846c945633dde28a3226697af3658572eca5a194c5b80dd4c57c4ce1d6cc4133d9a6bf692dd07da6c2
6
+ metadata.gz: bacb325cadef5c7d6846d550041b11e207e26681707d0ef399926d6e87196594bf06a29211dc4825b0134d4b9067c5129f9422e0260a6c78d2f127d02b665f56
7
+ data.tar.gz: 13f1ffa286c1627c2777390177d84dc5dfc96b33293a072370e938de0b18e9fbb898e4cfcd080118231502b3fb107e47b11370fae6e753cef589b632a9e286c7
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --format documentation
3
+ --color
data/.standard.yml ADDED
@@ -0,0 +1,11 @@
1
+ ruby_version: 2.0
2
+ fix: true
3
+ parallel: true
4
+
5
+ ignore:
6
+ - 'vendor/**/*'
7
+ - 'spec/fixtures/**/*'
8
+ - 'spec/vcr_cassettes/**/*'
9
+ - '*.md'
10
+ - '*.markdown'
11
+ - 'LICENSE*'
data/CHANGELOG.md CHANGED
@@ -3,3 +3,9 @@
3
3
  ## [0.0.1] - 2025-02-27
4
4
 
5
5
  - Initial release
6
+
7
+ ## [0.0.2] - 2025-02-28
8
+
9
+ - All dependencies have been removed
10
+ - Supports Ruby 2.0.0
11
+ - Updates gem author
data/Gemfile CHANGED
@@ -4,7 +4,3 @@ source "https://rubygems.org"
4
4
 
5
5
  # Specify your gem's dependencies in draft_chat.gemspec
6
6
  gemspec
7
-
8
- gem "activesupport", "~> 2.3", ">= 2.3.5"
9
- gem "http", "~> 5.2", ">= 5.2.0"
10
- gem "json", "~> 2.6", ">= 2.6.0"
data/Gemfile.lock CHANGED
@@ -1,47 +1,129 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openai-chat (0.0.1)
5
- activesupport (~> 2.3, >= 2.3.5)
6
- http (~> 5.2, >= 5.2.0)
7
- json (~> 2.6, >= 2.6.0)
4
+ openai-chat (0.0.3)
5
+ mime-types (~> 3.0)
8
6
 
9
7
  GEM
10
8
  remote: https://rubygems.org/
11
9
  specs:
12
- activesupport (2.3.18)
10
+ activesupport (8.0.1)
11
+ base64
12
+ benchmark (>= 0.3)
13
+ bigdecimal
14
+ concurrent-ruby (~> 1.0, >= 1.3.1)
15
+ connection_pool (>= 2.2.5)
16
+ drb
17
+ i18n (>= 1.6, < 2)
18
+ logger (>= 1.4.2)
19
+ minitest (>= 5.1)
20
+ securerandom (>= 0.3)
21
+ tzinfo (~> 2.0, >= 2.0.5)
22
+ uri (>= 0.13.1)
13
23
  addressable (2.8.7)
14
24
  public_suffix (>= 2.0.2, < 7.0)
25
+ ast (2.4.2)
15
26
  base64 (0.2.0)
16
- domain_name (0.6.20240107)
17
- ffi (1.17.1)
18
- ffi-compiler (1.3.2)
19
- ffi (>= 1.15.5)
20
- rake
21
- http (5.2.0)
22
- addressable (~> 2.8)
23
- base64 (~> 0.1)
24
- http-cookie (~> 1.0)
25
- http-form_data (~> 2.2)
26
- llhttp-ffi (~> 0.5.0)
27
- http-cookie (1.0.8)
28
- domain_name (~> 0.5)
29
- http-form_data (2.3.0)
27
+ benchmark (0.4.0)
28
+ bigdecimal (3.1.9)
29
+ concurrent-ruby (1.3.5)
30
+ connection_pool (2.5.0)
31
+ crack (1.0.0)
32
+ bigdecimal
33
+ rexml
34
+ diff-lcs (1.6.0)
35
+ drb (2.2.1)
36
+ factory_bot (6.5.1)
37
+ activesupport (>= 6.1.0)
38
+ hashdiff (1.1.2)
39
+ i18n (1.14.7)
40
+ concurrent-ruby (~> 1.0)
30
41
  json (2.10.1)
31
- llhttp-ffi (0.5.0)
32
- ffi-compiler (~> 1.0)
33
- rake (~> 13.0)
42
+ language_server-protocol (3.17.0.4)
43
+ lint_roller (1.1.0)
44
+ logger (1.6.6)
45
+ mime-types (3.6.0)
46
+ logger
47
+ mime-types-data (~> 3.2015)
48
+ mime-types-data (3.2025.0304)
49
+ minitest (5.25.4)
50
+ parallel (1.26.3)
51
+ parser (3.3.7.1)
52
+ ast (~> 2.4.1)
53
+ racc
34
54
  public_suffix (6.0.1)
55
+ racc (1.8.1)
56
+ rainbow (3.1.1)
35
57
  rake (13.2.1)
58
+ regexp_parser (2.10.0)
59
+ rexml (3.4.1)
60
+ rspec (3.13.0)
61
+ rspec-core (~> 3.13.0)
62
+ rspec-expectations (~> 3.13.0)
63
+ rspec-mocks (~> 3.13.0)
64
+ rspec-core (3.13.3)
65
+ rspec-support (~> 3.13.0)
66
+ rspec-expectations (3.13.3)
67
+ diff-lcs (>= 1.2.0, < 2.0)
68
+ rspec-support (~> 3.13.0)
69
+ rspec-mocks (3.13.2)
70
+ diff-lcs (>= 1.2.0, < 2.0)
71
+ rspec-support (~> 3.13.0)
72
+ rspec-support (3.13.2)
73
+ rubocop (1.69.2)
74
+ json (~> 2.3)
75
+ language_server-protocol (>= 3.17.0)
76
+ parallel (~> 1.10)
77
+ parser (>= 3.3.0.2)
78
+ rainbow (>= 2.2.2, < 4.0)
79
+ regexp_parser (>= 2.9.3, < 3.0)
80
+ rubocop-ast (>= 1.36.2, < 2.0)
81
+ ruby-progressbar (~> 1.7)
82
+ unicode-display_width (>= 2.4.0, < 4.0)
83
+ rubocop-ast (1.38.1)
84
+ parser (>= 3.3.1.0)
85
+ rubocop-performance (1.23.0)
86
+ rubocop (>= 1.48.1, < 2.0)
87
+ rubocop-ast (>= 1.31.1, < 2.0)
88
+ ruby-progressbar (1.13.0)
89
+ securerandom (0.4.1)
90
+ standard (1.43.0)
91
+ language_server-protocol (~> 3.17.0.2)
92
+ lint_roller (~> 1.0)
93
+ rubocop (~> 1.69.1)
94
+ standard-custom (~> 1.0.0)
95
+ standard-performance (~> 1.6)
96
+ standard-custom (1.0.2)
97
+ lint_roller (~> 1.0)
98
+ rubocop (~> 1.50)
99
+ standard-performance (1.6.0)
100
+ lint_roller (~> 1.1)
101
+ rubocop-performance (~> 1.23.0)
102
+ tzinfo (2.0.6)
103
+ concurrent-ruby (~> 1.0)
104
+ unicode-display_width (3.1.4)
105
+ unicode-emoji (~> 4.0, >= 4.0.4)
106
+ unicode-emoji (4.0.4)
107
+ uri (1.0.3)
108
+ vcr (6.3.1)
109
+ base64
110
+ webmock (3.25.0)
111
+ addressable (>= 2.8.0)
112
+ crack (>= 0.3.2)
113
+ hashdiff (>= 0.4.0, < 2.0.0)
36
114
 
37
115
  PLATFORMS
116
+ arm64-darwin-23
38
117
  x86_64-linux
39
118
 
40
119
  DEPENDENCIES
41
- activesupport (~> 2.3, >= 2.3.5)
42
- http (~> 5.2, >= 5.2.0)
43
- json (~> 2.6, >= 2.6.0)
120
+ factory_bot (~> 6.2)
44
121
  openai-chat!
122
+ rake (~> 13.0)
123
+ rspec (~> 3.12)
124
+ standard (~> 1.32)
125
+ vcr (~> 6.1)
126
+ webmock (~> 3.18)
45
127
 
46
128
  BUNDLED WITH
47
129
  2.3.7
data/README.md CHANGED
@@ -2,7 +2,40 @@
2
2
 
3
3
  This gem provides a class called `OpenAI::Chat` that is intended to make it as easy as possible to use OpenAI's Chat Completions endpoint.
4
4
 
5
- For example:
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem "openai-chat", github: "firstdraft/openai-chat"
11
+ ```
12
+
13
+ And then, at a command prompt:
14
+
15
+ ```
16
+ bundle install
17
+ ```
18
+
19
+ Or, install it directly with:
20
+
21
+ ```
22
+ gem install openai-chat
23
+ ```
24
+
25
+ ## Configuration
26
+
27
+ - By default, the gem assumes you have an environment variable called exactly `OPENAI_TOKEN`. If not, you can also provide your token when instantiating a chat:
28
+
29
+ ```ruby
30
+ x = OpenAI::Chat.new(api_token: "your-token-goes-here")
31
+ ```
32
+ - By default, the gem uses the `gpt-4o` model. If you want something else, you can set it:
33
+
34
+ ```ruby
35
+ x.model = "o3-mini"
36
+ ```
37
+
38
+ ## Simplest usage
6
39
 
7
40
  ```ruby
8
41
  x = OpenAI::Chat.new
@@ -10,12 +43,15 @@ x.system("You are a helpful assistant that speaks like Shakespeare.")
10
43
  x.user("Hi there!")
11
44
  x.assistant!
12
45
  # => "Greetings, good sir or madam! How dost thou fare on this fine day? Pray, tell me how I may be of service to thee."
46
+
13
47
  x.user("What's the best pizza in Chicago?")
14
48
  x.assistant!
15
49
  # => "Ah, the fair and bustling city of Chicago, renowned for its deep-dish delight that hath captured hearts and stomachs aplenty. Amongst the many offerings of this great city, 'tis often said that Lou Malnati's and Giordano's art the titans of the deep-dish realm. Lou Malnati's crust is praised for its buttery crispness, whilst Giordano's doth boast a stuffed creation that is nigh unto legendary. Yet, I encourage thee to embark upon thine own quest and savor the offerings of these famed establishments, for in the tasting lies the truth of which thy palate prefers. Enjoy the gastronomic adventure, my friend."
16
50
  ```
17
51
 
18
- Or, with Structured Output (I suggest using [OpenAI's handy tool for generating the JSON Schema](https://platform.openai.com/docs/guides/structured-outputs)):
52
+ ## Structured Output
53
+
54
+ Get back Structured Output by setting the `schema` attribute (I suggest using [OpenAI's handy tool for generating the JSON Schema](https://platform.openai.com/docs/guides/structured-outputs)):
19
55
 
20
56
  ```ruby
21
57
  x = OpenAI::Chat.new
@@ -26,46 +62,72 @@ x.assistant!
26
62
  # => {"fat"=>15, "protein"=>5, "carbs"=>50, "total_calories"=>350}
27
63
  ```
28
64
 
29
- More details:
65
+ ## Include images
30
66
 
31
- - By default, the gem assumes you have an environment variable called exactly `OPENAI_TOKEN`. If not, you can also provide your token when instantiating a chat:
67
+ You can include images in your chat messages using the `user` method with the `image` or `images` parameter:
32
68
 
33
- ```ruby
34
- x = OpenAI::Chat.new(api_token: "your-token-goes-here")
35
- ```
36
- - By default, the gem uses the `gpt-4o` model. If you want something else, you can set it:
69
+ ```ruby
70
+ # Send a single image
71
+ x.user("What's in this image?", image: "path/to/local/image.jpg")
37
72
 
38
- ```ruby
39
- x.model = "o3-mini"
40
- ```
41
- - You can call `.messages` to get an array containing the conversation so far.
42
- - You can manually set the assistant message
43
- ```rb
44
- x.assistant("Greetings, good sir or madam! How dost thou fare on this fine day? Pray, tell me how I may be of service to thee.")
45
- ```
73
+ # Send multiple images
74
+ x.user("What are these images showing?", images: ["path/to/image1.jpg", "https://example.com/image2.jpg"])
75
+ ```
46
76
 
47
- Enjoy!
77
+ The gem supports three types of image inputs:
48
78
 
49
- ## Installation
79
+ - URLs: Pass an image URL starting with `http://` or `https://`.
80
+ - File paths: Pass a string with a path to a local image file.
81
+ - File-like objects: Pass an object that responds to `read` (like `File.open("image.jpg")` or a Rails uploaded file).
50
82
 
51
- Add this line to your application's Gemfile:
83
+ You can send multiple images, and place them between bits of text, in a single user message:
84
+
85
+ ```ruby
86
+ z = OpenAI::Chat.new
87
+ z.user(
88
+ [
89
+ {"image" => "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6a/Eubalaena_glacialis_with_calf.jpg/215px-Eubalaena_glacialis_with_calf.jpg"},
90
+ {"text" => "What is in the above image? What is in the below image?"},
91
+ {"image" => "https://upload.wikimedia.org/wikipedia/commons/thumb/1/1a/Elephant_Diversity.jpg/305px-Elephant_Diversity.jpg"},
92
+ {"text" => "What are the differences between the images?"}
93
+ ]
94
+ )
95
+ z.assistant!
96
+ ```
97
+
98
+ Both string and symbol keys are supported for the hash items:
52
99
 
53
100
  ```ruby
54
- gem 'openai-chat'
101
+ z = OpenAI::Chat.new
102
+ z.user(
103
+ [
104
+ {image: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6a/Eubalaena_glacialis_with_calf.jpg/215px-Eubalaena_glacialis_with_calf.jpg"},
105
+ {text: "What is in the above image? What is in the below image?"},
106
+ {image: "https://upload.wikimedia.org/wikipedia/commons/thumb/1/1a/Elephant_Diversity.jpg/305px-Elephant_Diversity.jpg"},
107
+ {text: "What are the differences between the images?"}
108
+ ]
109
+ )
110
+ z.assistant!
55
111
  ```
56
112
 
57
- And then execute:
113
+ ## Set assistant messages manually
114
+
115
+ You can manually add assistant messages:
58
116
 
59
- $ bundle install
117
+ ```rb
118
+ x.assistant("Greetings, good sir or madam! How dost thou fare on this fine day? Pray, tell me how I may be of service to thee.")
119
+ ```
120
+
121
+ Useful if you are reconstructing old messages from a chat that has already happened.
60
122
 
61
- Or install it yourself as:
123
+ ## Getting and setting messages directly
62
124
 
63
- $ gem install openai-chat
125
+ - You can call `.messages` to get an array containing the conversation so far.
126
+ - TODO: Setting `.messages` will replace the conversation with the provided array.
64
127
 
65
128
  ## TODOs
66
129
 
67
130
  - Add a `reasoning_effort` parameter.
68
- - Add the ability to send images.
69
131
  - Add the ability to set all messages at once, ideally with an ActiveRecord Relation.
70
132
  - Add a way to access the whole API response body (rather than just the message content).
71
133
  - Add specs.
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+ require "standard/rake"
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ desc "Run standardrb and rspec tests"
10
+ task default: [:standard, :spec]
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OpenAI
4
4
  class Chat
5
- VERSION = "0.0.1"
5
+ VERSION = "0.0.3"
6
6
  end
7
7
  end
data/lib/openai/chat.rb CHANGED
@@ -1,74 +1,210 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "openai/chat/version"
3
+ # All dependencies are now required in the main openai-chat.rb file
4
4
 
5
5
  module OpenAI
6
6
  class Chat
7
- require "active_support/core_ext/object/blank"
8
- require "http"
9
- require "json"
10
-
11
7
  attr_accessor :messages, :schema, :model
12
-
8
+
13
9
  def initialize(api_token: nil)
14
10
  @api_token = api_token || ENV.fetch("OPENAI_TOKEN")
15
11
  @messages = []
16
12
  @model = "gpt-4o"
17
13
  end
18
-
14
+
19
15
  def system(content)
20
- messages.push({role: "system", content:})
16
+ messages.push({role: "system", content: content})
21
17
  end
22
-
23
- def user(content)
24
- messages.push({role: "user", content:})
18
+
19
+ def user(content, image: nil, images: nil)
20
+ if content.is_a?(Array)
21
+ processed_content = content.map do |item|
22
+ if item.key?("image") || item.key?(:image)
23
+ image_value = item.fetch("image") { item.fetch(:image) }
24
+ {
25
+ type: "image_url",
26
+ image_url: {
27
+ url: process_image(image_value)
28
+ }
29
+ }
30
+ elsif item.key?("text") || item.key?(:text)
31
+ text_value = item.fetch("text") { item.fetch(:text) }
32
+ {
33
+ type: "text",
34
+ text: text_value
35
+ }
36
+ else
37
+ item
38
+ end
39
+ end
40
+
41
+ messages.push(
42
+ {
43
+ role: "user",
44
+ content: processed_content
45
+ }
46
+ )
47
+ elsif image.nil? && images.nil?
48
+ messages.push(
49
+ {
50
+ role: "user",
51
+ content: content
52
+ }
53
+ )
54
+ else
55
+ text_and_images_array = [
56
+ {
57
+ type: "text",
58
+ text: content
59
+ }
60
+ ]
61
+
62
+ if images && !images.empty?
63
+ images_array = images.map do |image|
64
+ {
65
+ type: "image_url",
66
+ image_url: {
67
+ url: process_image(image)
68
+ }
69
+ }
70
+ end
71
+
72
+ text_and_images_array += images_array
73
+ else
74
+ text_and_images_array.push(
75
+ {
76
+ type: "image_url",
77
+ image_url: {
78
+ url: process_image(image)
79
+ }
80
+ }
81
+ )
82
+ end
83
+
84
+ messages.push(
85
+ {
86
+ role: "user",
87
+ content: text_and_images_array
88
+ }
89
+ )
90
+ end
25
91
  end
26
92
 
27
93
  def assistant(content)
28
- messages.push({role: "assistant", content:})
94
+ messages.push({role: "assistant", content: content})
29
95
  end
30
96
 
31
97
  def assistant!
32
98
  request_headers_hash = {
33
99
  "Authorization" => "Bearer #{@api_token}",
34
- "content-type" => "application/json",
100
+ "content-type" => "application/json"
35
101
  }
36
-
37
- response_format = if schema.present?
102
+
103
+ response_format = if schema.nil?
38
104
  {
39
- "type" => "json_schema",
40
- "json_schema" => JSON.parse(schema)
105
+ "type" => "text"
41
106
  }
42
107
  else
43
108
  {
44
- "type" => "text"
109
+ "type" => "json_schema",
110
+ "json_schema" => JSON.parse(schema)
45
111
  }
46
112
  end
47
-
113
+
48
114
  request_body_hash = {
49
115
  "model" => model,
50
116
  "response_format" => response_format,
51
117
  "messages" => messages
52
118
  }
53
-
119
+
54
120
  request_body_json = JSON.generate(request_body_hash)
55
-
56
- raw_response = HTTP.headers(request_headers_hash).post(
57
- "https://api.openai.com/v1/chat/completions",
58
- :body => request_body_json,
59
- ).to_s
60
-
61
- parsed_response = JSON.parse(raw_response)
62
-
121
+
122
+ uri = URI("https://api.openai.com/v1/chat/completions")
123
+ raw_response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
124
+ request = Net::HTTP::Post.new(uri, request_headers_hash)
125
+ request.body = request_body_json
126
+ http.request(request)
127
+ end
128
+
129
+ parsed_response = JSON.parse(raw_response.body)
130
+
63
131
  content = parsed_response.fetch("choices").at(0).fetch("message").fetch("content")
64
-
65
- messages.push({role: "assistant", content:})
66
-
67
- schema.present? ? JSON.parse(content) : content
132
+
133
+ messages.push({role: "assistant", content: content})
134
+
135
+ schema.nil? ? content : JSON.parse(content)
68
136
  end
69
137
 
70
138
  def inspect
71
139
  "#<#{self.class.name} @messages=#{messages.inspect} @model=#{@model.inspect} @schema=#{@schema.inspect}>"
72
140
  end
141
+
142
+ private
143
+
144
+ # Custom exception class for input classification errors.
145
+ class InputClassificationError < StandardError; end
146
+
147
+ def classify_obj(obj)
148
+ if obj.is_a?(String)
149
+ # Attempt to parse as a URL.
150
+ begin
151
+ uri = URI.parse(obj)
152
+ if uri.is_a?(URI::HTTP) || uri.is_a?(URI::HTTPS)
153
+ return :url
154
+ end
155
+ rescue URI::InvalidURIError
156
+ # Not a valid URL; continue to check if it's a file path.
157
+ end
158
+
159
+ # Check if the string represents a local file path (must exist on disk).
160
+ if File.exist?(obj)
161
+ :file_path
162
+ else
163
+ raise InputClassificationError,
164
+ "String provided is neither a valid URL (must start with http:// or https://) nor an existing file path on disk. Received value: #{obj.inspect}"
165
+ end
166
+ elsif obj.respond_to?(:read)
167
+ # For non-String objects, check if it behaves like a file.
168
+ :file_like
169
+ else
170
+ raise InputClassificationError,
171
+ "Object provided is neither a String nor file-like (missing :read method). Received value: #{obj.inspect}"
172
+ end
173
+ end
174
+
175
+ def process_image(obj)
176
+ case classify_obj(obj)
177
+ when :url
178
+ obj
179
+ when :file_path
180
+ file_path = obj
181
+
182
+ mime_type = MIME::Types.type_for(file_path).first.to_s
183
+
184
+ image_data = File.binread(file_path)
185
+
186
+ base64_string = Base64.strict_encode64(image_data)
187
+
188
+ "data:#{mime_type};base64,#{base64_string}"
189
+ when :file_like
190
+ filename = if obj.respond_to?(:path)
191
+ obj.path
192
+ elsif obj.respond_to?(:original_filename)
193
+ obj.original_filename
194
+ else
195
+ "unknown"
196
+ end
197
+
198
+ mime_type = MIME::Types.type_for(filename).first.to_s
199
+ mime_type = "image/jpeg" if mime_type.empty?
200
+
201
+ image_data = obj.read
202
+ obj.rewind if obj.respond_to?(:rewind)
203
+
204
+ base64_string = Base64.strict_encode64(image_data)
205
+
206
+ "data:#{mime_type};base64,#{base64_string}"
207
+ end
208
+ end
73
209
  end
74
210
  end
data/lib/openai-chat.rb CHANGED
@@ -1 +1,11 @@
1
+ # All gem dependencies
2
+ require "mime/types"
3
+ require "base64"
4
+ require "json"
5
+ require "net/http"
6
+ require "pathname"
7
+ require "uri"
8
+
9
+ # Internal gem files
10
+ require "openai/chat/version"
1
11
  require "openai/chat"
metadata CHANGED
@@ -1,90 +1,132 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openai-chat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
+ - Raghu Betina
7
8
  - Jelani Woods
8
- autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-27 00:00:00.000000000 Z
11
+ date: 2025-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: activesupport
14
+ name: mime-types
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.3'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 2.3.5
19
+ version: '3.0'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '2.3'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 2.3.5
26
+ version: '3.0'
33
27
  - !ruby/object:Gem::Dependency
34
- name: http
28
+ name: rake
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
31
  - - "~>"
38
32
  - !ruby/object:Gem::Version
39
- version: '5.2'
40
- - - ">="
33
+ version: '13.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
41
39
  - !ruby/object:Gem::Version
42
- version: 5.2.0
43
- type: :runtime
40
+ version: '13.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.12'
48
+ type: :development
44
49
  prerelease: false
45
50
  version_requirements: !ruby/object:Gem::Requirement
46
51
  requirements:
47
52
  - - "~>"
48
53
  - !ruby/object:Gem::Version
49
- version: '5.2'
50
- - - ">="
54
+ version: '3.12'
55
+ - !ruby/object:Gem::Dependency
56
+ name: factory_bot
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '6.2'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
51
67
  - !ruby/object:Gem::Version
52
- version: 5.2.0
68
+ version: '6.2'
53
69
  - !ruby/object:Gem::Dependency
54
- name: json
70
+ name: webmock
55
71
  requirement: !ruby/object:Gem::Requirement
56
72
  requirements:
57
73
  - - "~>"
58
74
  - !ruby/object:Gem::Version
59
- version: '2.6'
60
- - - ">="
75
+ version: '3.18'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
61
81
  - !ruby/object:Gem::Version
62
- version: 2.6.0
63
- type: :runtime
82
+ version: '3.18'
83
+ - !ruby/object:Gem::Dependency
84
+ name: vcr
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '6.1'
90
+ type: :development
64
91
  prerelease: false
65
92
  version_requirements: !ruby/object:Gem::Requirement
66
93
  requirements:
67
94
  - - "~>"
68
95
  - !ruby/object:Gem::Version
69
- version: '2.6'
70
- - - ">="
96
+ version: '6.1'
97
+ - !ruby/object:Gem::Dependency
98
+ name: standard
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.32'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
71
109
  - !ruby/object:Gem::Version
72
- version: 2.6.0
110
+ version: '1.32'
73
111
  description: This gem provides a class called `OpenAI::Chat` that is intended to make
74
112
  it as easy as possible to use OpenAI's Chat Completions endpoint. Supports Structured
75
113
  Output.
76
114
  email:
115
+ - raghu@firstdraft.com
77
116
  - jelani@firstdraft.com
78
117
  executables: []
79
118
  extensions: []
80
119
  extra_rdoc_files: []
81
120
  files:
121
+ - ".rspec"
122
+ - ".standard.yml"
82
123
  - CHANGELOG.md
83
124
  - CODE_OF_CONDUCT.md
84
125
  - Gemfile
85
126
  - Gemfile.lock
86
127
  - LICENSE.txt
87
128
  - README.md
129
+ - Rakefile
88
130
  - lib/openai-chat.rb
89
131
  - lib/openai/chat.rb
90
132
  - lib/openai/chat/version.rb
@@ -95,7 +137,6 @@ metadata:
95
137
  homepage_uri: https://github.com/firstdraft/openai-chat
96
138
  source_code_uri: https://github.com/firstdraft/openai-chat
97
139
  changelog_uri: https://github.com/firstdraft/openai-chat/blob/main/CHANGELOG.md
98
- post_install_message:
99
140
  rdoc_options: []
100
141
  require_paths:
101
142
  - lib
@@ -103,15 +144,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
103
144
  requirements:
104
145
  - - ">="
105
146
  - !ruby/object:Gem::Version
106
- version: 2.6.0
147
+ version: 2.0.0
107
148
  required_rubygems_version: !ruby/object:Gem::Requirement
108
149
  requirements:
109
150
  - - ">="
110
151
  - !ruby/object:Gem::Version
111
152
  version: '0'
112
153
  requirements: []
113
- rubygems_version: 3.3.7
114
- signing_key:
154
+ rubygems_version: 3.6.5
115
155
  specification_version: 4
116
156
  summary: This gem provides a class called `OpenAI::Chat` that is intended to make
117
157
  it as easy as possible to use OpenAI's Chat Completions endpoint.