ruby_llm-agents 1.2.1 → 1.2.3

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: b6f99247af4fcb9e76776ab2658bac4914d5b869423258bf3827583212447146
4
- data.tar.gz: a6927cced434962ed4b923717d7fd582e983c3091ac8172554afb68671a2514d
3
+ metadata.gz: 5396493167b6da5bcc4fd878d502efdf7269246374ea30ef8d5ce25423f3868a
4
+ data.tar.gz: 2e80ab75249560be31be4e1a9aa8c78efd6b0d6e2c692f391962a20b7ea98a5b
5
5
  SHA512:
6
- metadata.gz: c98ae91fde73edf152ac4efc5665fe5da30e17ec14ff9f2f9128102bf4665530f55196e705dc371f0dac2354af4ab7a2102be9c04b3b7ec2e8331b7b5445ce23
7
- data.tar.gz: af36432d85c4ac5ee6219eba846411dd4ffaa0ba8d8c9998550ea3d3e757fd125fa8a2bea3cc5c98a0387db519cc03b45d1fd3f3d63de5facc2dc84338b02692
6
+ metadata.gz: 2943372fc8709cef913eba67f491431b96e96b5ba4cc43338eabbfaee291fa53434e55fc1db7b7d0ab19b7d05e54c0b228c0799d73a5570f9dd9a18881fb9b7a
7
+ data.tar.gz: b442321d5323899962a6fab0ec998fd5616339bd46428c4198291c611eb2741fc9c3f78080f90fdb055654b16ef491d903caddff5d95394c87c72f84e900fe06
@@ -4,6 +4,6 @@ module RubyLLM
4
4
  module Agents
5
5
  # Current version of the RubyLLM::Agents gem
6
6
  # @return [String] Semantic version string
7
- VERSION = "1.2.1"
7
+ VERSION = "1.2.3"
8
8
  end
9
9
  end
@@ -29,10 +29,9 @@ module RubyLLM
29
29
 
30
30
  # Check budget before execution
31
31
  def check_budget!
32
- BudgetTracker.check!(
33
- agent_type: self.class.name,
34
- tenant_id: @tenant_id,
35
- execution_type: execution_type
32
+ BudgetTracker.check_budget!(
33
+ self.class.name,
34
+ tenant_id: @tenant_id
36
35
  )
37
36
  end
38
37
 
@@ -232,10 +232,9 @@ module RubyLLM
232
232
  end
233
233
 
234
234
  def check_budget!
235
- BudgetTracker.check!(
236
- agent_type: self.class.name,
237
- tenant_id: @tenant_id,
238
- execution_type: "image_pipeline"
235
+ BudgetTracker.check_budget!(
236
+ self.class.name,
237
+ tenant_id: @tenant_id
239
238
  )
240
239
  end
241
240
 
@@ -60,12 +60,11 @@ module RubyLLM
60
60
  # @param context [Context] The execution context
61
61
  # @raise [BudgetExceededError] If budget exceeded with hard enforcement
62
62
  def check_budget!(context)
63
- BudgetTracker.check!(
64
- agent_type: context.agent_class&.name,
65
- tenant_id: context.tenant_id,
66
- execution_type: context.agent_type&.to_s
63
+ BudgetTracker.check_budget!(
64
+ context.agent_class&.name,
65
+ tenant_id: context.tenant_id
67
66
  )
68
- rescue BudgetExceededError
67
+ rescue RubyLLM::Agents::Reliability::BudgetExceededError
69
68
  # Re-raise budget errors
70
69
  raise
71
70
  rescue StandardError => e
@@ -80,10 +79,19 @@ module RubyLLM
80
79
  return unless context.total_cost&.positive?
81
80
 
82
81
  BudgetTracker.record_spend!(
83
- tenant_id: context.tenant_id,
84
- cost: context.total_cost,
85
- tokens: context.total_tokens
82
+ context.agent_class&.name,
83
+ context.total_cost,
84
+ tenant_id: context.tenant_id
86
85
  )
86
+
87
+ # Also record tokens if available
88
+ if context.total_tokens&.positive?
89
+ BudgetTracker.record_tokens!(
90
+ context.agent_class&.name,
91
+ context.total_tokens,
92
+ tenant_id: context.tenant_id
93
+ )
94
+ end
87
95
  rescue StandardError => e
88
96
  # Log but don't fail on spend recording errors
89
97
  error("Failed to record spend: #{e.message}")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_llm-agents
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - adham90