ox-ai-workers 0.9.8 → 0.9.9

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: cea51225b7b09bfd512c62960fc5e01f3bb6ed848e8efc6d72115ac6765ac254
4
- data.tar.gz: 3f355bf99d4a5d3101c3d8b2f8e7f4859509489bb857c50b49d3efba15dc086f
3
+ metadata.gz: 9fde2ab33d3d1b89a4b351ff58f6c9f4d85c9d667770d6d258e5ee8215655666
4
+ data.tar.gz: dbbd0c85cf70948b8c92342e3b57804bf0b62828a5276b29650e66a79ac34742
5
5
  SHA512:
6
- metadata.gz: b665b7c498647dc8c53fe9bd538f3db34c424fc2277b4226e08e66faa0fbc3f3df5cc8d9d8a65301cca94c0b30b0241140565675486a0f2e70be55cbaf43ceef
7
- data.tar.gz: dcf0ef347b4e2017f69e09bc85bc99ffa785a4bf0d6ff565c292a0d8ee50fde675d49851766a25d9c473f67126d41185955365da303e4fe0272ad70e0b9a4b3c
6
+ metadata.gz: a6b1b2e7494c478266ba2044db4545006a28d2d7be61eeb62309b40eb360f8b5eed41672657c0e5b87c5efb0d2424572b5618df128b093f1e58b4eee9e49ea29
7
+ data.tar.gz: '00697510a6c17ce5a98b9460b4446fece185a5f618286e18c7ae28907d3c7ddaa17a480648342dd947a73373bb61a7fa34353b967e22449f8acd7812e4ead33e'
data/CHANGELOG.md CHANGED
@@ -1,7 +1,8 @@
1
1
 
2
- ## [0.9.8] - 2025-05-12
2
+ ## [0.9.9] - 2025-05-12
3
3
 
4
4
  - Added `strict` parameter for `define_function`
5
+ - Added `Wolfram` tool
5
6
 
6
7
  ## [0.9.6] - 2025-05-10
7
8
 
data/README.md CHANGED
@@ -569,6 +569,26 @@ OxAiWorkers provides several specialized tools to extend functionality:
569
569
 
570
570
  Provides functions for generating images with customizable parameters like size and quality, with ability to save generated images to disk.
571
571
 
572
+ - **Wolfram**: Query the Wolfram Alpha computational knowledge engine
573
+
574
+ ```ruby
575
+ `gem "wolfram-alpha", github: "neonix20b/wolfram-alpha"`
576
+ ```
577
+
578
+ ```ruby
579
+ OxAiWorkers.configuration.access_token_wolfram = 'YOUR_WOLFRAM_API_KEY'
580
+ ```
581
+
582
+ ```ruby
583
+ # Initialize with optional parameters
584
+ wolfram = OxAiWorkers::Tool::Wolfram.new(
585
+ access_token: 'YOUR_WOLFRAM_API_KEY', # Optional: API key
586
+ location: 'Berlin' # Optional: Location to use for the query
587
+ )
588
+ ```
589
+
590
+ This tool enables access to Wolfram Alpha's vast computational intelligence for performing complex mathematical calculations, solving equations, accessing scientific data, and answering knowledge-based queries with precise, authoritative results.
591
+
572
592
  - **Pipeline**: Assistant coordination and communication tool
573
593
 
