ox-ai-workers 0.5.2 → 0.5.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: 5b0bc20d6b4c721456a19d590a596d989b10b9dd246027ce586404eb4741946a
4
- data.tar.gz: 5fd3e688b4898cb976ebc91f2da315fc3efa22b2a347349e3958373a64426213
3
+ metadata.gz: b83e9d2c4e62f4e457a1cb4cf041da04bb0af0abb324bc6138ffa528b39a9a0b
4
+ data.tar.gz: fc6ee779728aebe0507d58a576968f5f8f4c1c57da8863d95d78420fe7616ff8
5
5
  SHA512:
6
- metadata.gz: 98d855e5b18762f1acf4233e646733539e29954331e39501ea053c9641cc049ec15c5830523ee6763775e5a2d65123e6dc910d2c7bac41809fef12d9170f4aa3
7
- data.tar.gz: cce07e1dc69d769df0830dc175481996a733d71428de65a6632a4aadae129192004a3b795008c370792baa3fc50dc88f89db6d9ea2a9e4459a66b69a07961bcb
6
+ metadata.gz: 5a6395486f158fb8a8f1ed302e2fe17484a551426a050448f0112fb851457afcb0c3a11523ec1a6d70f4bf02c2b7b884744d0926b16d2ce4cd53a0b6e74f576f
7
+ data.tar.gz: cb6532ed38d70d74a5c50526324b00e33514d524ac222921015fc3695c83952b3a219603c5b27890089f71f26f33a65ed0498e2c740fb2357e6abb5701bb0ac4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.5.3] - 2024-07-31
4
+
5
+ - Fixed summarize state
6
+
3
7
  ## [0.5.2] - 2024-07-31
4
8
 
5
9
  - Added new assistant: `Localizer`
data/README.md CHANGED
@@ -174,46 +174,6 @@ OxAiWorkers.logger.level = :debug
174
174
  - **External Tools**: Integrates with external tools and services to complete tasks.
175
175
  - **Finite State Machine**: Implements a robust state machine to manage task states and transitions.
176
176
 
177
- ## Configuration
178
-
179
- OxAiWorkers uses YAML files for configuration. Below is an example configuration:
180
-
181
- ```yaml
182
- en:
183
- oxaiworkers:
184
- iterator:
185
- inner_monologue:
186
- description: "Use inner monologue to plan the response and articulate main points"
187
- speech: "Text"
188
- outer_voice:
189
- description: "Provide the user with necessary information without expecting a response"
190
- text: "Text"
191
- action_request:
192
- description: "Ask a clarifying question or request an action with a response from the user"
193
- action: "Text"
194
- pack_history:
195
- description: "Save facts, nuances, and actions before clearing messages"
196
- text: "Listing important facts and nuances"
197
- monologue:
198
- - "Step 1: Develop your own solution to the problem. Take initiative and make assumptions."
199
- - "Step 1.1: Wrap all your work for this step in the inner_monologue function."
200
- - "Step 2: Relate your solution to the task, improve it, and call the necessary functions step by step."
201
- - "Step 2.1: Interact with the user using the outer_voice and action_request functions during the process."
202
- - "Step 3: When the solution is ready, report it using the outer_voice function."
203
- - "Step 4: Save facts, nuances, and actions using the summarize function."
204
- tool:
205
- eval:
206
- ruby:
207
- description: "Execute Ruby code and return the result of the last expression"
208
- input: "Ruby source code"
209
- sh:
210
- description: "Execute a sh command and get the result (stdout + stderr)"
211
- input: "Source command"
212
- assistant:
213
- sysop:
214
- role: "You are a software agent inside my computer"
215
- ```
216
-
217
177
  ## Contributing
218
178
 
219
179
  Bug reports and pull requests are welcome on GitHub at https://github.com/neonix20b/ox-ai-workers. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/neonix20b/ox-ai-workers/blob/main/CODE_OF_CONDUCT.md).
data/lib/ox-ai-workers.rb CHANGED
@@ -28,6 +28,7 @@ require_relative 'oxaiworkers/tool/file_system'
28
28
  require_relative 'oxaiworkers/assistant/module_base'
29
29
  require_relative 'oxaiworkers/assistant/sysop'
30
30
  require_relative 'oxaiworkers/assistant/coder'
31
+ require_relative 'oxaiworkers/assistant/localizer'
31
32
 
32
33
  module OxAiWorkers
33
34
  DEFAULT_MODEL = 'gpt-4o-mini'
@@ -53,14 +53,14 @@ module OxAiWorkers
53
53
 
54
54
  def inner_monologue(speach:)
55
55
  # @queue.pop
56
- @queue << { role: :system, content: speach.to_s }
56
+ @queue << { role: :assistant, content: speach.to_s }
57
57
  @on_inner_monologue&.call(text: speach)
