action_ai 0.2.0 → 0.4.0
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 +51 -0
- data/README.rdoc +149 -19
- data/lib/action_ai/agent.rb +54 -58
- data/lib/action_ai/model_schema/active_model.rb +123 -0
- data/lib/action_ai/model_schema/active_record.rb +151 -0
- data/lib/action_ai/model_schema.rb +195 -0
- data/lib/action_ai/railtie.rb +8 -1
- data/lib/action_ai/refinements/numeric.rb +32 -0
- data/lib/action_ai/refinements/regexp.rb +13 -0
- data/lib/action_ai/schema.rb +20 -0
- data/lib/action_ai/structured_output.rb +85 -0
- data/lib/action_ai/version.rb +1 -1
- data/lib/action_ai.rb +5 -0
- data/lib/rails/generators/ai/templates/agent.rb.tt +4 -0
- data/lib/ruby_llm/protocols/echo.rb +26 -0
- data/lib/ruby_llm/providers/test.rb +5 -21
- data/lib/ruby_llm/tester.rb +7 -3
- metadata +27 -4
- data/lib/ruby_llm/providers/test/echo.rb +0 -50
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: action_ai
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alexander Senko
|
|
@@ -75,6 +75,22 @@ dependencies:
|
|
|
75
75
|
version: "0"
|
|
76
76
|
- !ruby/object:Gem::Dependency
|
|
77
77
|
name: ruby_llm
|
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
-
|
|
81
|
+
- ~>
|
|
82
|
+
- !ruby/object:Gem::Version
|
|
83
|
+
version: "2.0"
|
|
84
|
+
type: :runtime
|
|
85
|
+
prerelease: false
|
|
86
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
87
|
+
requirements:
|
|
88
|
+
-
|
|
89
|
+
- ~>
|
|
90
|
+
- !ruby/object:Gem::Version
|
|
91
|
+
version: "2.0"
|
|
92
|
+
- !ruby/object:Gem::Dependency
|
|
93
|
+
name: magic-lookup
|
|
78
94
|
requirement: !ruby/object:Gem::Requirement
|
|
79
95
|
requirements:
|
|
80
96
|
-
|
|
@@ -138,12 +154,19 @@ files:
|
|
|
138
154
|
- lib/action_ai/implicit_interaction.rb
|
|
139
155
|
- lib/action_ai/interaction.rb
|
|
140
156
|
- lib/action_ai/log_subscriber.rb
|
|
157
|
+
- lib/action_ai/model_schema.rb
|
|
158
|
+
- lib/action_ai/model_schema/active_model.rb
|
|
159
|
+
- lib/action_ai/model_schema/active_record.rb
|
|
141
160
|
- lib/action_ai/parameterized.rb
|
|
142
161
|
- lib/action_ai/preview.rb
|
|
143
162
|
- lib/action_ai/prompt_helper.rb
|
|
144
163
|
- lib/action_ai/queued_execution.rb
|
|
145
164
|
- lib/action_ai/railtie.rb
|
|
165
|
+
- lib/action_ai/refinements/numeric.rb
|
|
166
|
+
- lib/action_ai/refinements/regexp.rb
|
|
146
167
|
- lib/action_ai/rescuable.rb
|
|
168
|
+
- lib/action_ai/schema.rb
|
|
169
|
+
- lib/action_ai/structured_output.rb
|
|
147
170
|
- lib/action_ai/test_case.rb
|
|
148
171
|
- lib/action_ai/test_helper.rb
|
|
149
172
|
- lib/action_ai/version.rb
|
|
@@ -151,16 +174,16 @@ files:
|
|
|
151
174
|
- lib/rails/generators/ai/ai_generator.rb
|
|
152
175
|
- lib/rails/generators/ai/templates/agent.rb.tt
|
|
153
176
|
- lib/rails/generators/ai/templates/application_agent.rb.tt
|
|
177
|
+
- lib/ruby_llm/protocols/echo.rb
|
|
154
178
|
- lib/ruby_llm/providers/test.rb
|
|
155
|
-
- lib/ruby_llm/providers/test/echo.rb
|
|
156
179
|
- lib/ruby_llm/tester.rb
|
|
157
180
|
homepage: "https://github.com/Alexander-Senko/action_ai"
|
|
158
181
|
licenses:
|
|
159
182
|
- MIT
|
|
160
183
|
metadata:
|
|
161
184
|
bug_tracker_uri: "https://github.com/Alexander-Senko/action_ai/issues"
|
|
162
|
-
changelog_uri: "https://github.com/Alexander-Senko/action_ai/blob/v0.
|
|
163
|
-
source_code_uri: "https://github.com/Alexander-Senko/action_ai/tree/v0.
|
|
185
|
+
changelog_uri: "https://github.com/Alexander-Senko/action_ai/blob/v0.4.0/CHANGELOG.md"
|
|
186
|
+
source_code_uri: "https://github.com/Alexander-Senko/action_ai/tree/v0.4.0"
|
|
164
187
|
rubygems_mfa_required: "true"
|
|
165
188
|
rdoc_options: []
|
|
166
189
|
require_paths:
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module RubyLLM
|
|
4
|
-
module Providers
|
|
5
|
-
# Echo model behavior for the RubyLLM Test provider.
|
|
6
|
-
#
|
|
7
|
-
# A deterministic response builder (`#echo_response`) returns
|
|
8
|
-
# incoming prompt content.
|
|
9
|
-
#
|
|
10
|
-
# It is intended to be mixed into `RubyLLM::Providers::Test`.
|
|
11
|
-
module Test::Echo
|
|
12
|
-
def self.id = "echo"
|
|
13
|
-
|
|
14
|
-
def self.info = Model::Info.new(
|
|
15
|
-
id:,
|
|
16
|
-
name:,
|
|
17
|
-
provider: Test.slug,
|
|
18
|
-
capabilities: Test.capabilities,
|
|
19
|
-
|
|
20
|
-
modalities: {
|
|
21
|
-
input: %w[text],
|
|
22
|
-
output: %w[text],
|
|
23
|
-
},
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
private
|
|
27
|
-
|
|
28
|
-
def echo_response(messages, **) = {
|
|
29
|
-
content: RubyLLM.concat_content(messages
|
|
30
|
-
.reverse_each.take_while { it.role != :assistant }.reverse
|
|
31
|
-
.map(&:content)
|
|
32
|
-
),
|
|
33
|
-
}
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def self.concat_content *parts
|
|
38
|
-
strings, contents = parts
|
|
39
|
-
.flatten
|
|
40
|
-
.partition { it.is_a? String }
|
|
41
|
-
|
|
42
|
-
Content.new(
|
|
43
|
-
[*strings, *contents.map(&:text)]
|
|
44
|
-
.reject(&:empty?)
|
|
45
|
-
.join("\n\n"),
|
|
46
|
-
contents.sum([], &:attachments)
|
|
47
|
-
.map(&:source)
|
|
48
|
-
)
|
|
49
|
-
end
|
|
50
|
-
end
|