openai-chat 0.0.5 → 0.0.6
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 +4 -4
- data/Gemfile.lock +3 -4
- data/lib/openai/chat/version.rb +1 -1
- data/lib/openai/chat.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33fa16d428155bce4e84924c956ef0160c8fbd8017cba7ac2b49960fcd19e76b
|
4
|
+
data.tar.gz: d88f0ce48660060ef4c861140f55e717616cbd49b78aeb210a66c93e8bcfdb17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71541948f4136d1048ce5f76a3f1b700acf8e7af0cdd6eaf7cbf8467b7704ea887e7d1c3d70680f68a8b281bf7b6e9b37507a0eb79b1786a04610639253df8fd
|
7
|
+
data.tar.gz: 7a3084c8338814583994bfee6e4da7b972d1d53084a87f6a9a04b02f3931965a9a9ab6c330a8fba58fb8b1668bef3cdf888d1d2af57a9f3a96b23c8aa38fbc70
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
openai-chat (0.0.
|
4
|
+
openai-chat (0.0.2)
|
5
5
|
mime-types (~> 3.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -42,10 +42,10 @@ GEM
|
|
42
42
|
language_server-protocol (3.17.0.4)
|
43
43
|
lint_roller (1.1.0)
|
44
44
|
logger (1.6.6)
|
45
|
-
mime-types (3.6.
|
45
|
+
mime-types (3.6.0)
|
46
46
|
logger
|
47
47
|
mime-types-data (~> 3.2015)
|
48
|
-
mime-types-data (3.2025.
|
48
|
+
mime-types-data (3.2025.0304)
|
49
49
|
minitest (5.25.4)
|
50
50
|
parallel (1.26.3)
|
51
51
|
parser (3.3.7.1)
|
@@ -114,7 +114,6 @@ GEM
|
|
114
114
|
|
115
115
|
PLATFORMS
|
116
116
|
arm64-darwin-23
|
117
|
-
arm64-darwin-24
|
118
117
|
x86_64-linux
|
119
118
|
|
120
119
|
DEPENDENCIES
|
data/lib/openai/chat/version.rb
CHANGED
data/lib/openai/chat.rb
CHANGED
@@ -4,13 +4,12 @@
|
|
4
4
|
|
5
5
|
module OpenAI
|
6
6
|
class Chat
|
7
|
-
attr_accessor :messages, :schema, :model
|
7
|
+
attr_accessor :messages, :schema, :model
|
8
8
|
|
9
9
|
def initialize(api_token: nil)
|
10
10
|
@api_token = api_token || ENV.fetch("OPENAI_TOKEN")
|
11
11
|
@messages = []
|
12
12
|
@model = "gpt-4.1-nano"
|
13
|
-
@temperature = 0
|
14
13
|
end
|
15
14
|
|
16
15
|
def system(content)
|
@@ -115,8 +114,7 @@ module OpenAI
|
|
115
114
|
request_body_hash = {
|
116
115
|
"model" => model,
|
117
116
|
"response_format" => response_format,
|
118
|
-
"messages" => messages
|
119
|
-
"temperature" => temperature
|
117
|
+
"messages" => messages
|
120
118
|
}
|
121
119
|
|
122
120
|
request_body_json = JSON.generate(request_body_hash)
|
@@ -138,7 +136,7 @@ module OpenAI
|
|
138
136
|
end
|
139
137
|
|
140
138
|
def inspect
|
141
|
-
"#<#{self.class.name} @messages=#{messages.inspect} @model=#{@model.inspect} @schema=#{@schema.inspect}
|
139
|
+
"#<#{self.class.name} @messages=#{messages.inspect} @model=#{@model.inspect} @schema=#{@schema.inspect}>"
|
142
140
|
end
|
143
141
|
|
144
142
|
private
|
@@ -151,7 +149,9 @@ module OpenAI
|
|
151
149
|
# Attempt to parse as a URL.
|
152
150
|
begin
|
153
151
|
uri = URI.parse(obj)
|
154
|
-
|
152
|
+
if uri.is_a?(URI::HTTP) || uri.is_a?(URI::HTTPS)
|
153
|
+
return :url
|
154
|
+
end
|
155
155
|
rescue URI::InvalidURIError
|
156
156
|
# Not a valid URL; continue to check if it's a file path.
|
157
157
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openai-chat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Raghu Betina
|
8
8
|
- Jelani Woods
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-05-
|
11
|
+
date: 2025-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types
|