ox-ai-workers 0.5.3 → 0.5.3.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 +4 -4
- data/CHANGELOG.md +2 -0
- data/README.md +23 -0
- data/lib/ox-ai-workers.rb +2 -1
- data/lib/oxaiworkers/assistant/module_base.rb +4 -0
- data/lib/oxaiworkers/iterator.rb +4 -4
- data/lib/oxaiworkers/version.rb +1 -1
- data/template/my_assistant.rb +9 -0
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34c154dd79d968e939b91f26e410e0f7a4e51c5099347b3577dc05708ab8b341
|
4
|
+
data.tar.gz: 294f14527bb5ef82e885ee5c93e6577d93c1820f844baad1139fbd385cb895c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f2c528093acd8ef4a6214ef65898807f72172f10e211096cbd490589d04e55220ff679c57cc04dd677ab04a211445fe4eb8cfefbc0beb1b453fcb7282dfabd0
|
7
|
+
data.tar.gz: 14f317606790d54f1c735f437145da15243a86af05c28bfcaf63464929c841df1b4de02cc6326b94571ddb0334a3bd13298ffe78078e39e1c24e7314d386fea7
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -88,6 +88,7 @@ OxAiWorkers.configure do |config|
|
|
88
88
|
config.model = "gpt-4o"
|
89
89
|
config.max_tokens = 4096
|
90
90
|
config.temperature = 0.7
|
91
|
+
config.auto_execute = true
|
91
92
|
end
|
92
93
|
```
|
93
94
|
|
@@ -124,6 +125,28 @@ iterator.add_task("linux")
|
|
124
125
|
|
125
126
|
This way, you have the flexibility to choose between a higher-level assistant for simplicity or a lower-level iterator for finer control over the tasks and tools used.
|
126
127
|
|
128
|
+
### Advanced instructions for your Assistant
|
129
|
+
|
130
|
+
```ruby
|
131
|
+
steps = []
|
132
|
+
steps << 'Step 1. Develop your own solution to the problem, taking initiative and making assumptions.'
|
133
|
+
steps << 'Step 2. Enclose all your developments from the previous step in the ox_ai_workers_iterator__inner_monologue function.'
|
134
|
+
steps << 'Step 3. Call the necessary functions one after another until the desired result is achieved.'
|
135
|
+
steps << '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.'
|
136
|
+
steps << "Step 5. When the solution is ready, notify about it and wait for the user's response."
|
137
|
+
|
138
|
+
@iterator = OxAiWorkers::Iterator.new(
|
139
|
+
worker: init_worker(delayed: delayed, model: model),
|
140
|
+
role: 'You are a software agent inside my computer',
|
141
|
+
tools: [MyTool.new],
|
142
|
+
steps: steps,
|
143
|
+
on_inner_monologue: ->(text:) { puts "monologue: #{text}".colorize(:yellow) },
|
144
|
+
on_outer_voice: ->(text:) { puts "voice: #{text}".colorize(:green) },
|
145
|
+
on_action_request: ->(text:) { puts "action: #{text}".colorize(:red) },
|
146
|
+
on_pack_history: ->(text:) { puts "summary: #{text}".colorize(:blue) }
|
147
|
+
)
|
148
|
+
```
|
149
|
+
|
127
150
|
### Worker Options
|
128
151
|
|
129
152
|
As a worker, you can use different classes depending on your needs:
|
data/lib/ox-ai-workers.rb
CHANGED
@@ -39,13 +39,14 @@ module OxAiWorkers
|
|
39
39
|
class ConfigurationError < Error; end
|
40
40
|
|
41
41
|
class Configuration
|
42
|
-
attr_accessor :model, :max_tokens, :temperature, :access_token
|
42
|
+
attr_accessor :model, :max_tokens, :temperature, :access_token, :auto_execute
|
43
43
|
|
44
44
|
def initialize
|
45
45
|
@access_token = nil
|
46
46
|
@model = DEFAULT_MODEL
|
47
47
|
@max_tokens = DEFAULT_MAX_TOKEN
|
48
48
|
@temperature = DEFAULT_TEMPERATURE
|
49
|
+
@auto_execute = true
|
49
50
|
|
50
51
|
[Array, NilClass, String, Symbol, Hash].each do |c|
|
51
52
|
c.send(:include, OxAiWorkers::PresentCompat) unless c.method_defined?(:present?)
|
data/lib/oxaiworkers/iterator.rb
CHANGED
@@ -25,12 +25,12 @@ module OxAiWorkers
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def initialize(worker:, role: nil, tools: [], on_inner_monologue: nil, on_outer_voice: nil, on_action_request: nil,
|
28
|
-
on_pack_history: nil)
|
28
|
+
on_pack_history: nil, steps: nil)
|
29
29
|
@worker = worker
|
30
30
|
@tools = [self] + tools
|
31
31
|
@role = role
|
32
32
|
@context = []
|
33
|
-
@monologue = I18n.t('oxaiworkers.iterator.monologue')
|
33
|
+
@monologue = steps || I18n.t('oxaiworkers.iterator.monologue')
|
34
34
|
|
35
35
|
@on_inner_monologue = on_inner_monologue
|
36
36
|
@on_outer_voice = on_outer_voice
|
@@ -143,10 +143,10 @@ module OxAiWorkers
|
|
143
143
|
@worker.finish
|
144
144
|
end
|
145
145
|
|
146
|
-
def add_task(task
|
146
|
+
def add_task(task)
|
147
147
|
@tasks << task
|
148
148
|
@messages << { role: :user, content: task }
|
149
|
-
execute if auto_execute
|
149
|
+
execute if OxAiWorkers.configuration.auto_execute
|
150
150
|
end
|
151
151
|
|
152
152
|
def add_context(text, role: :system)
|
data/lib/oxaiworkers/version.rb
CHANGED
data/template/my_assistant.rb
CHANGED
@@ -7,10 +7,19 @@ class MyAssistant
|
|
7
7
|
include OxAiWorkers::Assistant::ModuleBase
|
8
8
|
|
9
9
|
def initialize(delayed: false, model: nil)
|
10
|
+
# Optional instructions
|
11
|
+
# steps = []
|
12
|
+
# steps << 'Step 1. Develop your own solution to the problem, taking initiative and making assumptions.'
|
13
|
+
# steps << 'Step 2. Enclose all your developments from the previous step in the ox_ai_workers_iterator__inner_monologue function.'
|
14
|
+
# steps << 'Step 3. Call the necessary functions one after another until the desired result is achieved.'
|
15
|
+
# steps << '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.'
|
16
|
+
# steps << "Step 5. When the solution is ready, notify about it and wait for the user's response."
|
17
|
+
|
10
18
|
@iterator = OxAiWorkers::Iterator.new(
|
11
19
|
worker: init_worker(delayed: delayed, model: model),
|
12
20
|
role: 'You are a software agent inside my computer',
|
13
21
|
tools: [MyTool.new],
|
22
|
+
# steps: steps,
|
14
23
|
on_inner_monologue: ->(text:) { puts "monologue: #{text}".colorize(:yellow) },
|
15
24
|
on_outer_voice: ->(text:) { puts "voice: #{text}".colorize(:green) },
|
16
25
|
on_action_request: ->(text:) { puts "action: #{text}".colorize(:red) },
|
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.3
|
4
|
+
version: 0.5.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Smolev
|
@@ -108,17 +108,17 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '1'
|
111
|
-
description: |
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
111
|
+
description: |
|
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
116
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
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.
|
122
122
|
email:
|
123
123
|
- smolev@me.com
|
124
124
|
executables:
|