ragaai-catalyst 2.1.5.1b1__py3-none-any.whl → 2.1.5.1b3__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.
@@ -23,14 +23,15 @@ class GuardExecutor:
23
23
  self.output_deployment_details = self.guard_manager.get_deployment(output_deployment_id)
24
24
  if input_deployment_id and output_deployment_id:
25
25
  # check if 2 deployments are mapped to same dataset
26
- pass
26
+ if self.input_deployment_details['data']['datasetId'] != self.output_deployment_details['data']['datasetId']:
27
+ raise ValueError('Input deployment and output deployment should be mapped to same dataset')
27
28
  for guardrail in self.input_deployment_details['data']['guardrailsResponse']:
28
29
  maps = guardrail['metricSpec']['config']['mappings']
29
30
  for _map in maps:
30
31
  if _map['schemaName']=='Response':
31
- raise ValueError('Response field mapping found in input guardrails')
32
+ raise ValueError('Response field should be mapped only in output guardrails')
32
33
  except Exception as e:
33
- raise ValueError('Error in fetching deployment details')
34
+ raise ValueError(str(e))
34
35
  self.base_url = guard_manager.base_url
35
36
  for key in field_map.keys():
36
37
  if key not in ['prompt','context','response','instruction']:
@@ -40,7 +41,8 @@ class GuardExecutor:
40
41
 
41
42
  def execute_deployment(self, deployment_id, payload):
42
43
  api = self.base_url + f'/guardrail/deployment/{deployment_id}/ingest'
43
-
44
+ if self.current_trace_id:
45
+ payload['traceId'] = self.current_trace_id
44
46
  payload = json.dumps(payload)
