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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 44bbf08beb61d9fdb2e505c5a2e192bb15a9f096a94171dbcdce3035e371b4fe
|
|
4
|
+
data.tar.gz: 10779dab805e5cfff33fbc5333493a0aa43c6f8e5d2db3243444ff62e902df70
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 666d280a8b0e04866a20d2ad4a283d78ed2082c9351ee9ece721866274b00f5aace1accd5fdf4884a4e4b72b4fa2c1bee76464ac77ab67c0187d5a42d0809846
|
|
7
|
+
data.tar.gz: 93e17e173639605a4833bf4738095e1ae1aa7047d1ceb225cf7f759d65c4c76b95165ce565f2964719c43947c7bd0876261379b25e60eeadb1de539bd7a94e80
|
|
@@ -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.
|
|
64
|
-
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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}")
|