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 +4 -4
- data/lib/llm/function.rb +12 -0
- data/lib/llm/message.rb +3 -0
- data/lib/llm/providers/openai/responses.rb +1 -3
- data/lib/llm/version.rb +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: 41efcc6a142e5863b3b1d2ab1b1c8a452b5c8e8098bf48918c3bd5b16abfcdd2
|
4
|
+
data.tar.gz: d2bfdfd690070d6dbca8411874d2970e470b37ed67139976026120b2806e3421
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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