ragaai-catalyst 2.0.6b1__py3-none-any.whl → 2.0.6b2__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.
@@ -16,7 +16,7 @@ class Dataset:
16
16
 
17
17
  def __init__(self, project_name):
18
18
  self.project_name = project_name
19
- self.num_projects = 100
19
+ self.num_projects = 99999
20
20
  Dataset.BASE_URL = (
21
21
  os.getenv("RAGAAI_CATALYST_BASE_URL")
22
22
  if os.getenv("RAGAAI_CATALYST_BASE_URL")
@@ -16,7 +16,7 @@ class Evaluation:
16
16
  self.base_url = f"{RagaAICatalyst.BASE_URL}"
17
17
  self.timeout = 10
18
18
  self.jobId = None
19
- self.num_projects=100
19
+ self.num_projects=99999
20
20
 
21
21
  try:
22
22
  response = requests.get(
@@ -13,7 +13,7 @@ class GuardrailsManager:
13
13
  """
14
14
  self.project_name = project_name
15
15
  self.timeout = 10
16
- self.num_projects = 100
16
+ self.num_projects = 99999
17
17
  self.deployment_name = "NA"
18
18
  self.deployment_id = "NA"
19
19
  self.base_url = f"{RagaAICatalyst.BASE_URL}"
@@ -31,7 +31,7 @@ class GuardrailsManager:
31
31
  :return: A tuple containing a list of project names and a list of dictionaries with project IDs and names.
32
32
  """
33
33
  headers = {'Authorization': f'Bearer {os.getenv("RAGAAI_CATALYST_TOKEN")}'}
34
- response = requests.request("GET", f"{self.base_url}/v2/llm/projects?size=12&page=0", headers=headers, timeout=self.timeout)
34
+ response = requests.request("GET", f"{self.base_url}/v2/llm/projects?size={self.num_projects}", headers=headers, timeout=self.timeout)
35
35
  project_content = response.json()["data"]["content"]
36
36
  list_project = [_["name"] for _ in project_content]
37
37
  project_name_with_id = [{"id": _["id"], "name": _["name"]} for _ in project_content]
@@ -23,7 +23,7 @@ class PromptManager:
23
23
  self.project_name = project_name
24
24
  self.base_url = f"{RagaAICatalyst.BASE_URL}/playground/prompt"
25
25
  self.timeout = 10
26
- self.size = 100 #Number of projects to fetch
26
+ self.size = 99999 #Number of projects to fetch
27
27
 
28
28
  try:
29
29
  response = requests.get(
@@ -287,7 +287,7 @@ class RagaAICatalyst:
287
287
  def get_project_id(self, project_name):
288
288
  pass
289
289
 
290
- def list_projects(self, num_projects=100):
290
+ def list_projects(self, num_projects=99999):
291
291
  """
292
292
  Retrieves a list of projects with the specified number of projects.
293
293
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ragaai_catalyst
3
- Version: 2.0.6b1
3
+ Version: 2.0.6b2
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
@@ -28,6 +28,7 @@ Requires-Dist: litellm==1.51.1
28
28
  Requires-Dist: tenacity==8.3.0
29
29
  Requires-Dist: tqdm>=4.66.5
30
30
  Requires-Dist: llama-index==0.10.0
31
+ Requires-Dist: pyopenssl==24.2.1
31
32
  Provides-Extra: dev
32
33
  Requires-Dist: pytest; extra == "dev"
33
34
  Requires-Dist: pytest-cov; extra == "dev"
@@ -38,7 +39,7 @@ Requires-Dist: flake8; extra == "dev"
38
39
 
39
40
  # RagaAI Catalyst
40
41
 
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
+ RagaAI Catalyst is a comprehensive platform designed to enhance the management and optimization of LLM projects. It offers a wide range of features, including project management, dataset management, evaluation management, trace management, prompt management, synthetic data generation, and guardrail management. These functionalities enable you to efficiently evaluate, and safeguard your LLM applications.
42
43
 
43
44
  ## Table of Contents
44
45
 
@@ -53,6 +54,7 @@ RagaAI Catalyst is a powerful tool for managing and optimizing LLM projects. It
53
54
  - [Trace Management](#trace-management)
54
55
  - [Prompt Management](#prompt-management)
55
56
  - [Synthetic Data Generation](#synthetic-data-generation)
57
+ - [Guardrail Management](#guardrail-management)
56
58
 
57
59
  ## Installation
58
60
 
@@ -144,6 +146,7 @@ evaluation = Evaluation(
144
146
  evaluation.list_metrics()
145
147
 
146
148
  # Add metrics to the experiment
149
+
147
150
  schema_mapping={
148
151
  'Query': 'prompt',
149
152
  'response': 'response',
@@ -201,8 +204,12 @@ tracer = Tracer(
201
204
 
202
205
  # Your code here
203
206
 
207
+
204
208
  # Stop the trace recording
205
209
  tracer.stop()
210
+
211
+ # Get upload status
212
+ tracer.get_upload_status()
206
213
  ```
207
214
 
208
215
 
@@ -237,7 +244,7 @@ print("variable:",variable)
237
244
  prompt_content = prompt.get_prompt_content()
238
245
  print("prompt_content:", prompt_content)
239
246
 
240
- # Compile a prompt with variables
247
+ # Compile the prompt with variables
241
248
  compiled_prompt = prompt.compile(query="What's the weather?", context="sunny", llm_response="It's sunny today")
242
249
  print("Compiled prompt:", compiled_prompt)
243
250
 
@@ -280,7 +287,9 @@ sdg = SyntheticDataGeneration()
280
287
  text = sdg.process_document(input_data="file_path")
281
288
 
282
289
  # Generate results
283
- result = sdg.generate_qna(text, question_type ='simple',model_config={"provider":"openai","model":"gpt-4o-mini"},n=20)
290
+ result = sdg.generate_qna(text, question_type ='complex',model_config={"provider":"openai","model":"openai/gpt-3.5-turbo"},n=5)
291
+
292
+ print(result.head())
284
293
 
285
294
  # Get supported Q&A types
286
295
  sdg.get_supported_qna()
@@ -291,5 +300,87 @@ sdg.get_supported_providers()
291
300
 
292
301
 
293
302
 
303
+ ### Guardrail Management
304
+
305
+ ```py
306
+ from ragaai_catalyst import GuardrailsManager
307
+
308
+ # Initialize Guardrails Manager
309
+ gdm = GuardrailsManager(project_name=project_name)
310
+
311
+ # Get list of Guardrails available
312
+ guardrails_list = gdm.list_guardrails()
313
+ print('guardrails_list:', guardrails_list)
314
+
315
+ # Get list of fail condition for guardrails
316
+ fail_conditions = gdm.list_fail_condition()
317
+ print('fail_conditions;', fail_conditions)
318
+
319
+ #Get list of deployment ids
320
+ deployment_list = gdm.list_deployment_ids()
321
+ print('deployment_list:', deployment_list)
322
+
323
+ # Get specific deployment id with guardrails information
324
+ deployment_id_detail = gdm.get_deployment(17)
325
+ print('deployment_id_detail:', deployment_id_detail)
326
+
327
+ # Add guardrails to a deployment id
328
+ guardrails_config = {"guardrailFailConditions": ["FAIL"],
329
+ "deploymentFailCondition": "ALL_FAIL",
330
+ "alternateResponse": "Your alternate response"}
331
+
332
+ guardrails = [
333
+ {
334
+ "displayName": "Response_Evaluator",
335
+ "name": "Response Evaluator",
336
+ "config":{
337
+ "mappings": [{
338
+ "schemaName": "Text",
339
+ "variableName": "Response"
340
+ }],
341
+ "params": {
342
+ "isActive": {"value": False},
343
+ "isHighRisk": {"value": True},
344
+ "threshold": {"eq": 0},
345
+ "competitors": {"value": ["Google","Amazon"]}
346
+ }
347
+ }
348
+ },
349
+ {
350
+ "displayName": "Regex_Check",
351
+ "name": "Regex Check",
352
+ "config":{
353
+ "mappings": [{
354
+ "schemaName": "Text",
355
+ "variableName": "Response"
356
+ }],
357
+ "params":{
358
+ "isActive": {"value": False},
359
+ "isHighRisk": {"value": True},
360
+ "threshold": {"lt1": 1}
361
+ }
362
+ }
363
+ }
364
+ ]
365
+
366
+ gdm.add_guardrails(deployment_id, guardrails, guardrails_config)
294
367
 
295
368
 
369
+ # Import GuardExecutor
370
+ from ragaai_catalyst import GuardExecutor
371
+
372
+ # Initialise GuardExecutor with required params and Evaluate
373
+ executor = GuardExecutor(deployment_id,gdm,field_map={'context':'document'})
374
+
375
+
376
+ message={'role':'user',
377
+ 'content':'What is the capital of France'
378
+ }
379
+ prompt_params={'document':' France'}
380
+
381
+ model_params = {'temperature':.7,'model':'gpt-4o-mini'}
382
+ llm_caller = 'litellm'
383
+
384
+ executor([message],prompt_params,model_params,llm_caller)
385
+
386
+ ```
@@ -1,14 +1,14 @@
1
1
  ragaai_catalyst/__init__.py,sha256=BdIJ_UUre0uEnRTsLw_hE0C0muWk6XWNZqdVOel22R4,537
2
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
3
+ ragaai_catalyst/dataset.py,sha256=j_vu3Xkp_8qYW0J9Qnn53Uyh98MsugqYl5zxhOv9EOg,10731
4
+ ragaai_catalyst/evaluation.py,sha256=EZGISQH6vGB7vP5OmUBRXmEqkqZPIYN_eEUUz1jTrJ8,20285
5
5
  ragaai_catalyst/experiment.py,sha256=8KvqgJg5JVnt9ghhGDJvdb4mN7ETBX_E5gNxBT0Nsn8,19010
6
6
  ragaai_catalyst/guard_executor.py,sha256=llPbE3DyVtrybojXknzBZj8-dtUrGBQwi9-ZiPJxGRo,3762
7
- ragaai_catalyst/guardrails_manager.py,sha256=EsuQuZOPraLzZMJD502B1-wb642Sm3vqxWM4Nv9Q8Jc,11892
7
+ ragaai_catalyst/guardrails_manager.py,sha256=DILMOAASK57FH9BLq_8yC1AQzRJ8McMFLwCXgYwNAd4,11904
8
8
  ragaai_catalyst/internal_api_completion.py,sha256=51YwXcas5NviC1wjr8EX5Y6BOyTbJ4FlKHM8gE46Wtk,2916
9
- ragaai_catalyst/prompt_manager.py,sha256=ZMIHrmsnPMq20YfeNxWXLtrxnJyMcxpeJ8Uya7S5dUA,16411
9
+ ragaai_catalyst/prompt_manager.py,sha256=XIqf42x2aE3-7oMlJ7RtvmD8kuZof9Dtv7YNbM1Q5OA,16413
10
10
  ragaai_catalyst/proxy_call.py,sha256=CHxldeceZUaLU-to_hs_Kf1z_b2vHMssLS_cOBedu78,5499
11
- ragaai_catalyst/ragaai_catalyst.py,sha256=5Q1VCE7P33DtjaOtVGRUgBL8dpDL9kjisWGIkOyX4nE,17426
11
+ ragaai_catalyst/ragaai_catalyst.py,sha256=FdqMzwuQLqS2-3JJDsTQ8uh2itllOxfPrRUjb8Kwmn0,17428
12
12
  ragaai_catalyst/synthetic_data_generation.py,sha256=957UYz58uX13i8vn24rzZief5FgtfOEnEH7S8VtXtVw,19157
13
13
  ragaai_catalyst/utils.py,sha256=TlhEFwLyRU690HvANbyoRycR3nQ67lxVUQoUOfTPYQ0,3772
14
14
  ragaai_catalyst/tracers/__init__.py,sha256=NppmJhD3sQ5R1q6teaZLS7rULj08Gb6JT8XiPRIe_B0,49
@@ -23,7 +23,7 @@ ragaai_catalyst/tracers/instrumentators/llamaindex.py,sha256=SMrRlR4xM7k9HK43hak
23
23
  ragaai_catalyst/tracers/instrumentators/openai.py,sha256=14R4KW9wQCR1xysLfsP_nxS7cqXrTPoD8En4MBAaZUU,379
24
24
  ragaai_catalyst/tracers/utils/__init__.py,sha256=KeMaZtYaTojilpLv65qH08QmpYclfpacDA0U3wg6Ybw,64
25
25
  ragaai_catalyst/tracers/utils/utils.py,sha256=ViygfJ7vZ7U0CTSA1lbxVloHp4NSlmfDzBRNCJuMhis,2374
26
- ragaai_catalyst-2.0.6b1.dist-info/METADATA,sha256=jDHkbahJ8JAcsVi0su6KtWbQoPgdZt07jxYxgT4LXDM,8525
27
- ragaai_catalyst-2.0.6b1.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
28
- ragaai_catalyst-2.0.6b1.dist-info/top_level.txt,sha256=HpgsdRgEJMk8nqrU6qdCYk3di7MJkDL0B19lkc7dLfM,16
29
- ragaai_catalyst-2.0.6b1.dist-info/RECORD,,
26
+ ragaai_catalyst-2.0.6b2.dist-info/METADATA,sha256=xtvXyOPSvzXBZvPHpYgH9i9ALaSt778zJcBO-cPGYBY,11241
27
+ ragaai_catalyst-2.0.6b2.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
28
+ ragaai_catalyst-2.0.6b2.dist-info/top_level.txt,sha256=HpgsdRgEJMk8nqrU6qdCYk3di7MJkDL0B19lkc7dLfM,16
29
+ ragaai_catalyst-2.0.6b2.dist-info/RECORD,,