foobara-agent-backed-command 0.0.6 → 0.0.7
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 +4 -0
- data/src/agent_backed_command.rb +25 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc71a16e925bc371058a8fa67197ffbb4628fc5b9a7201a41a19e9bb86b661b6
|
4
|
+
data.tar.gz: 1274e53472b00432601ad7ca1c9db89716e82d804816c2b6b35383d9f1dbffb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74a9526f5b9e09496b5a0c0e162181af418d8a2aa9efecdaffe5bb9c6e0e2f04222dbcba84ceded5d7c14d3a0a2b24fefb3b54c8986d23832aa95ed6f3ec5686
|
7
|
+
data.tar.gz: 6c442453cec558c796c836ab9a24b74d0106307dda2cb51689611df1b86e28201adc158e8f3c18cede0b10c3ed662606152074fc2b70c6e2afc491d2460f2d3e
|
data/CHANGELOG.md
CHANGED
data/src/agent_backed_command.rb
CHANGED
@@ -126,13 +126,12 @@ module Foobara
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
-
agent_name = agent_options&.[](:agent_name) || self.class.agent_name ||
|
129
|
+
agent_name = agent_options&.[](:agent_name) || self.class.agent_name || self.class.scoped_short_name
|
130
130
|
|
131
131
|
verbose = agent_options&.[](:verbose)
|
132
132
|
verbose = self.class.verbose? if verbose.nil?
|
133
133
|
|
134
134
|
opts = {
|
135
|
-
command_classes:,
|
136
135
|
include_message_to_user_in_result:,
|
137
136
|
result_type: agent_result_type,
|
138
137
|
verbose:,
|
@@ -164,6 +163,27 @@ module Foobara
|
|
164
163
|
end
|
165
164
|
|
166
165
|
self.agent = Foobara::Agent.new(**opts)
|
166
|
+
|
167
|
+
command_classes.each do |klass|
|
168
|
+
if klass.is_a?(::Symbol)
|
169
|
+
real_class = Namespace.global.foobara_lookup_command(
|
170
|
+
klass,
|
171
|
+
mode: Namespace::LookupMode::ABSOLUTE
|
172
|
+
)
|
173
|
+
|
174
|
+
if real_class
|
175
|
+
klass = real_class
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
opts = if klass.is_a?(Class) && klass < AgentBackedCommand
|
180
|
+
{ inputs: { reject: [:agent_options] } }
|
181
|
+
else
|
182
|
+
{}
|
183
|
+
end
|
184
|
+
|
185
|
+
agent.connect(klass, **opts)
|
186
|
+
end
|
167
187
|
end
|
168
188
|
|
169
189
|
def agent_options
|
@@ -184,10 +204,9 @@ module Foobara
|
|
184
204
|
goal = Util.underscore(goal)
|
185
205
|
goal = Util.humanize(goal)
|
186
206
|
|
187
|
-
goal = "You are an agent backed command named #{self.class.scoped_short_name}. Your goal is: #{goal}."
|
188
|
-
|
189
207
|
if self.class.description
|
190
|
-
goal += "
|
208
|
+
goal += "\n\nYour behavior has been described to the person or agent that chose to run you as: "
|
209
|
+
goal += self.class.description
|
191
210
|
end
|
192
211
|
|
193
212
|
inputs_type = self.class.inputs_type
|
@@ -209,7 +228,7 @@ module Foobara
|
|
209
228
|
inputs_type,
|
210
229
|
association_depth:
|
211
230
|
)
|
212
|
-
goal += "
|
231
|
+
goal += "\n\nYour inputs to this command have the following type:\n\n#{json_inputs_type}\n\n"
|
213
232
|
|
214
233
|
serializer = if pass_aggregates_to_llm?
|
215
234
|
CommandConnectors::Serializers::AggregateSerializer
|