ragaai-catalyst 2.1b5__tar.gz → 2.1.1__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.1b5 → ragaai_catalyst-2.1.1}/PKG-INFO +5 -5
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ai_travel_agent.py +7 -7
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/catalyst_v2.ipynb +4 -18
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/finance_agent_catalyst.ipynb +4 -18
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/financial_analysis_agent.py +3 -3
- ragaai_catalyst-2.1.1/nested_agents.py +131 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/pyproject.toml +4 -4
- ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/README.md +97 -0
- ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/__init__.py +5 -0
- ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/data/__init__.py +0 -0
- {ragaai_catalyst-2.1b5/ragaai_catalyst/tracers/agentic_tracing → ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/data}/data_structure.py +14 -1
- ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/tests/__init__.py +0 -0
- ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/tracers/__init__.py +0 -0
- {ragaai_catalyst-2.1b5/ragaai_catalyst/tracers/agentic_tracing → ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/tracers}/agent_tracer.py +15 -10
- {ragaai_catalyst-2.1b5/ragaai_catalyst/tracers/agentic_tracing → ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/tracers}/base.py +5 -6
- {ragaai_catalyst-2.1b5/ragaai_catalyst/tracers/agentic_tracing → ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/tracers}/llm_tracer.py +36 -249
- ragaai_catalyst-2.1b5/ragaai_catalyst/tracers/agentic_tracing/agentic_tracing.py → ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/tracers/main_tracer.py +41 -8
- {ragaai_catalyst-2.1b5/ragaai_catalyst/tracers/agentic_tracing → ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/tracers}/tool_tracer.py +3 -3
- ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/upload/__init__.py +0 -0
- {ragaai_catalyst-2.1b5/ragaai_catalyst/tracers/agentic_tracing → ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/upload}/upload_agentic_traces.py +3 -0
- ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/utils/llm_utils.py +363 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/tracers/tracer.py +11 -12
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst.egg-info/PKG-INFO +5 -5
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst.egg-info/SOURCES.txt +25 -19
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst.egg-info/requires.txt +2 -2
- ragaai_catalyst-2.1.1/sample_llm_testing_code.py +276 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/sync_sample_llm_testing.py +3 -3
- ragaai_catalyst-2.1b5/ragaai_catalyst/tracers/agentic_tracing/__init__.py +0 -3
- ragaai_catalyst-2.1b5/ragaai_catalyst/tracers/agentic_tracing/utils/data_classes.py +0 -61
- ragaai_catalyst-2.1b5/ragaai_catalyst/tracers/agentic_tracing/utils/llm_utils.py +0 -177
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/.gitignore +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/__init__.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/docs/dataset_management.md +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/docs/prompt_management.md +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/examples/prompt_management_litellm.ipynb +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/examples/prompt_management_openai.ipynb +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/__init__.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/_version.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/dataset.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/evaluation.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/experiment.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/guard_executor.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/guardrails_manager.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/internal_api_completion.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/prompt_manager.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/proxy_call.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/ragaai_catalyst.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/synthetic_data_generation.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/tracers/__init__.py +0 -0
- {ragaai_catalyst-2.1b5/ragaai_catalyst/tracers/agentic_tracing/examples → ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/tests}/FinancialAnalysisSystem.ipynb +0 -0
- {ragaai_catalyst-2.1b5/ragaai_catalyst/tracers/agentic_tracing/examples → ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/tests}/GameActivityEventPlanner.ipynb +0 -0
- {ragaai_catalyst-2.1b5/ragaai_catalyst/tracers/agentic_tracing/examples → ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/tests}/TravelPlanner.ipynb +0 -0
- /ragaai_catalyst-2.1b5/ragaai_catalyst/tracers/agentic_tracing/sample.py → /ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/tests/ai_travel_agent.py +0 -0
- {ragaai_catalyst-2.1b5/ragaai_catalyst/tracers/agentic_tracing → ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/tests}/unique_decorator_test.py +0 -0
- {ragaai_catalyst-2.1b5/ragaai_catalyst/tracers/agentic_tracing → ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/tracers}/network_tracer.py +0 -0
- {ragaai_catalyst-2.1b5/ragaai_catalyst/tracers/agentic_tracing → ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/tracers}/user_interaction_tracer.py +0 -0
- {ragaai_catalyst-2.1b5/ragaai_catalyst/tracers/agentic_tracing → ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/upload}/upload_code.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/tracers/agentic_tracing/utils/__init__.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/tracers/agentic_tracing/utils/api_utils.py +0 -0
- {ragaai_catalyst-2.1b5/ragaai_catalyst/tracers/agentic_tracing → ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/utils}/file_name_tracker.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/tracers/agentic_tracing/utils/generic.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/tracers/agentic_tracing/utils/model_costs.json +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/tracers/agentic_tracing/utils/trace_utils.py +0 -0
- {ragaai_catalyst-2.1b5/ragaai_catalyst/tracers/agentic_tracing → ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/utils}/unique_decorator.py +0 -0
- {ragaai_catalyst-2.1b5/ragaai_catalyst/tracers/agentic_tracing → ragaai_catalyst-2.1.1/ragaai_catalyst/tracers/agentic_tracing/utils}/zip_list_of_unique_files.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/tracers/exporters/__init__.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/tracers/exporters/file_span_exporter.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/tracers/exporters/raga_exporter.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/tracers/instrumentators/__init__.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/tracers/instrumentators/langchain.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/tracers/instrumentators/llamaindex.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/tracers/instrumentators/openai.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/tracers/llamaindex_callback.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/tracers/upload_traces.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/tracers/utils/__init__.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/tracers/utils/utils.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst/utils.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst.egg-info/dependency_links.txt +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/ragaai_catalyst.egg-info/top_level.txt +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/requirements.txt +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/setup.cfg +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/test/test_catalyst/test_configuration.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/test/test_catalyst/test_dataset.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/test/test_catalyst/test_evaluation.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/test/test_catalyst/test_prompt_manager.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/test/test_catalyst/test_synthetic_data_generation.py +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/traces/2439beda-8f3a-45c3-82de-4f72624c6ce9.json +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/traces/cd571931-29fe-4d57-9523-71381c97abb1.json +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/traces/d3d5ad2d-6a98-40d6-8b69-8b082eab1bc2.json +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/traces/ed050fde-8705-4635-8570-3aa7f6e4b286.json +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/traces/f2d41172-f89e-47e4-9523-1c1fe6ce20eb.json +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/traces/prompt_metric_dataset_finance.json +0 -0
- {ragaai_catalyst-2.1b5 → ragaai_catalyst-2.1.1}/traces/prompt_metric_dataset_travel.json +0 -0
@@ -1,9 +1,9 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.2
|
2
2
|
Name: ragaai_catalyst
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.1.1
|
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
|
-
Requires-Python:
|
6
|
+
Requires-Python: <3.13,>=3.9
|
7
7
|
Description-Content-Type: text/markdown
|
8
8
|
Requires-Dist: aiohttp>=3.10.2
|
9
9
|
Requires-Dist: opentelemetry-api==1.25.0
|
@@ -19,7 +19,7 @@ Requires-Dist: opentelemetry-instrumentation-openai~=0.24.0
|
|
19
19
|
Requires-Dist: langchain-core>=0.2.11
|
20
20
|
Requires-Dist: langchain>=0.2.11
|
21
21
|
Requires-Dist: openai>=1.57.0
|
22
|
-
Requires-Dist: pandas
|
22
|
+
Requires-Dist: pandas
|
23
23
|
Requires-Dist: groq>=0.11.0
|
24
24
|
Requires-Dist: PyPDF2>=3.0.1
|
25
25
|
Requires-Dist: google-generativeai>=0.8.2
|
@@ -27,7 +27,7 @@ Requires-Dist: Markdown>=3.7
|
|
27
27
|
Requires-Dist: litellm==1.51.1
|
28
28
|
Requires-Dist: tenacity==8.3.0
|
29
29
|
Requires-Dist: tqdm>=4.66.5
|
30
|
-
Requires-Dist: llama-index
|
30
|
+
Requires-Dist: llama-index<0.11.0,>=0.10.0
|
31
31
|
Requires-Dist: pyopenssl>=24.2.1
|
32
32
|
Requires-Dist: psutil~=6.0.0
|
33
33
|
Requires-Dist: py-cpuinfo~=9.0.0
|
@@ -16,15 +16,15 @@ import openai
|
|
16
16
|
from openai import AsyncOpenAI
|
17
17
|
|
18
18
|
catalyst = RagaAICatalyst(
|
19
|
-
access_key="
|
20
|
-
secret_key="
|
21
|
-
base_url="
|
19
|
+
access_key="access_key",
|
20
|
+
secret_key="secret_key",
|
21
|
+
base_url="base_url"
|
22
22
|
)
|
23
23
|
# Initialize tracer
|
24
24
|
tracer = Tracer(
|
25
|
-
project_name="
|
26
|
-
dataset_name="
|
27
|
-
tracer_type="
|
25
|
+
project_name="project_name",
|
26
|
+
dataset_name="dataset_name",
|
27
|
+
tracer_type="tracer_type",
|
28
28
|
metadata={
|
29
29
|
"model": "gpt-3.5-turbo",
|
30
30
|
"environment": "production"
|
@@ -114,7 +114,7 @@ class ItineraryAgent:
|
|
114
114
|
def __init__(self, persona="Itinerary Agent"):
|
115
115
|
self.persona = persona
|
116
116
|
|
117
|
-
@tracer.
|
117
|
+
@tracer.trace_agent(name="plan_itinerary")
|
118
118
|
def plan_itinerary(self, user_preferences, duration=3):
|
119
119
|
# Get weather information
|
120
120
|
weather = weather_tool(user_preferences["destination"])
|
@@ -49,25 +49,11 @@
|
|
49
49
|
"source": [
|
50
50
|
"from ragaai_catalyst import RagaAICatalyst\n",
|
51
51
|
"\n",
|
52
|
-
"# catalyst = RagaAICatalyst(\n",
|
53
|
-
"# access_key=\"dn5OuL29uA0K6G2046ZG\",\n",
|
54
|
-
"# secret_key=\"Je5Kyg787f4Tdth9c75VBAen198L8KOihMTrhdYB\",\n",
|
55
|
-
"# base_url='http://15.206.202.3/api'\n",
|
56
|
-
"# # api_keys=OPENAI_API_KEY\n",
|
57
|
-
"# )\n",
|
58
|
-
"# os.environ[\"RAGAAI_CATALYST_BASE_URL\"] = \"http://15.206.202.3/api\"\n",
|
59
|
-
"\n",
|
60
52
|
"catalyst = RagaAICatalyst(\n",
|
61
|
-
" access_key=\"
|
62
|
-
" secret_key=\"
|
63
|
-
" base_url=\"
|
64
|
-
"
|
65
|
-
")\n",
|
66
|
-
"\n",
|
67
|
-
"# catalyst = RagaAICatalyst(\n",
|
68
|
-
"# access_key=\"jqa9FHN8B313H5mQS14X\",\n",
|
69
|
-
"# secret_key=\"BTzSSKKzFbX8YKoHmIMNpcegsKXF9yRhnYFvyMAF\",\n",
|
70
|
-
"# )"
|
53
|
+
" access_key=\"access_key\",\n",
|
54
|
+
" secret_key=\"secret_key\",\n",
|
55
|
+
" base_url=\"base_url\"\n",
|
56
|
+
")"
|
71
57
|
]
|
72
58
|
},
|
73
59
|
{
|
@@ -36,25 +36,11 @@
|
|
36
36
|
"source": [
|
37
37
|
"from ragaai_catalyst import RagaAICatalyst\n",
|
38
38
|
"\n",
|
39
|
-
"# catalyst = RagaAICatalyst(\n",
|
40
|
-
"# access_key=\"dn5OuL29uA0K6G2046ZG\",\n",
|
41
|
-
"# secret_key=\"Je5Kyg787f4Tdth9c75VBAen198L8KOihMTrhdYB\",\n",
|
42
|
-
"# base_url='http://15.206.202.3/api'\n",
|
43
|
-
"# # api_keys=OPENAI_API_KEY\n",
|
44
|
-
"# )\n",
|
45
|
-
"# os.environ[\"RAGAAI_CATALYST_BASE_URL\"] = \"http://15.206.202.3/api\"\n",
|
46
|
-
"\n",
|
47
39
|
"catalyst = RagaAICatalyst(\n",
|
48
|
-
" access_key=\"
|
49
|
-
" secret_key=\"
|
50
|
-
" base_url=\"
|
51
|
-
"
|
52
|
-
")\n",
|
53
|
-
"\n",
|
54
|
-
"# catalyst = RagaAICatalyst(\n",
|
55
|
-
"# access_key=\"jqa9FHN8B313H5mQS14X\",\n",
|
56
|
-
"# secret_key=\"BTzSSKKzFbX8YKoHmIMNpcegsKXF9yRhnYFvyMAF\",\n",
|
57
|
-
"# )"
|
40
|
+
" access_key=\"access_key\",\n",
|
41
|
+
" secret_key=\"secret_key\",\n",
|
42
|
+
" base_url=\"base_url\"\n",
|
43
|
+
")"
|
58
44
|
]
|
59
45
|
},
|
60
46
|
{
|
@@ -14,9 +14,9 @@ load_dotenv()
|
|
14
14
|
# Initialize OpenAI API
|
15
15
|
openai.api_key = os.getenv("OPENAI_API_KEY")
|
16
16
|
catalyst = RagaAICatalyst(
|
17
|
-
access_key="
|
18
|
-
secret_key="
|
19
|
-
base_url="
|
17
|
+
access_key="access_key",
|
18
|
+
secret_key="secret_key",
|
19
|
+
base_url="base_url"
|
20
20
|
)
|
21
21
|
|
22
22
|
# Start tracing
|
@@ -0,0 +1,131 @@
|
|
1
|
+
import os
|
2
|
+
import requests
|
3
|
+
from dotenv import load_dotenv
|
4
|
+
from litellm import completion
|
5
|
+
from openai import OpenAI
|
6
|
+
|
7
|
+
from ragaai_catalyst.tracers import Tracer
|
8
|
+
from ragaai_catalyst import RagaAICatalyst
|
9
|
+
import asyncio
|
10
|
+
import os
|
11
|
+
import requests
|
12
|
+
from dotenv import load_dotenv
|
13
|
+
load_dotenv()
|
14
|
+
from litellm import completion
|
15
|
+
import openai
|
16
|
+
from openai import AsyncOpenAI
|
17
|
+
|
18
|
+
catalyst = RagaAICatalyst(
|
19
|
+
access_key="access_key",
|
20
|
+
secret_key="secret_key",
|
21
|
+
base_url="base_url"
|
22
|
+
)
|
23
|
+
# Initialize tracer
|
24
|
+
tracer = Tracer(
|
25
|
+
project_name="project_name",
|
26
|
+
dataset_name="dataset_name",
|
27
|
+
tracer_type="tracer_type",
|
28
|
+
metadata={
|
29
|
+
"model": "gpt-3.5-turbo",
|
30
|
+
"environment": "production"
|
31
|
+
},
|
32
|
+
pipeline={
|
33
|
+
"llm_model": "gpt-3.5-turbo",
|
34
|
+
"vector_store": "faiss",
|
35
|
+
"embed_model": "text-embedding-ada-002",
|
36
|
+
}
|
37
|
+
)
|
38
|
+
load_dotenv()
|
39
|
+
|
40
|
+
|
41
|
+
tracer.start()
|
42
|
+
|
43
|
+
@tracer.trace_llm(name="llm_call")
|
44
|
+
def llm_call(prompt, max_tokens=512, model="gpt-4o-mini"):
|
45
|
+
client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
|
46
|
+
response = client.chat.completions.create(
|
47
|
+
model=model,
|
48
|
+
messages=[{"role": "user", "content": prompt}],
|
49
|
+
max_tokens=max_tokens,
|
50
|
+
temperature=0.7,
|
51
|
+
)
|
52
|
+
response_data = response.choices[0].message.content.strip()
|
53
|
+
print('response_data: ', response_data)
|
54
|
+
return response_data
|
55
|
+
|
56
|
+
@tracer.trace_agent(name="summary_agent")
|
57
|
+
class SummaryAgent:
|
58
|
+
def __init__(self, persona="Summary Agent"):
|
59
|
+
self.persona = persona
|
60
|
+
|
61
|
+
def summarize(self, text):
|
62
|
+
# Make an LLM call
|
63
|
+
prompt = f"Please summarize this text concisely: {text}"
|
64
|
+
summary = llm_call(prompt)
|
65
|
+
return summary
|
66
|
+
|
67
|
+
@tracer.trace_agent(name="analysis_agent")
|
68
|
+
class AnalysisAgent:
|
69
|
+
def __init__(self, persona="Analysis Agent"):
|
70
|
+
self.persona = persona
|
71
|
+
self.summary_agent = SummaryAgent()
|
72
|
+
|
73
|
+
def analyze(self, text):
|
74
|
+
# First use the summary agent
|
75
|
+
summary = self.summary_agent.summarize(text)
|
76
|
+
|
77
|
+
# Then make our own LLM call for analysis
|
78
|
+
prompt = f"Given this summary: {summary}\nProvide a brief analysis of the main points."
|
79
|
+
analysis = llm_call(prompt)
|
80
|
+
|
81
|
+
return {
|
82
|
+
"summary": summary,
|
83
|
+
"analysis": analysis
|
84
|
+
}
|
85
|
+
|
86
|
+
@tracer.trace_agent(name="recommendation_agent")
|
87
|
+
class RecommendationAgent:
|
88
|
+
def __init__(self, persona="Recommendation Agent"):
|
89
|
+
self.persona = persona
|
90
|
+
self.analysis_agent = AnalysisAgent()
|
91
|
+
|
92
|
+
def recommend(self, text):
|
93
|
+
# First get analysis from analysis agent (which internally uses summary agent)
|
94
|
+
analysis_result = self.analysis_agent.analyze(text)
|
95
|
+
|
96
|
+
# Then make our own LLM call for recommendations
|
97
|
+
prompt = f"""Given this summary: {analysis_result['summary']}
|
98
|
+
And this analysis: {analysis_result['analysis']}
|
99
|
+
Provide 2-3 actionable recommendations."""
|
100
|
+
|
101
|
+
recommendations = llm_call(prompt)
|
102
|
+
|
103
|
+
return {
|
104
|
+
"summary": analysis_result["summary"],
|
105
|
+
"analysis": analysis_result["analysis"],
|
106
|
+
"recommendations": recommendations
|
107
|
+
}
|
108
|
+
|
109
|
+
def main():
|
110
|
+
# Sample text to analyze
|
111
|
+
text = """
|
112
|
+
Artificial Intelligence has transformed various industries in recent years.
|
113
|
+
From healthcare to finance, AI applications are becoming increasingly prevalent.
|
114
|
+
Machine learning models are being used to predict market trends, diagnose diseases,
|
115
|
+
and automate routine tasks. The impact of AI on society continues to grow,
|
116
|
+
raising both opportunities and challenges for the future.
|
117
|
+
"""
|
118
|
+
|
119
|
+
# Create and use the recommendation agent
|
120
|
+
recommendation_agent = RecommendationAgent()
|
121
|
+
result = recommendation_agent.recommend(text)
|
122
|
+
|
123
|
+
print("\nResults:")
|
124
|
+
print("Summary:", result["summary"])
|
125
|
+
print("\nAnalysis:", result["analysis"])
|
126
|
+
print("\nRecommendations:", result["recommendations"])
|
127
|
+
|
128
|
+
|
129
|
+
if __name__ == "__main__":
|
130
|
+
main()
|
131
|
+
tracer.stop()
|
@@ -6,9 +6,9 @@ build-backend = "setuptools.build_meta"
|
|
6
6
|
name = "ragaai_catalyst"
|
7
7
|
description = "RAGA AI CATALYST"
|
8
8
|
readme = "README.md"
|
9
|
-
requires-python = ">=3.9"
|
9
|
+
requires-python = ">=3.9,<3.13"
|
10
10
|
# license = {file = "LICENSE"}
|
11
|
-
version = "2.1.
|
11
|
+
version = "2.1.1"
|
12
12
|
authors = [
|
13
13
|
{name = "Kiran Scaria", email = "kiran.scaria@raga.ai"},
|
14
14
|
{name = "Kedar Gaikwad", email = "kedar.gaikwad@raga.ai"},
|
@@ -33,7 +33,7 @@ dependencies = [
|
|
33
33
|
"langchain-core>=0.2.11",
|
34
34
|
"langchain>=0.2.11",
|
35
35
|
"openai>=1.57.0",
|
36
|
-
"pandas
|
36
|
+
"pandas",
|
37
37
|
"groq>=0.11.0",
|
38
38
|
"PyPDF2>=3.0.1",
|
39
39
|
"google-generativeai>=0.8.2",
|
@@ -41,7 +41,7 @@ dependencies = [
|
|
41
41
|
"litellm==1.51.1",
|
42
42
|
"tenacity==8.3.0",
|
43
43
|
"tqdm>=4.66.5",
|
44
|
-
"llama-index>=0.10.0",
|
44
|
+
"llama-index>=0.10.0,<0.11.0",
|
45
45
|
"pyopenssl>=24.2.1",
|
46
46
|
"psutil~=6.0.0",
|
47
47
|
"py-cpuinfo~=9.0.0",
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# Agentic Tracing
|
2
|
+
|
3
|
+
This module provides tracing functionality for agentic AI systems, helping track and analyze various aspects of AI agent behavior including LLM interactions, tool usage, and network activities.
|
4
|
+
|
5
|
+
## Directory Structure
|
6
|
+
|
7
|
+
```
|
8
|
+
agentic_tracing/
|
9
|
+
├── tracers/ # Core tracing implementations
|
10
|
+
│ ├── main_tracer.py # Main tracing functionality
|
11
|
+
│ ├── agent_tracer.py # Agent behavior tracing
|
12
|
+
│ ├── base.py # Base tracing classes
|
13
|
+
│ ├── llm_tracer.py # Language model interaction tracing
|
14
|
+
│ ├── network_tracer.py # Network activity tracing
|
15
|
+
│ ├── tool_tracer.py # Tool usage tracing
|
16
|
+
│ ├── user_interaction_tracer.py # User interaction tracing
|
17
|
+
│ └── __init__.py # Tracer module initialization
|
18
|
+
├── data/ # Data structures and classes
|
19
|
+
│ ├── data_classes.py # Data class definitions
|
20
|
+
│ └── __init__.py # Data module initialization
|
21
|
+
├── utils/ # Utility functions and helpers
|
22
|
+
│ ├── api_utils.py # API-related utilities
|
23
|
+
│ ├── file_name_tracker.py # Tracks file names and paths
|
24
|
+
│ ├── generic.py # Generic utility functions
|
25
|
+
│ ├── llm_utils.py # LLM-specific utilities
|
26
|
+
│ ├── model_costs.json # Model cost configurations
|
27
|
+
│ ├── trace_utils.py # General tracing utilities
|
28
|
+
│ ├── unique_decorator.py # Unique ID generation
|
29
|
+
│ ├── zip_list_of_unique_files.py # File handling utilities
|
30
|
+
│ └── __init__.py # Utils module initialization
|
31
|
+
├── tests/ # Test suites and examples
|
32
|
+
│ ├── ai_travel_agent.py # Travel agent test implementation
|
33
|
+
│ ├── unique_decorator_test.py # Tests for unique decorator
|
34
|
+
│ ├── TravelPlanner.ipynb # Travel planner example notebook
|
35
|
+
│ ├── FinancialAnalysisSystem.ipynb # Financial analysis example
|
36
|
+
│ ├── GameActivityEventPlanner.ipynb # Game event planner example
|
37
|
+
│ └── __init__.py # Tests module initialization
|
38
|
+
├── upload/ # Upload functionality
|
39
|
+
│ ├── upload_code.py # Code upload utilities
|
40
|
+
│ └── __init__.py # Upload module initialization
|
41
|
+
└── __init__.py # Package initialization
|
42
|
+
```
|
43
|
+
|
44
|
+
## Components
|
45
|
+
|
46
|
+
### Tracers
|
47
|
+
Different types of tracers for various aspects of agent behavior:
|
48
|
+
- Main Tracer: Core tracing functionality for managing and coordinating different trace types
|
49
|
+
- Agent Tracer: Tracks agent behavior, decisions, and state changes
|
50
|
+
- Base Tracer: Provides base classes and common functionality for all tracers
|
51
|
+
- LLM Tracer: Monitors language model interactions, including:
|
52
|
+
- Token usage tracking
|
53
|
+
- Cost calculation
|
54
|
+
- Input/output monitoring
|
55
|
+
- Model parameter tracking
|
56
|
+
- Network Tracer: Tracks network activities and API calls
|
57
|
+
- Tool Tracer: Monitors tool usage and execution
|
58
|
+
- User Interaction Tracer: Tracks user interactions and feedback
|
59
|
+
|
60
|
+
### Data
|
61
|
+
Core data structures and classes:
|
62
|
+
- Data Classes: Defines structured data types for:
|
63
|
+
- LLM calls
|
64
|
+
- Network requests
|
65
|
+
- Tool executions
|
66
|
+
- Trace components
|
67
|
+
- Agent states
|
68
|
+
- User interactions
|
69
|
+
|
70
|
+
### Utils
|
71
|
+
Helper functions and utilities:
|
72
|
+
- API Utils: Handles API-related operations and configurations
|
73
|
+
- LLM Utils: Utilities for handling LLM-specific operations:
|
74
|
+
- Model name extraction
|
75
|
+
- Token usage calculation
|
76
|
+
- Cost computation
|
77
|
+
- Parameter sanitization
|
78
|
+
- Generic Utils: Common utility functions used across modules
|
79
|
+
- Trace Utils: General tracing utilities
|
80
|
+
- File Name Tracker: Manages file paths and names
|
81
|
+
- Unique Decorator: Generates unique identifiers for trace components
|
82
|
+
- Model Costs: Configuration for different model pricing
|
83
|
+
- Zip List of Unique Files: Handles file compression and unique file management
|
84
|
+
|
85
|
+
### Tests
|
86
|
+
Test suites and example implementations:
|
87
|
+
- AI Travel Agent: Test implementation of a travel planning agent
|
88
|
+
- Unique Decorator Tests: Unit tests for unique ID generation
|
89
|
+
- Example Notebooks:
|
90
|
+
- Travel Planner: Example of travel planning implementation
|
91
|
+
- Financial Analysis: Example of financial system analysis
|
92
|
+
- Game Event Planner: Example of game activity planning
|
93
|
+
|
94
|
+
### Upload
|
95
|
+
Components for uploading and managing trace data:
|
96
|
+
- Code Upload: Handles uploading of traced code and execution data
|
97
|
+
- Supports various data formats and trace types
|
File without changes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from dataclasses import dataclass
|
1
|
+
from dataclasses import dataclass, field
|
2
2
|
from typing import List, Dict, Optional, Any, Union
|
3
3
|
from datetime import datetime
|
4
4
|
import uuid
|
@@ -159,6 +159,19 @@ class ToolInfo:
|
|
159
159
|
version: str
|
160
160
|
memory_used: int
|
161
161
|
|
162
|
+
@dataclass
|
163
|
+
class LLMCall:
|
164
|
+
name: str
|
165
|
+
model_name: str
|
166
|
+
input_prompt: str
|
167
|
+
output_response: str
|
168
|
+
tool_call: Dict
|
169
|
+
token_usage: Dict[str, int]
|
170
|
+
cost: Dict[str, float]
|
171
|
+
start_time: float = field(default=0)
|
172
|
+
end_time: float = field(default=0)
|
173
|
+
duration: float = field(default=0)
|
174
|
+
|
162
175
|
class Component:
|
163
176
|
def __init__(self, id: str, hash_id: str, type: str, name: str, start_time: str, end_time: str, parent_id: int, info: Dict[str, Any], data: Dict[str, Any], network_calls: Optional[List[NetworkCall]] = None, interactions: Optional[List[Union[Interaction, Dict]]] = None, error: Optional[Dict[str, Any]] = None):
|
164
177
|
self.id = id
|
File without changes
|
File without changes
|
@@ -3,12 +3,10 @@ import uuid
|
|
3
3
|
from datetime import datetime
|
4
4
|
import psutil
|
5
5
|
from typing import Optional, Any, Dict, List
|
6
|
-
from .unique_decorator import mydecorator
|
7
|
-
from .unique_decorator import generate_unique_hash_simple
|
8
|
-
|
6
|
+
from ..utils.unique_decorator import mydecorator, generate_unique_hash_simple
|
9
7
|
import contextvars
|
10
8
|
import asyncio
|
11
|
-
from .file_name_tracker import TrackName
|
9
|
+
from ..utils.file_name_tracker import TrackName
|
12
10
|
|
13
11
|
|
14
12
|
class AgentTracerMixin:
|
@@ -20,16 +18,23 @@ class AgentTracerMixin:
|
|
20
18
|
self.agent_children = contextvars.ContextVar("agent_children", default=[])
|
21
19
|
self.component_network_calls = contextvars.ContextVar("component_network_calls", default={})
|
22
20
|
self.component_user_interaction = contextvars.ContextVar("component_user_interaction", default={})
|
21
|
+
self.version = contextvars.ContextVar("version", default="1.0.0")
|
22
|
+
self.agent_type = contextvars.ContextVar("agent_type", default="generic")
|
23
|
+
self.capabilities = contextvars.ContextVar("capabilities", default=[])
|
24
|
+
self.start_time = contextvars.ContextVar("start_time", default=None)
|
25
|
+
self.input_data = contextvars.ContextVar("input_data", default=None)
|
23
26
|
self.gt = None
|
24
27
|
|
25
28
|
|
26
|
-
def trace_agent(self, name: str, agent_type: str =
|
29
|
+
def trace_agent(self, name: str, agent_type: str = None, version: str = None, capabilities: List[str] = None):
|
27
30
|
def decorator(target):
|
28
31
|
# Check if target is a class
|
29
32
|
is_class = isinstance(target, type)
|
30
33
|
tracer = self # Store reference to tracer instance
|
31
34
|
top_level_hash_id = generate_unique_hash_simple(target) # Generate hash based on the decorated target code
|
32
|
-
|
35
|
+
self.version.set(version)
|
36
|
+
self.agent_type.set(agent_type)
|
37
|
+
self.capabilities.set(capabilities)
|
33
38
|
|
34
39
|
if is_class:
|
35
40
|
# Store original __init__
|
@@ -160,6 +165,8 @@ class AgentTracerMixin:
|
|
160
165
|
return func(*args, **kwargs)
|
161
166
|
|
162
167
|
start_time = datetime.now()
|
168
|
+
self.start_time = start_time
|
169
|
+
self.input_data = self._sanitize_input(args, kwargs)
|
163
170
|
start_memory = psutil.Process().memory_info().rss
|
164
171
|
component_id = str(uuid.uuid4())
|
165
172
|
|
@@ -206,12 +213,11 @@ class AgentTracerMixin:
|
|
206
213
|
start_time=start_time,
|
207
214
|
end_time=end_time,
|
208
215
|
memory_used=memory_used,
|
209
|
-
input_data=self.
|
216
|
+
input_data=self.input_data,
|
210
217
|
output_data=self._sanitize_output(result),
|
211
218
|
children=children,
|
212
219
|
parent_id=parent_agent_id
|
213
220
|
)
|
214
|
-
|
215
221
|
# Add ground truth to component data if present
|
216
222
|
if ground_truth is not None:
|
217
223
|
agent_component["data"]["gt"] = ground_truth
|
@@ -253,13 +259,12 @@ class AgentTracerMixin:
|
|
253
259
|
start_time=start_time,
|
254
260
|
end_time=datetime.now(),
|
255
261
|
memory_used=0,
|
256
|
-
input_data=self.
|
262
|
+
input_data=self.input_data,
|
257
263
|
output_data=None,
|
258
264
|
error=error_component,
|
259
265
|
children=children,
|
260
266
|
parent_id=parent_agent_id # Add parent ID if exists
|
261
267
|
)
|
262
|
-
|
263
268
|
# If this is a nested agent, add it to parent's children
|
264
269
|
if parent_agent_id:
|
265
270
|
parent_component = self._agent_components.get(parent_agent_id)
|
@@ -10,18 +10,17 @@ import uuid
|
|
10
10
|
import sys
|
11
11
|
import tempfile
|
12
12
|
|
13
|
-
from .data_structure import (
|
13
|
+
from ..data.data_structure import (
|
14
14
|
Trace, Metadata, SystemInfo, OSInfo, EnvironmentInfo,
|
15
15
|
Resources, CPUResource, MemoryResource, DiskResource, NetworkResource,
|
16
16
|
ResourceInfo, MemoryInfo, DiskInfo, NetworkInfo,
|
17
17
|
Component,
|
18
18
|
)
|
19
19
|
|
20
|
-
from .upload_agentic_traces import UploadAgenticTraces
|
21
|
-
from .upload_code import upload_code
|
22
|
-
|
23
|
-
from .
|
24
|
-
from .zip_list_of_unique_files import zip_list_of_unique_files
|
20
|
+
from ..upload.upload_agentic_traces import UploadAgenticTraces
|
21
|
+
from ..upload.upload_code import upload_code
|
22
|
+
from ..utils.file_name_tracker import TrackName
|
23
|
+
from ..utils.zip_list_of_unique_files import zip_list_of_unique_files
|
25
24
|
|
26
25
|
class TracerJSONEncoder(json.JSONEncoder):
|
27
26
|
def default(self, obj):
|