foobara-agent-backed-command 0.0.4 → 0.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 485915c4c74a0e92159692aa22963ed96c487bcee80ab76a7acc43d803de48ae
4
- data.tar.gz: ab01f8d12e59e7b5171d969da98e7b8562b42d4b7e54ba26230b4cb19d5ad5f4
3
+ metadata.gz: d4a95e6015814a8a5f4050a444e5ba64214a166d4fa2d17f65c7f8722304b182
4
+ data.tar.gz: 89e75c0ddc7e951b2676e078af839319935c1aacd48137adf1ce41ea485d0d23
5
5
  SHA512:
6
- metadata.gz: cc558acd211fac9831e5bbac810232dea7a165d4729cfb6b9ecf1223bda23bfab3eb8ad8a8fa8275660d8b1c1873dae3aa610f252117d81b4c6421dd043bcf9f
7
- data.tar.gz: 9bb9274e270b987c4aa2dd3d708f6e81f74658a99c1526b9aae3aa71525329a0ef55497c0aba2b8419b130bd86f5e0e2693ef8e06d534a008ccd10e85a7001f6
6
+ metadata.gz: 62be54f5dbfe362382ac96f9b097a3d4bbec38b073f3704a4be9e0f311ee0fbd399abdae11dfa7dc966611388a203b0502b615785174022e06377b398ed12836
7
+ data.tar.gz: e5109c393e91add730ce98de1a58c9d60a0c1b80b8b23b6666dec5b3658240c8d360b4c733da5a3c6c6e4582c541ec32add7f348ef81b1de529409bff8ca6708
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [0.0.6] - 2025-07-21
2
+
3
+ - Make sure foobara-ai gem is properly loaded
4
+
5
+ ## [0.0.5] - 2025-07-12
6
+
7
+ - Allow agent_options input to be removed
8
+
1
9
  ## [0.0.4] - 2025-07-10
2
10
 
3
11
  - Support DSL forms for several of the agent options
@@ -1,3 +1,4 @@
1
1
  require "foobara/all"
2
+ require "foobara/ai"
2
3
 
3
4
  Foobara::Util.require_directory "#{__dir__}/../../src"
@@ -30,8 +30,8 @@ module Foobara
30
30
  [
31
31
  :agent_name,
32
32
  :llm_model,
33
- :max_llm_calls_per_minute,
34
- :result_entity_depth
33
+ :result_entity_depth,
34
+ :maximum_command_calls
35
35
  ].each do |method_name|
36
36
  define_method method_name do |*args|
37
37
  case args.size
@@ -60,8 +60,11 @@ module Foobara
60
60
  one_of: Ai::AnswerBot::Types::ModelEnum,
61
61
  default: Ai.default_llm_model,
62
62
  description: "The model to use for the LLM"
63
- max_llm_calls_per_minute :integer, :allow_nil
64
63
  pass_aggregates_to_llm :boolean, :allow_nil
64
+ maximum_command_calls :integer,
65
+ :allow_nil,
66
+ default: 25,
67
+ description: "Maximum number of commands to run before giving up"
65
68
  result_entity_depth :symbol, :allow_nil, one_of: Foobara::AssociationDepth
66
69
  end
67
70
  end
@@ -137,9 +140,7 @@ module Foobara
137
140
  io_err: agent_options&.[](:io_err) || self.class.io_err,
138
141
  agent_name:,
139
142
  context: agent_options&.[](:context) || self.class.context,
140
- llm_model: agent_options&.[](:llm_model) || self.class.llm_model,
141
- # TODO: eliminate this now that we have backoffs for 529s and 429s
142
- max_llm_calls_per_minute: agent_options&.[](:max_llm_calls_per_minute) || self.class.max_llm_calls_per_minute
143
+ llm_model: agent_options&.[](:llm_model) || self.class.llm_model
143
144
  }
144
145
 
145
146
  if agent_options&.[](:result_entity_depth).nil?
@@ -156,9 +157,19 @@ module Foobara
156
157
  agent_options[:pass_aggregates_to_llm]
157
158
  end
158
159
 
160
+ maximum_command_calls = agent_options&.[](:maximum_command_calls) || self.class.maximum_command_calls
161
+
162
+ if maximum_command_calls
163
+ opts[:maximum_command_calls] = maximum_command_calls
164
+ end
165
+
159
166
  self.agent = Foobara::Agent.new(**opts)
160
167
  end
161
168
 
169
+ def agent_options
170
+ @agent_options ||= inputs[:agent_options] || {}
171
+ end
172
+
162
173
  def pass_aggregates_to_llm?
163
174
  if agent_options&.[](:pass_aggregates_to_llm).nil?
164
175
  self.class.pass_aggregates_to_llm?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara-agent-backed-command
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi