enkryptai-sdk 1.0.11__tar.gz → 1.0.12__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.
- {enkryptai_sdk-1.0.11/src/enkryptai_sdk.egg-info → enkryptai_sdk-1.0.12}/PKG-INFO +1 -1
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/setup.py +1 -1
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/red_team.py +4 -12
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12/src/enkryptai_sdk.egg-info}/PKG-INFO +1 -1
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/tests/test_all_v2.py +50 -8
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/LICENSE +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/README.md +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/setup.cfg +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/__init__.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/ai_proxy.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/base.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/coc.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/config.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/datasets.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/deployments.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/dto/__init__.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/dto/ai_proxy.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/dto/base.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/dto/coc.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/dto/datasets.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/dto/deployments.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/dto/guardrails.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/dto/models.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/dto/red_team.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/evals.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/guardrails.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/guardrails_old.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/models.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk/response.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk.egg-info/SOURCES.txt +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk.egg-info/dependency_links.txt +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk.egg-info/top_level.txt +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/tests/test_ai_proxy.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/tests/test_all.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/tests/test_basic.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/tests/test_coc.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/tests/test_datasets.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/tests/test_deployments.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/tests/test_detect_policy.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/tests/test_guardrails.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/tests/test_injection_attack.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/tests/test_model.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/tests/test_openai.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/tests/test_policy_violation.py +0 -0
- {enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/tests/test_redteam.py +0 -0
|
@@ -9,7 +9,7 @@ with open(os.path.join(here, "README.md"), encoding="utf-8") as fh:
|
|
|
9
9
|
setup(
|
|
10
10
|
name="enkryptai-sdk", # This is the name of your package on PyPI
|
|
11
11
|
# NOTE: Also change this in .github/workflows/test.yaml
|
|
12
|
-
version="1.0.
|
|
12
|
+
version="1.0.12", # Update this for new versions
|
|
13
13
|
description="A Python SDK with guardrails and red teaming functionality for API interactions",
|
|
14
14
|
long_description=long_description,
|
|
15
15
|
long_description_content_type="text/markdown",
|
|
@@ -106,9 +106,7 @@ class RedTeamClient(BaseClient):
|
|
|
106
106
|
# "async": config.async_enabled,
|
|
107
107
|
"dataset_name": config.dataset_name,
|
|
108
108
|
"test_name": config.test_name,
|
|
109
|
-
"redteam_test_configurations":
|
|
110
|
-
k: v.to_dict() for k, v in test_configs.items()
|
|
111
|
-
},
|
|
109
|
+
"redteam_test_configurations": test_configs,
|
|
112
110
|
}
|
|
113
111
|
|
|
114
112
|
if config.target_model_configuration:
|
|
@@ -153,9 +151,7 @@ class RedTeamClient(BaseClient):
|
|
|
153
151
|
# "async": config.async_enabled,
|
|
154
152
|
"dataset_name": config.dataset_name,
|
|
155
153
|
"test_name": config.test_name,
|
|
156
|
-
"redteam_test_configurations":
|
|
157
|
-
k: v.to_dict() for k, v in test_configs.items()
|
|
158
|
-
},
|
|
154
|
+
"redteam_test_configurations": test_configs,
|
|
159
155
|
}
|
|
160
156
|
|
|
161
157
|
headers = {
|
|
@@ -196,9 +192,7 @@ class RedTeamClient(BaseClient):
|
|
|
196
192
|
payload = {
|
|
197
193
|
# "async": config.async_enabled,
|
|
198
194
|
"test_name": config.test_name,
|
|
199
|
-
"redteam_test_configurations":
|
|
200
|
-
k: v.to_dict() for k, v in test_configs.items()
|
|
201
|
-
},
|
|
195
|
+
"redteam_test_configurations": test_configs,
|
|
202
196
|
}
|
|
203
197
|
|
|
204
198
|
if config.dataset_configuration:
|
|
@@ -252,9 +246,7 @@ class RedTeamClient(BaseClient):
|
|
|
252
246
|
payload = {
|
|
253
247
|
# "async": config.async_enabled,
|
|
254
248
|
"test_name": config.test_name,
|
|
255
|
-
"redteam_test_configurations":
|
|
256
|
-
k: v.to_dict() for k, v in test_configs.items()
|
|
257
|
-
},
|
|
249
|
+
"redteam_test_configurations": test_configs,
|
|
258
250
|
}
|
|
259
251
|
|
|
260
252
|
if config.dataset_configuration:
|
|
@@ -19,6 +19,7 @@ test_guardrails_policy_name = "Test Guardrails Policy"
|
|
|
19
19
|
model_saved_name = None
|
|
20
20
|
model_version = None
|
|
21
21
|
test_model_saved_name = "Test Model"
|
|
22
|
+
test_custom_model_saved_name = "Test Custom Model"
|
|
22
23
|
test_model_version = "v1"
|
|
23
24
|
test_deployment_name = "test-deployment"
|
|
24
25
|
|
|
@@ -155,6 +156,7 @@ def sample_detectors():
|
|
|
155
156
|
},
|
|
156
157
|
}
|
|
157
158
|
|
|
159
|
+
|
|
158
160
|
@pytest.fixture
|
|
159
161
|
def sample_model_config():
|
|
160
162
|
return {
|
|
@@ -162,6 +164,23 @@ def sample_model_config():
|
|
|
162
164
|
"model_version": test_model_version,
|
|
163
165
|
"testing_for": "foundationModels",
|
|
164
166
|
"model_name": model_name,
|
|
167
|
+
"model_config": {
|
|
168
|
+
"model_provider": model_provider,
|
|
169
|
+
"endpoint_url": model_endpoint_url,
|
|
170
|
+
"apikey": OPENAI_API_KEY,
|
|
171
|
+
"input_modalities": ["text"],
|
|
172
|
+
"output_modalities": ["text"],
|
|
173
|
+
},
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
@pytest.fixture
|
|
178
|
+
def sample_custom_model_config():
|
|
179
|
+
return {
|
|
180
|
+
"model_saved_name": test_custom_model_saved_name,
|
|
181
|
+
"model_version": test_model_version,
|
|
182
|
+
"testing_for": "foundationModels",
|
|
183
|
+
"model_name": model_name,
|
|
165
184
|
"model_config": {
|
|
166
185
|
# "model_provider": model_provider,
|
|
167
186
|
"model_provider": "custom",
|
|
@@ -193,6 +212,7 @@ def sample_model_config():
|
|
|
193
212
|
},
|
|
194
213
|
}
|
|
195
214
|
|
|
215
|
+
|
|
196
216
|
@pytest.fixture
|
|
197
217
|
def sample_deployment_config():
|
|
198
218
|
return {
|
|
@@ -945,6 +965,20 @@ def test_add_model(model_client, sample_model_config):
|
|
|
945
965
|
assert model_info["model_saved_name"] == test_model_saved_name
|
|
946
966
|
assert model_info["model_version"] == test_model_version
|
|
947
967
|
|
|
968
|
+
def test_add_custom_model(model_client, sample_custom_model_config):
|
|
969
|
+
print("\n\nTesting adding a new custom model")
|
|
970
|
+
response = model_client.add_model(config=sample_custom_model_config)
|
|
971
|
+
print("\nResponse from adding a new custom model: ", response)
|
|
972
|
+
print("\nResponse data type: ", type(response))
|
|
973
|
+
assert response is not None
|
|
974
|
+
# assert hasattr(response, "message")
|
|
975
|
+
assert response.message == "Model details added successfully"
|
|
976
|
+
# assert hasattr(response, "data")
|
|
977
|
+
model_info = response.data
|
|
978
|
+
assert model_info is not None
|
|
979
|
+
assert model_info["model_saved_name"] == test_custom_model_saved_name
|
|
980
|
+
assert model_info["model_version"] == test_model_version
|
|
981
|
+
|
|
948
982
|
def test_list_models(model_client):
|
|
949
983
|
print("\n\nTesting list_models")
|
|
950
984
|
# Test the list_models method
|
|
@@ -962,7 +996,7 @@ def test_list_models(model_client):
|
|
|
962
996
|
# assert model_info["model_version"] == test_model_version
|
|
963
997
|
|
|
964
998
|
def test_get_model(model_client):
|
|
965
|
-
print("\n\nTesting get_model")
|
|
999
|
+
print("\n\nTesting get_model with custom model")
|
|
966
1000
|
# global model_saved_name
|
|
967
1001
|
# if model_saved_name is None:
|
|
968
1002
|
# print("\nModel saved name is None, fetching it from list_models")
|
|
@@ -972,7 +1006,7 @@ def test_get_model(model_client):
|
|
|
972
1006
|
# model_saved_name = model_info.model_saved_name
|
|
973
1007
|
# assert model_saved_name is not None
|
|
974
1008
|
# print("\nPicked model in get_model: ", model_saved_name)
|
|
975
|
-
model_saved_name =
|
|
1009
|
+
model_saved_name = test_custom_model_saved_name
|
|
976
1010
|
model_version = test_model_version
|
|
977
1011
|
|
|
978
1012
|
# Now test the get_model method
|
|
@@ -984,10 +1018,10 @@ def test_get_model(model_client):
|
|
|
984
1018
|
# assert hasattr(model, "status")
|
|
985
1019
|
|
|
986
1020
|
|
|
987
|
-
def test_modify_model(model_client,
|
|
988
|
-
print("\n\nTesting modifying
|
|
1021
|
+
def test_modify_model(model_client, sample_custom_model_config):
|
|
1022
|
+
print("\n\nTesting modifying custom model")
|
|
989
1023
|
# Test creating a new model
|
|
990
|
-
response = model_client.modify_model(config=
|
|
1024
|
+
response = model_client.modify_model(config=sample_custom_model_config, old_model_saved_name=None, old_model_version=None)
|
|
991
1025
|
print("\nResponse from modifying a new model: ", response)
|
|
992
1026
|
print("\nResponse data type: ", type(response))
|
|
993
1027
|
assert response is not None
|
|
@@ -996,7 +1030,7 @@ def test_modify_model(model_client, sample_model_config):
|
|
|
996
1030
|
# assert hasattr(response, "data")
|
|
997
1031
|
model_info = response.data
|
|
998
1032
|
assert model_info is not None
|
|
999
|
-
assert model_info["model_saved_name"] ==
|
|
1033
|
+
assert model_info["model_saved_name"] == test_custom_model_saved_name
|
|
1000
1034
|
assert model_info["model_version"] == test_model_version
|
|
1001
1035
|
print("\nSleeping for 60 seconds after model tests...")
|
|
1002
1036
|
time.sleep(60)
|
|
@@ -1233,7 +1267,7 @@ def test_get_health(redteam_client):
|
|
|
1233
1267
|
|
|
1234
1268
|
def test_saved_model_health(redteam_client):
|
|
1235
1269
|
print("\n\nTesting check_saved_model_health")
|
|
1236
|
-
response = redteam_client.check_saved_model_health(model_saved_name=
|
|
1270
|
+
response = redteam_client.check_saved_model_health(model_saved_name=test_custom_model_saved_name, model_version=test_model_version)
|
|
1237
1271
|
print("\nResponse from check_saved_model_health: ", response)
|
|
1238
1272
|
assert response is not None
|
|
1239
1273
|
assert hasattr(response, "status")
|
|
@@ -1297,7 +1331,7 @@ def test_saved_model_health(redteam_client):
|
|
|
1297
1331
|
|
|
1298
1332
|
def test_add_custom_task_with_saved_model(redteam_client, sample_custom_redteam_model_config):
|
|
1299
1333
|
print("\n\nTesting adding a new custom redteam task with saved model")
|
|
1300
|
-
response = redteam_client.add_custom_task_with_saved_model(config=sample_custom_redteam_model_config, model_saved_name=
|
|
1334
|
+
response = redteam_client.add_custom_task_with_saved_model(config=sample_custom_redteam_model_config, model_saved_name=test_custom_model_saved_name, model_version=test_model_version)
|
|
1301
1335
|
print("\nResponse from adding a new custom redteam task with saved model: ", response)
|
|
1302
1336
|
assert response is not None
|
|
1303
1337
|
assert hasattr(response, "task_id")
|
|
@@ -1439,6 +1473,14 @@ def test_delete_model(model_client):
|
|
|
1439
1473
|
# assert hasattr(response, "message")
|
|
1440
1474
|
assert response.message == "Model details deleted successfully"
|
|
1441
1475
|
|
|
1476
|
+
def test_delete_custom_model(model_client):
|
|
1477
|
+
print("\n\nTesting delete_custom_model")
|
|
1478
|
+
response = model_client.delete_model(model_saved_name=test_custom_model_saved_name, model_version=test_model_version)
|
|
1479
|
+
print("\nResponse from delete_custom_model: ", response)
|
|
1480
|
+
assert response is not None
|
|
1481
|
+
# assert hasattr(response, "message")
|
|
1482
|
+
assert response.message == "Model details deleted successfully"
|
|
1483
|
+
|
|
1442
1484
|
def test_delete_deployment(deployment_client):
|
|
1443
1485
|
print("\n\nTesting delete_deployment")
|
|
1444
1486
|
response = deployment_client.delete_deployment(deployment_name=test_deployment_name)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{enkryptai_sdk-1.0.11 → enkryptai_sdk-1.0.12}/src/enkryptai_sdk.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|