ragaai-catalyst 2.1b0__py3-none-any.whl → 2.1b2__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.
Files changed (45) hide show
  1. ragaai_catalyst/__init__.py +1 -0
  2. ragaai_catalyst/dataset.py +1 -4
  3. ragaai_catalyst/evaluation.py +4 -5
  4. ragaai_catalyst/guard_executor.py +97 -0
  5. ragaai_catalyst/guardrails_manager.py +41 -15
  6. ragaai_catalyst/internal_api_completion.py +1 -1
  7. ragaai_catalyst/prompt_manager.py +7 -2
  8. ragaai_catalyst/ragaai_catalyst.py +1 -1
  9. ragaai_catalyst/synthetic_data_generation.py +7 -0
  10. ragaai_catalyst/tracers/__init__.py +1 -1
  11. ragaai_catalyst/tracers/agentic_tracing/__init__.py +3 -0
  12. ragaai_catalyst/tracers/agentic_tracing/agent_tracer.py +422 -0
  13. ragaai_catalyst/tracers/agentic_tracing/agentic_tracing.py +198 -0
  14. ragaai_catalyst/tracers/agentic_tracing/base.py +376 -0
  15. ragaai_catalyst/tracers/agentic_tracing/data_structure.py +248 -0
  16. ragaai_catalyst/tracers/agentic_tracing/examples/FinancialAnalysisSystem.ipynb +536 -0
  17. ragaai_catalyst/tracers/agentic_tracing/examples/GameActivityEventPlanner.ipynb +134 -0
  18. ragaai_catalyst/tracers/agentic_tracing/examples/TravelPlanner.ipynb +563 -0
  19. ragaai_catalyst/tracers/agentic_tracing/file_name_tracker.py +46 -0
  20. ragaai_catalyst/tracers/agentic_tracing/llm_tracer.py +808 -0
  21. ragaai_catalyst/tracers/agentic_tracing/network_tracer.py +286 -0
  22. ragaai_catalyst/tracers/agentic_tracing/sample.py +197 -0
  23. ragaai_catalyst/tracers/agentic_tracing/tool_tracer.py +247 -0
  24. ragaai_catalyst/tracers/agentic_tracing/unique_decorator.py +165 -0
  25. ragaai_catalyst/tracers/agentic_tracing/unique_decorator_test.py +172 -0
  26. ragaai_catalyst/tracers/agentic_tracing/upload_agentic_traces.py +187 -0
  27. ragaai_catalyst/tracers/agentic_tracing/upload_code.py +115 -0
  28. ragaai_catalyst/tracers/agentic_tracing/user_interaction_tracer.py +43 -0
  29. ragaai_catalyst/tracers/agentic_tracing/utils/__init__.py +3 -0
  30. ragaai_catalyst/tracers/agentic_tracing/utils/api_utils.py +18 -0
  31. ragaai_catalyst/tracers/agentic_tracing/utils/data_classes.py +61 -0
  32. ragaai_catalyst/tracers/agentic_tracing/utils/generic.py +32 -0
  33. ragaai_catalyst/tracers/agentic_tracing/utils/llm_utils.py +177 -0
  34. ragaai_catalyst/tracers/agentic_tracing/utils/model_costs.json +7823 -0
  35. ragaai_catalyst/tracers/agentic_tracing/utils/trace_utils.py +74 -0
  36. ragaai_catalyst/tracers/agentic_tracing/zip_list_of_unique_files.py +184 -0
  37. ragaai_catalyst/tracers/exporters/raga_exporter.py +1 -7
  38. ragaai_catalyst/tracers/tracer.py +30 -4
  39. ragaai_catalyst/tracers/upload_traces.py +127 -0
  40. ragaai_catalyst-2.1b2.dist-info/METADATA +43 -0
  41. ragaai_catalyst-2.1b2.dist-info/RECORD +56 -0
  42. {ragaai_catalyst-2.1b0.dist-info → ragaai_catalyst-2.1b2.dist-info}/WHEEL +1 -1
  43. ragaai_catalyst-2.1b0.dist-info/METADATA +0 -295
  44. ragaai_catalyst-2.1b0.dist-info/RECORD +0 -28
  45. {ragaai_catalyst-2.1b0.dist-info → ragaai_catalyst-2.1b2.dist-info}/top_level.txt +0 -0
