ox-ai-workers 0.5.5.1 → 0.5.6.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: cd23611eb845a63cc6bd0142480645aff071bd569e748cb5aa394f461e360073
4
- data.tar.gz: 1b8049ea7ed0a74ddf350bce0e7f9a7b88e0feb16626e7c6eb8891b55fec3995
3
+ metadata.gz: b4ac618c0c5d09d4763b8703322a22e072cae34504bb5b352cdc3f3471a1d9b4
4
+ data.tar.gz: 923f7b531b6bf9e6d4e0f357811d246b25c3325f90a40a033de8ef01560c5d20
5
5
  SHA512:
6
- metadata.gz: b91a2846312a4403eb059f075f76ea39f18a1706b85db6bac1b053841e09a5ba901f11ab4c36397162174b9f696aca51b82ea714644a581409957a8ab5be2bbe
7
- data.tar.gz: c725fab2dcfaef342000918d9f4a21feceb2196191de27b7d6bf528af41e6db761ceefd439c7bbd3dbc0bb546fb50016b788c22be802f566e61a8f36d114838f
6
+ metadata.gz: 81c860c7bd2791b49f6a82bc6b05dfb45c429cfd0e4716d9f7e3d07b1622507f4ec716c59afddc816bd7a7cd488532b36f26368aa51005f4d28346d11163db64
7
+ data.tar.gz: 7d3838f53d93f618f8e7a0dba87bbeb3fee24cdf6c64bad1cb4190f954ef0092406dfc8d7f4a977d0f9d73dd70ddc839945333764f5a62f171b7e8b9de97b5dd
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.5.6] - 2024-08-02
4
+
5
+ - Added `oxaiworkers run` command
6
+
3
7
  ## [0.5.5] - 2024-08-02
4
8
 
5
9
  - Added `only` for Tools
data/README.md CHANGED
@@ -184,25 +184,25 @@ As a worker, you can use different classes depending on your needs:
184
184
 
185
185
  2. Initialize with the command:
186
186
 
187
- ```sh
188
- oxaiworkers init
189
- ```
187
+ ```sh
188
+ oxaiworkers init
189
+ ```
190
190
 
191
- This will create a `.oxaiworkers-local` directory with the necessary initial source code.
191
+ This will create a `.oxaiworkers-local` directory with the necessary initial source code.
192
192
 
193
- Additionally, you can initialize a more comprehensive example using the command:
193
+ Additionally, you can initialize a more comprehensive example using the command:
194
194
 
195
- ```sh
196
- oxaiworkers init full
197
- ```
195
+ ```sh
196
+ oxaiworkers init full
197
+ ```
198
198
 
199
- After this, in the `my_assistant.rb` file, you can find an example of an assistant that uses a tool from the `tools/my_tool.rb` file. In the `start` file, you will find the algorithm for applying this assistant.
199
+ After this, in the `my_assistant.rb` file, you can find an example of an assistant that uses a tool from the `tools/my_tool.rb` file. In the `start` file, you will find the algorithm for applying this assistant.
200
200
 
201
201
  3. Modify the code as needed and run:
202
202
 
203
- ```sh
204
- .oxaiworkers-local/start
205
- ```
203
+ ```sh
204
+ .oxaiworkers-local/start
205
+ ```
206
206
 
207
207
  ## Logging
208
208
 
@@ -213,6 +213,82 @@ To show all log messages:
213
213
  OxAiWorkers.logger.level = :debug