45
47
  headers = {
46
48
  'x-project-id': str(self.guard_manager.project_id),
@@ -182,6 +184,7 @@ class GuardExecutor:
182
184
  doc = self.set_variables(prompt,prompt_params)
183
185
  deployment_response = self.execute_deployment(self.output_deployment_id,doc)
184
186
  del self.id_2_doc[self.current_trace_id]
187
+ self.current_trace_id = None
185
188
  if deployment_response and deployment_response['data']['status'].lower() == 'fail':
186
189
  return deployment_response['data']['alternateResponse'], deployment_response
187
190
  elif deployment_response:
@@ -3,7 +3,7 @@ import ast
3
3
  import csv
4
4
  import json
5
5
  import random
6
- import PyPDF2
6
+ import pypdf
7
7
  import markdown
8
8
  import pandas as pd
9
9
  from tqdm import tqdm
@@ -105,6 +105,9 @@ class SyntheticDataGeneration:
105
105
  raise Exception(f"{e}")
106
106
 
107
107
  else:
108
+ if "'utf-8' codec can't encode characters" in str(e):
109
+ print('Encountered non utf charactes, retrying with processed text')
110
+ text = str(text.encode('utf-8',errors='ignore'))
108
111
  print(f"Retrying...")
109
112
  continue
110
113
 
@@ -469,7 +472,7 @@ class SyntheticDataGeneration:
469
472
  """
470
473
  text = ""
471
474
  with open(file_path, 'rb') as file:
472
- pdf_reader = PyPDF2.PdfReader(file)
475
+ pdf_reader = pypdf.PdfReader(file)
473
476
  for page in pdf_reader.pages:
474
477
  text += page.extract_text()
475
478
  return text
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ragaai_catalyst
3
- Version: 2.1.5.1b1
3
+ Version: 2.1.5.1b3
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>
6
6
  Requires-Python: <3.13,>=3.9
@@ -22,7 +22,7 @@ Requires-Dist: langchain>=0.2.11
22
22
  Requires-Dist: openai>=1.57.0
23
23
  Requires-Dist: pandas
24
24
  Requires-Dist: groq>=0.11.0
25
- Requires-Dist: PyPDF2>=3.0.1
25
+ Requires-Dist: pypdf>=5.3.1
26
26
  Requires-Dist: google-generativeai>=0.8.2
27
27
  Requires-Dist: google-genai>=1.3.0
28
28
  Requires-Dist: Markdown>=3.7
@@ -3,14 +3,14 @@ ragaai_catalyst/_version.py,sha256=JKt9KaVNOMVeGs8ojO6LvIZr7ZkMzNN-gCcvryy4x8E,4
3
3
  ragaai_catalyst/dataset.py,sha256=YCj8Ovu6y38KEw-1HCe4xQWkmYPgfNTtMa8Q0g6B62o,29401
4
4
  ragaai_catalyst/evaluation.py,sha256=O96CydYVPh3duUmXjY6REIXMOR-tOPixSG-Qhrf636A,22955
5
5
  ragaai_catalyst/experiment.py,sha256=8yQo1phCHlpnJ-4CqCaIbLXg_1ZlAuLGI9kqGBl-OTE,18859
6
- ragaai_catalyst/guard_executor.py,sha256=WyosKLgEsAERJTtzs6wA4F1uDl8wKoiNZtTdyTPvOAw,13651
6
+ ragaai_catalyst/guard_executor.py,sha256=rSdgf_3PB1Eaeoxz0cz6jbAoGvHXAeEfmM1jFUwL8cI,13970
7
7
  ragaai_catalyst/guardrails_manager.py,sha256=_VrARJ1udmCF8TklNKy7XTQUaM8ATDhTOAGDonBkFro,14245
8
8
  ragaai_catalyst/internal_api_completion.py,sha256=DdICI5yfEudiOAIC8L4oxH0Qz7kX-BZCdo9IWsi2gNo,2965
9
9
  ragaai_catalyst/prompt_manager.py,sha256=W8ypramzOprrJ7-22d5vkBXIuIQ8v9XAzKDGxKsTK28,16550
10
10
  ragaai_catalyst/proxy_call.py,sha256=CHxldeceZUaLU-to_hs_Kf1z_b2vHMssLS_cOBedu78,5499
11
11
  ragaai_catalyst/ragaai_catalyst.py,sha256=1FaeK_VZpJLQ1ZqEWpMyI8J8M2MI0abLLLDFWY9W-4A,19580
12
12
  ragaai_catalyst/redteaming_old.py,sha256=W2d89Ok8W-C8g7TBM3fDIFLof3q9FuYSr0jcryH2XQo,7097
13
- ragaai_catalyst/synthetic_data_generation.py,sha256=oWxV36wewwrggxXgvOZtzf-M5IOYalP1h5XjF6IOyY8,37597
13
+ ragaai_catalyst/synthetic_data_generation.py,sha256=r7YKhVApkvc36uqeztggGH4DkPk9YblpAOpJO8LlW8k,37835
14
14
  ragaai_catalyst/utils.py,sha256=TlhEFwLyRU690HvANbyoRycR3nQ67lxVUQoUOfTPYQ0,3772
15
15
  ragaai_catalyst/redteaming/__init__.py,sha256=TJdvZpaZGFsg9qKONdjTosSVLZGadYFpHG6KE0xapKU,155
16
16
  ragaai_catalyst/redteaming/evaluator.py,sha256=C50SAc3RsR7PZnz-VQ7wQfDpiVEb7T3W3KV4Lj0tWYE,4599
@@ -90,8 +90,8 @@ ragaai_catalyst/tracers/utils/langchain_tracer_extraction_logic.py,sha256=XS2_x2
90
90
  ragaai_catalyst/tracers/utils/model_prices_and_context_window_backup.json,sha256=C3uwkibJ08C9sOX-54kulZYmJlIpZ-SQpfE6HNGrjbM,343502
91
91
  ragaai_catalyst/tracers/utils/trace_json_converter.py,sha256=qXSYKr4JMUpGQsB3mnr9_2qH6FqzUhCynNqlDp1IWTs,12440
92
92
  ragaai_catalyst/tracers/utils/utils.py,sha256=ViygfJ7vZ7U0CTSA1lbxVloHp4NSlmfDzBRNCJuMhis,2374
93
- ragaai_catalyst-2.1.5.1b1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
94
- ragaai_catalyst-2.1.5.1b1.dist-info/METADATA,sha256=e0NQYAkSe9ivCqBqAFPv0zjz5IuS_PwOTFZUjB7BVKM,22057
95
- ragaai_catalyst-2.1.5.1b1.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
96
- ragaai_catalyst-2.1.5.1b1.dist-info/top_level.txt,sha256=HpgsdRgEJMk8nqrU6qdCYk3di7MJkDL0B19lkc7dLfM,16
97
- ragaai_catalyst-2.1.5.1b1.dist-info/RECORD,,
93
+ ragaai_catalyst-2.1.5.1b3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
94
+ ragaai_catalyst-2.1.5.1b3.dist-info/METADATA,sha256=-LuYUeg0C3QaUS8xS4K68nvwd4o9tXXx_ncJkxKEFC4,22056
95
+ ragaai_catalyst-2.1.5.1b3.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
96
+ ragaai_catalyst-2.1.5.1b3.dist-info/top_level.txt,sha256=HpgsdRgEJMk8nqrU6qdCYk3di7MJkDL0B19lkc7dLfM,16
97
+ ragaai_catalyst-2.1.5.1b3.dist-info/RECORD,,