llm.rb 0.14.1 → 0.14.2

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: 1b5d6ed41bd22685f456bdd30f90bb462b1d8c89d63b496862c241cd2a9a11ff
4
- data.tar.gz: feb10f6589c89741ed978a5bd9eb96c228649fd4348ff93b7fa222e3a4d6fd1a
3
+ metadata.gz: 41efcc6a142e5863b3b1d2ab1b1c8a452b5c8e8098bf48918c3bd5b16abfcdd2
4
+ data.tar.gz: d2bfdfd690070d6dbca8411874d2970e470b37ed67139976026120b2806e3421
5
5
  SHA512:
6
- metadata.gz: b922ffea8f415e50ab5a33e16bfe40d9dc9f8875fefccb6e1ad1afe0001ab3e3b52e2f5389d152ecf65f68913af57b6bada63eff25121a9b0d45013072f813c4
7
- data.tar.gz: f930afdee74629503347f2115c0e9a4a734282cbade8591804988d910ac5180ef26a727d937cd496a76a46f3aa100548e61e103b7edaa6b57e35d8aa4552eb2f
6
+ metadata.gz: 7a10131e21e424e4620b155ef4e8fd23617aecc5ee9141e6a6f0e09b99b042286992f6b27299502f0d7664a92c62e520bf99a7f8aa0836ba0973292c74ab5d80
7
+ data.tar.gz: 57e5110fc829a790ae064c5a52b2ae856fd5566b5256444148008dd9f3dc170b3cbf57fda0c09f7ecc5630215c0c7e236375d063943d9b791a034359569c7ecb
data/lib/llm/function.rb CHANGED
@@ -140,6 +140,18 @@ class LLM::Function
140
140
  {name: @name, description: @description, parameters: @params}.compact
141
141
  when "LLM::Anthropic"
142
142
  {name: @name, description: @description, input_schema: @params}.compact
143
+ else
144
+ format_openai(provider)
145
+ end
146
+ end
147
+
148
+ def format_openai(provider)
149
+ case provider.class.to_s
150
+ when "LLM::OpenAI::Responses"
151
+ {
152
+ type: "function", name: @name, description: @description,
153
+ parameters: @params.to_h.merge(additionalProperties: false), strict: true
154
+ }.compact
143
155
  else
144
156
  {
145
157
  type: "function", name: @name,
data/lib/llm/message.rb CHANGED
@@ -118,6 +118,9 @@ module LLM
118
118
  end
119
119
 
120
120
  ##
121
+ # @note
122
+ # This method returns a response for assistant messages,
123
+ # and it returns nil for non-assistant messages
121
124
  # @return [LLM::Response, nil]
122
125
  # Returns the response associated with the message, or nil
123
126
  def response
@@ -75,9 +75,7 @@ class LLM::OpenAI
75
75
 
76
76
  private
77
77
 
78
- [:headers, :execute,
79
- :set_body_stream, :format_schema,
80
- :format_tools].each do |m|
78
+ [:headers, :execute, :set_body_stream].each do |m|
81
79
  define_method(m) { |*args, **kwargs, &b| @provider.send(m, *args, **kwargs, &b) }
82
80
  end
83
81
 
data/lib/llm/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LLM
4
- VERSION = "0.14.1"
4
+ VERSION = "0.14.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: llm.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.1
4
+ version: 0.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antar Azri