574
594
  ```ruby
@@ -44,4 +44,9 @@ en:
44
44
  prompt: 'Text description of the image to generate on **English language**'
45
45
  size: 'Size of the generated image'
46
46
  quality: 'Quality of the generated image'
47
- file_name: 'File name for saving the generated image in png format. For example: image.png'
47
+ file_name: 'File name for saving the generated image in png format. For example: image.png'
48
+ wolfram_alpha:
49
+ ask:
50
+ description: 'Wolfram Alpha Tool: Query the Wolfram Alpha computational knowledge engine'
51
+ prompt: 'The query to send to Wolfram Alpha'
52
+ location: 'Location information to provide context for the query'
@@ -49,3 +49,8 @@ ru:
49
49
  description: 'Инструмент редактирования изображений: Редактирует изображение на основе предоставленного текстового запроса.'
50
50
  input_image: 'URL или путь к изображению для редактирования'
51
51
  prompt: 'Текстовое описание действий для редактирования изображения'
52
+ wolfram_alpha:
53
+ ask:
54
+ description: 'Инструмент Wolfram Alpha: Запрос к вычислительной базе знаний Wolfram Alpha'
55
+ prompt: 'Запрос для отправки в Wolfram Alpha'
56
+ location: 'Информация о местоположении для контекста запроса'
data/lib/ox-ai-workers.rb CHANGED
@@ -28,6 +28,7 @@ require_relative 'oxaiworkers/tool/database'
28
28
  require_relative 'oxaiworkers/tool/file_system'
29
29
  require_relative 'oxaiworkers/tool/pipeline'
30
30
  require_relative 'oxaiworkers/tool/pixels'
31
+ require_relative 'oxaiworkers/tool/wolfram'
31
32
 
32
33
  require_relative 'oxaiworkers/assistant/module_base'
33
34
  require_relative 'oxaiworkers/assistant/sysop'
@@ -58,7 +59,7 @@ module OxAiWorkers
58
59
 
59
60
  class Configuration
60
61
  attr_accessor :max_tokens, :temperature, :wait_for_complete, :access_token_deepseek, :access_token_openai,
61
- :access_token_stability
62
+ :access_token_stability, :access_token_wolfram
62
63
 
63
64
  def initialize
64
65
  @max_tokens = DEFAULT_MAX_TOKEN
@@ -68,6 +69,7 @@ module OxAiWorkers
68
69
  @access_token_deepseek = nil
69
70
  @access_token_openai = nil
70
71
  @access_token_stability = nil
72
+ @access_token_wolfram = nil
71
73
 
72
74
  [Array, NilClass, String, Symbol, Hash].each do |c|
73
75
  c.send(:include, OxAiWorkers::PresentCompat) unless c.method_defined?(:present?)
@@ -0,0 +1,52 @@
1
+ require 'fileutils'
2
+ require 'open-uri'
3
+
4
+ module OxAiWorkers
5
+ module Tool
6
+ class Wolfram
7
+ include OxAiWorkers::ToolDefinition
8
+ include OxAiWorkers::DependencyHelper
9
+ include OxAiWorkers::LoadI18n
10
+
11
+ attr_accessor :access_token, :location
12
+
13
+ def initialize(only: nil, access_token: nil, location: nil)
14
+ store_locale
15
+
16
+ init_white_list_with only
17
+
18
+ define_function :ask, description: I18n.t('oxaiworkers.tool.wolfram_alpha.ask.description') do
19
+ property :prompt, type: 'string', description: I18n.t('oxaiworkers.tool.wolfram_alpha.ask.prompt'),
20
+ required: true
21
+ if location.nil?
22
+ property :location, type: 'string', description: I18n.t('oxaiworkers.tool.wolfram_alpha.ask.location'),
23
+ required: true
24
+ end
25
+ end
26
+
27
+ @access_token = access_token
28
+ @location = location
29
+ end
30
+
31
+ def ask(prompt:, location: nil)
32
+ location ||= @location
33
+ options = { location: }
34
+ api_key = @access_token || OxAiWorkers.configuration.access_token_wolfram
35
+ @wolfram ||= WolframAlpha::Client.new api_key, options.compact
36
+ response = @wolfram.query prompt
37
+ input = response['Input'] # Get the input interpretation pod.
38
+ result = ''
39
+ result = "Input interpretation:\n#{input.subpods.map(&:plaintext).join("\n")}\n\n" unless input.nil?
40
+ result += response.pods.map { |p| [p.title, p.subpods.map(&:plaintext).join("\n")].join(":\n") }.join("\n\n")
41
+ images = []
42
+ %w[Plots Result Image].each do |title|
43
+ plot = response.find { |pod| pod.title == title }
44
+ images += plot.subpods.map { |img| img&.image } unless plot.nil?
45
+ end
46
+ images = images.compact.filter { |i| i[:type] != 'Default' }.uniq
47
+ result += "\n\n" + images.map { |img| "![#{img[:alt]}](\"#{img[:src]}\")" }.join("\n") unless images.empty?
48
+ result
49
+ end
50
+ end
51
+ end
52
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OxAiWorkers
4
- VERSION = '0.9.8'
4
+ VERSION = '0.9.9'
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: 0.9.8
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Smolev
@@ -177,6 +177,7 @@ files:
177
177
  - lib/oxaiworkers/tool/file_system.rb
178
178
  - lib/oxaiworkers/tool/pipeline.rb
179
179
  - lib/oxaiworkers/tool/pixels.rb
180
+ - lib/oxaiworkers/tool/wolfram.rb
180
181
  - lib/oxaiworkers/tool_definition.rb
181
182
  - lib/oxaiworkers/version.rb
182
183
  - lib/ruby/ox-ai-workers.rb