simple-openai-client 1.0.4 → 1.0.5

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: c14118266582c1aab20eaf87badf7ecbd547e97040eabe674ce7b118d1945352
4
- data.tar.gz: 1b3f51fac5d7be0160aeb5f5939e78ad175a414824081d20c2401765ae47a675
3
+ metadata.gz: 89976a4d61c06b3abb6f14fd7d67a69fd72ffeb236d588c236af5a6a335e01a4
4
+ data.tar.gz: 0eb2a967251c702cab294b9ffa221bd4dce2314b4241ec780b37eff9a1096d30
5
5
  SHA512:
6
- metadata.gz: 8e082c4e9176c5a87d7d56d1ceb7756473b280cf84eb93d7f375a018dbf64dfe24969e6ecd9efe3b0366592c6ec0ef8692e73ebc198f0b37195f22c89e0f7163
7
- data.tar.gz: 2a9eeb217d03d5e5d90a4855601bc69903398bfc40354a628c4abd65a8fb6d24c2818d848e6bed1f0fbbf461fbc6704177acb79fc44c592236a339ff76f5422b
6
+ metadata.gz: 25a5c07a411f8cfba69407516d4c7944fa0d325ed7445463aed26c7a39770aab1c4eea970d494db36d6f821c3a0ffd3a6b64f5efc0f9903f5cc82bcc8208f3ff
7
+ data.tar.gz: 6bbb06f477bce4be636074c32e958c0bee87b2b988d24f7ffed5240ca20f9b5badeada0fbf812e0916895850eab4dfa9adefa7eee0990b732385595b9f09305d
@@ -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"] = "auto"
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.4'
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."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-openai-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi