ox-ai-workers 0.1.1 → 0.2.0

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: b6d3516a02ebb121bdf02d3de27e78ca5c71b893efa9a25b69217b9260819f7a
4
+ data.tar.gz: 4ef7a7ef32d76506b5eb4e852d77a0cf979ba40c2ed74d4635081a774bf65d20
5
5
  SHA512:
6
- metadata.gz: af5d143c8a8ad34c6f65f5b576076785848b16736025177358bcf2cc87c062b8ded0f2dec8f9b4d44635c3ed8ade86085daed0b075e1f7c59b152149d5f41397
7
- data.tar.gz: d6754f9a006e04829d02ff7b32844b4179c0318371cbc8b573de37fc4552a3c3d9533d8665d847682e5e2af937a1c133ee14d7c28883bce0fdbd426ab1e5812e
6
+ metadata.gz: a432bb010d43b81c4041dd01ef5bf141ad3c2a61a44690dad1d4bd20efd2e206d8e28f1618c8f6137517a8366f0e0fe25a446893e3815393599a5ba5bc34434c
7
+ data.tar.gz: 7a3932acb7227a48970deed5f131d016f83340f137a97efc1fb9b9b98ba6a8668f7ce9cf5247d4540d9ecebd3388af82d4a2cb08f31a987ba85b15d208fbb82e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.0] - 2024-07-30
4
+ - fix missing require 'open3'
5
+ - fix Steps
6
+
3
7
  ## [0.1.1] - 2024-07-29
4
8
 
5
9
  - 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/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.0"
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.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Smolev
@@ -117,6 +117,7 @@ files:
117
117
  - README.md
118
118
  - Rakefile
119
119
  - lib/ox-ai-workers.rb
120
+ - lib/oxaiworkers/assistant/module_base.rb
120
121
  - lib/oxaiworkers/assistant/sysop.rb
121
122
  - lib/oxaiworkers/compatibility.rb
122
123
  - lib/oxaiworkers/delayed_request.rb