214
214
  ```
215
215
 
216
+ ## Real World Examples
217
+
218
+ ### Project: Python Snake Game
219
+
220
+ 1. Create the project folder:
221
+
222
+ ```sh
223
+ mkdir snake
224
+ cd snake
225
+ ```
226
+
227
+ 2. Initialize OxAiWorkers:
228
+
229
+ ```sh
230
+ oxaiworkers init
231
+ ```
232
+
233
+ 3. Modify the file `.oxaiworkers-local/start`:
234
+
235
+ ```ruby
236
+ # Replace
237
+ @assistant = OxAiWorkers::Assistant::Sysop.new
238
+
239
+ # With
240
+ @assistant = OxAiWorkers::Assistant::Coder.new(language: 'python')
241
+ ```
242
+
243
+ 4. Run the project:
244
+
245
+ ```sh
246
+ .oxaiworkers-local/start
247
+ ```
248
+
249
+ 5. In the command prompt, type:
250
+
251
+ ```sh
252
+ @assistant.task = "Write a snake game"
253
+ ```
254
+
255
+ ### Running System Operator in Any Directory
256
+
257
+ To run OxAiWorkers in any directory, execute the following command:
258
+
259
+ ```sh
260
+ oxaiworkers run sysop
261
+ ```
262
+
263
+ Alternatively, you can use IRB (Interactive Ruby):
264
+
265
+ 1. Start IRB:
266
+
267
+ ```sh
268
+ irb
269
+ ```
270
+
271
+ 2. In the console, enter the following commands (see Usage section):
272
+
273
+ ```ruby
274
+ require 'ox-ai-workers'
275
+ @sysop = OxAiWorkers::Assistant::Sysop.new
276
+ ```
277
+
278
+ Then set a task:
279
+
280
+ ```ruby
281
+ @sysop.task = "Show all cron jobs"
282
+ ```
283
+
284
+ After these steps you can interact with it using the following method:
285
+
286
+ ```ruby
287
+ @sysop.add_response("Yes, I want it")
288
+ ```
289
+
290
+ or set a new task.
291
+
216
292
  ## Features
217
293
 
218
294
  - **Generative Intelligence**: Leverages OpenAI's capabilities to enhance task execution.
data/exe/oxaiworkers CHANGED
@@ -2,8 +2,9 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'fileutils'
5
+ require 'oxaiworkers/version'
5
6
 
6
- puts 'Welcome to OxAiWorkers!'
7
+ puts "Welcome to OxAiWorkers v#{OxAiWorkers::VERSION}"
7
8
 
8
9
  if ARGV.first == 'init'
9
10
  dir = '.oxaiworkers-local'
@@ -21,4 +22,13 @@ if ARGV.first == 'init'
21
22
  puts "A #{dir} directory was created with the necessary initial settings."
22
23
  puts "Modify the settings as needed and run: #{dir}/start"
23
24
  end
25
+ elsif ARGV.first == 'run'
26
+ require 'irb'
27
+ require 'ox-ai-workers'
28
+ puts "Assistant: #{ARGV.last.capitalize}"
29
+ instance_variable_set("@#{ARGV.last}", Object.const_get("OxAiWorkers::Assistant::#{ARGV.last.capitalize}").new)
30
+ ARGV.clear
31
+ IRB.start
32
+ else
33
+ puts "Error: Unknown command: #{ARGV.first}"
24
34
  end
@@ -18,6 +18,12 @@ module OxAiWorkers
18
18
  on_summarize: ->(text:) { puts "summary: #{text}".colorize(:blue) }
19
19
  )
20
20
  end
21
+
22
+ def language=(language)
23
+ with_locale do
24
+ @iterator.role = format(I18n.t('oxaiworkers.assistant.coder.role'), language)
25
+ end
26
+ end
21
27
  end
22
28
  end
23
29
  end
@@ -24,7 +24,7 @@ module OxAiWorkers
24
24
  end
25
25
 
26
26
  def ruby(input:)
27
- puts "Executing ruby: \"#{input}\"".colorize(:red)
27
+ OxAiWorkers.logger.info("Executing ruby: \"#{input}\"", for: self.class)
28
28
  eval(input)
29
29
  end
30
30
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OxAiWorkers
4
- VERSION = '0.5.5.1'
4
+ VERSION = '0.5.6.1'
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.5.5.1
4
+ version: 0.5.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Smolev
@@ -109,16 +109,14 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1'
111
111
  description: |2
112
- OxAiWorkers (ox-ai-workers) is a Ruby gem that provides a powerful and flexible state machine with
113
- integration of generative intelligence using the ruby-openai gem. This gem allows you to create state
114
- machines for solving complex tasks, enhancing the final result by leveraging internal logic (state machine)
115
- and external tools (OpenAI generative intelligence).
116
-
117
- Features:
118
- - State Machine: Easily create and manage state machines to model various states and transitions in your application.
119
- - OpenAI Integration: Utilize the capabilities of generative intelligence to make decisions and perform tasks, improving the quality and accuracy of results.
120
- - Flexibility and Extensibility: Customize the behavior of the state machine and OpenAI integration according to your needs.
121
- - Ease of Use: Intuitive syntax and documentation make it easy to get started with the gem.
112
+ OxAiWorkers (ox-ai-workers) is a cutting-edge Ruby gem designed to seamlessly integrate
113
+ a sophisticated state machine with the powerful capabilities of generative intelligence
114
+ via the ruby-openai gem. This innovative tool empowers developers to construct state machines
115
+ that efficiently handle complex tasks, enhancing outcomes by combining robust internal
116
+ logic with advanced AI-driven decision-making. Key features include straightforward creation
117
+ and management of state machines, harnessing AI for improved decision-making and task
118
+ execution, customizable behavior to suit specific requirements, and user-friendly syntax
119
+ and documentation for a smooth development experience.
122
120
  email:
123
121
  - smolev@me.com
124
122
  executables: