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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33177f5c822272383d00d96fadd552db0b966af7ddb2ec494538ca8cace7fadf
4
- data.tar.gz: e3f756943f16fb8be2823f493156e261eb2d4d02a99d9c0373e8a3ed606c8726
3
+ metadata.gz: 838a2c53f4ce2423cd215d9cda21c76fe5870f709e528b3de491666b25b7b516
4
+ data.tar.gz: 7c55a9076dcbd3f4e21222a5b2300d1677e08fcdfe0d9ae0f186c88b0206585b
5
5
  SHA512:
6
- metadata.gz: a64203d85443d9b812c2d36aa0718283fb21fd784043a4d1346ec96a3386bec3766f4ed127d41c1c6f149af7abb4af6241fad089caf72b058037b7bc323b08cb
7
- data.tar.gz: f0e1ec3b3be53fbe00f31dddc6e16e6a3befb7457d307cbc9906160b02e94bc66d8d18ec1c0095c2e6a53c9d48d4f256515da6ac0ea1ae4bb327ab07fb0772a0
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?)
@@ -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 << { role: :assistant,
231
- content: "Tool call #{external_call[:name]} completed." }
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, content: out, tool_call_id: "call_#{@call_id}" }
243
+ { role: :tool,
244
+ content: out,
245
+ tool_call_id: "call_#{@call_id}" }
234
246
  else
235
- { role: :tool, content: "Tool call #{external_call[:name]} successful.",
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OxAiWorkers
4
- VERSION = '1.0.2.1'
4
+ VERSION = '1.0.3'
5
5
  end
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.2.1
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