ox-ai-workers 1.0.2.1 → 1.0.3
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/ox-ai-workers.rb +2 -1
- data/lib/oxaiworkers/iterator.rb +18 -5
- data/lib/oxaiworkers/models/anthropic_max.rb +14 -0
- data/lib/oxaiworkers/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 838a2c53f4ce2423cd215d9cda21c76fe5870f709e528b3de491666b25b7b516
|
4
|
+
data.tar.gz: 7c55a9076dcbd3f4e21222a5b2300d1677e08fcdfe0d9ae0f186c88b0206585b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f642f834e477f074fffda948b505bcce54381369391e05f3ca54acb0943d87e3dc78ff050c2f9b8cb507ad2f3754fd86355dd0e32495e9bc00a04cea95d1b0d6
|
7
|
+
data.tar.gz: 55464fe188ebea0a2c73a07c1c91e381cec4d16faa24755b803c527671db6185b95fc022104db5670d2a79d65cc6ad7c28b5992655c5926a5da64d3ea3a9fd63
|
data/lib/ox-ai-workers.rb
CHANGED
@@ -61,7 +61,7 @@ module OxAiWorkers
|
|
61
61
|
|
62
62
|
class Configuration
|
63
63
|
attr_accessor :max_tokens, :temperature, :wait_for_complete, :access_token_deepseek, :access_token_openai,
|
64
|
-
:access_token_stability, :access_token_wolfram
|
64
|
+
:access_token_stability, :access_token_wolfram, :access_token_anthropic
|
65
65
|
|
66
66
|
def initialize
|
67
67
|
@max_tokens = DEFAULT_MAX_TOKEN
|
@@ -72,6 +72,7 @@ module OxAiWorkers
|
|
72
72
|
@access_token_openai = nil
|
73
73
|
@access_token_stability = nil
|
74
74
|
@access_token_wolfram = nil
|
75
|
+
@access_token_anthropic = nil
|
75
76
|
|
76
77
|
[Array, NilClass, String, Symbol, Hash].each do |c|
|
77
78
|
c.send(:include, OxAiWorkers::PresentCompat) unless c.method_defined?(:present?)
|
data/lib/oxaiworkers/iterator.rb
CHANGED
@@ -217,7 +217,7 @@ module OxAiWorkers
|
|
217
217
|
end
|
218
218
|
|
219
219
|
if @worker.tool_calls.present?
|
220
|
-
@queue << { role: :assistant, content: @worker.tool_calls_raw.to_s }
|
220
|
+
# @queue << { role: :assistant, content: @worker.tool_calls_raw.to_s }
|
221
221
|
@worker.tool_calls.each do |external_call|
|
222
222
|
tool = ([self] + @tools).select do |t|
|
223
223
|
tool_name = t.respond_to?(:tool_name) ? t.tool_name : t.class.tool_name
|
@@ -226,13 +226,26 @@ module OxAiWorkers
|
|
226
226
|
next if tool.nil?
|
227
227
|
|
228
228
|
@call_id += 1
|
229
|
+
# Add tool call message in the correct format
|
229
230
|
out = tool.send(external_call[:name], **external_call[:args])
|
230
|
-
@queue << {
|
231
|
-
|
231
|
+
@queue << {
|
232
|
+
role: :assistant,
|
233
|
+
tool_calls: [{
|
234
|
+
id: "call_#{@call_id}",
|
235
|
+
type: 'function',
|
236
|
+
function: {
|
237
|
+
name: external_call[:name],
|
238
|
+
arguments: external_call[:args].to_json
|
239
|
+
}
|
240
|
+
}]
|
241
|
+
}
|
232
242
|
@queue << if out.present?
|
233
|
-
{ role: :tool,
|
243
|
+
{ role: :tool,
|
244
|
+
content: out,
|
245
|
+
tool_call_id: "call_#{@call_id}" }
|
234
246
|
else
|
235
|
-
{ role: :tool,
|
247
|
+
{ role: :tool,
|
248
|
+
content: "Tool call #{external_call[:name]} successful.",
|
236
249
|
tool_call_id: "call_#{@call_id}" }
|
237
250
|
end
|
238
251
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OxAiWorkers
|
4
|
+
module Models
|
5
|
+
class AnthropicMax < LLMBase
|
6
|
+
def initialize(uri_base: nil, api_key: nil, model: nil, max_tokens: nil, temperature: nil, frequency_penalty: nil)
|
7
|
+
@model = model || 'claude-3-7-sonnet-latest'
|
8
|
+
@uri_base = uri_base || 'https://api.anthropic.com/v1/'
|
9
|
+
@api_key = api_key || OxAiWorkers.configuration.access_token_anthropic
|
10
|
+
super(uri_base:, api_key: @api_key, model: @model, max_tokens:, temperature:, frequency_penalty:)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/oxaiworkers/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ox-ai-workers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Smolev
|
@@ -157,6 +157,7 @@ files:
|
|
157
157
|
- lib/oxaiworkers/image_iterator.rb
|
158
158
|
- lib/oxaiworkers/iterator.rb
|
159
159
|
- lib/oxaiworkers/load_i18n.rb
|
160
|
+
- lib/oxaiworkers/models/anthropic_max.rb
|
160
161
|
- lib/oxaiworkers/models/deepseek_max.rb
|
161
162
|
- lib/oxaiworkers/models/images_base.rb
|
162
163
|
- lib/oxaiworkers/models/llm_base.rb
|