activeagent 0.2.6.rc4 → 0.2.6
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/lib/active_agent/action_prompt/message.rb +2 -2
- data/lib/active_agent/base.rb +7 -6
- data/lib/active_agent/callbacks.rb +3 -3
- data/lib/active_agent/operation.rb +3 -3
- data/lib/active_agent/queued_generation.rb +1 -1
- data/lib/active_agent/railtie.rb +4 -4
- data/lib/active_agent/service.rb +1 -1
- data/lib/active_agent/version.rb +1 -1
- data/lib/activeagent.rb +1 -1
- data/lib/generators/active_agent/agent_generator.rb +18 -18
- data/lib/generators/active_agent/install_generator.rb +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fbf916ff515e5995698e44b5722699cad1203fcc04739111cd10a29c0c0bb90
|
4
|
+
data.tar.gz: 52bb6ec8e3a69f8b04a31d87c59f143ce89be9e6c4b129046d0a5e244e02b4a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aba7d978854208f22e22ce862b801281a71c507eedc195052077d760ebffa024c218dd6130ace50198c5d0e55f2399efac8a12eca601d319aae4affa9f7fc478
|
7
|
+
data.tar.gz: cded1a0791b447893b50d4b4b52486c32971bf8c1fbc52b56948e0fea84d74a99b67df8aac85d020ad8afd6b7f123590d2750cfec18385a90777296ef5c4a945
|
@@ -5,7 +5,7 @@ module ActiveAgent
|
|
5
5
|
|
6
6
|
attr_accessor :action_id, :content, :role, :name, :action_requested, :requested_actions, :content_type, :charset
|
7
7
|
|
8
|
-
def initialize(attributes = {})
|
8
|
+
def initialize(attributes = {})
|
9
9
|
@action_id = attributes[:action_id]
|
10
10
|
@charset = attributes[:charset] || "UTF-8"
|
11
11
|
@content = attributes[:content] || ""
|
@@ -19,7 +19,7 @@ module ActiveAgent
|
|
19
19
|
|
20
20
|
def to_h
|
21
21
|
hash = {
|
22
|
-
role: role,
|
22
|
+
role: role,
|
23
23
|
action_id: action_id,
|
24
24
|
content: content,
|
25
25
|
type: content_type,
|
data/lib/active_agent/base.rb
CHANGED
@@ -128,7 +128,7 @@ module ActiveAgent
|
|
128
128
|
# Define how the agent should generate content
|
129
129
|
def generate_with(provider, **options)
|
130
130
|
self.generation_provider = provider
|
131
|
-
self.options = (options || {}).merge(options)
|
131
|
+
self.options = (options || {}).merge(options)
|
132
132
|
generation_provider.config.merge!(self.options)
|
133
133
|
end
|
134
134
|
|
@@ -205,7 +205,7 @@ module ActiveAgent
|
|
205
205
|
def embed
|
206
206
|
context.options.merge(options)
|
207
207
|
generation_provider.embed(context) if context && generation_provider
|
208
|
-
handle_response(generation_provider.response)
|
208
|
+
handle_response(generation_provider.response)
|
209
209
|
end
|
210
210
|
|
211
211
|
def perform_generation
|
@@ -216,12 +216,12 @@ module ActiveAgent
|
|
216
216
|
|
217
217
|
def handle_response(response)
|
218
218
|
perform_actions(requested_actions: response.message.requested_actions) if response.message.requested_actions.present?
|
219
|
-
|
220
|
-
update_context(response)
|
219
|
+
|
220
|
+
update_context(response)
|
221
221
|
end
|
222
222
|
|
223
223
|
def update_context(response)
|
224
|
-
|
224
|
+
response.prompt
|
225
225
|
response
|
226
226
|
end
|
227
227
|
|
@@ -249,7 +249,7 @@ module ActiveAgent
|
|
249
249
|
action: method_name,
|
250
250
|
args: args
|
251
251
|
}
|
252
|
-
|
252
|
+
|
253
253
|
ActiveSupport::Notifications.instrument("process.active_agent", payload) do
|
254
254
|
super
|
255
255
|
@_context = ActiveAgent::ActionPrompt::Prompt.new unless @_prompt_was_called
|
@@ -456,6 +456,7 @@ module ActiveAgent
|
|
456
456
|
)
|
457
457
|
context.add_part(message)
|
458
458
|
end
|
459
|
+
|
459
460
|
# This and #instrument_name is for caching instrument
|
460
461
|
def instrument_payload(key)
|
461
462
|
{
|
@@ -27,13 +27,13 @@ module ActiveAgent
|
|
27
27
|
def around_generate(*filters, &)
|
28
28
|
set_callback(:generate, :around, *filters, &)
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
# Defines a callback for handling streaming responses during generation
|
32
32
|
def on_stream(*filters, &)
|
33
33
|
set_callback(:stream, :before, *filters, &)
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
# Helper method to run stream callbacks
|
38
38
|
def run_stream_callbacks(message, delta = nil, stop = false)
|
39
39
|
run_callbacks(:stream) do
|
@@ -41,4 +41,4 @@ module ActiveAgent
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
44
|
-
end
|
44
|
+
end
|
@@ -2,12 +2,12 @@ module ActiveAgent
|
|
2
2
|
class Operation < AbstractController::Base
|
3
3
|
include AbstractController::Rendering
|
4
4
|
include ActionView::Rendering # Allows rendering of ERB templates without a view context tied to a request
|
5
|
-
append_view_path
|
6
|
-
|
5
|
+
append_view_path "app/views" # Ensure the controller knows where to look for view templates
|
6
|
+
|
7
7
|
def process_tool(tool_name, params)
|
8
8
|
send(tool_name, params) # Dynamically calls the method corresponding to tool_name
|
9
9
|
rescue NoMethodError
|
10
10
|
"Tool not found: #{tool_name}"
|
11
11
|
end
|
12
12
|
end
|
13
|
-
end
|
13
|
+
end
|
data/lib/active_agent/railtie.rb
CHANGED
@@ -34,8 +34,8 @@ module ActiveAgent
|
|
34
34
|
# make sure readers methods get compiled
|
35
35
|
options.asset_host ||= app.config.asset_host
|
36
36
|
options.relative_url_root ||= app.config.relative_url_root
|
37
|
-
|
38
|
-
ActiveAgent.load_configuration(Rails.root.join(
|
37
|
+
|
38
|
+
ActiveAgent.load_configuration(Rails.root.join("config", "active_agent.yml")) if File.exist?(Rails.root.join("config", "active_agent.yml"))
|
39
39
|
|
40
40
|
ActiveSupport.on_load(:active_agent) do
|
41
41
|
include AbstractController::UrlFor
|
@@ -48,7 +48,7 @@ module ActiveAgent
|
|
48
48
|
self.view_paths = ["#{Rails.root}/app/views"]
|
49
49
|
self.preview_paths |= options[:preview_paths]
|
50
50
|
|
51
|
-
if generation_job = options.delete(:generation_job)
|
51
|
+
if (generation_job = options.delete(:generation_job))
|
52
52
|
self.generation_job = generation_job.constantize
|
53
53
|
end
|
54
54
|
|
@@ -62,7 +62,7 @@ module ActiveAgent
|
|
62
62
|
end
|
63
63
|
|
64
64
|
initializer "active_agent.set_autoload_paths", before: :set_autoload_paths do |app|
|
65
|
-
options = app.config.active_agent
|
65
|
+
# options = app.config.active_agent
|
66
66
|
# app.config.paths["test/agents/previews"].concat(options.preview_paths)
|
67
67
|
end
|
68
68
|
|
data/lib/active_agent/service.rb
CHANGED
data/lib/active_agent/version.rb
CHANGED
data/lib/activeagent.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require "active_agent"
|
1
|
+
require "active_agent"
|
@@ -36,28 +36,28 @@ module ActiveAgent
|
|
36
36
|
template "action.html.#{template_engine}", @view_path
|
37
37
|
end
|
38
38
|
end
|
39
|
-
|
40
39
|
|
41
40
|
private
|
42
|
-
def test_framework
|
43
|
-
::Rails.application.config.generators.options[:rails][:test_framework]
|
44
|
-
end
|
45
|
-
|
46
|
-
def template_engine
|
47
|
-
::Rails.application.config.generators.options[:rails][:template_engine]
|
48
|
-
end
|
49
|
-
|
50
|
-
def file_name # :doc:
|
51
|
-
@_file_name ||= super + "_agent"
|
52
|
-
end
|
53
41
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
42
|
+
def test_framework
|
43
|
+
::Rails.application.config.generators.options[:rails][:test_framework]
|
44
|
+
end
|
45
|
+
|
46
|
+
def template_engine
|
47
|
+
::Rails.application.config.generators.options[:rails][:template_engine]
|
48
|
+
end
|
49
|
+
|
50
|
+
def file_name # :doc:
|
51
|
+
@_file_name ||= super + "_agent"
|
52
|
+
end
|
53
|
+
|
54
|
+
def application_agent_file_name
|
55
|
+
@_application_agent_file_name ||= if mountable_engine?
|
56
|
+
"app/agents/#{namespaced_path}/application_agent.rb"
|
57
|
+
else
|
58
|
+
"app/agents/application_agent.rb"
|
60
59
|
end
|
60
|
+
end
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
@@ -4,7 +4,7 @@ module ActiveAgent
|
|
4
4
|
module Generators
|
5
5
|
class InstallGenerator < ::Rails::Generators::Base
|
6
6
|
source_root File.expand_path("templates", __dir__)
|
7
|
-
|
7
|
+
|
8
8
|
def create_configuration
|
9
9
|
template "active_agent.yml", "config/active_agent.yml"
|
10
10
|
end
|
@@ -14,4 +14,4 @@ module ActiveAgent
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
17
|
-
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeagent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.6
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Bowen
|
@@ -130,8 +130,9 @@ dependencies:
|
|
130
130
|
- - "<"
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '9.0'
|
133
|
-
description:
|
134
|
-
|
133
|
+
description: The only agent-oriented AI framework designed for Rails, where Agents
|
134
|
+
are Controllers. Build AI features with less complexity using the MVC conventions
|
135
|
+
you love.
|
135
136
|
email: jusbowen@gmail.com
|
136
137
|
executables: []
|
137
138
|
extensions: []
|