ragaai-catalyst 2.0.7.2b0__tar.gz → 2.0.7.2b1__tar.gz
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-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/PKG-INFO +1 -1
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/pyproject.toml +1 -1
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/llamaindex_callback.py +60 -56
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/upload_traces.py +57 -46
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst.egg-info/PKG-INFO +1 -1
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/.gitignore +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/__init__.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/catalyst_v2.ipynb +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/docs/dataset_management.md +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/docs/prompt_management.md +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/examples/prompt_management_litellm.ipynb +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/examples/prompt_management_openai.ipynb +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/__init__.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/_version.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/dataset.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/evaluation.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/experiment.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/guard_executor.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/guardrails_manager.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/internal_api_completion.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/prompt_manager.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/proxy_call.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/ragaai_catalyst.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/synthetic_data_generation.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/__init__.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/agentic_tracing/Untitled-1.json +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/agentic_tracing/__init__.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/agentic_tracing/agent_tracer.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/agentic_tracing/agentic_tracing.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/agentic_tracing/base.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/agentic_tracing/data_structure.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/agentic_tracing/llm_tracer.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/agentic_tracing/network_tracer.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/agentic_tracing/sample.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/agentic_tracing/tool_tracer.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/agentic_tracing/unique_decorator.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/agentic_tracing/unique_decorator_test.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/agentic_tracing/user_interaction_tracer.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/agentic_tracing/utils/__init__.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/agentic_tracing/utils/api_utils.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/agentic_tracing/utils/data_classes.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/agentic_tracing/utils/generic.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/agentic_tracing/utils/llm_utils.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/agentic_tracing/utils/model_costs.json +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/agentic_tracing/utils/trace_utils.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/exporters/__init__.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/exporters/file_span_exporter.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/exporters/raga_exporter.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/instrumentators/__init__.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/instrumentators/langchain.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/instrumentators/llamaindex.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/instrumentators/openai.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/tracer.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/utils/__init__.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/utils/utils.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/utils.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst.egg-info/SOURCES.txt +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst.egg-info/dependency_links.txt +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst.egg-info/requires.txt +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst.egg-info/top_level.txt +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/requirements.txt +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/setup.cfg +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/test/test_catalyst/test_configuration.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/test/test_catalyst/test_dataset.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/test/test_catalyst/test_evaluation.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/test/test_catalyst/test_prompt_manager.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/test/test_catalyst/test_synthetic_data_generation.py +0 -0
- {ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/traces/prompt_metric_dataset_20241216_135809.json +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ragaai_catalyst
|
3
|
-
Version: 2.0.7.
|
3
|
+
Version: 2.0.7.2b1
|
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>
|
6
6
|
Requires-Python: >=3.9
|
@@ -8,7 +8,7 @@ description = "RAGA AI CATALYST"
|
|
8
8
|
readme = "README.md"
|
9
9
|
requires-python = ">=3.9"
|
10
10
|
# license = {file = "LICENSE"}
|
11
|
-
version = "2.0.7.2.beta.
|
11
|
+
version = "2.0.7.2.beta.1"
|
12
12
|
authors = [
|
13
13
|
{name = "Kiran Scaria", email = "kiran.scaria@raga.ai"},
|
14
14
|
{name = "Kedar Gaikwad", email = "kedar.gaikwad@raga.ai"},
|
@@ -11,6 +11,7 @@ import tempfile
|
|
11
11
|
|
12
12
|
from ..ragaai_catalyst import RagaAICatalyst
|
13
13
|
|
14
|
+
|
14
15
|
class CustomEncoder(json.JSONEncoder):
|
15
16
|
def default(self, obj):
|
16
17
|
if isinstance(obj, Enum):
|
@@ -54,7 +55,7 @@ class LlamaIndexTracer:
|
|
54
55
|
payload: Optional[Dict[str, Any]] = None,
|
55
56
|
event_id: str = "",
|
56
57
|
parent_id: str = "",
|
57
|
-
**kwargs: Any
|
58
|
+
**kwargs: Any,
|
58
59
|
) -> None:
|
59
60
|
trace = {
|
60
61
|
"event_type": event_type,
|
@@ -68,7 +69,7 @@ class LlamaIndexTracer:
|
|
68
69
|
self.in_query = True
|
69
70
|
self.query_event_id = event_id
|
70
71
|
self.current_query_traces = []
|
71
|
-
|
72
|
+
|
72
73
|
if self.in_query:
|
73
74
|
self.current_query_traces.append(trace)
|
74
75
|
self.traces.append(trace)
|
@@ -78,7 +79,7 @@ class LlamaIndexTracer:
|
|
78
79
|
event_type: Optional[str],
|
79
80
|
payload: Optional[Dict[str, Any]] = None,
|
80
81
|
event_id: str = "",
|
81
|
-
**kwargs: Any
|
82
|
+
**kwargs: Any,
|
82
83
|
) -> None:
|
83
84
|
trace = {
|
84
85
|
"event_type": event_type,
|
@@ -90,24 +91,21 @@ class LlamaIndexTracer:
|
|
90
91
|
if self.in_query:
|
91
92
|
self.current_query_traces.append(trace)
|
92
93
|
self.traces.append(trace)
|
93
|
-
|
94
|
+
|
94
95
|
# If this is the end of a query event, automatically save the traces
|
95
96
|
if event_type == "query" and event_id == self.query_event_id:
|
96
97
|
self.in_query = False
|
97
98
|
outer_self._save_current_query_traces(self.current_query_traces)
|
98
99
|
self.current_query_traces = []
|
99
|
-
|
100
100
|
|
101
101
|
self.trace_handler = CustomTraceHandler()
|
102
102
|
self.callback_manager.add_handler(self.trace_handler)
|
103
103
|
Settings.callback_manager = self.callback_manager
|
104
104
|
|
105
|
-
|
106
105
|
# Monkey-patch LlamaIndex components
|
107
106
|
self._monkey_patch()
|
108
107
|
return self # Return self to allow method chaining
|
109
108
|
|
110
|
-
|
111
109
|
def _save_current_query_traces(self, query_traces):
|
112
110
|
"""Save traces for the current query"""
|
113
111
|
self.query_count += 1
|
@@ -131,7 +129,6 @@ class LlamaIndexTracer:
|
|
131
129
|
self._insert_traces(presignedUrl)
|
132
130
|
# print(f"Query {self.query_count} traces uploaded")
|
133
131
|
|
134
|
-
|
135
132
|
def _monkey_patch(self):
|
136
133
|
"""Monkey-patch LlamaIndex components to automatically include the callback manager"""
|
137
134
|
from llama_index.core import VectorStoreIndex, ServiceContext
|
@@ -181,7 +178,7 @@ class LlamaIndexTracer:
|
|
181
178
|
# self._upload_traces(save_json_to_pwd=True)
|
182
179
|
self.callback_manager.remove_handler(self.trace_handler)
|
183
180
|
self._restore_original_inits()
|
184
|
-
print("Traces
|
181
|
+
print("Traces uploaded")
|
185
182
|
self._upload_task = True
|
186
183
|
|
187
184
|
def _restore_original_inits(self):
|
@@ -213,17 +210,17 @@ class LlamaIndexTracer:
|
|
213
210
|
Generate a random trace ID using UUID4.
|
214
211
|
Returns a string representation of the UUID with no hyphens.
|
215
212
|
"""
|
216
|
-
return
|
213
|
+
return "0x" + str(uuid.uuid4()).replace("-", "")
|
217
214
|
|
218
215
|
def _get_user_passed_detail(self):
|
219
216
|
user_detail = self.user_detail
|
220
217
|
user_detail["trace_id"] = self._generate_trace_id()
|
221
218
|
metadata = user_detail["metadata"]
|
222
219
|
metadata["log_source"] = "llamaindex_tracer"
|
223
|
-
metadata["recorded_on"] = datetime.utcnow().isoformat().replace(
|
220
|
+
metadata["recorded_on"] = datetime.utcnow().isoformat().replace("T", " ")
|
224
221
|
user_detail["metadata"] = metadata
|
225
222
|
return user_detail
|
226
|
-
|
223
|
+
|
227
224
|
def _add_traces_in_data(self, traces=None):
|
228
225
|
"""Add traces to user detail"""
|
229
226
|
user_detail = self._get_user_passed_detail()
|
@@ -234,37 +231,40 @@ class LlamaIndexTracer:
|
|
234
231
|
user_detail["traces"] = traces
|
235
232
|
return user_detail
|
236
233
|
|
237
|
-
|
238
234
|
def _create_dataset_schema_with_trace(self):
|
239
235
|
SCHEMA_MAPPING_NEW = {
|
240
236
|
"trace_id": {"columnType": "traceId"},
|
241
237
|
"trace_uri": {"columnType": "traceUri"},
|
242
238
|
"prompt": {"columnType": "prompt"},
|
243
|
-
"response":{"columnType": "response"},
|
239
|
+
"response": {"columnType": "response"},
|
244
240
|
"context": {"columnType": "context"},
|
245
|
-
"llm_model": {"columnType":"pipeline"},
|
241
|
+
"llm_model": {"columnType": "pipeline"},
|
246
242
|
"recorded_on": {"columnType": "metadata"},
|
247
|
-
"embed_model": {"columnType":"pipeline"},
|
243
|
+
"embed_model": {"columnType": "pipeline"},
|
248
244
|
"log_source": {"columnType": "metadata"},
|
249
|
-
"vector_store":{"columnType":"pipeline"},
|
250
|
-
"feedback": {"columnType":"feedBack"}
|
245
|
+
"vector_store": {"columnType": "pipeline"},
|
246
|
+
"feedback": {"columnType": "feedBack"},
|
251
247
|
}
|
248
|
+
|
252
249
|
def make_request():
|
253
250
|
headers = {
|
254
251
|
"Content-Type": "application/json",
|
255
252
|
"Authorization": f"Bearer {os.getenv('RAGAAI_CATALYST_TOKEN')}",
|
256
253
|
"X-Project-Name": self.project_name,
|
257
254
|
}
|
258
|
-
payload = json.dumps(
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
255
|
+
payload = json.dumps(
|
256
|
+
{
|
257
|
+
"datasetName": self.dataset_name,
|
258
|
+
"schemaMapping": SCHEMA_MAPPING_NEW,
|
259
|
+
"traceFolderUrl": None,
|
260
|
+
}
|
261
|
+
)
|
262
|
+
response = requests.request(
|
263
|
+
"POST",
|
264
264
|
f"{self.base_url}/v1/llm/dataset/logs",
|
265
265
|
headers=headers,
|
266
266
|
data=payload,
|
267
|
-
timeout=self.timeout
|
267
|
+
timeout=self.timeout,
|
268
268
|
)
|
269
269
|
|
270
270
|
return response
|
@@ -277,31 +277,35 @@ class LlamaIndexTracer:
|
|
277
277
|
if response.status_code != 200:
|
278
278
|
return response.status_code
|
279
279
|
return response.status_code
|
280
|
-
|
280
|
+
|
281
281
|
def _get_presigned_url(self):
|
282
|
-
payload = json.dumps(
|
282
|
+
payload = json.dumps(
|
283
|
+
{
|
283
284
|
"datasetName": self.dataset_name,
|
284
285
|
"numFiles": 1,
|
285
|
-
}
|
286
|
+
}
|
287
|
+
)
|
286
288
|
headers = {
|
287
289
|
"Content-Type": "application/json",
|
288
290
|
"Authorization": f"Bearer {os.getenv('RAGAAI_CATALYST_TOKEN')}",
|
289
291
|
"X-Project-Name": self.project_name,
|
290
292
|
}
|
291
293
|
|
292
|
-
response = requests.request(
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
294
|
+
response = requests.request(
|
295
|
+
"GET",
|
296
|
+
f"{self.base_url}/v1/llm/presigned-url",
|
297
|
+
headers=headers,
|
298
|
+
data=payload,
|
299
|
+
timeout=self.timeout,
|
300
|
+
)
|
297
301
|
if response.status_code == 200:
|
298
302
|
presignedUrls = response.json()["data"]["presignedUrls"][0]
|
299
303
|
return presignedUrls
|
300
|
-
|
304
|
+
|
301
305
|
def _put_presigned_url(self, presignedUrl, filename):
|
302
306
|
headers = {
|
303
|
-
|
304
|
-
|
307
|
+
"Content-Type": "application/json",
|
308
|
+
}
|
305
309
|
|
306
310
|
if "blob.core.windows.net" in presignedUrl: # Azure
|
307
311
|
headers["x-ms-blob-type"] = "BlockBlob"
|
@@ -309,31 +313,31 @@ class LlamaIndexTracer:
|
|
309
313
|
with open(filename) as f:
|
310
314
|
payload = f.read().replace("\n", "").replace("\r", "").encode()
|
311
315
|
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
headers=headers,
|
316
|
-
data=payload,
|
317
|
-
timeout=self.timeout)
|
316
|
+
response = requests.request(
|
317
|
+
"PUT", presignedUrl, headers=headers, data=payload, timeout=self.timeout
|
318
|
+
)
|
318
319
|
if response.status_code != 200 or response.status_code != 201:
|
319
320
|
return response, response.status_code
|
320
|
-
|
321
|
+
|
321
322
|
def _insert_traces(self, presignedUrl):
|
322
323
|
headers = {
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
payload = json.dumps(
|
324
|
+
"Authorization": f"Bearer {os.getenv('RAGAAI_CATALYST_TOKEN')}",
|
325
|
+
"Content-Type": "application/json",
|
326
|
+
"X-Project-Name": self.project_name,
|
327
|
+
}
|
328
|
+
payload = json.dumps(
|
329
|
+
{
|
328
330
|
"datasetName": self.dataset_name,
|
329
331
|
"presignedUrl": presignedUrl,
|
330
|
-
}
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
332
|
+
}
|
333
|
+
)
|
334
|
+
response = requests.request(
|
335
|
+
"POST",
|
336
|
+
f"{self.base_url}/v1/llm/insert/trace",
|
337
|
+
headers=headers,
|
338
|
+
data=payload,
|
339
|
+
timeout=self.timeout,
|
340
|
+
)
|
337
341
|
|
338
342
|
def _upload_traces(self, save_json_to_pwd=None):
|
339
343
|
"""Save traces to a file"""
|
@@ -351,7 +355,7 @@ class LlamaIndexTracer:
|
|
351
355
|
presignedUrl = self._get_presigned_url()
|
352
356
|
self._put_presigned_url(presignedUrl, filename)
|
353
357
|
self._insert_traces(presignedUrl)
|
354
|
-
print("Traces
|
358
|
+
print("Traces uploaded")
|
355
359
|
|
356
360
|
def get_upload_status(self):
|
357
361
|
"""Check the status of the trace upload."""
|
{ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/upload_traces.py
RENAMED
@@ -5,13 +5,15 @@ from datetime import datetime
|
|
5
5
|
|
6
6
|
|
7
7
|
class UploadTraces:
|
8
|
-
def __init__(
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
def __init__(
|
9
|
+
self,
|
10
|
+
json_file_path,
|
11
|
+
project_name,
|
12
|
+
project_id,
|
13
|
+
dataset_name,
|
14
|
+
user_detail,
|
15
|
+
base_url,
|
16
|
+
):
|
15
17
|
self.json_file_path = json_file_path
|
16
18
|
self.project_name = project_name
|
17
19
|
self.project_id = project_id
|
@@ -25,31 +27,35 @@ class UploadTraces:
|
|
25
27
|
"trace_id": {"columnType": "traceId"},
|
26
28
|
"trace_uri": {"columnType": "traceUri"},
|
27
29
|
"prompt": {"columnType": "prompt"},
|
28
|
-
"response":{"columnType": "response"},
|
30
|
+
"response": {"columnType": "response"},
|
29
31
|
"context": {"columnType": "context"},
|
30
|
-
"llm_model": {"columnType":"pipeline"},
|
32
|
+
"llm_model": {"columnType": "pipeline"},
|
31
33
|
"recorded_on": {"columnType": "metadata"},
|
32
|
-
"embed_model": {"columnType":"pipeline"},
|
34
|
+
"embed_model": {"columnType": "pipeline"},
|
33
35
|
"log_source": {"columnType": "metadata"},
|
34
|
-
"vector_store":{"columnType":"pipeline"},
|
35
|
-
"feedback": {"columnType":"feedBack"}
|
36
|
+
"vector_store": {"columnType": "pipeline"},
|
37
|
+
"feedback": {"columnType": "feedBack"},
|
36
38
|
}
|
39
|
+
|
37
40
|
def make_request():
|
38
41
|
headers = {
|
39
42
|
"Content-Type": "application/json",
|
40
43
|
"Authorization": f"Bearer {os.getenv('RAGAAI_CATALYST_TOKEN')}",
|
41
44
|
"X-Project-Name": self.project_name,
|
42
45
|
}
|
43
|
-
payload = json.dumps(
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
payload = json.dumps(
|
47
|
+
{
|
48
|
+
"datasetName": self.dataset_name,
|
49
|
+
"schemaMapping": SCHEMA_MAPPING_NEW,
|
50
|
+
"traceFolderUrl": None,
|
51
|
+
}
|
52
|
+
)
|
53
|
+
response = requests.request(
|
54
|
+
"POST",
|
49
55
|
f"{self.base_url}/v1/llm/dataset/logs",
|
50
56
|
headers=headers,
|
51
57
|
data=payload,
|
52
|
-
timeout=self.timeout
|
58
|
+
timeout=self.timeout,
|
53
59
|
)
|
54
60
|
|
55
61
|
return response
|
@@ -64,64 +70,69 @@ class UploadTraces:
|
|
64
70
|
return response.status_code
|
65
71
|
|
66
72
|
def _get_presigned_url(self):
|
67
|
-
payload = json.dumps(
|
73
|
+
payload = json.dumps(
|
74
|
+
{
|
68
75
|
"datasetName": self.dataset_name,
|
69
76
|
"numFiles": 1,
|
70
|
-
}
|
77
|
+
}
|
78
|
+
)
|
71
79
|
headers = {
|
72
80
|
"Content-Type": "application/json",
|
73
81
|
"Authorization": f"Bearer {os.getenv('RAGAAI_CATALYST_TOKEN')}",
|
74
82
|
"X-Project-Name": self.project_name,
|
75
83
|
}
|
76
84
|
|
77
|
-
response = requests.request(
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
85
|
+
response = requests.request(
|
86
|
+
"GET",
|
87
|
+
f"{self.base_url}/v1/llm/presigned-url",
|
88
|
+
headers=headers,
|
89
|
+
data=payload,
|
90
|
+
timeout=self.timeout,
|
91
|
+
)
|
82
92
|
if response.status_code == 200:
|
83
93
|
presignedUrls = response.json()["data"]["presignedUrls"][0]
|
84
94
|
return presignedUrls
|
85
95
|
|
86
96
|
def _put_presigned_url(self, presignedUrl, filename):
|
87
97
|
headers = {
|
88
|
-
|
89
|
-
|
98
|
+
"Content-Type": "application/json",
|
99
|
+
}
|
90
100
|
|
91
101
|
if "blob.core.windows.net" in presignedUrl: # Azure
|
92
102
|
headers["x-ms-blob-type"] = "BlockBlob"
|
93
103
|
print(f"Uploading traces...")
|
94
104
|
with open(filename) as f:
|
95
105
|
payload = f.read().replace("\n", "").replace("\r", "").encode()
|
96
|
-
|
97
106
|
|
98
|
-
response = requests.request(
|
99
|
-
|
100
|
-
|
101
|
-
data=payload,
|
102
|
-
timeout=self.timeout)
|
107
|
+
response = requests.request(
|
108
|
+
"PUT", presignedUrl, headers=headers, data=payload, timeout=self.timeout
|
109
|
+
)
|
103
110
|
if response.status_code != 200 or response.status_code != 201:
|
104
111
|
return response, response.status_code
|
105
112
|
|
106
113
|
def _insert_traces(self, presignedUrl):
|
107
114
|
headers = {
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
payload = json.dumps(
|
115
|
+
"Authorization": f"Bearer {os.getenv('RAGAAI_CATALYST_TOKEN')}",
|
116
|
+
"Content-Type": "application/json",
|
117
|
+
"X-Project-Name": self.project_name,
|
118
|
+
}
|
119
|
+
payload = json.dumps(
|
120
|
+
{
|
113
121
|
"datasetName": self.dataset_name,
|
114
122
|
"presignedUrl": presignedUrl,
|
115
|
-
}
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
123
|
+
}
|
124
|
+
)
|
125
|
+
response = requests.request(
|
126
|
+
"POST",
|
127
|
+
f"{self.base_url}/v1/llm/insert/trace",
|
128
|
+
headers=headers,
|
129
|
+
data=payload,
|
130
|
+
timeout=self.timeout,
|
131
|
+
)
|
121
132
|
|
122
133
|
def upload_traces(self):
|
123
134
|
self._create_dataset_schema_with_trace()
|
124
135
|
presignedUrl = self._get_presigned_url()
|
125
136
|
self._put_presigned_url(presignedUrl, self.json_file_path)
|
126
137
|
self._insert_traces(presignedUrl)
|
127
|
-
print("Traces
|
138
|
+
print("Traces uploaded")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ragaai_catalyst
|
3
|
-
Version: 2.0.7.
|
3
|
+
Version: 2.0.7.2b1
|
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>
|
6
6
|
Requires-Python: >=3.9
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/examples/prompt_management_litellm.ipynb
RENAMED
File without changes
|
{ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/examples/prompt_management_openai.ipynb
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/guardrails_manager.py
RENAMED
File without changes
|
{ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/internal_api_completion.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/synthetic_data_generation.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/utils/__init__.py
RENAMED
File without changes
|
{ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst/tracers/utils/utils.py
RENAMED
File without changes
|
File without changes
|
{ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
{ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst.egg-info/requires.txt
RENAMED
File without changes
|
{ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/ragaai_catalyst.egg-info/top_level.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
{ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/test/test_catalyst/test_configuration.py
RENAMED
File without changes
|
File without changes
|
{ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/test/test_catalyst/test_evaluation.py
RENAMED
File without changes
|
{ragaai_catalyst-2.0.7.2b0 → ragaai_catalyst-2.0.7.2b1}/test/test_catalyst/test_prompt_manager.py
RENAMED
File without changes
|
File without changes
|
File without changes
|