ox-ai-workers 0.1.1 → 0.2.1

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: cdc74e4ff15dab4e67681666575aacb9a57d05183caaaa18982cbff7bdeea280
4
- data.tar.gz: 3e7e8f0c6cec85b1b6b6857d395f5ee05a48904e157d99a72d82bd60429d0970
3
+ metadata.gz: 8b3b4eb6c020db58b365cb68881b30440eb11e30513237a3ff7dca7260274d3e
4
+ data.tar.gz: b5382e6983a58bd732c428c311072ffacd6fbece4d65a47e32033ce70a219610
5
5
  SHA512:
6
- metadata.gz: af5d143c8a8ad34c6f65f5b576076785848b16736025177358bcf2cc87c062b8ded0f2dec8f9b4d44635c3ed8ade86085daed0b075e1f7c59b152149d5f41397
7
- data.tar.gz: d6754f9a006e04829d02ff7b32844b4179c0318371cbc8b573de37fc4552a3c3d9533d8665d847682e5e2af937a1c133ee14d7c28883bce0fdbd426ab1e5812e
6
+ metadata.gz: 84868bddc15e283d49b6ff586f90a5eb6abfc8ea09f53a8ab22a656cf09e5198ae44a08eff90a399097c9a321de2c37546c514220607d9bc643f8309040169df
7
+ data.tar.gz: 1c27771f8ace9608d603f27e96bad758b901fbe90596ed69d679793ee5ac5603b7da7086e6c0fb1ed924426d81ad4468bbe380a0bda9a080ab2888599f4c45e6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.0] - 2024-07-30
4
+ - fix missing require 'open3'
5
+ - fix Steps
6
+ - cli: oxaiworkers init
7
+
3
8
  ## [0.1.1] - 2024-07-29
4
9
 
5
10
  - Fix Delayed Requests
data/README.md CHANGED
@@ -35,11 +35,14 @@ require 'ox-ai-workers'
35
35
  sysop = OxAiWorkers::Assistant::Sysop.new(delayed: false, model: "gpt-4o")
36
36
 
37
37
  # Add a task
38
- sysop.addTask("Add a cron job to synchronize files daily.")
38
+ sysop.setTask("Add a cron job to synchronize files daily.")
39
+
40
+ # Add a response to the assistant's question.
41
+ sysop.addResponse("blah-blah-blah")
39
42
  ```
40
43
 
41
44
  ```ruby
42
- worker = OxAiWorkers::DelayedRequest.new(batch_id: "xxx-xxx-xxx", model: "gpt-4o-mini", max_tokens: 4096, temperature: 0.7)
45
+ worker = OxAiWorkers::DelayedRequest.new(model: "gpt-4o-mini", max_tokens: 4096, temperature: 0.7)
43
46
  # or
44
47
  # worker = OxAiWorkers::Request.new(model: "gpt-4o-mini", max_tokens: 4096, temperature: 0.7)
45
48
  my_tool = OxAiWorkers::Tool::Eval.new()
@@ -74,7 +77,7 @@ iterator = OxAiWorkers::Iterator.new(
74
77
  role: "You are a software agent inside my computer"
75
78
  )
76
79
 
