omni_agent 0.1.3 → 0.1.4

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: '0094c9758c242364af55eeffd4e87143f78b1db9ffabb54c06aaa23234030382'
4
- data.tar.gz: 866bc34809e4c1ecbf21679a2d4dab00a0e1383ae3ac3bb8f6f94348d7ae7b6b
3
+ metadata.gz: 68e52e8d8eb8a4f59c708d32e7464b7526c92f8e5342d6a85fe3c1244bf643e7
4
+ data.tar.gz: 36d892f5d7593582f31cc15d957deab720c80c8416a48ba32df4253f24d10ac6
5
5
  SHA512:
6
- metadata.gz: bf56557c378dce28538199dc6cf9795923acd7db6ea291dae542845f9f66d923a40ef78e0c1dfdff443e675425c431a58d0cb0d825edc69a171d6b473a0201a1
7
- data.tar.gz: a4ee13697bbff34e8a3e0e1f196b282bc05d35ba680b8f19c2860c44527d3b61ed7210ed5a6d756dfcf7acea6bcb4219696d04528b7c3d57a479963f390fc1e4
6
+ metadata.gz: afaf69e6f85c7db759d6796477601945577550a80f86e53a694f52d07910ffe081e79aa18db0688a8aaf3b4cb5dae5e141beaefc43e4083c59e46af2f6496df3
7
+ data.tar.gz: efc7e291b645b15c0fe2d528737597948aaa28b9cc5a2f1bffd153313f071c0bd659d3d5b885932a607cf21f55dd217f907f85e82a667cbc797c8d8b85b9674d
data/CHANGELOG.md CHANGED
@@ -35,3 +35,15 @@ All notable changes to this project will be documented in this file.
35
35
  - Added `generated_messages` to the agent response, it contains all the messages generated by the agent and the user request.
36
36
  - Added `history` as a context variable which are the messages to be sent to the provider.
37
37
  - Added support for nested datatypes in the `array` schema for tools
38
+
39
+ # [0.1.4] - 2026-06-16
40
+
41
+ ### Fixed
42
+ - Change invoke method to an instance method instead of a class method, to actually catch invocations of the `stop_generation!` method.
43
+
44
+ ### Changed
45
+ - Remove agent file from directory to prevent needing to change Zeitwerk initializer as Railtie wasn't allowing to change behaviour without it.
46
+
47
+ ### Added
48
+ - Add Railtie to project to handle concerns.
49
+ - Added docusaurus, the actual docs will be done later.
data/README.md CHANGED
@@ -56,10 +56,11 @@ OPENAI_ACCESS_TOKEN=your_api_key_here
56
56
  4. Implement your agent prompt and optional tools under:
57
57
 
58
58
  ```text
59
- app/agents/research_agent/
59
+ app/agents/
60
60
  research_agent.rb
61
- prompt.md.erb
62
- tools/
61
+ research_agent/
62
+ prompt.md.erb
63
+ tools/
63
64
  ```
64
65
 
65
66
  ## Agent Example
@@ -46,7 +46,7 @@ module OmniAgent
46
46
  end
47
47
 
48
48
  def agent_file_path
49
- File.join(agent_directory, "#{file_name}.rb")
49
+ File.join(destination_root, "#{file_name}.rb")
50
50
  end
51
51
 
52
52
  def prompt_file_path
@@ -89,7 +89,7 @@ module OmniAgent
89
89
 
90
90
  def requested_tool_names
91
91
  names = Array(options[:with_tools]).map(&:to_s).map(&:strip).reject(&:empty?)
92
- names.empty? ? ["ExampleTool"] : names
92
+ names.empty? ? [ "ExampleTool" ] : names
93
93
  end
94
94
 
95
95
  def generated_model_expression
@@ -189,7 +189,7 @@ module OmniAgent
189
189
  tool_instance = tool_class.new
190
190
 
191
191
  begin
192
- result = tool_class.invoke(tool_args)
192
+ result = tool_instance.invoke(tool_args)
193
193
 
194
194
  messages << {
195
195
  role: "tool",
@@ -0,0 +1,31 @@
1
+ # lib/omni_agent/railtie.rb
2
+ module OmniAgent
3
+ class Railtie < ::Rails::Railtie
4
+ initializer "omni_agent.remove_agents_from_zeitwerk", before: :setup_main_autoloader do
5
+ agents_path = Rails.root.join("app", "agents")
6
+ if agents_path.exist?
7
+ Rails.autoloaders.main.ignore(agents_path)
8
+ end
9
+ end
10
+
11
+ config.to_prepare do
12
+ agents_dir = Rails.root.join("app", "agents")
13
+ next unless agents_dir.exist?
14
+
15
+ Dir.glob(agents_dir.join("concerns/**/*.rb")).each { |f| require_dependency f }
16
+
17
+ Dir.glob(agents_dir.join("*")).each do |file|
18
+ next unless File.directory?(file)
19
+ next if File.basename(file) == "concerns"
20
+
21
+ main_agent_file = File.join(file, "#{File.basename(file)}.rb")
22
+ require_dependency main_agent_file if File.file?(main_agent_file)
23
+
24
+ Dir.glob(File.join(file, "**/*.rb")).each do |sub_file|
25
+ next if sub_file == main_agent_file
26
+ require_dependency sub_file
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -40,14 +40,10 @@ module OmniAgent
40
40
  }
41
41
  end
42
42
 
43
- def invoke(arguments_hash)
43
+ def parse_arguments(arguments_hash)
44
44
  kwargs = arguments_hash.transform_keys(&:to_sym)
45
-
46
45
  valid_keys = (@properties || {}).keys.map(&:to_sym)
47
-
48
- filtered_kwargs = kwargs.slice(*valid_keys)
49
-
50
- new.execute(**filtered_kwargs)
46
+ kwargs.slice(*valid_keys)
51
47
  end
52
48
 
53
49
  def stops_generation(value = true)
@@ -73,6 +69,11 @@ module OmniAgent
73
69
  end
74
70
  end
75
71
 
72
+ def invoke(arguments_hash)
73
+ filtered_kwargs = self.class.parse_arguments(arguments_hash)
74
+ execute(**filtered_kwargs)
75
+ end
76
+
76
77
  def stop_generation!
77
78
  @stops_generation_instance = true
78
79
  end
@@ -1,3 +1,3 @@
1
1
  module OmniAgent
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omni_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ACR1209
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-13 00:00:00.000000000 Z
11
+ date: 2026-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -70,6 +70,7 @@ files:
70
70
  - lib/omni_agent/providers/mock.rb
71
71
  - lib/omni_agent/providers/openai.rb
72
72
  - lib/omni_agent/providers/response.rb
73
+ - lib/omni_agent/railtie.rb
73
74
  - lib/omni_agent/tasks/omni_agent_tasks.rake
74
75
  - lib/omni_agent/tool.rb
75
76
  - lib/omni_agent/tool/schema_builder.rb