simple-openai-client 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/simple-openai-client.rb +6 -1
- data/simple-openai-client.gemspec +2 -2
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c14118266582c1aab20eaf87badf7ecbd547e97040eabe674ce7b118d1945352
|
4
|
+
data.tar.gz: 1b3f51fac5d7be0160aeb5f5939e78ad175a414824081d20c2401765ae47a675
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e082c4e9176c5a87d7d56d1ceb7756473b280cf84eb93d7f375a018dbf64dfe24969e6ecd9efe3b0366592c6ec0ef8692e73ebc198f0b37195f22c89e0f7163
|
7
|
+
data.tar.gz: 2a9eeb217d03d5e5d90a4855601bc69903398bfc40354a628c4abd65a8fb6d24c2818d848e6bed1f0fbbf461fbc6704177acb79fc44c592236a339ff76f5422b
|
data/lib/simple-openai-client.rb
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
require 'net/http'
|
6
6
|
require 'uri'
|
7
7
|
require 'json'
|
8
|
+
require 'colorize'
|
8
9
|
|
9
10
|
class OpenAIClient
|
10
11
|
attr_accessor :api_key, :model, :messages, :functions, :callbacks, :version
|
@@ -69,7 +70,11 @@ class OpenAIClient
|
|
69
70
|
# If you want the model to call a function explicitly, you can add: "function_call" => "auto"
|
70
71
|
}
|
71
72
|
|
72
|
-
|
73
|
+
if self.functions.size > 0
|
74
|
+
request_body["functions"] = self.functions
|
75
|
+
# Important: enable function-calling
|
76
|
+
request_body["function_call"] = "auto"
|
77
|
+
end
|
73
78
|
|
74
79
|
http = Net::HTTP.new(uri.host, uri.port)
|
75
80
|
http.use_ssl = true
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'simple-openai-client'
|
3
|
-
s.version = '1.0.
|
4
|
-
s.date = '2025-01-
|
3
|
+
s.version = '1.0.4'
|
4
|
+
s.date = '2025-01-18'
|
5
5
|
s.summary = "Very simple Ruby library for operating OpenAI API for building Agents."
|
6
6
|
s.description = "Very simple Ruby library for operating OpenAI API for building Agents."
|
7
7
|
s.authors = ["Leandro Daniel Sardi"]
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-openai-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leandro Daniel Sardi
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
10
|
+
date: 2025-01-18 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: uri
|
@@ -142,7 +141,6 @@ homepage: https://github.com/leandrosardi/simple-openai-client
|
|
142
141
|
licenses:
|
143
142
|
- MIT
|
144
143
|
metadata: {}
|
145
|
-
post_install_message:
|
146
144
|
rdoc_options: []
|
147
145
|
require_paths:
|
148
146
|
- lib
|
@@ -157,8 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
155
|
- !ruby/object:Gem::Version
|
158
156
|
version: '0'
|
159
157
|
requirements: []
|
160
|
-
rubygems_version: 3.3
|
161
|
-
signing_key:
|
158
|
+
rubygems_version: 3.6.3
|
162
159
|
specification_version: 4
|
163
160
|
summary: Very simple Ruby library for operating OpenAI API for building Agents.
|
164
161
|
test_files: []
|