77
- iterator.addTask("Show files in current dir")
80
+ iterator.addTask("Show files in current directory.")
78
81
  ```
79
82
 
80
83
  ## Features
data/exe/oxaiworkers ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fileutils'
4
+
5
+ if ARGV.first == "init"
6
+ dir = '.oxaiworkers-local'
7
+ dest = "#{Dir.pwd}/#{dir}"
8
+ source = File.expand_path('../../', __FILE__)
9
+
10
+ FileUtils.mkdir_p dir + "/locales"
11
+ FileUtils.copy_entry source + "/locales", dest + "/locales"
12
+ FileUtils.cp(source+"/bin/console", dest)
13
+ end
data/lib/ox-ai-workers.rb CHANGED
@@ -20,6 +20,8 @@ require_relative "oxaiworkers/iterator.rb"
20
20
  require_relative "oxaiworkers/request.rb"
21
21
  require_relative "oxaiworkers/tool/eval.rb"
22
22
  require_relative "oxaiworkers/version.rb"
23
+
24
+ require_relative "oxaiworkers/assistant/module_base.rb"
23
25
  require_relative "oxaiworkers/assistant/sysop.rb"
24
26
 
25
27
  module OxAiWorkers
@@ -0,0 +1,22 @@
1
+ module OxAiWorkers
2
+ module Assistant
3
+ module ModuleBase
4
+ attr_accessor :iterator
5
+
6
+ def setTask task
7
+ @iterator.cleanup()
8
+ @iterator.addTask task
9
+ end
10
+
11
+ def addResponse text
12
+ @iterator.addTask text
13
+ end
14
+
15
+ def initWorker delayed:, model:
16
+ worker = delayed ? OxAiWorkers::DelayedRequest.new : OxAiWorkers::Request.new
17
+ worker.model = model || OxAiWorkers.configuration.model
18
+ worker
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,13 +1,14 @@
1
1
  module OxAiWorkers
2
2
  module Assistant
3
3
  class Sysop
4
- attr_accessor :iterator
4
+ include OxAiWorkers::Assistant::ModuleBase
5
+
5
6
  def initialize delayed: false, model: nil
6
- worker = delayed ? OxAiWorkers::DelayedRequest.new : OxAiWorkers::Request.new
7
- worker.model = model || OxAiWorkers.configuration.model
8
- @iterator = OxAiWorkers::Iterator.new(worker: worker, tools: [OxAiWorkers::Tool::Eval.new])
9
- @iterator.role = I18n.t("oxaiworkers.assistant.sysop.role")
10
- # @iterator.addTask("покажи мне файлы на диске")
7
+ @iterator = OxAiWorkers::Iterator.new(
8
+ worker: initWorker(delayed: delayed, model: model),
9
+ role: I18n.t("oxaiworkers.assistant.sysop.role"),
10
+ tools: [OxAiWorkers::Tool::Eval.new]
11
+ )
11
12
  end
12
13
  end
13
14
  end
@@ -21,17 +21,22 @@ class OxAiWorkers::Iterator < OxAiWorkers::StateTools
21
21
  def initialize(worker:, role: nil, tools: [])
22
22
  puts "call: #{__method__}"
23
23
  @worker = worker
24
- @messages = []
25
24
  @tools = [self] + tools
26
25
  @role = role
27
26
  @context = nil
27
+ @monologue = I18n.t("oxaiworkers.iterator.monologue")
28
+ cleanup()
29
+
30
+ super()
31
+ end
32
+
33
+ def cleanup
28
34
  @result = nil
29
35
  @queue = []
30
- @monologue = I18n.t("oxaiworkers.iterator.monologue")
31
36
  @tasks = []
32
37
  @milestones = []
33
-
34
- super()
38
+ @messages = []
39
+ completeIteration()
35
40
  end
36
41
 
37
42
  def innerMonologue speach:
@@ -60,7 +60,7 @@ class OxAiWorkers::ModuleRequest
60
60
  end
61
61
 
62
62
  def parseChoices(response)
63
- puts response.inspect
63
+ # puts response.inspect
64
64
  @tool_calls = []
65
65
  @result = response.dig("choices", 0, "message", "content")
66
66
  @tool_calls_raw = response.dig("choices", 0, "message", "tool_calls")
@@ -1,16 +1,7 @@
1
1
  # frozen_string_literal: true
2
+ require 'open3'
2
3
 
3
4
  module OxAiWorkers::Tool
4
- #
5
- # A calculator tool that falls back to the Google calculator widget
6
- #
7
- # Gem requirements:
8
- # gem "eqn", "~> 1.6.5"
9
- # gem "google_search_results", "~> 2.0.0"
10
- #
11
- # Usage:
12
- # calculator = OxAiWorkers::Tool::Calculator.new
13
- #
14
5
  class Eval
15
6
  extend OxAiWorkers::ToolDefinition
16
7
  include OxAiWorkers::DependencyHelper
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OxAiWorkers
4
- VERSION = "0.1.1"
4
+ VERSION = "0.2.1"
5
5
  end
6
6
 
@@ -15,11 +15,11 @@ en:
15
15
  text: "Listing important facts and nuances"
16
16
  monologue:
17
17
  - "Step 1: Develop your own solution to the problem. Take initiative and make assumptions."
18
- - "Step 1.1: Wrap all your work for this step in the innerMonologue function."
18
+ - "Step 1.1: Wrap all your work for this step in the ox_ai_workers_iterator__innerMonologue function."
19
19
  - "Step 2: Relate your solution to the task, improve it, and call the necessary functions step by step."
20
- - "Step 2.1: Interact with the user using the outerVoice and actionRequest functions during the process."
21
- - "Step 3: When the solution is ready, report it using the outerVoice function."
22
- - "Step 4: Save facts, nuances, and actions using the packHistory function."
20
+ - "Step 2.1: Interact with the user using the ox_ai_workers_iterator__outerVoice and ox_ai_workers_iterator__actionRequest functions during the process."
21
+ - "Step 3: When the solution is ready, report it using the ox_ai_workers_iterator__outerVoice function."
22
+ - "Step 4: Save facts, nuances, and actions using the ox_ai_workers_iterator__packHistory function."
23
23
  tool:
24
24
  eval:
25
25
  ruby:
@@ -15,11 +15,11 @@ ru:
15
15
  text: Перечисление важных фактов и нюансов
16
16
  monologue:
17
17
  - Шаг 1. Разработай собственное решение проблемы. Проявляй инициативу и делай предположения.
18
- - Шаг 1.1. Заключи все свои наработки для этого шага в функцию innerMonologue.
18
+ - Шаг 1.1. Заключи все свои наработки для этого шага в функцию ox_ai_workers_iterator__innerMonologue.
19
19
  - Шаг 2. Соотнеси свое решение с задачей, улучшай его и вызывай необходимые функции шаг за шагом.
20
- - Шаг 2.1. Во время работы используй функции outerVoice и actionRequest.
21
- - Шаг 3. Когда решение готово, сообщи о нем с помощью функции outerVoice.
22
- - Шаг 4. Сохрани факты, нюансы и действия с помощью функции packHistory.
20
+ - Шаг 2.1. Во время работы используй функции ox_ai_workers_iterator__outerVoice и ox_ai_workers_iterator__actionRequest.
21
+ - Шаг 3. Когда решение готово, сообщи о нем с помощью функции ox_ai_workers_iterator__outerVoice
22
+ - Шаг 4. Сохрани факты, нюансы и действия с помощью функции ox_ai_workers_iterator__packHistory и предложи дальнейшие действия с помощью функции ox_ai_workers_iterator__actionRequest.
23
23
  tool:
24
24
  eval:
25
25
  ruby:
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.1.1
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Smolev
@@ -107,7 +107,8 @@ description: |2
107
107
  - Ease of Use: Intuitive syntax and documentation make it easy to get started with the gem.
108
108
  email:
109
109
  - smolev@me.com
110
- executables: []
110
+ executables:
111
+ - oxaiworkers
111
112
  extensions: []
112
113
  extra_rdoc_files: []
113
114
  files:
@@ -116,7 +117,9 @@ files:
116
117
  - LICENSE
117
118
  - README.md
118
119
  - Rakefile
120
+ - exe/oxaiworkers
119
121
  - lib/ox-ai-workers.rb
122
+ - lib/oxaiworkers/assistant/module_base.rb
120
123
  - lib/oxaiworkers/assistant/sysop.rb
121
124
  - lib/oxaiworkers/compatibility.rb
122
125
  - lib/oxaiworkers/delayed_request.rb