ragaai-catalyst 2.2.4.1b10__py3-none-any.whl → 2.2.4.2b2__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/upload/trace_uploader.py +6 -4
- ragaai_catalyst/tracers/agentic_tracing/upload/upload_agentic_traces.py +25 -0
- ragaai_catalyst/tracers/agentic_tracing/utils/create_dataset_schema.py +73 -27
- {ragaai_catalyst-2.2.4.1b10.dist-info → ragaai_catalyst-2.2.4.2b2.dist-info}/METADATA +1 -1
- {ragaai_catalyst-2.2.4.1b10.dist-info → ragaai_catalyst-2.2.4.2b2.dist-info}/RECORD +8 -8
- {ragaai_catalyst-2.2.4.1b10.dist-info → ragaai_catalyst-2.2.4.2b2.dist-info}/WHEEL +0 -0
- {ragaai_catalyst-2.2.4.1b10.dist-info → ragaai_catalyst-2.2.4.2b2.dist-info}/licenses/LICENSE +0 -0
- {ragaai_catalyst-2.2.4.1b10.dist-info → ragaai_catalyst-2.2.4.2b2.dist-info}/top_level.txt +0 -0
@@ -240,12 +240,14 @@ def process_upload(task_id: str, filepath: str, hash_id: str, zip_path: str,
|
|
240
240
|
user_details=user_details,
|
241
241
|
timeout=timeout
|
242
242
|
)
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
243
|
+
if response is None:
|
244
|
+
logger.error(f"Dataset schema creation failed for {dataset_name} - received None response")
|
245
|
+
elif hasattr(response, 'status_code') and response.status_code in [200, 201]:
|
246
|
+
logger.info(f"Dataset schema created successfully: {response.status_code}")
|
247
247
|
_cache_dataset_creation(cache_key, response)
|
248
248
|
logger.info(f"Response cached successfully for dataset: {dataset_name} and key: {cache_key}")
|
249
|
+
else:
|
250
|
+
logger.warning(f"Dataset schema creation returned unexpected response: {response}")
|
249
251
|
|
250
252
|
except Exception as e:
|
251
253
|
logger.error(f"Error creating dataset schema: {e}")
|
@@ -64,8 +64,33 @@ class UploadAgenticTraces:
|
|
64
64
|
presignedURLs = response.json()["data"]["presignedUrls"][0]
|
65
65
|
presignedurl = self.update_presigned_url(presignedURLs, self.base_url)
|
66
66
|
return presignedurl
|
67
|
+
elif response.status_code == 401:
|
68
|
+
logger.warning("Received 401 error. Attempting to refresh token.")
|
69
|
+
token = RagaAICatalyst.get_token(force_refresh=True)
|
70
|
+
headers = {
|
71
|
+
"Content-Type": "application/json",
|
72
|
+
"Authorization": f"Bearer {token}",
|
73
|
+
"X-Project-Name": self.project_name,
|
74
|
+
}
|
75
|
+
response = session_manager.make_request_with_retry(
|
76
|
+
"POST", endpoint, headers=headers, data=payload, timeout=self.timeout
|
77
|
+
)
|
78
|
+
elapsed_ms = (time.time() - start_time) * 1000
|
79
|
+
logger.debug(
|
80
|
+
f"API Call: [POST] {endpoint} | Status: {response.status_code} | Time: {elapsed_ms:.2f}ms"
|
81
|
+
)
|
82
|
+
if response.status_code == 200:
|
83
|
+
presignedURLs = response.json()["data"]["presignedUrls"][0]
|
84
|
+
presignedurl = self.update_presigned_url(presignedURLs, self.base_url)
|
85
|
+
return presignedurl
|
86
|
+
else:
|
87
|
+
logger.error(
|
88
|
+
f"Error while getting presigned url after token refresh: {response.json()['message']}"
|
89
|
+
)
|
90
|
+
return None
|
67
91
|
else:
|
68
92
|
# If POST fails, try GET
|
93
|
+
logger.warning(f"POST request failed for presign url with status {response.status_code}. Falling back to GET request.")
|
69
94
|
response = session_manager.make_request_with_retry(
|
70
95
|
"GET", endpoint, headers=headers, data=payload, timeout=self.timeout
|
71
96
|
)
|
@@ -1,8 +1,16 @@
|
|
1
1
|
import os
|
2
2
|
import json
|
3
3
|
import re
|
4
|
-
import
|
5
|
-
|
4
|
+
import logging
|
5
|
+
import time
|
6
|
+
from urllib3.exceptions import PoolError, MaxRetryError, NewConnectionError
|
7
|
+
from requests.exceptions import ConnectionError, Timeout, RequestException
|
8
|
+
from http.client import RemoteDisconnected
|
9
|
+
|
10
|
+
from ragaai_catalyst import RagaAICatalyst
|
11
|
+
from ragaai_catalyst.tracers.agentic_tracing.upload.session_manager import session_manager
|
12
|
+
|
13
|
+
logger = logging.getLogger(__name__)
|
6
14
|
|
7
15
|
def create_dataset_schema_with_trace(project_name, dataset_name, base_url=None, user_details=None, timeout=120):
|
8
16
|
SCHEMA_MAPPING = {}
|
@@ -13,31 +21,69 @@ def create_dataset_schema_with_trace(project_name, dataset_name, base_url=None,
|
|
13
21
|
continue
|
14
22
|
SCHEMA_MAPPING[key] = {"columnType": "metadata"}
|
15
23
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
24
|
+
headers = {
|
25
|
+
"Content-Type": "application/json",
|
26
|
+
"Authorization": f"Bearer {os.getenv('RAGAAI_CATALYST_TOKEN')}",
|
27
|
+
"X-Project-Name": project_name,
|
28
|
+
}
|
29
|
+
logger.info(f"Header for dataset logs api {headers}")
|
30
|
+
if SCHEMA_MAPPING:
|
31
|
+
payload = json.dumps({
|
32
|
+
"datasetName": dataset_name,
|
33
|
+
"traceFolderUrl": None,
|
34
|
+
"schemaMapping": SCHEMA_MAPPING
|
35
|
+
})
|
36
|
+
else:
|
37
|
+
payload = json.dumps({
|
38
|
+
"datasetName": dataset_name,
|
39
|
+
"traceFolderUrl": None,
|
40
|
+
})
|
41
|
+
|
42
|
+
try:
|
33
43
|
# Use provided base_url or fall back to default
|
34
44
|
url_base = base_url if base_url is not None else RagaAICatalyst.BASE_URL
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
timeout=timeout
|
45
|
+
start_time = time.time()
|
46
|
+
endpoint = f"{url_base}/v1/llm/dataset/logs"
|
47
|
+
|
48
|
+
response = session_manager.make_request_with_retry(
|
49
|
+
"POST", endpoint, headers=headers, data=payload, timeout=timeout
|
40
50
|
)
|
41
|
-
|
42
|
-
|
43
|
-
|
51
|
+
|
52
|
+
elapsed_ms = (time.time() - start_time) * 1000
|
53
|
+
logger.debug(
|
54
|
+
f"API Call: [POST] {endpoint} | Status: {response.status_code} | Time: {elapsed_ms:.2f}ms"
|
55
|
+
)
|
56
|
+
|
57
|
+
if response.status_code in [200, 201]:
|
58
|
+
logger.info(f"Dataset schema created successfully: {response.status_code}")
|
59
|
+
return response
|
60
|
+
elif response.status_code == 401:
|
61
|
+
logger.warning("Received 401 error during dataset schema creation. Attempting to refresh token.")
|
62
|
+
RagaAICatalyst.get_token(force_refresh=True)
|
63
|
+
headers = {
|
64
|
+
"Content-Type": "application/json",
|
65
|
+
"Authorization": f"Bearer {os.getenv('RAGAAI_CATALYST_TOKEN')}",
|
66
|
+
"X-Project-Name": project_name,
|
67
|
+
}
|
68
|
+
response = session_manager.make_request_with_retry(
|
69
|
+
"POST", endpoint, headers=headers, data=payload, timeout=timeout
|
70
|
+
)
|
71
|
+
elapsed_ms = (time.time() - start_time) * 1000
|
72
|
+
logger.debug(
|
73
|
+
f"API Call: [POST] {endpoint} | Status: {response.status_code} | Time: {elapsed_ms:.2f}ms"
|
74
|
+
)
|
75
|
+
if response.status_code in [200, 201]:
|
76
|
+
logger.info(f"Dataset schema created successfully after 401: {response.status_code}")
|
77
|
+
return response
|
78
|
+
else:
|
79
|
+
logger.error(f"Failed to create dataset schema after 401: {response.status_code}")
|
80
|
+
return None
|
81
|
+
else:
|
82
|
+
logger.error(f"Failed to create dataset schema: {response.status_code}")
|
83
|
+
return None
|
84
|
+
except (PoolError, MaxRetryError, NewConnectionError, ConnectionError, Timeout, RemoteDisconnected) as e:
|
85
|
+
session_manager.handle_request_exceptions(e, "creating dataset schema")
|
86
|
+
return None
|
87
|
+
except RequestException as e:
|
88
|
+
logger.error(f"Failed to create dataset schema: {e}")
|
89
|
+
return None
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ragaai_catalyst
|
3
|
-
Version: 2.2.4.
|
3
|
+
Version: 2.2.4.2b2
|
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>, Rishabh Pandey <rishabh.pandey@raga.ai>, Jyotsana C G <jyotsana@raga.ai>
|
6
6
|
Requires-Python: <=3.13.2,>=3.10
|
@@ -55,13 +55,13 @@ ragaai_catalyst/tracers/agentic_tracing/tracers/tool_tracer.py,sha256=xxrliKPfdf
|
|
55
55
|
ragaai_catalyst/tracers/agentic_tracing/tracers/user_interaction_tracer.py,sha256=bhSUhNQCuJXKjgJAXhjKEYjnHMpYN90FSZdR84fNIKU,4614
|
56
56
|
ragaai_catalyst/tracers/agentic_tracing/upload/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
57
57
|
ragaai_catalyst/tracers/agentic_tracing/upload/session_manager.py,sha256=sOlxeIYIP8tycaTtZC9xkZosi6EDJUxvDw0_rc_NLI8,6823
|
58
|
-
ragaai_catalyst/tracers/agentic_tracing/upload/trace_uploader.py,sha256=
|
59
|
-
ragaai_catalyst/tracers/agentic_tracing/upload/upload_agentic_traces.py,sha256=
|
58
|
+
ragaai_catalyst/tracers/agentic_tracing/upload/trace_uploader.py,sha256=U3CV_52kAMGO2q0dRbLcYr8hLpYkzwPeKCWioevqxh0,25050
|
59
|
+
ragaai_catalyst/tracers/agentic_tracing/upload/upload_agentic_traces.py,sha256=E4A-BX5y14pcvbchvH41EXTtwsVe7tvh8qBFHeCiIxc,14444
|
60
60
|
ragaai_catalyst/tracers/agentic_tracing/upload/upload_code.py,sha256=CbTx2vBAPIat5bdIClv9szOo4i33YL_1v04mkUjNG2c,12170
|
61
61
|
ragaai_catalyst/tracers/agentic_tracing/upload/upload_local_metric.py,sha256=m1O8lKpxKwtHofXLW3fTHX5yfqDW5GxoveARlg5cTw4,2571
|
62
62
|
ragaai_catalyst/tracers/agentic_tracing/utils/__init__.py,sha256=XdB3X_ufe4RVvGorxSqAiB9dYv4UD7Hvvuw3bsDUppY,60
|
63
63
|
ragaai_catalyst/tracers/agentic_tracing/utils/api_utils.py,sha256=ZduFA7MmTnWfQ2FzSD0hxMAAfNNTgBs4CXcHZdXJv6k,749
|
64
|
-
ragaai_catalyst/tracers/agentic_tracing/utils/create_dataset_schema.py,sha256=
|
64
|
+
ragaai_catalyst/tracers/agentic_tracing/utils/create_dataset_schema.py,sha256=KhvLaREsNYuLntxoEl68PFcI-vrkNxaXflDewCEA8yM,3724
|
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
|
@@ -89,8 +89,8 @@ ragaai_catalyst/tracers/utils/rag_extraction_logic_final.py,sha256=3ygkRT__lLDRf
|
|
89
89
|
ragaai_catalyst/tracers/utils/rag_trace_json_converter.py,sha256=54IEZO-YRjUAahV5nw8KClXqTF1LhfDry_TsZ4KGow4,20467
|
90
90
|
ragaai_catalyst/tracers/utils/trace_json_converter.py,sha256=-HZVmijeUFLO7e9OAvi1RJdWVTxPRUHPd1MkKQlCD54,11785
|
91
91
|
ragaai_catalyst/tracers/utils/utils.py,sha256=o-p9n2ZuophdrV0wrixu-BqRHCkovup_klc3mS8mU8g,2374
|
92
|
-
ragaai_catalyst-2.2.4.
|
93
|
-
ragaai_catalyst-2.2.4.
|
94
|
-
ragaai_catalyst-2.2.4.
|
95
|
-
ragaai_catalyst-2.2.4.
|
96
|
-
ragaai_catalyst-2.2.4.
|
92
|
+
ragaai_catalyst-2.2.4.2b2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
93
|
+
ragaai_catalyst-2.2.4.2b2.dist-info/METADATA,sha256=zbeWbluwBmIS4QXiu3RvPqjOmAlOIfMuuOajXL9VLUs,17681
|
94
|
+
ragaai_catalyst-2.2.4.2b2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
95
|
+
ragaai_catalyst-2.2.4.2b2.dist-info/top_level.txt,sha256=HpgsdRgEJMk8nqrU6qdCYk3di7MJkDL0B19lkc7dLfM,16
|
96
|
+
ragaai_catalyst-2.2.4.2b2.dist-info/RECORD,,
|
File without changes
|
{ragaai_catalyst-2.2.4.1b10.dist-info → ragaai_catalyst-2.2.4.2b2.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
File without changes
|