ruby_llm-agents 1.2.1 → 1.2.2

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: 44bbf08beb61d9fdb2e505c5a2e192bb15a9f096a94171dbcdce3035e371b4fe
4
+ data.tar.gz: 10779dab805e5cfff33fbc5333493a0aa43c6f8e5d2db3243444ff62e902df70
5
5
  SHA512:
6
- metadata.gz: c98ae91fde73edf152ac4efc5665fe5da30e17ec14ff9f2f9128102bf4665530f55196e705dc371f0dac2354af4ab7a2102be9c04b3b7ec2e8331b7b5445ce23
7
- data.tar.gz: af36432d85c4ac5ee6219eba846411dd4ffaa0ba8d8c9998550ea3d3e757fd125fa8a2bea3cc5c98a0387db519cc03b45d1fd3f3d63de5facc2dc84338b02692
6
+ metadata.gz: 666d280a8b0e04866a20d2ad4a283d78ed2082c9351ee9ece721866274b00f5aace1accd5fdf4884a4e4b72b4fa2c1bee76464ac77ab67c0187d5a42d0809846
7
+ data.tar.gz: 93e17e173639605a4833bf4738095e1ae1aa7047d1ceb225cf7f759d65c4c76b95165ce565f2964719c43947c7bd0876261379b25e60eeadb1de539bd7a94e80
@@ -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.2"
8
8
  end
9
9
  end
@@ -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.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - adham90