ox-ai-workers 1.1.4 → 1.1.4.2

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: 68d97fd108d7781f5761271c70a32143c491cc95ceaf345b2e9277253e7edf07
4
- data.tar.gz: db1ad80e6fee22ebffa4ff4273dff3cf7e9cd5d23909058722cd21f6a9ee1481
3
+ metadata.gz: 1d0694e0a6bed4958f629d8faa968fa8246f8ed3be490af1471b135d07e362c1
4
+ data.tar.gz: b0e2648f476ca674bb53c7fa5f37c0c8200fb482b7a43f558601faa6abc7523a
5
5
  SHA512:
6
- metadata.gz: e87f891e063be2234ebc772f00966139f6fd2bf9efe0d24c19e60491a28cabf8e8881050629f19497b19b8462b41fea275f1442175122582eda3ca5b42fc69e2
7
- data.tar.gz: 269c70ebe72eef95f6a3d6c7de312f57161b17b4eaa80fcc426bf006655aff44e16fab4c84bdb366d4b8f8f6fdf9af58bee43ef36e97a98ba6d5fce3201a7d86
6
+ metadata.gz: c637d9bab58ff1384a1e658423e5abdd631c21a5b15f57523415e98adaf196870a8285b1fed173a8f7248349b33d471f0941c9ab5d877d3a8ce6c9d72c17bd0a
7
+ data.tar.gz: d1f3279c0dcc2db5a6b696d17777d248b934663d8776a87eeab93ac7bbe4d8890a174f876dae443bfd9f047b7a01f7e50d694ef0cbc2b110aa08dbe1d703c7a9
@@ -76,7 +76,7 @@ module OxAiWorkers
76
76
  @tasks = []
77
77
  @messages = []
78
78
  @call_id = 0
79
- # Очищаем сообщения в worker, если он существует
79
+ # Clear messages in worker if it exists
80
80
  @worker.messages = [] if @worker&.respond_to?(:messages=)
81
81
  complete_iteration
82
82
  end
@@ -123,7 +123,7 @@ module OxAiWorkers
123
123
  # @worker.last_call = nil
124
124
  @worker.call_stack = @call_stack.dup
125
125
  @worker.stop_double_calls = @stop_double_calls
126
- # Не очищаем сообщения, а сохраняем их в переменной
126
+ # Don't clear messages, save them in a variable
127
127
  current_messages = @worker.messages || []
128
128
  @worker.messages = []
129
129
  @worker.append(role: :system, content: "<role>\n#{@role}\n</role>") if @role.present?
@@ -134,7 +134,7 @@ module OxAiWorkers
134
134
  @tools.each do |tool|
135
135
  @worker.append(role: :user, content: tool.context) if tool.respond_to?(:context) && tool.context.present?
136
136
  end
137
- # Добавляем сохраненные сообщения обратно, если они не пустые
137
+ # Add saved messages back if they are not empty
138
138
  @worker.append(messages: current_messages) if current_messages.present?
139
139
  @worker.append(messages: @messages)
140
140
  # @tasks.each { |task| @worker.append(role: :user, content: "<task>\n#{task}\n</task>") }
@@ -176,32 +176,31 @@ module OxAiWorkers
176
176
  end
177
177
 
178
178
  def next_iteration
179
- # Проверяем call_stack перед продолжением итерации
179
+ # Check call_stack before continuing iteration
180
180
  if should_finish_iteration?
181
181
  OxAiWorkers.logger.info "Iterator::Call stack is empty or contains only finish_it. Finishing iteration."
182
182
  finish_it
183
183
  return
184
184
  end
185
185
 
186
- # Сначала добавляем сообщения из очереди к worker
186
+ # First add messages from queue to worker
187
187
  @worker.append(messages: @queue)
188
- # Затем добавляем их к локальным сообщениям
188
+ # Then add them to local messages
189
189
  @messages += @queue
190
190
  OxAiWorkers.logger.warn "Iterator::Next iteration: #{@messages.count}/#{@queue.count}"
191
- # И только потом очищаем очередь
191
+ # And only then clear the queue
192
192
  @queue = []
193
193
  request!
194
194
  end
195
195
 
196
196
  def should_finish_iteration?
197
+ return false if @worker.call_stack.nil?
197
198
  return false unless @worker.respond_to?(:call_stack) && @worker.call_stack.present?
198
199
 
199
200
  finish_it_function = OxAiWorkers::Iterator.full_function_name(:finish_it)
200
201
 
201
- # Проверяем, пуста ли очередь вызовов или содержит только finish_it
202
- @worker.call_stack.empty? ||
203
- (@worker.call_stack.size == 1 && @worker.call_stack.first == finish_it_function) ||
204
- @worker.call_stack.all? { |call| call == finish_it_function }
202
+ # Check if the call queue is empty or contains only finish_it
203
+ @worker.call_stack.empty? || @worker.call_stack.all? { |call| call == finish_it_function }
205
204
  end
206
205
 
207
206
  def external_request
@@ -281,7 +280,7 @@ module OxAiWorkers
281
280
 
282
281
  def complete_iteration
283
282
  @queue = []
284
- # Используем finish_without_cleanup вместо finish
283
+ # Use finish_without_cleanup instead of finish
285
284
  @worker.finish_without_cleanup if @worker.respond_to?(:finish_without_cleanup)
286
285
  end
287
286
 
@@ -9,10 +9,10 @@ module OxAiWorkers
9
9
  cleanup
10
10
  end
11
11
 
12
- # Метод для завершения без очистки сообщений
12
+ # Method to finish without clearing messages
13
13
  def finish_without_cleanup
14
14
  @custom_id = SecureRandom.uuid
15
- # Очищаем только результат и ошибки, но не сообщения
15
+ # Clear only result and errors, but not messages
16
16
  @result = nil
17
17
  @errors = nil
18
18
  @tool_calls = nil
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OxAiWorkers
4
- VERSION = '1.1.4'
4
+ VERSION = '1.1.4.2'
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.1.4
4
+ version: 1.1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Smolev