ragaai-catalyst 2.0.6b2__tar.gz → 2.0.7__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.
Files changed (46) hide show
  1. {ragaai_catalyst-2.0.6b2/ragaai_catalyst.egg-info → ragaai_catalyst-2.0.7}/PKG-INFO +1 -1
  2. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/pyproject.toml +1 -1
  3. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/internal_api_completion.py +1 -1
  4. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/prompt_manager.py +6 -1
  5. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/synthetic_data_generation.py +1 -0
  6. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7/ragaai_catalyst.egg-info}/PKG-INFO +1 -1
  7. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst.egg-info/SOURCES.txt +6 -1
  8. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/requirements.txt +1 -1
  9. ragaai_catalyst-2.0.7/test/test_catalyst/test_configuration.py +199 -0
  10. ragaai_catalyst-2.0.7/test/test_catalyst/test_dataset.py +170 -0
  11. ragaai_catalyst-2.0.7/test/test_catalyst/test_evaluation.py +503 -0
  12. ragaai_catalyst-2.0.7/test/test_catalyst/test_prompt_manager.py +88 -0
  13. ragaai_catalyst-2.0.7/test/test_catalyst/test_synthetic_data_generation.py +151 -0
  14. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/.gitignore +0 -0
  15. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/README.md +0 -0
  16. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/__init__.py +0 -0
  17. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/docs/dataset_management.md +0 -0
  18. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/docs/prompt_management.md +0 -0
  19. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/examples/prompt_management_litellm.ipynb +0 -0
  20. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/examples/prompt_management_openai.ipynb +0 -0
  21. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/__init__.py +0 -0
  22. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/_version.py +0 -0
  23. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/dataset.py +0 -0
  24. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/evaluation.py +0 -0
  25. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/experiment.py +0 -0
  26. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/guard_executor.py +0 -0
  27. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/guardrails_manager.py +0 -0
  28. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/proxy_call.py +0 -0
  29. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/ragaai_catalyst.py +0 -0
  30. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/tracers/__init__.py +0 -0
  31. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/tracers/exporters/__init__.py +0 -0
  32. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/tracers/exporters/file_span_exporter.py +0 -0
  33. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/tracers/exporters/raga_exporter.py +0 -0
  34. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/tracers/instrumentators/__init__.py +0 -0
  35. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/tracers/instrumentators/langchain.py +0 -0
  36. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/tracers/instrumentators/llamaindex.py +0 -0
  37. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/tracers/instrumentators/openai.py +0 -0
  38. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/tracers/llamaindex_callback.py +0 -0
  39. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/tracers/tracer.py +0 -0
  40. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/tracers/utils/__init__.py +0 -0
  41. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/tracers/utils/utils.py +0 -0
  42. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst/utils.py +0 -0
  43. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst.egg-info/dependency_links.txt +0 -0
  44. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst.egg-info/requires.txt +0 -0
  45. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/ragaai_catalyst.egg-info/top_level.txt +0 -0
  46. {ragaai_catalyst-2.0.6b2 → ragaai_catalyst-2.0.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ragaai_catalyst
3
- Version: 2.0.6b2
3
+ Version: 2.0.7
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
@@ -8,7 +8,7 @@ description = "RAGA AI CATALYST"
8
8
  readme = "README.md"
9
9
  requires-python = ">=3.9"
10
10
  # license = {file = "LICENSE"}
11
- version = "2.0.6.beta.2"
11
+ version = "2.0.7"
12
12
  authors = [
13
13
  {name = "Kiran Scaria", email = "kiran.scaria@raga.ai"},
14
14
  {name = "Kedar Gaikwad", email = "kedar.gaikwad@raga.ai"},
@@ -36,7 +36,7 @@ def api_completion(messages, model_config, kwargs):
36
36
  raise ValueError(response["error"]["message"])
37
37
  else:
38
38
  result= response["choices"][0]["message"]["content"]
39
- response1 = result.replace('\n', '')
39
+ response1 = result.replace('\n', '').replace('```json','').replace('```', '').strip()
40
40
  try:
41
41
  json_data = json.loads(response1)
42
42
  df = pd.DataFrame(json_data)
@@ -432,7 +432,12 @@ class PromptObject:
432
432
  Returns:
433
433
  dict: A dictionary of parameters found in the prompt text.
434
434
  """
435
- parameters = {param["name"]: self._convert_value(param["value"], param["type"]) for param in self.parameters}
435
+ parameters = {}
436
+ for param in self.parameters:
437
+ if "value" in param:
438
+ parameters[param["name"]] = self._convert_value(param["value"], param["type"])
439
+ else:
440
+ parameters[param["name"]] = ""
436
441
  parameters["model"] = self.model
437
442
  return parameters
438
443
 
@@ -289,6 +289,7 @@ class SyntheticDataGeneration:
289
289
 
290
290
  # Extract the content from the response
291
291
  content = response.choices[0].message.content
292
+ content = content.replace('\n', '').replace('```json','').replace('```', '').strip()
292
293
 
293
294
  # Clean the response if needed (remove any prefix before the JSON list)
294
295
  list_start_index = content.find('[')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ragaai_catalyst
3
- Version: 2.0.6b2
3
+ Version: 2.0.7
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
@@ -36,4 +36,9 @@ ragaai_catalyst/tracers/instrumentators/langchain.py
36
36
  ragaai_catalyst/tracers/instrumentators/llamaindex.py
37
37
  ragaai_catalyst/tracers/instrumentators/openai.py
38
38
  ragaai_catalyst/tracers/utils/__init__.py
39
- ragaai_catalyst/tracers/utils/utils.py
39
+ ragaai_catalyst/tracers/utils/utils.py
40
+ test/test_catalyst/test_configuration.py
41
+ test/test_catalyst/test_dataset.py
42
+ test/test_catalyst/test_evaluation.py
43
+ test/test_catalyst/test_prompt_manager.py
44
+ test/test_catalyst/test_synthetic_data_generation.py
@@ -1,5 +1,5 @@
1
1
  toml==0.10.2
2
- aiohttp==3.9.5
2
+ aiohttp==3.10.2
3
3
  opentelemetry-api==1.25.0
4
4
  opentelemetry-sdk==1.25.0
5
5
  opentelemetry-instrumentation==0.46b0
@@ -0,0 +1,199 @@
1
+ import pytest
2
+ import os
3
+ import requests
4
+ from unittest.mock import patch, MagicMock
5
+ import dotenv
6
+ dotenv.load_dotenv()
7
+ import os
8
+
9
+ from ragaai_catalyst import RagaAICatalyst
10
+
11
+
12
+ # Mock environment variables for testing
13
+ @pytest.fixture
14
+ def mock_env_vars():
15
+ original_environ = os.environ.copy()
16
+ RAGAAI_CATALYST_ACCESS_KEY = os.getenv("RAGAAI_CATALYST_ACCESS_KEY")
17
+ RAGAAI_CATALYST_SECRET_KEY = os.getenv("RAGAAI_CATALYST_SECRET_KEY")
18
+ RAGAAI_CATALYST_BASE_URL = os.getenv("RAGAAI_CATALYST_BASE_URL")
19
+
20
+ yield
21
+
22
+ os.environ.clear()
23
+ os.environ.update(original_environ)
24
+
25
+ @pytest.fixture
26
+ def raga_catalyst(mock_env_vars):
27
+ with patch('ragaai_catalyst.RagaAICatalyst.get_token', return_value='test_token'):
28
+ catalyst = RagaAICatalyst(
29
+ os.getenv("RAGAAI_CATALYST_ACCESS_KEY"),
30
+ os.getenv("RAGAAI_CATALYST_SECRET_KEY")
31
+ )
32
+ return catalyst
33
+
34
+
35
+
36
+ def test_project_use_cases():
37
+ catalyst = RagaAICatalyst(
38
+ access_key=os.getenv("RAGAAI_CATALYST_ACCESS_KEY"),
39
+ secret_key=os.getenv("RAGAAI_CATALYST_SECRET_KEY"),
40
+ base_url=os.getenv("RAGAAI_CATALYST_BASE_URL")
41
+ )
42
+ use_case = catalyst.project_use_cases()
43
+ assert use_case ==['Chatbot', 'Text2SQL', 'Q/A', 'Code Generation', 'Others']
44
+
45
+
46
+ def test_list_project():
47
+ catalyst = RagaAICatalyst(
48
+ access_key=os.getenv("RAGAAI_CATALYST_ACCESS_KEY"),
49
+ secret_key=os.getenv("RAGAAI_CATALYST_SECRET_KEY"),
50
+ base_url=os.getenv("RAGAAI_CATALYST_BASE_URL")
51
+ )
52
+ use_case = catalyst.list_projects()
53
+ assert use_case is not None # Check if the result is not None
54
+
55
+
56
+ def test_existing_projectname():
57
+ with pytest.raises(ValueError, match="already exists. Please choose a different name."):
58
+ catalyst = RagaAICatalyst(
59
+ access_key=os.getenv("RAGAAI_CATALYST_ACCESS_KEY"),
60
+ secret_key=os.getenv("RAGAAI_CATALYST_SECRET_KEY"),
61
+ base_url=os.getenv("RAGAAI_CATALYST_BASE_URL")
62
+ )
63
+ project = catalyst.create_project(
64
+ project_name="prompt_metric_dataset3",
65
+ usecase="Chatbot"
66
+ )
67
+
68
+ def test_initialization_missing_credentials():
69
+ """Test initialization with missing credentials"""
70
+ with pytest.raises(ValueError, match="RAGAAI_CATALYST_ACCESS_KEY and RAGAAI_CATALYST_SECRET_KEY environment variables must be set"):
71
+ RagaAICatalyst('', '')
72
+
73
+ @patch('requests.post')
74
+ def test_get_token_success(mock_post, mock_env_vars):
75
+ """Test token retrieval success"""
76
+ mock_response = MagicMock()
77
+ mock_response.status_code = 200
78
+ mock_response.json.return_value = {
79
+ 'success': True,
80
+ 'data': {'token': 'test_token'}
81
+ }
82
+ mock_post.return_value = mock_response
83
+
84
+ token = RagaAICatalyst.get_token()
85
+ assert token == 'test_token'
86
+ assert os.getenv('RAGAAI_CATALYST_TOKEN') == 'test_token'
87
+
88
+ @patch('requests.post')
89
+ def test_get_token_failure(mock_post, mock_env_vars):
90
+ """Test token retrieval failure"""
91
+ mock_response = MagicMock()
92
+ mock_response.status_code = 400
93
+ mock_response.json.return_value = {
94
+ 'message': 'Please enter valid credentials'
95
+ }
96
+ mock_post.return_value = mock_response
97
+
98
+ with pytest.raises(Exception, match="Authentication failed"):
99
+ RagaAICatalyst.get_token()
100
+
101
+ @patch('requests.get')
102
+ def test_project_use_cases_success(mock_get, raga_catalyst):
103
+ """Test retrieving project use cases"""
104
+ mock_response = MagicMock()
105
+ mock_response.status_code = 200
106
+ mock_response.json.return_value = {
107
+ 'data': {'usecase': ['Q/A', 'Chatbot', 'Summarization']}
108
+ }
109
+ mock_get.return_value = mock_response
110
+
111
+ use_cases = raga_catalyst.project_use_cases()
112
+ assert use_cases == ['Q/A', 'Chatbot', 'Summarization']
113
+
114
+ @patch('requests.get')
115
+ def test_project_use_cases_failure(mock_get, raga_catalyst):
116
+ """Test project use cases retrieval failure"""
117
+ mock_get.side_effect = requests.exceptions.RequestException("Network Error")
118
+
119
+ use_cases = raga_catalyst.project_use_cases()
120
+ assert use_cases == []
121
+
122
+ @patch('requests.post')
123
+ @patch('ragaai_catalyst.RagaAICatalyst.list_projects')
124
+ def test_create_project_success(mock_list_projects, mock_post, raga_catalyst):
125
+ """Test successful project creation"""
126
+ mock_list_projects.return_value = [] # No existing projects
127
+ mock_post_response = MagicMock()
128
+ mock_post_response.status_code = 200
129
+ mock_post_response.json.return_value = {
130
+ 'data': {'name': 'TestProject'}
131
+ }
132
+ mock_post.return_value = mock_post_response
133
+
134
+ with patch('ragaai_catalyst.RagaAICatalyst.project_use_cases', return_value=['Q/A']):
135
+ result = raga_catalyst.create_project('TestProject')
136
+ assert 'Project Created Successfully' in result
137
+
138
+ @patch('requests.post')
139
+ @patch('ragaai_catalyst.RagaAICatalyst.list_projects')
140
+ def test_create_project_duplicate(mock_list_projects, mock_post, raga_catalyst):
141
+ """Test project creation with duplicate name"""
142
+ mock_list_projects.return_value = ['TestProject']
143
+
144
+ with pytest.raises(ValueError, match="Project name 'TestProject' already exists"):
145
+ raga_catalyst.create_project('TestProject')
146
+
147
+ @patch('requests.get')
148
+ def test_list_projects_success(mock_get, raga_catalyst):
149
+ """Test successful project listing"""
150
+ mock_response = MagicMock()
151
+ mock_response.status_code = 200
152
+ mock_response.json.return_value = {
153
+ 'data': {
154
+ 'content': [
155
+ {'name': 'Project1'},
156
+ {'name': 'Project2'}
157
+ ]
158
+ }
159
+ }
160
+ mock_get.return_value = mock_response
161
+
162
+ projects = raga_catalyst.list_projects()
163
+ assert projects == ['Project1', 'Project2']
164
+
165
+ @patch('requests.get')
166
+ def test_list_metrics_success(mock_get):
167
+ """Test successful metrics listing"""
168
+ with patch.dict(os.environ, {'RAGAAI_CATALYST_TOKEN': 'test_token'}):
169
+ mock_response = MagicMock()
170
+ mock_response.status_code = 200
171
+ mock_response.json.return_value = {
172
+ 'data': {
173
+ 'metrics': [
174
+ {'name': 'hallucination', 'category': 'quality'},
175
+ {'name': 'toxicity', 'category': 'safety'}
176
+ ]
177
+ }
178
+ }
179
+ mock_get.return_value = mock_response
180
+
181
+ metrics = RagaAICatalyst.list_metrics()
182
+ assert metrics == ['hallucination', 'toxicity']
183
+
184
+ def test_initialization_invalid_credentials():
185
+ """Test initialization with invalid credentials"""
186
+ with pytest.raises(Exception, match="Authentication failed. Invalid credentials provided."):
187
+ RagaAICatalyst(
188
+ access_key=os.getenv("RAGAAI_CATALYST_ACCESS_KEY")+"a",
189
+ secret_key=os.getenv("RAGAAI_CATALYST_SECRET_KEY"),
190
+ base_url=os.getenv("RAGAAI_CATALYST_BASE_URL")
191
+ )
192
+
193
+ def test_initialization_invalid_base_url():
194
+ with pytest.raises(ConnectionError, match="The provided base_url is not accessible. Please re-check the base_url."):
195
+ RagaAICatalyst(
196
+ access_key=os.getenv("RAGAAI_CATALYST_ACCESS_KEY"),
197
+ secret_key=os.getenv("RAGAAI_CATALYST_SECRET_KEY"),
198
+ base_url=os.getenv("RAGAAI_CATALYST_BASE_URL") +"a",
199
+ )
@@ -0,0 +1,170 @@
1
+ import pytest
2
+ import os
3
+ import dotenv
4
+ dotenv.load_dotenv()
5
+ import pandas as pd
6
+ from datetime import datetime
7
+ from typing import Dict, List
8
+ from unittest.mock import patch, Mock
9
+ import requests
10
+ from ragaai_catalyst import Dataset,RagaAICatalyst
11
+
12
+
13
+ @pytest.fixture
14
+ def base_url():
15
+ return "https://catalyst.raga.ai/api"
16
+
17
+ @pytest.fixture
18
+ def access_keys():
19
+ return {
20
+ "access_key": os.getenv("RAGAAI_CATALYST_ACCESS_KEY"),
21
+ "secret_key": os.getenv("RAGAAI_CATALYST_SECRET_KEY")}
22
+
23
+ @pytest.fixture
24
+ def dataset(base_url, access_keys):
25
+ """Create evaluation instance with specific project and dataset"""
26
+ os.environ["RAGAAI_CATALYST_BASE_URL"] = base_url
27
+ catalyst = RagaAICatalyst(
28
+ access_key=access_keys["access_key"],
29
+ secret_key=access_keys["secret_key"]
30
+ )
31
+ return Dataset(project_name="prompt_metric_dataset")
32
+
33
+ def test_list_dataset(dataset) -> List[str]:
34
+ datasets = dataset.list_datasets()
35
+ return datasets
36
+
37
+
38
+ def test_get_dataset_columns(dataset) -> List[str]:
39
+ dataset_column = dataset.get_dataset_columns(dataset_name="ritika_dataset")
40
+ return dataset_column
41
+
42
+ def test_incorrect_dataset(dataset):
43
+ with pytest.raises(ValueError, match="Please enter a valid dataset name"):
44
+ dataset.get_dataset_columns(dataset_name="ritika_datset")
45
+
46
+ def test_get_schema_mapping(dataset):
47
+ schema_mapping_columns= dataset.get_schema_mapping()
48
+ return schema_mapping_columns
49
+
50
+
51
+ def test_upload_csv(dataset):
52
+ project_name = 'prompt_metric_dataset'
53
+
54
+ schema_mapping = {
55
+ 'Query': 'prompt',
56
+ 'Response': 'response',
57
+ 'Context': 'context',
58
+ 'ExpectedResponse': 'expected_response',
59
+ }
60
+
61
+ csv_path= "/Users/siddharthakosti/Downloads/catalyst_error_handling/catalyst_v2/catalyst_v2_new_1/data/prompt_metric_dataset_v1.csv"
62
+
63
+ timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
64
+ dataset_name = f"schema_metric_dataset_ritika_{timestamp}"
65
+
66
+
67
+
68
+ dataset.create_from_csv(
69
+ csv_path=csv_path,
70
+ dataset_name=dataset_name,
71
+ schema_mapping=schema_mapping
72
+ )
73
+
74
+ def test_upload_csv_repeat_dataset(dataset):
75
+ with pytest.raises(ValueError, match="already exists"):
76
+ project_name = 'prompt_metric_dataset'
77
+
78
+ schema_mapping = {
79
+ 'Query': 'prompt',
80
+ 'Response': 'response',
81
+ 'Context': 'context',
82
+ 'ExpectedResponse': 'expected_response',
83
+ }
84
+
85
+ csv_path= "/Users/siddharthakosti/Downloads/catalyst_error_handling/catalyst_v2/catalyst_v2_new_1/data/prompt_metric_dataset_v1.csv"
86
+
87
+ dataset.create_from_csv(
88
+ csv_path=csv_path,
89
+ dataset_name="schema_metric_dataset_ritika_3",
90
+ schema_mapping=schema_mapping
91
+ )
92
+
93
+
94
+ def test_upload_csv_no_schema_mapping(dataset):
95
+ with pytest.raises(TypeError, match="missing 1 required positional argument"):
96
+ project_name = 'prompt_metric_dataset'
97
+
98
+ schema_mapping = {
99
+ 'Query': 'prompt',
100
+ 'Response': 'response',
101
+ 'Context': 'context',
102
+ 'ExpectedResponse': 'expected_response',
103
+ }
104
+
105
+ csv_path= "/Users/siddharthakosti/Downloads/catalyst_error_handling/catalyst_v2/catalyst_v2_new_1/data/prompt_metric_dataset_v1.csv"
106
+
107
+ dataset.create_from_csv(
108
+ csv_path=csv_path,
109
+ dataset_name="schema_metric_dataset_ritika_3",
110
+ )
111
+
112
+ def test_upload_csv_empty_csv_path(dataset):
113
+ with pytest.raises(FileNotFoundError, match="No such file or directory"):
114
+ project_name = 'prompt_metric_dataset'
115
+
116
+ schema_mapping = {
117
+ 'Query': 'prompt',
118
+ 'Response': 'response',
119
+ 'Context': 'context',
120
+ 'ExpectedResponse': 'expected_response',
121
+ }
122
+
123
+ csv_path= "/Users/siddharthakosti/Downloads/catalyst_error_handling/catalyst_v2/catalyst_v2_new_1/data/prompt_metric_dataset_v1.csv"
124
+
125
+ dataset.create_from_csv(
126
+ csv_path="",
127
+ dataset_name="schema_metric_dataset_ritika_12",
128
+ schema_mapping=schema_mapping
129
+
130
+ )
131
+
132
+ def test_upload_csv_empty_schema_mapping(dataset):
133
+ with pytest.raises(AttributeError):
134
+ project_name = 'prompt_metric_dataset'
135
+
136
+ schema_mapping = {
137
+ 'Query': 'prompt',
138
+ 'Response': 'response',
139
+ 'Context': 'context',
140
+ 'ExpectedResponse': 'expected_response',
141
+ }
142
+
143
+ csv_path= "/Users/siddharthakosti/Downloads/catalyst_error_handling/catalyst_v2/catalyst_v2_new_1/data/prompt_metric_dataset_v1.csv"
144
+
145
+ dataset.create_from_csv(
146
+ csv_path=csv_path,
147
+ dataset_name="schema_metric_dataset_ritika_12",
148
+ schema_mapping=""
149
+
150
+ )
151
+
152
+
153
+ def test_upload_csv_invalid_schema(dataset):
154
+ with pytest.raises(ValueError, match="Invalid schema mapping provided"):
155
+
156
+ project_name = 'prompt_metric_dataset'
157
+
158
+ schema_mapping={
159
+ 'prompt': 'prompt',
160
+ 'response': 'response',
161
+ 'chatId': 'chatId',
162
+ 'chatSequence': 'chatSequence'
163
+ }
164
+
165
+ csv_path= "/Users/siddharthakosti/Downloads/catalyst_error_handling/catalyst_v2/catalyst_v2_new_1/data/prompt_metric_dataset_v1.csv"
166
+
167
+ dataset.create_from_csv(
168
+ csv_path=csv_path,
169
+ dataset_name="schema_metric_dataset_ritika_12",
170
+ schema_mapping=schema_mapping)