ragaai-catalyst 2.2.4b5__py3-none-any.whl → 2.2.5b1__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/__init__.py +0 -2
- ragaai_catalyst/dataset.py +59 -1
- ragaai_catalyst/tracers/agentic_tracing/tracers/main_tracer.py +1 -22
- ragaai_catalyst/tracers/agentic_tracing/utils/__init__.py +0 -2
- ragaai_catalyst/tracers/agentic_tracing/utils/create_dataset_schema.py +1 -1
- ragaai_catalyst/tracers/exporters/__init__.py +1 -2
- ragaai_catalyst/tracers/exporters/file_span_exporter.py +0 -1
- ragaai_catalyst/tracers/exporters/ragaai_trace_exporter.py +23 -1
- ragaai_catalyst/tracers/tracer.py +6 -186
- {ragaai_catalyst-2.2.4b5.dist-info → ragaai_catalyst-2.2.5b1.dist-info}/METADATA +1 -1
- {ragaai_catalyst-2.2.4b5.dist-info → ragaai_catalyst-2.2.5b1.dist-info}/RECORD +14 -45
- ragaai_catalyst/experiment.py +0 -486
- ragaai_catalyst/tracers/agentic_tracing/tests/FinancialAnalysisSystem.ipynb +0 -536
- ragaai_catalyst/tracers/agentic_tracing/tests/GameActivityEventPlanner.ipynb +0 -134
- ragaai_catalyst/tracers/agentic_tracing/tests/TravelPlanner.ipynb +0 -563
- ragaai_catalyst/tracers/agentic_tracing/tests/__init__.py +0 -0
- ragaai_catalyst/tracers/agentic_tracing/tests/ai_travel_agent.py +0 -197
- ragaai_catalyst/tracers/agentic_tracing/tests/unique_decorator_test.py +0 -172
- ragaai_catalyst/tracers/agentic_tracing/tracers/agent_tracer.py +0 -687
- ragaai_catalyst/tracers/agentic_tracing/tracers/base.py +0 -1319
- ragaai_catalyst/tracers/agentic_tracing/tracers/custom_tracer.py +0 -347
- ragaai_catalyst/tracers/agentic_tracing/tracers/langgraph_tracer.py +0 -0
- ragaai_catalyst/tracers/agentic_tracing/tracers/llm_tracer.py +0 -1182
- ragaai_catalyst/tracers/agentic_tracing/tracers/network_tracer.py +0 -288
- ragaai_catalyst/tracers/agentic_tracing/tracers/tool_tracer.py +0 -557
- ragaai_catalyst/tracers/agentic_tracing/tracers/user_interaction_tracer.py +0 -129
- ragaai_catalyst/tracers/agentic_tracing/upload/upload_local_metric.py +0 -74
- ragaai_catalyst/tracers/agentic_tracing/utils/api_utils.py +0 -21
- ragaai_catalyst/tracers/agentic_tracing/utils/generic.py +0 -32
- ragaai_catalyst/tracers/agentic_tracing/utils/get_user_trace_metrics.py +0 -28
- ragaai_catalyst/tracers/agentic_tracing/utils/span_attributes.py +0 -133
- ragaai_catalyst/tracers/agentic_tracing/utils/supported_llm_provider.toml +0 -34
- ragaai_catalyst/tracers/exporters/raga_exporter.py +0 -467
- ragaai_catalyst/tracers/langchain_callback.py +0 -821
- ragaai_catalyst/tracers/llamaindex_callback.py +0 -361
- ragaai_catalyst/tracers/llamaindex_instrumentation.py +0 -424
- ragaai_catalyst/tracers/upload_traces.py +0 -170
- ragaai_catalyst/tracers/utils/convert_langchain_callbacks_output.py +0 -62
- ragaai_catalyst/tracers/utils/convert_llama_instru_callback.py +0 -69
- ragaai_catalyst/tracers/utils/extraction_logic_llama_index.py +0 -74
- ragaai_catalyst/tracers/utils/langchain_tracer_extraction_logic.py +0 -82
- ragaai_catalyst/tracers/utils/rag_trace_json_converter.py +0 -403
- {ragaai_catalyst-2.2.4b5.dist-info → ragaai_catalyst-2.2.5b1.dist-info}/WHEEL +0 -0
- {ragaai_catalyst-2.2.4b5.dist-info → ragaai_catalyst-2.2.5b1.dist-info}/licenses/LICENSE +0 -0
- {ragaai_catalyst-2.2.4b5.dist-info → ragaai_catalyst-2.2.5b1.dist-info}/top_level.txt +0 -0
ragaai_catalyst/__init__.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
from .experiment import Experiment
|
2
1
|
from .ragaai_catalyst import RagaAICatalyst
|
3
2
|
from .utils import response_checker
|
4
3
|
from .dataset import Dataset
|
@@ -15,7 +14,6 @@ from .redteaming import RedTeaming
|
|
15
14
|
|
16
15
|
|
17
16
|
__all__ = [
|
18
|
-
"Experiment",
|
19
17
|
"RagaAICatalyst",
|
20
18
|
"Tracer",
|
21
19
|
"PromptManager",
|
ragaai_catalyst/dataset.py
CHANGED
@@ -732,4 +732,62 @@ class Dataset:
|
|
732
732
|
try:
|
733
733
|
os.remove(tmp_csv_path)
|
734
734
|
except Exception as e:
|
735
|
-
logger.error(f"Error removing temporary CSV file: {e}")
|
735
|
+
logger.error(f"Error removing temporary CSV file: {e}")
|
736
|
+
|
737
|
+
def delete_dataset(self, dataset_name):
|
738
|
+
try:
|
739
|
+
def make_request():
|
740
|
+
headers = {
|
741
|
+
'Content-Type': 'application/json',
|
742
|
+
"Authorization": f"Bearer {os.getenv('RAGAAI_CATALYST_TOKEN')}",
|
743
|
+
"X-Project-Id": str(self.project_id),
|
744
|
+
}
|
745
|
+
json_data = {"size": 99999, "page": "0", "projectId": str(self.project_id), "search": ""}
|
746
|
+
try:
|
747
|
+
response = requests.post(
|
748
|
+
f"{Dataset.BASE_URL}/v2/llm/dataset",
|
749
|
+
headers=headers,
|
750
|
+
json=json_data,
|
751
|
+
timeout=Dataset.TIMEOUT,
|
752
|
+
)
|
753
|
+
response.raise_for_status()
|
754
|
+
return response
|
755
|
+
except requests.exceptions.RequestException as e:
|
756
|
+
logger.error(f"Failed to list datasets: {e}")
|
757
|
+
pass
|
758
|
+
|
759
|
+
response = make_request()
|
760
|
+
|
761
|
+
datasets = response.json()["data"]["content"]
|
762
|
+
dataset_list = [dataset["name"] for dataset in datasets]
|
763
|
+
if dataset_name not in dataset_list:
|
764
|
+
logger.error(f"Dataset '{dataset_name}' does not exists. Please enter a existing dataset name")
|
765
|
+
return
|
766
|
+
|
767
|
+
# Get dataset id
|
768
|
+
dataset_id = [dataset["id"] for dataset in datasets if dataset["name"] == dataset_name][0]
|
769
|
+
|
770
|
+
response = requests.delete(
|
771
|
+
f"{Dataset.BASE_URL}/v1/llm/dataset/{int(dataset_id)}",
|
772
|
+
headers={
|
773
|
+
'Authorization': f"Bearer {os.getenv('RAGAAI_CATALYST_TOKEN')}",
|
774
|
+
"X-Project-Id": str(self.project_id)
|
775
|
+
},
|
776
|
+
timeout=Dataset.TIMEOUT
|
777
|
+
)
|
778
|
+
response.raise_for_status()
|
779
|
+
if response.json()["success"]:
|
780
|
+
print(f"Dataset '{dataset_name}' deleted successfully")
|
781
|
+
else:
|
782
|
+
logger.error("Request was not successful")
|
783
|
+
except requests.exceptions.HTTPError as http_err:
|
784
|
+
logger.error(f"HTTP error occurred: {http_err}")
|
785
|
+
except requests.exceptions.ConnectionError as conn_err:
|
786
|
+
logger.error(f"Connection error occurred: {conn_err}")
|
787
|
+
except requests.exceptions.Timeout as timeout_err:
|
788
|
+
logger.error(f"Timeout error occurred: {timeout_err}")
|
789
|
+
except requests.exceptions.RequestException as req_err:
|
790
|
+
logger.error(f"An error occurred: {req_err}")
|
791
|
+
except Exception as e:
|
792
|
+
logger.error(f"An unexpected error occurred: {e}")
|
793
|
+
|
@@ -8,14 +8,6 @@ import builtins
|
|
8
8
|
from pathlib import Path
|
9
9
|
import logging
|
10
10
|
|
11
|
-
from .base import BaseTracer
|
12
|
-
from .llm_tracer import LLMTracerMixin
|
13
|
-
from .tool_tracer import ToolTracerMixin
|
14
|
-
from .agent_tracer import AgentTracerMixin
|
15
|
-
from .network_tracer import NetworkTracer
|
16
|
-
from .user_interaction_tracer import UserInteractionTracer
|
17
|
-
from .custom_tracer import CustomTracerMixin
|
18
|
-
from ..utils.span_attributes import SpanAttributes
|
19
11
|
|
20
12
|
from ..data.data_structure import (
|
21
13
|
Trace,
|
@@ -42,20 +34,10 @@ from ..data.data_structure import (
|
|
42
34
|
)
|
43
35
|
|
44
36
|
from ....ragaai_catalyst import RagaAICatalyst
|
45
|
-
from ragaai_catalyst.tracers.upload_traces import UploadTraces
|
46
37
|
|
47
38
|
|
48
|
-
class AgenticTracing(
|
49
|
-
BaseTracer, LLMTracerMixin, ToolTracerMixin, AgentTracerMixin, CustomTracerMixin
|
50
|
-
):
|
39
|
+
class AgenticTracing():
|
51
40
|
def __init__(self, user_detail, auto_instrumentation=None, timeout=120):
|
52
|
-
# Initialize all parent classes
|
53
|
-
self.user_interaction_tracer = UserInteractionTracer()
|
54
|
-
LLMTracerMixin.__init__(self)
|
55
|
-
ToolTracerMixin.__init__(self)
|
56
|
-
AgentTracerMixin.__init__(self)
|
57
|
-
CustomTracerMixin.__init__(self)
|
58
|
-
|
59
41
|
self.project_name = user_detail["project_name"]
|
60
42
|
self.project_id = user_detail["project_id"]
|
61
43
|
self.trace_user_detail = user_detail["trace_user_detail"]
|
@@ -65,14 +47,11 @@ class AgenticTracing(
|
|
65
47
|
# Add warning flag
|
66
48
|
self._warning_shown = False
|
67
49
|
|
68
|
-
BaseTracer.__init__(self, user_detail)
|
69
|
-
|
70
50
|
self.tools: Dict[str, Tool] = {}
|
71
51
|
self.call_depth = contextvars.ContextVar("call_depth", default=0)
|
72
52
|
self.current_component_id = contextvars.ContextVar(
|
73
53
|
"current_component_id", default=None
|
74
54
|
)
|
75
|
-
self.network_tracer = NetworkTracer()
|
76
55
|
|
77
56
|
# Handle auto_instrumentation
|
78
57
|
if auto_instrumentation is None:
|
@@ -2,7 +2,7 @@ import os
|
|
2
2
|
import json
|
3
3
|
import re
|
4
4
|
import requests
|
5
|
-
from ragaai_catalyst
|
5
|
+
from ragaai_catalyst import RagaAICatalyst
|
6
6
|
|
7
7
|
def create_dataset_schema_with_trace(project_name, dataset_name, base_url=None, user_details=None, timeout=120):
|
8
8
|
SCHEMA_MAPPING = {}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
from .file_span_exporter import FileSpanExporter
|
2
|
-
from .raga_exporter import RagaExporter
|
3
2
|
from .ragaai_trace_exporter import RAGATraceExporter
|
4
3
|
from .dynamic_trace_exporter import DynamicTraceExporter
|
5
4
|
|
6
5
|
|
7
|
-
__all__ = ["FileSpanExporter", "
|
6
|
+
__all__ = ["FileSpanExporter", "RAGATraceExporter", "DynamicTraceExporter"]
|
@@ -9,7 +9,6 @@ import asyncio
|
|
9
9
|
from concurrent.futures import ThreadPoolExecutor
|
10
10
|
from opentelemetry.sdk.trace.export import SpanExporter
|
11
11
|
from ..utils import get_unique_key
|
12
|
-
from .raga_exporter import RagaExporter
|
13
12
|
|
14
13
|
# Set up logging
|
15
14
|
logging.basicConfig(level=logging.INFO)
|
@@ -6,7 +6,6 @@ from dataclasses import asdict
|
|
6
6
|
|
7
7
|
from opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult
|
8
8
|
|
9
|
-
from ragaai_catalyst.tracers.agentic_tracing.tracers.base import TracerJSONEncoder
|
10
9
|
from ragaai_catalyst.tracers.agentic_tracing.upload.trace_uploader import (
|
11
10
|
submit_upload_task,
|
12
11
|
)
|
@@ -24,6 +23,29 @@ logging_level = (
|
|
24
23
|
logger.setLevel(logging.DEBUG) if os.getenv("DEBUG") == "1" else logging.INFO
|
25
24
|
)
|
26
25
|
|
26
|
+
class TracerJSONEncoder(json.JSONEncoder):
|
27
|
+
def default(self, obj):
|
28
|
+
if isinstance(obj, datetime):
|
29
|
+
return obj.isoformat()
|
30
|
+
if isinstance(obj, bytes):
|
31
|
+
try:
|
32
|
+
return obj.decode("utf-8")
|
33
|
+
except UnicodeDecodeError:
|
34
|
+
return str(obj) # Fallback to string representation
|
35
|
+
if hasattr(obj, "to_dict"): # Handle objects with to_dict method
|
36
|
+
return obj.to_dict()
|
37
|
+
if hasattr(obj, "__dict__"):
|
38
|
+
# Filter out None values and handle nested serialization
|
39
|
+
return {
|
40
|
+
k: v
|
41
|
+
for k, v in obj.__dict__.items()
|
42
|
+
if v is not None and not k.startswith("_")
|
43
|
+
}
|
44
|
+
try:
|
45
|
+
# Try to convert to a basic type
|
46
|
+
return str(obj)
|
47
|
+
except:
|
48
|
+
return None # Last resort: return None instead of failing
|
27
49
|
|
28
50
|
class RAGATraceExporter(SpanExporter):
|
29
51
|
def __init__(self, tracer_type, files_to_zip, project_name, project_id, dataset_name, user_details, base_url, custom_model_cost, timeout=120, post_processor = None, max_upload_workers = 30,user_context = None, user_gt = None, external_id=None):
|
@@ -9,25 +9,16 @@ from litellm import model_cost
|
|
9
9
|
from pathlib import Path
|
10
10
|
from contextlib import contextmanager
|
11
11
|
from concurrent.futures import ThreadPoolExecutor
|
12
|
-
from ragaai_catalyst.tracers.langchain_callback import LangchainTracer
|
13
|
-
from ragaai_catalyst.tracers.utils.convert_langchain_callbacks_output import convert_langchain_callbacks_output
|
14
|
-
|
15
|
-
from ragaai_catalyst.tracers.utils.langchain_tracer_extraction_logic import langchain_tracer_extraction
|
16
|
-
from ragaai_catalyst.tracers.upload_traces import UploadTraces
|
17
12
|
import tempfile
|
18
13
|
import json
|
19
14
|
import numpy as np
|
20
15
|
from opentelemetry.sdk import trace as trace_sdk
|
21
16
|
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
|
22
17
|
from ragaai_catalyst.tracers.exporters.file_span_exporter import FileSpanExporter
|
23
|
-
from ragaai_catalyst.tracers.exporters.raga_exporter import RagaExporter
|
24
18
|
from ragaai_catalyst.tracers.utils import get_unique_key
|
25
|
-
# from ragaai_catalyst.tracers.llamaindex_callback import LlamaIndexTracer
|
26
|
-
from ragaai_catalyst.tracers.llamaindex_instrumentation import LlamaIndexInstrumentationTracer
|
27
19
|
from openinference.instrumentation.langchain import LangChainInstrumentor
|
28
20
|
from ragaai_catalyst import RagaAICatalyst
|
29
21
|
from ragaai_catalyst.tracers.agentic_tracing import AgenticTracing
|
30
|
-
from ragaai_catalyst.tracers.agentic_tracing.tracers.llm_tracer import LLMTracerMixin
|
31
22
|
from ragaai_catalyst.tracers.exporters.ragaai_trace_exporter import RAGATraceExporter
|
32
23
|
from ragaai_catalyst.tracers.agentic_tracing.utils.file_name_tracker import TrackName
|
33
24
|
|
@@ -178,19 +169,6 @@ class Tracer(AgenticTracing):
|
|
178
169
|
except requests.exceptions.RequestException as e:
|
179
170
|
logger.error(f"Failed to retrieve projects list: {e}")
|
180
171
|
|
181
|
-
# if tracer_type == "langchain":
|
182
|
-
# instrumentors = []
|
183
|
-
# from openinference.instrumentation.langchain import LangChainInstrumentor
|
184
|
-
# instrumentors += [(LangChainInstrumentor, [])]
|
185
|
-
# self._setup_agentic_tracer(instrumentors)
|
186
|
-
# elif tracer_type == "llamaindex":
|
187
|
-
# self._upload_task = None
|
188
|
-
# self.llamaindex_tracer = None
|
189
|
-
# elif tracer_type == "rag/langchain":
|
190
|
-
# instrumentors = []
|
191
|
-
# from openinference.instrumentation.langchain import LangChainInstrumentor
|
192
|
-
# instrumentors += [(LangChainInstrumentor, [])]
|
193
|
-
# self._setup_agentic_tracer(instrumentors)
|
194
172
|
# Handle agentic tracers
|
195
173
|
if tracer_type == "agentic" or tracer_type.startswith("agentic/") or tracer_type == "langchain":
|
196
174
|
# Setup instrumentors based on tracer type
|
@@ -490,23 +468,13 @@ class Tracer(AgenticTracing):
|
|
490
468
|
|
491
469
|
|
492
470
|
def set_external_id(self, external_id):
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
'pipeline': self.pipeline,
|
499
|
-
'metadata': self.metadata,
|
500
|
-
'description': self.description,
|
501
|
-
'timeout': self.timeout,
|
502
|
-
'update_llm_cost': self.update_llm_cost,
|
503
|
-
'auto_instrumentation': self.auto_instrumentation,
|
504
|
-
'interval_time': self.interval_time,
|
505
|
-
'max_upload_workers': self.max_upload_workers
|
506
|
-
}
|
507
|
-
|
471
|
+
"""
|
472
|
+
This method updates the external_id attribute of the dynamic exporter.
|
473
|
+
Args:
|
474
|
+
external_id (str): The new external_id to set
|
475
|
+
"""
|
508
476
|
self.dynamic_exporter.external_id = external_id
|
509
|
-
logger.debug(f"Updated external_id to {external_id}")
|
477
|
+
logger.debug(f"Updated dynamic exporter's external_id to {external_id}")
|
510
478
|
|
511
479
|
def set_dataset_name(self, dataset_name):
|
512
480
|
"""
|
@@ -524,106 +492,6 @@ class Tracer(AgenticTracing):
|
|
524
492
|
metadata.setdefault("recorded_on", str(datetime.datetime.now()))
|
525
493
|
return metadata
|
526
494
|
|
527
|
-
def _add_unique_key(self, data, key_name):
|
528
|
-
data[key_name] = get_unique_key(data)
|
529
|
-
return data
|
530
|
-
|
531
|
-
def _setup_provider(self):
|
532
|
-
self.filespanx = FileSpanExporter(
|
533
|
-
project_name=self.project_name,
|
534
|
-
metadata=self.metadata,
|
535
|
-
pipeline=self.pipeline,
|
536
|
-
raga_client=self.raga_client,
|
537
|
-
)
|
538
|
-
tracer_provider = trace_sdk.TracerProvider()
|
539
|
-
tracer_provider.add_span_processor(SimpleSpanProcessor(self.filespanx))
|
540
|
-
return tracer_provider
|
541
|
-
|
542
|
-
def _setup_instrumentor(self, tracer_type):
|
543
|
-
instrumentors = {
|
544
|
-
"langchain": LangchainInstrumentor,
|
545
|
-
"openai": OpenAIInstrumentor,
|
546
|
-
"llama_index": LlamaIndexInstrumentor,
|
547
|
-
}
|
548
|
-
if tracer_type not in instrumentors:
|
549
|
-
logger.error(f"Invalid tracer type: {tracer_type}")
|
550
|
-
return instrumentors[tracer_type]().get()
|
551
|
-
|
552
|
-
@contextmanager
|
553
|
-
def trace(self):
|
554
|
-
"""
|
555
|
-
Synchronous context manager for tracing.
|
556
|
-
Usage:
|
557
|
-
with tracer.trace():
|
558
|
-
# Your code here
|
559
|
-
"""
|
560
|
-
self.start()
|
561
|
-
try:
|
562
|
-
yield self
|
563
|
-
finally:
|
564
|
-
self.stop()
|
565
|
-
|
566
|
-
def start(self):
|
567
|
-
"""Start the tracer."""
|
568
|
-
if self.tracer_type == "langchain":
|
569
|
-
super().start()
|
570
|
-
return self
|
571
|
-
elif self.tracer_type == "llamaindex":
|
572
|
-
super().start()
|
573
|
-
return self
|
574
|
-
|
575
|
-
# self.llamaindex_tracer = LlamaIndexInstrumentationTracer(self._pass_user_data())
|
576
|
-
# return self.llamaindex_tracer.start()
|
577
|
-
elif self.tracer_type == "rag/langchain":
|
578
|
-
super().start()
|
579
|
-
return self
|
580
|
-
else:
|
581
|
-
super().start()
|
582
|
-
return self
|
583
|
-
|
584
|
-
def stop(self):
|
585
|
-
"""Stop the tracer and initiate trace upload."""
|
586
|
-
if self.tracer_type == "langchain":
|
587
|
-
super().stop()
|
588
|
-
return self
|
589
|
-
elif self.tracer_type == "llamaindex":
|
590
|
-
super().stop()
|
591
|
-
return self
|
592
|
-
|
593
|
-
|
594
|
-
# if self.llamaindex_tracer is None:
|
595
|
-
# raise ValueError("LlamaIndex tracer was not started")
|
596
|
-
|
597
|
-
# user_detail = self._pass_user_data()
|
598
|
-
# converted_back_to_callback = self.llamaindex_tracer.stop()
|
599
|
-
|
600
|
-
# filepath_3 = os.path.join(os.getcwd(), "llama_final_result.json")
|
601
|
-
# with open(filepath_3, 'w') as f:
|
602
|
-
# json.dump(converted_back_to_callback, f, default=str, indent=2)
|
603
|
-
|
604
|
-
# # Apply post-processor if registered
|
605
|
-
# if self.post_processor is not None:
|
606
|
-
# try:
|
607
|
-
# final_trace_filepath = self.post_processor(filepath_3)
|
608
|
-
# logger.debug(f"Post-processor applied successfully, new path: {filepath_3}")
|
609
|
-
# except Exception as e:
|
610
|
-
# logger.error(f"Error in post-processing: {e}")
|
611
|
-
# else:
|
612
|
-
# final_trace_filepath = filepath_3
|
613
|
-
|
614
|
-
# if converted_back_to_callback:
|
615
|
-
# UploadTraces(json_file_path=final_trace_filepath,
|
616
|
-
# project_name=self.project_name,
|
617
|
-
# project_id=self.project_id,
|
618
|
-
# dataset_name=self.dataset_name,
|
619
|
-
# user_detail=user_detail,
|
620
|
-
# base_url=self.base_url
|
621
|
-
# ).upload_traces()
|
622
|
-
# return
|
623
|
-
elif self.tracer_type == "rag/langchain":
|
624
|
-
super().stop()
|
625
|
-
else:
|
626
|
-
super().stop()
|
627
495
|
|
628
496
|
def get_upload_status(self):
|
629
497
|
"""Check the status of the trace upload."""
|
@@ -638,54 +506,6 @@ class Tracer(AgenticTracing):
|
|
638
506
|
return f"Upload failed: {str(e)}"
|
639
507
|
return "Upload in progress..."
|
640
508
|
|
641
|
-
def _run_async(self, coroutine):
|
642
|
-
"""Run an asynchronous coroutine in a separate thread."""
|
643
|
-
loop = asyncio.new_event_loop()
|
644
|
-
with ThreadPoolExecutor() as executor:
|
645
|
-
future = executor.submit(lambda: loop.run_until_complete(coroutine))
|
646
|
-
return future
|
647
|
-
|
648
|
-
async def _upload_traces(self):
|
649
|
-
"""
|
650
|
-
Asynchronously uploads traces to the RagaAICatalyst server.
|
651
|
-
|
652
|
-
This function uploads the traces generated by the RagaAICatalyst client to the RagaAICatalyst server. It uses the `aiohttp` library to make an asynchronous HTTP request to the server. The function first checks if the `RAGAAI_CATALYST_TOKEN` environment variable is set. If not, it raises a `ValueError` with the message "RAGAAI_CATALYST_TOKEN not found. Cannot upload traces.".
|
653
|
-
|
654
|
-
The function then uses the `asyncio.wait_for` function to wait for the `check_and_upload_files` method of the `raga_client` object to complete. The `check_and_upload_files` method is called with the `session` object and a list of file paths to be uploaded. The `timeout` parameter is set to the value of the `timeout` attribute of the `Tracer` object.
|
655
|
-
|
656
|
-
If the upload is successful, the function returns the string "Files uploaded successfully" if the `upload_stat` variable is truthy, otherwise it returns the string "No files to upload".
|
657
|
-
|
658
|
-
If the upload times out, the function returns a string with the message "Upload timed out after {self.timeout} seconds".
|
659
|
-
|
660
|
-
If any other exception occurs during the upload, the function returns a string with the message "Upload failed: {str(e)}", where `{str(e)}` is the string representation of the exception.
|
661
|
-
|
662
|
-
Parameters:
|
663
|
-
None
|
664
|
-
|
665
|
-
Returns:
|
666
|
-
A string indicating the status of the upload.
|
667
|
-
"""
|
668
|
-
async with aiohttp.ClientSession() as session:
|
669
|
-
if not os.getenv("RAGAAI_CATALYST_TOKEN"):
|
670
|
-
logger.error("RAGAAI_CATALYST_TOKEN not found. Cannot upload traces.")
|
671
|
-
|
672
|
-
try:
|
673
|
-
upload_stat = await asyncio.wait_for(
|
674
|
-
self.raga_client.check_and_upload_files(
|
675
|
-
session=session,
|
676
|
-
file_paths=[self.filespanx.sync_file],
|
677
|
-
),
|
678
|
-
timeout=self.timeout,
|
679
|
-
)
|
680
|
-
return (
|
681
|
-
"Files uploaded successfully"
|
682
|
-
if upload_stat
|
683
|
-
else "No files to upload"
|
684
|
-
)
|
685
|
-
except asyncio.TimeoutError:
|
686
|
-
return f"Upload timed out after {self.timeout} seconds"
|
687
|
-
except Exception as e:
|
688
|
-
return f"Upload failed: {str(e)}"
|
689
509
|
|
690
510
|
def _cleanup(self):
|
691
511
|
"""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ragaai_catalyst
|
3
|
-
Version: 2.2.
|
3
|
+
Version: 2.2.5b1
|
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
|
@@ -1,8 +1,7 @@
|
|
1
|
-
ragaai_catalyst/__init__.py,sha256=
|
1
|
+
ragaai_catalyst/__init__.py,sha256=mbBaQYwSm3vDTBzJUZOhOHjNyuyZpliGgzsCGKWFgOk,841
|
2
2
|
ragaai_catalyst/_version.py,sha256=JKt9KaVNOMVeGs8ojO6LvIZr7ZkMzNN-gCcvryy4x8E,460
|
3
|
-
ragaai_catalyst/dataset.py,sha256=
|
3
|
+
ragaai_catalyst/dataset.py,sha256=Flhrc4B0U26yj-0Bmx56RfcDWLtVUn2I4mIzLvzfp08,32030
|
4
4
|
ragaai_catalyst/evaluation.py,sha256=8P2zUMSMsQGmKdv7_dZ8F0iXWYddvappgKPN5oJXWuY,22568
|
5
|
-
ragaai_catalyst/experiment.py,sha256=8yQo1phCHlpnJ-4CqCaIbLXg_1ZlAuLGI9kqGBl-OTE,18859
|
6
5
|
ragaai_catalyst/guard_executor.py,sha256=VLqVO1gAEBaovoQQUjdNkivH1dXACFTsuXQ1nzAALQQ,14008
|
7
6
|
ragaai_catalyst/guardrails_manager.py,sha256=_VrARJ1udmCF8TklNKy7XTQUaM8ATDhTOAGDonBkFro,14245
|
8
7
|
ragaai_catalyst/internal_api_completion.py,sha256=DdICI5yfEudiOAIC8L4oxH0Qz7kX-BZCdo9IWsi2gNo,2965
|
@@ -28,68 +27,38 @@ ragaai_catalyst/redteaming/utils/issue_description.py,sha256=iB0XbeOjdqHTPrikCKS
|
|
28
27
|
ragaai_catalyst/redteaming/utils/rt.png,sha256=HzVC8bz_4UgwafKXuMe8RJVI6CyK_UmSgo53ceAOQK8,282154
|
29
28
|
ragaai_catalyst/tracers/__init__.py,sha256=LfgTes-nHpazssbGKnn8kyLZNr49kIPrlkrqqoTFTfc,301
|
30
29
|
ragaai_catalyst/tracers/distributed.py,sha256=CGPuOh4CsgEk428PPibieLaAG2Tt3BVygF6ZlmbXxg4,10009
|
31
|
-
ragaai_catalyst/tracers/
|
32
|
-
ragaai_catalyst/tracers/llamaindex_callback.py,sha256=ZY0BJrrlz-P9Mg2dX-ZkVKG3gSvzwqBtk7JL_05MiYA,14028
|
33
|
-
ragaai_catalyst/tracers/llamaindex_instrumentation.py,sha256=Ys_jLkvVqo12bKgXDmkp4TxJu9HkBATrFE8cIcTYxWw,14329
|
34
|
-
ragaai_catalyst/tracers/tracer.py,sha256=hxVJN45CtIeU8Dc5G1kreXJa7Vv_3buBAHVz-Q3buKo,41435
|
35
|
-
ragaai_catalyst/tracers/upload_traces.py,sha256=w1clGGfdOMpStUJX40NAlxe6dcFdN4pwcezyII0bGYA,6994
|
30
|
+
ragaai_catalyst/tracers/tracer.py,sha256=ulkotFgb_QQNwE85aY8jYFB00EqGHUdlVzGWRdfEknk,33387
|
36
31
|
ragaai_catalyst/tracers/agentic_tracing/README.md,sha256=X4QwLb7-Jg7GQMIXj-SerZIgDETfw-7VgYlczOR8ZeQ,4508
|
37
32
|
ragaai_catalyst/tracers/agentic_tracing/__init__.py,sha256=yf6SKvOPSpH-9LiKaoLKXwqj5sez8F_5wkOb91yp0oE,260
|
38
33
|
ragaai_catalyst/tracers/agentic_tracing/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
39
34
|
ragaai_catalyst/tracers/agentic_tracing/data/data_structure.py,sha256=icAtNzKN_I0YtfuJ3RF8BdZJK3ohqxkVZIdvM5_YugY,9327
|
40
|
-
ragaai_catalyst/tracers/agentic_tracing/tests/FinancialAnalysisSystem.ipynb,sha256=0qZxjWqYCTAVvdo3Tsp544D8Am48wfeMQ9RKpKgAL8g,34291
|
41
|
-
ragaai_catalyst/tracers/agentic_tracing/tests/GameActivityEventPlanner.ipynb,sha256=QCMFJYbGX0fd9eMW4PqyQLZjyWuTXo7n1nqO_hMLf0s,4225
|
42
|
-
ragaai_catalyst/tracers/agentic_tracing/tests/TravelPlanner.ipynb,sha256=fU3inXoemJbdTkGAQl_N1UwVEZ10LrKv4gCEpbQ4ISg,43481
|
43
|
-
ragaai_catalyst/tracers/agentic_tracing/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
44
|
-
ragaai_catalyst/tracers/agentic_tracing/tests/ai_travel_agent.py,sha256=S4rCcKzU_5SB62BYEbNn_1VbbTdG4396N8rdZ3ZNGcE,5654
|
45
|
-
ragaai_catalyst/tracers/agentic_tracing/tests/unique_decorator_test.py,sha256=Xk1cLzs-2A3dgyBwRRnCWs7Eubki40FVonwd433hPN8,4805
|
46
35
|
ragaai_catalyst/tracers/agentic_tracing/tracers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
47
|
-
ragaai_catalyst/tracers/agentic_tracing/tracers/
|
48
|
-
ragaai_catalyst/tracers/agentic_tracing/tracers/base.py,sha256=SBTpHP-sFw_Qm581wlnfZCh4XF12qP6BTN0GTrbQ8nc,55365
|
49
|
-
ragaai_catalyst/tracers/agentic_tracing/tracers/custom_tracer.py,sha256=OBJJjFSvwRjCGNJyqX3yIfC1W05ZN2QUXasCJ4gmCjQ,13930
|
50
|
-
ragaai_catalyst/tracers/agentic_tracing/tracers/langgraph_tracer.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
51
|
-
ragaai_catalyst/tracers/agentic_tracing/tracers/llm_tracer.py,sha256=z-qzmCQCkhyW0aLDUR_rNq4pmxhAaVhNY-kZQsox-Ws,50221
|
52
|
-
ragaai_catalyst/tracers/agentic_tracing/tracers/main_tracer.py,sha256=Va66pvibVSgrr_Wfokog4toxLZw40SqxAmR_NZlWu70,16383
|
53
|
-
ragaai_catalyst/tracers/agentic_tracing/tracers/network_tracer.py,sha256=m8CxYkl7iMiFya_lNwN1ykBc3Pmo-2pR_2HmpptwHWQ,10352
|
54
|
-
ragaai_catalyst/tracers/agentic_tracing/tracers/tool_tracer.py,sha256=xxrliKPfdfbIZRZqMnUewsaTD8_Hv0dbuoBivNZGD4U,21674
|
55
|
-
ragaai_catalyst/tracers/agentic_tracing/tracers/user_interaction_tracer.py,sha256=bhSUhNQCuJXKjgJAXhjKEYjnHMpYN90FSZdR84fNIKU,4614
|
36
|
+
ragaai_catalyst/tracers/agentic_tracing/tracers/main_tracer.py,sha256=iJ2gmVcPB3syVldTbyeeFl92d-EmZ-cryRwIeJhJ_4U,15529
|
56
37
|
ragaai_catalyst/tracers/agentic_tracing/upload/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
57
38
|
ragaai_catalyst/tracers/agentic_tracing/upload/trace_uploader.py,sha256=iMUMFR9XVipCBunpv8_No8bCoP3lqG47M5dg-ugibWo,21006
|
58
39
|
ragaai_catalyst/tracers/agentic_tracing/upload/upload_agentic_traces.py,sha256=t3spo5w7TyfR0Zeqm1h5Z-bJ-BlZ3EPGTvRdK5lpFpE,11705
|
59
40
|
ragaai_catalyst/tracers/agentic_tracing/upload/upload_code.py,sha256=2mxdi7k_SoDqQUFo1oQ__28CpmSIvVugYcbuRltUK9Q,9920
|
60
|
-
ragaai_catalyst/tracers/agentic_tracing/
|
61
|
-
ragaai_catalyst/tracers/agentic_tracing/utils/
|
62
|
-
ragaai_catalyst/tracers/agentic_tracing/utils/api_utils.py,sha256=ZduFA7MmTnWfQ2FzSD0hxMAAfNNTgBs4CXcHZdXJv6k,749
|
63
|
-
ragaai_catalyst/tracers/agentic_tracing/utils/create_dataset_schema.py,sha256=KxxIuuB7-TIfXdwaJsAgKsG90S2tOTS021mimCOczwc,1543
|
41
|
+
ragaai_catalyst/tracers/agentic_tracing/utils/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
42
|
+
ragaai_catalyst/tracers/agentic_tracing/utils/create_dataset_schema.py,sha256=UCecTolWXp6DwOaRut0EZo8q2e1kAeT_Bv4VeoRSVK8,1506
|
64
43
|
ragaai_catalyst/tracers/agentic_tracing/utils/file_name_tracker.py,sha256=YG601l1a29ov9VPu9Vl4RXxgL7l16k54_WWnoTNoG58,2064
|
65
|
-
ragaai_catalyst/tracers/agentic_tracing/utils/generic.py,sha256=WwXT01xmp8MSr7KinuDCSK9a1ifpLcT7ajFkvYviG_A,1190
|
66
|
-
ragaai_catalyst/tracers/agentic_tracing/utils/get_user_trace_metrics.py,sha256=vPZ4dn4EHFW0kqd1GyRpsYXbfrRrd0DXCmh-pzsDBNE,1109
|
67
44
|
ragaai_catalyst/tracers/agentic_tracing/utils/llm_utils.py,sha256=PiyXvEj_qu0EnJFjk4GfGyWFZbwlvQQh0hdQ_lm0p8E,22976
|
68
45
|
ragaai_catalyst/tracers/agentic_tracing/utils/model_costs.json,sha256=2tzGw_cKCTPcfjEm7iGvFE6pTw7gMTPzeBov_MTaXNY,321336
|
69
|
-
ragaai_catalyst/tracers/agentic_tracing/utils/span_attributes.py,sha256=aWMofqiNZZbOwlEFpcsEHu_Tu_6XeUlF36Y827p588c,4405
|
70
|
-
ragaai_catalyst/tracers/agentic_tracing/utils/supported_llm_provider.toml,sha256=LvFDivDIE96Zasp-fgDEqUJ5GEQZUawQucR3aOcSUTY,926
|
71
46
|
ragaai_catalyst/tracers/agentic_tracing/utils/system_monitor.py,sha256=H8WNsk4v_5T6OUw4TFOzlDLjQhJwjh1nAMyMAoqMEi4,6946
|
72
47
|
ragaai_catalyst/tracers/agentic_tracing/utils/trace_utils.py,sha256=W7Nw-IpugejIoHbCtQiN4Sn4ughLocQ9AUCjuAtOhOo,17258
|
73
48
|
ragaai_catalyst/tracers/agentic_tracing/utils/unique_decorator.py,sha256=G027toV-Km20JjKrc-Y_PilQ8ABEKrBvvzgLTnqVg7I,5819
|
74
49
|
ragaai_catalyst/tracers/agentic_tracing/utils/zip_list_of_unique_files.py,sha256=4TeCGsFF26249fV6dJHLTZDrRa93SG9oer4rudoF8Y4,19443
|
75
|
-
ragaai_catalyst/tracers/exporters/__init__.py,sha256=
|
50
|
+
ragaai_catalyst/tracers/exporters/__init__.py,sha256=qA3vx7z9CQ5kTGCn9LIDtIFvW9fJHQLkvF9-xBQUm94,237
|
76
51
|
ragaai_catalyst/tracers/exporters/dynamic_trace_exporter.py,sha256=Rm-QaLv1qMAKpHKcFOcK_HWaKHwFBoUH45_4QYipE-g,6843
|
77
|
-
ragaai_catalyst/tracers/exporters/file_span_exporter.py,sha256=
|
78
|
-
ragaai_catalyst/tracers/exporters/
|
79
|
-
ragaai_catalyst/tracers/exporters/ragaai_trace_exporter.py,sha256=VLvlWFRFPhE32WrF-_J_vCczduz13WAcOW8MKDgDYJc,8979
|
52
|
+
ragaai_catalyst/tracers/exporters/file_span_exporter.py,sha256=_icciSCktK6c86KB2HV3GZMFHvUitgKJ8x_IdPmgi1M,6363
|
53
|
+
ragaai_catalyst/tracers/exporters/ragaai_trace_exporter.py,sha256=GnV0wm9e6shD4MPyPCbi50fmTtgjkxMDh85_7FZHWuM,9793
|
80
54
|
ragaai_catalyst/tracers/instrumentators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
81
55
|
ragaai_catalyst/tracers/utils/__init__.py,sha256=KeMaZtYaTojilpLv65qH08QmpYclfpacDA0U3wg6Ybw,64
|
82
|
-
ragaai_catalyst/tracers/utils/convert_langchain_callbacks_output.py,sha256=SehrD7q8ytAiUYoWr406b4mWs3Lk0Rcy6Ekkihh22TI,1703
|
83
|
-
ragaai_catalyst/tracers/utils/convert_llama_instru_callback.py,sha256=8qLo7x4Zsn3dhJfSv9gviB60YXZ2TOsWEouucJmBM0c,1724
|
84
|
-
ragaai_catalyst/tracers/utils/extraction_logic_llama_index.py,sha256=ZhPs0YhVtB82-Pq9o1BvCinKE_WPvVxPTEcZjlJbFYM,2371
|
85
|
-
ragaai_catalyst/tracers/utils/langchain_tracer_extraction_logic.py,sha256=XS2_x2qneqEx9oAighLg-LRiueWcESLwIC2r7eJT-Ww,3117
|
86
56
|
ragaai_catalyst/tracers/utils/model_prices_and_context_window_backup.json,sha256=WlZCZeOQ54aMVjYS8BAeka2uaFC3ftBTMZ8zzzA8TAI,495947
|
87
57
|
ragaai_catalyst/tracers/utils/rag_extraction_logic_final.py,sha256=3ygkRT__lLDRflRttjzPu28tIA8cTCiGQVMQjqMItqQ,11309
|
88
|
-
ragaai_catalyst/tracers/utils/rag_trace_json_converter.py,sha256=54IEZO-YRjUAahV5nw8KClXqTF1LhfDry_TsZ4KGow4,20467
|
89
58
|
ragaai_catalyst/tracers/utils/trace_json_converter.py,sha256=-HZVmijeUFLO7e9OAvi1RJdWVTxPRUHPd1MkKQlCD54,11785
|
90
59
|
ragaai_catalyst/tracers/utils/utils.py,sha256=o-p9n2ZuophdrV0wrixu-BqRHCkovup_klc3mS8mU8g,2374
|
91
|
-
ragaai_catalyst-2.2.
|
92
|
-
ragaai_catalyst-2.2.
|
93
|
-
ragaai_catalyst-2.2.
|
94
|
-
ragaai_catalyst-2.2.
|
95
|
-
ragaai_catalyst-2.2.
|
60
|
+
ragaai_catalyst-2.2.5b1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
61
|
+
ragaai_catalyst-2.2.5b1.dist-info/METADATA,sha256=kmC1gVsCmraQyABm9a6enoOlQuyHoKiNrRFeIj8skZc,17679
|
62
|
+
ragaai_catalyst-2.2.5b1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
63
|
+
ragaai_catalyst-2.2.5b1.dist-info/top_level.txt,sha256=HpgsdRgEJMk8nqrU6qdCYk3di7MJkDL0B19lkc7dLfM,16
|
64
|
+
ragaai_catalyst-2.2.5b1.dist-info/RECORD,,
|