ragaai-catalyst 2.1.5b40__py3-none-any.whl → 2.1.5b41__py3-none-any.whl
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.
- ragaai_catalyst/tracers/agentic_tracing/utils/llm_utils.py +26 -7
- {ragaai_catalyst-2.1.5b40.dist-info → ragaai_catalyst-2.1.5b41.dist-info}/METADATA +1 -1
- {ragaai_catalyst-2.1.5b40.dist-info → ragaai_catalyst-2.1.5b41.dist-info}/RECORD +6 -6
- {ragaai_catalyst-2.1.5b40.dist-info → ragaai_catalyst-2.1.5b41.dist-info}/LICENSE +0 -0
- {ragaai_catalyst-2.1.5b40.dist-info → ragaai_catalyst-2.1.5b41.dist-info}/WHEEL +0 -0
- {ragaai_catalyst-2.1.5b40.dist-info → ragaai_catalyst-2.1.5b41.dist-info}/top_level.txt +0 -0
@@ -74,6 +74,10 @@ def extract_model_name(args, kwargs, result):
|
|
74
74
|
return "gemini-1.5-pro"
|
75
75
|
if "gemini-pro" in model:
|
76
76
|
return "gemini-pro"
|
77
|
+
|
78
|
+
if 'response_metadata' in dir(result):
|
79
|
+
if 'model_name' in result.response_metadata:
|
80
|
+
model = result.response_metadata['model_name']
|
77
81
|
|
78
82
|
return model or "default"
|
79
83
|
|
@@ -116,8 +120,8 @@ def extract_token_usage(result):
|
|
116
120
|
# Run the coroutine in the current event loop
|
117
121
|
result = loop.run_until_complete(result)
|
118
122
|
|
119
|
-
# Handle text attribute responses (JSON string
|
120
|
-
if hasattr(result, "text"):
|
123
|
+
# Handle text attribute responses (JSON string for Vertex AI)
|
124
|
+
if hasattr(result, "text") and isinstance(result.text, (str, bytes, bytearray)):
|
121
125
|
# First try parsing as JSON for OpenAI responses
|
122
126
|
try:
|
123
127
|
import json
|
@@ -162,11 +166,26 @@ def extract_token_usage(result):
|
|
162
166
|
# Handle Google GenerativeAI format with usage_metadata
|
163
167
|
if hasattr(result, "usage_metadata"):
|
164
168
|
metadata = result.usage_metadata
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
169
|
+
if hasattr(metadata, "prompt_token_count"):
|
170
|
+
return {
|
171
|
+
"prompt_tokens": getattr(metadata, "prompt_token_count", 0),
|
172
|
+
"completion_tokens": getattr(metadata, "candidates_token_count", 0),
|
173
|
+
"total_tokens": getattr(metadata, "total_token_count", 0)
|
174
|
+
}
|
175
|
+
elif hasattr(metadata, "input_tokens"):
|
176
|
+
return {
|
177
|
+
"prompt_tokens": getattr(metadata, "input_tokens", 0),
|
178
|
+
"completion_tokens": getattr(metadata, "output_tokens", 0),
|
179
|
+
"total_tokens": getattr(metadata, "total_tokens", 0)
|
180
|
+
}
|
181
|
+
elif "input_tokens" in metadata:
|
182
|
+
return {
|
183
|
+
"prompt_tokens": metadata["input_tokens"],
|
184
|
+
"completion_tokens": metadata["output_tokens"],
|
185
|
+
"total_tokens": metadata["total_tokens"]
|
186
|
+
}
|
187
|
+
|
188
|
+
|
170
189
|
|
171
190
|
# Handle ChatResponse format with raw usuage
|
172
191
|
if hasattr(result, "raw") and hasattr(result.raw, "usage"):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: ragaai_catalyst
|
3
|
-
Version: 2.1.
|
3
|
+
Version: 2.1.5b41
|
4
4
|
Summary: RAGA AI CATALYST
|
5
5
|
Author-email: Kiran Scaria <kiran.scaria@raga.ai>, Kedar Gaikwad <kedar.gaikwad@raga.ai>, Dushyant Mahajan <dushyant.mahajan@raga.ai>, Siddhartha Kosti <siddhartha.kosti@raga.ai>, Ritika Goel <ritika.goel@raga.ai>, Vijay Chaurasia <vijay.chaurasia@raga.ai>, Tushar Kumar <tushar.kumar@raga.ai>
|
6
6
|
Requires-Python: <3.13,>=3.9
|
@@ -65,7 +65,7 @@ ragaai_catalyst/tracers/agentic_tracing/utils/create_dataset_schema.py,sha256=xH
|
|
65
65
|
ragaai_catalyst/tracers/agentic_tracing/utils/file_name_tracker.py,sha256=YG601l1a29ov9VPu9Vl4RXxgL7l16k54_WWnoTNoG58,2064
|
66
66
|
ragaai_catalyst/tracers/agentic_tracing/utils/generic.py,sha256=WwXT01xmp8MSr7KinuDCSK9a1ifpLcT7ajFkvYviG_A,1190
|
67
67
|
ragaai_catalyst/tracers/agentic_tracing/utils/get_user_trace_metrics.py,sha256=vPZ4dn4EHFW0kqd1GyRpsYXbfrRrd0DXCmh-pzsDBNE,1109
|
68
|
-
ragaai_catalyst/tracers/agentic_tracing/utils/llm_utils.py,sha256=
|
68
|
+
ragaai_catalyst/tracers/agentic_tracing/utils/llm_utils.py,sha256=McKB7TQchmFcgg2h0zg-inuxxKaRjcwbqV_OnRzzYEw,22387
|
69
69
|
ragaai_catalyst/tracers/agentic_tracing/utils/model_costs.json,sha256=2tzGw_cKCTPcfjEm7iGvFE6pTw7gMTPzeBov_MTaXNY,321336
|
70
70
|
ragaai_catalyst/tracers/agentic_tracing/utils/span_attributes.py,sha256=qmODERcFZhc8MX24boFCXkkh6sJ-vZngRHPvxhyWFeE,4347
|
71
71
|
ragaai_catalyst/tracers/agentic_tracing/utils/supported_llm_provider.toml,sha256=LvFDivDIE96Zasp-fgDEqUJ5GEQZUawQucR3aOcSUTY,926
|
@@ -90,8 +90,8 @@ ragaai_catalyst/tracers/utils/langchain_tracer_extraction_logic.py,sha256=XS2_x2
|
|
90
90
|
ragaai_catalyst/tracers/utils/model_prices_and_context_window_backup.json,sha256=C3uwkibJ08C9sOX-54kulZYmJlIpZ-SQpfE6HNGrjbM,343502
|
91
91
|
ragaai_catalyst/tracers/utils/trace_json_converter.py,sha256=qXSYKr4JMUpGQsB3mnr9_2qH6FqzUhCynNqlDp1IWTs,12440
|
92
92
|
ragaai_catalyst/tracers/utils/utils.py,sha256=ViygfJ7vZ7U0CTSA1lbxVloHp4NSlmfDzBRNCJuMhis,2374
|
93
|
-
ragaai_catalyst-2.1.
|
94
|
-
ragaai_catalyst-2.1.
|
95
|
-
ragaai_catalyst-2.1.
|
96
|
-
ragaai_catalyst-2.1.
|
97
|
-
ragaai_catalyst-2.1.
|
93
|
+
ragaai_catalyst-2.1.5b41.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
94
|
+
ragaai_catalyst-2.1.5b41.dist-info/METADATA,sha256=CrlkR9TD7BsrlN3EbTlxlCqOKuk2GFWLMGJV3hqkHJQ,22060
|
95
|
+
ragaai_catalyst-2.1.5b41.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
96
|
+
ragaai_catalyst-2.1.5b41.dist-info/top_level.txt,sha256=HpgsdRgEJMk8nqrU6qdCYk3di7MJkDL0B19lkc7dLfM,16
|
97
|
+
ragaai_catalyst-2.1.5b41.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|