@@ -1,295 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: ragaai_catalyst
3
- Version: 2.1b0
4
- Summary: RAGA AI CATALYST
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: >=3.9
7
- Description-Content-Type: text/markdown
8
- Requires-Dist: aiohttp>=3.10.2
9
- Requires-Dist: opentelemetry-api==1.25.0
10
- Requires-Dist: opentelemetry-sdk==1.25.0
11
- Requires-Dist: opentelemetry-exporter-otlp-proto-grpc==1.25.0
12
- Requires-Dist: opentelemetry-instrumentation==0.46b0
13
- Requires-Dist: opentelemetry-instrumentation-fastapi==0.46b0
14
- Requires-Dist: opentelemetry-instrumentation-asgi==0.46b0
15
- Requires-Dist: opentelemetry-semantic-conventions==0.46b0
16
- Requires-Dist: opentelemetry-util-http==0.46b0
17
- Requires-Dist: opentelemetry-instrumentation-langchain~=0.24.0
18
- Requires-Dist: opentelemetry-instrumentation-openai~=0.24.0
19
- Requires-Dist: langchain-core>=0.2.11
20
- Requires-Dist: langchain>=0.2.11
21
- Requires-Dist: openai>=1.35.10
22
- Requires-Dist: pandas>=2.1.1
23
- Requires-Dist: groq>=0.11.0
24
- Requires-Dist: PyPDF2>=3.0.1
25
- Requires-Dist: google-generativeai>=0.8.2
26
- Requires-Dist: Markdown>=3.7
27
- Requires-Dist: litellm==1.51.1
28
- Requires-Dist: tenacity==8.3.0
29
- Requires-Dist: tqdm>=4.66.5
30
- Requires-Dist: llama-index==0.10.0
31
- Provides-Extra: dev
32
- Requires-Dist: pytest; extra == "dev"
33
- Requires-Dist: pytest-cov; extra == "dev"
34
- Requires-Dist: black; extra == "dev"
35
- Requires-Dist: isort; extra == "dev"
36
- Requires-Dist: mypy; extra == "dev"
37
- Requires-Dist: flake8; extra == "dev"
38
-
39
- # RagaAI Catalyst
40
-
41
- RagaAI Catalyst is a powerful tool for managing and optimizing LLM projects. It provides functionalities for project management, trace recording, and experiment management, allowing you to fine-tune and evaluate your LLM applications effectively.
42
-
43
- ## Table of Contents
44
-
45
- - [RagaAI Catalyst](#ragaai-catalyst)
46
- - [Table of Contents](#table-of-contents)
47
- - [Installation](#installation)
48
- - [Configuration](#configuration)
49
- - [Usage](#usage)
50
- - [Project Management](#project-management)
51
- - [Dataset Management](#dataset-management)
52
- - [Evaluation Management](#evaluation)
53
- - [Trace Management](#trace-management)
54
- - [Prompt Management](#prompt-management)
55
- - [Synthetic Data Generation](#synthetic-data-generation)
56
-
57
- ## Installation
58
-
59
- To install RagaAI Catalyst, you can use pip:
60
-
61
- ```bash
62
- pip install ragaai-catalyst
63
- ```
64
-
65
- ## Configuration
66
-
67
- Before using RagaAI Catalyst, you need to set up your credentials. You can do this by setting environment variables or passing them directly to the `RagaAICatalyst` class:
68
-
69
- ```python
70
- from ragaai_catalyst import RagaAICatalyst
71
-
72
- catalyst = RagaAICatalyst(
73
- access_key="YOUR_ACCESS_KEY",
74
- secret_key="YOUR_SECRET_KEY",
75
- base_url="BASE_URL"
76
- )
77
- ```
78
- **Note**: Authetication to RagaAICatalyst is necessary to perform any operations below
79
-
80
-
81
- ## Usage
82
-
83
- ### Project Management
84
-
85
- Create and manage projects using RagaAI Catalyst:
86
-
87
- ```python
88
- # Create a project
89
- project = catalyst.create_project(
90
- project_name="Test-RAG-App-1",
91
- usecase="Chatbot"
92
- )
93
-
94
- # Get project usecases
95
- catalyst.project_use_cases()
96
-
97
- # List projects
98
- projects = catalyst.list_projects()
99
- print(projects)
100
- ```
101
-
102
- ### Dataset Management
103
- Manage datasets efficiently for your projects:
104
-
105
- ```py
106
- from ragaai_catalyst import Dataset
107
-
108
- # Initialize Dataset management for a specific project
109
- dataset_manager = Dataset(project_name="project_name")
110
-
111
- # List existing datasets
112
- datasets = dataset_manager.list_datasets()
113
- print("Existing Datasets:", datasets)
114
-
115
- # Create a dataset from CSV
116
- dataset_manager.create_from_csv(
117
- csv_path='path/to/your.csv',
118
- dataset_name='MyDataset',
119
- schema_mapping={'column1': 'schema_element1', 'column2': 'schema_element2'}
120
- )
121
-
122
- # Get project schema mapping
123
- dataset_manager.get_schema_mapping()
124
-
125
- ```
126
-
127
- For more detailed information on Dataset Management, including CSV schema handling and advanced usage, please refer to the [Dataset Management documentation](docs/dataset_management.md).
128
-
129
-
130
- ### Evaluation
131
-
132
- Create and manage metric evaluation of your RAG application:
133
-
134
- ```python
135
- from ragaai_catalyst import Evaluation
136
-
137
- # Create an experiment
138
- evaluation = Evaluation(
139
- project_name="Test-RAG-App-1",
140
- dataset_name="MyDataset",
141
- )
142
-
143
- # Get list of available metrics
144
- evaluation.list_metrics()
145
-
146
- # Add metrics to the experiment
147
- schema_mapping={
148
- 'Query': 'prompt',
149
- 'response': 'response',
150
- 'Context': 'context',
151
- 'expectedResponse': 'expected_response'
152
- }
153
-
154
- # Add single metric
155
- evaluation.add_metrics(
156
- metrics=[
157
- {"name": "Faithfulness", "config": {"model": "gpt-4o-mini", "provider": "openai", "threshold": {"gte": 0.232323}}, "column_name": "Faithfulness_v1", "schema_mapping": schema_mapping},
158
-
159
- ]
160
- )
161
-
162
- # Add multiple metrics
163
- evaluation.add_metrics(
164
- metrics=[
165
- {"name": "Faithfulness", "config": {"model": "gpt-4o-mini", "provider": "openai", "threshold": {"gte": 0.323}}, "column_name": "Faithfulness_gte", "schema_mapping": schema_mapping},
166
- {"name": "Hallucination", "config": {"model": "gpt-4o-mini", "provider": "openai", "threshold": {"lte": 0.323}}, "column_name": "Hallucination_lte", "schema_mapping": schema_mapping},
167
- {"name": "Hallucination", "config": {"model": "gpt-4o-mini", "provider": "openai", "threshold": {"eq": 0.323}}, "column_name": "Hallucination_eq", "schema_mapping": schema_mapping},
168
- ]
169
- )
170
-
171
- # Get the status of the experiment
172
- status = evaluation.get_status()
173
- print("Experiment Status:", status)
174
-
175
- # Get the results of the experiment
176
- results = evaluation.get_results()
177
- print("Experiment Results:", results)
178
- ```
179
-
180
-
181
-
182
- ### Trace Management
183
-
184
- Record and analyze traces of your RAG application:
185
-
186
- ```python
187
- from ragaai_catalyst import Tracer
188
-
189
- # Start a trace recording
190
- tracer = Tracer(
191
- project_name="Test-RAG-App-1",
192
- dataset_name="tracer_dataset_name"
193
- metadata={"key1": "value1", "key2": "value2"},
194
- tracer_type="langchain",
195
- pipeline={
196
- "llm_model": "gpt-3.5-turbo",
197
- "vector_store": "faiss",
198
- "embed_model": "text-embedding-ada-002",
199
- }
200
- ).start()
201
-
202
- # Your code here
203
-
204
- # Stop the trace recording
205
- tracer.stop()
206
- ```
207
-
208
-
209
- ### Prompt Management
210
-
211
- Manage and use prompts efficiently in your projects:
212
-
213
- ```py
214
- from ragaai_catalyst import PromptManager
215
-
216
- # Initialize PromptManager
217
- prompt_manager = PromptManager(project_name="Test-RAG-App-1")
218
-
219
- # List available prompts
220
- prompts = prompt_manager.list_prompts()
221
- print("Available prompts:", prompts)
222
-
223
- # Get default prompt by prompt_name
224
- prompt_name = "your_prompt_name"
225
- prompt = prompt_manager.get_prompt(prompt_name)
226
-
227
- # Get specific version of prompt by prompt_name and version
228
- prompt_name = "your_prompt_name"
229
- version = "v1"
230
- prompt = prompt_manager.get_prompt(prompt_name,version)
231
-
232
- # Get variables in a prompt
233
- variable = prompt.get_variables()
234
- print("variable:",variable)
235
-
236
- # Get prompt content
237
- prompt_content = prompt.get_prompt_content()
238
- print("prompt_content:", prompt_content)
239
-
240
- # Compile a prompt with variables
241
- compiled_prompt = prompt.compile(query="What's the weather?", context="sunny", llm_response="It's sunny today")
242
- print("Compiled prompt:", compiled_prompt)
243
-
244
- # implement compiled_prompt with openai
245
- import openai
246
- def get_openai_response(prompt):
247
- client = openai.OpenAI()
248
- response = client.chat.completions.create(
249
- model="gpt-4o-mini",
250
- messages=prompt
251
- )
252
- return response.choices[0].message.content
253
- openai_response = get_openai_response(compiled_prompt)
254
- print("openai_response:", openai_response)
255
-
256
- # implement compiled_prompt with litellm
257
- import litellm
258
- def get_litellm_response(prompt):
259
- response = litellm.completion(
260
- model="gpt-4o-mini",
261
- messages=prompt
262
- )
263
- return response.choices[0].message.content
264
- litellm_response = get_litellm_response(compiled_prompt)
265
- print("litellm_response:", litellm_response)
266
-
267
- ```
268
- For more detailed information on Prompt Management, please refer to the [Prompt Management documentation](docs/prompt_management.md).
269
-
270
-
271
- ### Synthetic Data Generation
272
-
273
- ```py
274
- from ragaai_catalyst import SyntheticDataGeneration
275
-
276
- # Initialize Synthetic Data Generation
277
- sdg = SyntheticDataGeneration()
278
-
279
- # Process your file
280
- text = sdg.process_document(input_data="file_path")
281
-
282
- # Generate results
283
- result = sdg.generate_qna(text, question_type ='simple',model_config={"provider":"openai","model":"gpt-4o-mini"},n=20)
284
-
285
- # Get supported Q&A types
286
- sdg.get_supported_qna()
287
-
288
- # Get supported providers
289
- sdg.get_supported_providers()
290
- ```
291
-
292
-
293
-
294
-
295
-
@@ -1,28 +0,0 @@
1
- ragaai_catalyst/__init__.py,sha256=Gwhhw9Q-ze2BTwvo2FsXCS6ad9Dy4RktMRL3R_SbCR0,495
2
- ragaai_catalyst/_version.py,sha256=JKt9KaVNOMVeGs8ojO6LvIZr7ZkMzNN-gCcvryy4x8E,460
3
- ragaai_catalyst/dataset.py,sha256=bDNZkcji22sg-zJqMHEwueTO8A2f_GJu70WcEHESwQk,10729
4
- ragaai_catalyst/evaluation.py,sha256=ZS5G5RjmATjljQhAKYCrDXW2mUNXscpRRoL8cseDjAA,20283
5
- ragaai_catalyst/experiment.py,sha256=8KvqgJg5JVnt9ghhGDJvdb4mN7ETBX_E5gNxBT0Nsn8,19010
6
- ragaai_catalyst/guardrails_manager.py,sha256=4G8RkZH4QXXZXPGFDlJ7_93dSBCtVwZOrLvg2jawtHc,10533
7
- ragaai_catalyst/internal_api_completion.py,sha256=51YwXcas5NviC1wjr8EX5Y6BOyTbJ4FlKHM8gE46Wtk,2916
8
- ragaai_catalyst/prompt_manager.py,sha256=ZMIHrmsnPMq20YfeNxWXLtrxnJyMcxpeJ8Uya7S5dUA,16411
9
- ragaai_catalyst/proxy_call.py,sha256=CHxldeceZUaLU-to_hs_Kf1z_b2vHMssLS_cOBedu78,5499
10
- ragaai_catalyst/ragaai_catalyst.py,sha256=5Q1VCE7P33DtjaOtVGRUgBL8dpDL9kjisWGIkOyX4nE,17426
11
- ragaai_catalyst/synthetic_data_generation.py,sha256=49DtTzYVGaGvye-g6cgpYNf7YMf2wZFLQ7ACxtqu9_E,18945
12
- ragaai_catalyst/utils.py,sha256=TlhEFwLyRU690HvANbyoRycR3nQ67lxVUQoUOfTPYQ0,3772
13
- ragaai_catalyst/tracers/__init__.py,sha256=NppmJhD3sQ5R1q6teaZLS7rULj08Gb6JT8XiPRIe_B0,49
14
- ragaai_catalyst/tracers/llamaindex_callback.py,sha256=vPE7MieKjfwLrLUnnPs20Df0xNYqoCCj-Mt2NbiuiKU,14023
15
- ragaai_catalyst/tracers/tracer.py,sha256=Y7eGoUDU1tAF3adccfn1ukE38zMs38azUKfO7hB4Zto,11300
16
- ragaai_catalyst/tracers/exporters/__init__.py,sha256=kVA8zp05h3phu4e-iHSlnznp_PzMRczB7LphSsZgUjg,138
17
- ragaai_catalyst/tracers/exporters/file_span_exporter.py,sha256=RgGteu-NVGprXKkynvyIO5yOjpbtA41R3W_NzCjnkwE,6445
18
- ragaai_catalyst/tracers/exporters/raga_exporter.py,sha256=rQ5Wj71f2Ke3qLlV8KiWCskbGBR-ia_hlzDx86rPrEo,18188
19
- ragaai_catalyst/tracers/instrumentators/__init__.py,sha256=FgnMQupoRTzmVsG9YKsLQera2Pfs-AluZv8CxwavoyQ,253
20
- ragaai_catalyst/tracers/instrumentators/langchain.py,sha256=yMN0qVF0pUVk6R5M1vJoUXezDo1ejs4klCFRlE8x4vE,574
21
- ragaai_catalyst/tracers/instrumentators/llamaindex.py,sha256=SMrRlR4xM7k9HK43hakE8rkrWHxMlmtmWD-AX6TeByc,416
22
- ragaai_catalyst/tracers/instrumentators/openai.py,sha256=14R4KW9wQCR1xysLfsP_nxS7cqXrTPoD8En4MBAaZUU,379
23
- ragaai_catalyst/tracers/utils/__init__.py,sha256=KeMaZtYaTojilpLv65qH08QmpYclfpacDA0U3wg6Ybw,64
24
- ragaai_catalyst/tracers/utils/utils.py,sha256=ViygfJ7vZ7U0CTSA1lbxVloHp4NSlmfDzBRNCJuMhis,2374
25
- ragaai_catalyst-2.1b0.dist-info/METADATA,sha256=XrgVIgtVfnDmsupun20g_93nNyyc3jHNPzKgU7DBPjY,8523
26
- ragaai_catalyst-2.1b0.dist-info/WHEEL,sha256=a7TGlA-5DaHMRrarXjVbQagU3Man_dCnGIWMJr5kRWo,91
27
- ragaai_catalyst-2.1b0.dist-info/top_level.txt,sha256=HpgsdRgEJMk8nqrU6qdCYk3di7MJkDL0B19lkc7dLfM,16
28
- ragaai_catalyst-2.1b0.dist-info/RECORD,,