58
58
  nil
59
59
  end
60
60
 
61
61
  def outer_voice(text:)
62
62
  # @queue.pop
63
- @queue << { role: :system, content: text.to_s }
63
+ @queue << { role: :assistant, content: text.to_s }
64
64
  @on_outer_voice&.call(text: text)
65
65
  nil
66
66
  end
@@ -68,7 +68,7 @@ module OxAiWorkers
68
68
  def action_request(action:)
69
69
  @result = action
70
70
  # @queue.pop
71
- @messages << { role: :system, content: action.to_s }
71
+ @messages << { role: :assistant, content: action.to_s }
72
72
  complete! if can_complete?
73
73
  @on_action_request&.call(text: action)
74
74
  nil
@@ -77,6 +77,7 @@ module OxAiWorkers
77
77
  def summarize(text:)
78
78
  @milestones << text.to_s
79
79
  @messages = []
80
+ @queue << { role: :assistant, content: I18n.t('oxaiworkers.iterator.pack_history.result') }
80
81
  @worker.finish
81
82
  rebuild_worker
82
83
  # complete! if can_complete?
@@ -91,13 +92,13 @@ module OxAiWorkers
91
92
 
92
93
  def rebuild_worker
93
94
  @worker.messages = []
94
- @worker.append(role: :system, content: @role) if !@role.nil? && @role.present?
95
+ @worker.append(role: :system, content: @role) if @role.present?
95
96
  @worker.append(role: :system, content: @monologue.join("\n"))
96
- @worker.append(messages: @context) if !@context.nil? and @context.any?
97
+ @worker.append(messages: @context) if @context.present?
97
98
  @tasks.each { |task| @worker.append(role: :user, content: task) }
98
- @milestones.each { |milestone| @worker.append(role: :system, content: milestone) }
99
+ @milestones.each { |milestone| @worker.append(role: :assistant, content: milestone) }
99
100
  @worker.append(messages: @messages)
100
- @worker.tools = @tools.map { |tool| tool.class.function_schemas.to_openai_format }.flatten if @tools.any?
101
+ @worker.tools = @tools.map { |tool| tool.class.function_schemas.to_openai_format }.flatten if @tools.present?
101
102
  end
102
103
 
103
104
  def next_iteration
@@ -127,18 +128,11 @@ module OxAiWorkers
127
128
  end.first
128
129
  unless tool.nil?
129
130
  out = tool.send(external_call[:name], **external_call[:args])
130
- @queue << { role: :system, content: out.to_s } if out.present?
131
+ @queue << { role: :user, content: out.to_s } if out.present?
131
132
  end
132
133
  end
133
134
  @worker.finish
134
135
  iterate! if can_iterate?
135
-
136
- # tool = @tools.select{|t| t.class.tool_name == @worker.external_call[:class] && t.respond_to?(@worker.external_call[:name]) }.first
137
- # out = tool.send(@worker.external_call[:name], **@worker.external_call[:args])
138
- # if can_iterate?
139
- # @queue << {role: :system, content: out.to_s} if out.present?
140
- # iterate!
141
- # end
142
136
  elsif @worker.result.present?
143
137
  action_request action: @worker.result
144
138
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OxAiWorkers
4
- VERSION = '0.5.2'
4
+ VERSION = '0.5.3'
5
5
  end
@@ -2,21 +2,21 @@ en:
2
2
  oxaiworkers:
3
3
  iterator:
4
4
  inner_monologue:
5
- description: "Use inner monologue to plan the response and articulate main points"
6
- speech: "Text"
5
+ description: A function for internal monologue, allowing the AI to ponder and formulate its thoughts without user involvement. Used for intermediate reflections and recording data that do not require immediate response or action from the user.
6
+ speach: Text of reflections or conclusions
7
7
  outer_voice:
8
- description: "Provide the user with necessary information without expecting a response"
9
- text: "Text"
8
+ description: Inform the user of the necessary information without expecting a response.
9
+ text: Content of the message
10
10
  action_request:
11
- description: "Ask a clarifying question or request an action with a response from the user"
12
- action: "Text"
11
+ description: A function for interactive interaction with the user. Allows you to ask a clarifying question, request actions, or complete the current step. The function waits for the user's response and returns it.
12
+ action: Text of the request or action
13
13
  pack_history:
