simple-openai-client 1.0.4 → 1.0.5
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 +2 -2
- data/simple-openai-client.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89976a4d61c06b3abb6f14fd7d67a69fd72ffeb236d588c236af5a6a335e01a4
|
4
|
+
data.tar.gz: 0eb2a967251c702cab294b9ffa221bd4dce2314b4241ec780b37eff9a1096d30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25a5c07a411f8cfba69407516d4c7944fa0d325ed7445463aed26c7a39770aab1c4eea970d494db36d6f821c3a0ffd3a6b64f5efc0f9903f5cc82bcc8208f3ff
|
7
|
+
data.tar.gz: 6bbb06f477bce4be636074c32e958c0bee87b2b988d24f7ffed5240ca20f9b5badeada0fbf812e0916895850eab4dfa9adefa7eee0990b732385595b9f09305d
|
data/lib/simple-openai-client.rb
CHANGED
@@ -53,7 +53,7 @@ class OpenAIClient
|
|
53
53
|
|
54
54
|
# Ask something to GPT.
|
55
55
|
# Return the response.
|
56
|
-
def ask(s, context: [])
|
56
|
+
def ask(s, context: [], function_to_call: nil)
|
57
57
|
# Use v1 chat completions endpoint (with functions support)
|
58
58
|
uri = URI("https://api.openai.com/v1/chat/completions")
|
59
59
|
|
@@ -73,7 +73,7 @@ class OpenAIClient
|
|
73
73
|
if self.functions.size > 0
|
74
74
|
request_body["functions"] = self.functions
|
75
75
|
# Important: enable function-calling
|
76
|
-
request_body["function_call"] = "
|
76
|
+
request_body["function_call"] = {"name" => function_to_call} if function_to_call
|
77
77
|
end
|
78
78
|
|
79
79
|
http = Net::HTTP.new(uri.host, uri.port)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'simple-openai-client'
|
3
|
-
s.version = '1.0.
|
3
|
+
s.version = '1.0.5'
|
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."
|