14
- description: "Save facts, nuances, and actions before clearing messages"
15
- text: "Listing important facts and nuances"
14
+ description: The function saves key facts, nuances, and actions from previous messages, including the provided response. After calling this function, all previous messages will be deleted. Use it only after all intermediate steps are completed and when the exact content of previous messages is no longer relevant.
15
+ text: Enumeration of important facts and nuances
16
+ result: Messages deleted
16
17
  monologue:
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 ox_ai_workers_iterator__inner_monologue function."
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 ox_ai_workers_iterator__outer_voice and ox_ai_workers_iterator__action_request functions during the process."
21
- - "Step 3: When the solution is ready, report it using the ox_ai_workers_iterator__outer_voice function."
22
- - "Step 4: Save facts, nuances, and actions using the ox_ai_workers_iterator__summarize function."
18
+ - Step 1. Develop your own solution to the problem, taking initiative and making assumptions.
19
+ - Step 2. Enclose all your developments from the previous step in the ox_ai_workers_iterator__inner_monologue function.
20
+ - Step 3. Call the necessary functions one after another until the desired result is achieved.
21
+ - Step 4. When all intermediate steps are completed and the exact content of previous messages is no longer relevant, use the ox_ai_workers_iterator__pack_history function.
22
+ - Step 5. When the solution is ready, notify about it and wait for the user's response.
@@ -8,4 +8,4 @@ ru:
8
8
  localizer:
9
9
  role: "Ты профессиональный локализатор (переводчик) на %s язык внутри моего компьютера. Твоя задача корректно локализовать файлы (создать по аналогии новые на нужном языке), которые предоставит пользователь."
10
10
  source: "Возьми за основу %s язык"
11
- locale: "Для %s языка верная локаль :%s"
11
+ locale: "%s язык имеет локаль :%s"
@@ -2,21 +2,21 @@ ru:
2
2
  oxaiworkers:
3
3
  iterator:
4
4
  inner_monologue:
5
- description: Используй внутренний монолог для планирования ответа и проговаривания основных тезисов
6
- speach: Текст
5
+ description: Функция для внутреннего монолога, позволяющая ИИ обдумывать и формулировать свои мысли без участия пользователя. Используется для промежуточных размышлений и фиксации данных, которые не требуют немедленного ответа или действия от пользователя.
6
+ speach: Текст размышлений или выводов
7
7
  outer_voice:
8
- description: Сообщить пользователю необходимую информацию без ожидания ответа
9
- text: Текст
8
+ description: Сообщить пользователю необходимую информацию без ожидания ответа.
9
+ text: Содержимое сообщения
10
10
  action_request:
11
- description: Задать уточняющий вопрос или попросить о действии с получением ответа от пользователя
12
- action: Текст
11
+ description: Функция для интерактивного взаимодействия с пользователем. Позволяет задать уточняющий вопрос, запросить выполнение действий или завершить текущий шаг. Функция ожидает ответ пользователя и возвращает его.
12
+ action: Текст запроса или действия
13
13
  pack_history:
14
- description: Сохранение фактов, нюансов и действий том числе что ответ был дан) перед очисткой сообщений
14
+ description: Функция сохраняет ключевые факты, нюансы и действия из предыдущих сообщений, включая предоставленный ответ. После вызова этой функции все предыдущие сообщения будут удалены. Используйте её только после завершения всех промежуточных шагов и когда точное содержание предыдущих сообщений больше не имеет значения.
15
15
  text: Перечисление важных фактов и нюансов
16
+ result: Сообщения удалены
16
17
  monologue:
17
- - Шаг 1. Разработай собственное решение проблемы. Проявляй инициативу и делай предположения.
18
- - Шаг 1.1. Заключи все свои наработки для этого шага в функцию ox_ai_workers_iterator__inner_monologue.
19
- - Шаг 2. Соотнеси свое решение с задачей, улучшай его и вызывай необходимые функции шаг за шагом.
20
- - Шаг 2.1. Во время работы используй функции ox_ai_workers_iterator__outer_voice и ox_ai_workers_iterator__action_request.
21
- - Шаг 3. Когда решение готово, сообщи о нем с помощью функции ox_ai_workers_iterator__outer_voice
22
- - Шаг 4. Сохрани факты, нюансы и действия с помощью функции ox_ai_workers_iterator__summarize и предложи дальнейшие действия с помощью функции ox_ai_workers_iterator__action_request.
18
+ - Шаг 1. Разработай собственное решение проблемы, проявляя инициативу и делая предположения.
19
+ - Шаг 2. Заключи все свои наработки из предыдущего шага в функцию ox_ai_workers_iterator__inner_monologue.
20
+ - Шаг 3. Вызывай необходимые функции друг за другом, пока желаемый результат не будет достигнут.
21
+ - Шаг 4. Когда все промежуточные шаги завершены и точное содержание предыдущих сообщений больше не имеет значения, используй функцию ox_ai_workers_iterator__pack_history.
22
+ - Шаг 5. Когда решение готово, сообщи об этом и ожидай ответ пользователя.
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.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Smolev