enkryptai-sdk 1.0.2__py3-none-any.whl → 1.0.3__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.
- enkryptai_sdk/ai_proxy.py +6 -4
- {enkryptai_sdk-1.0.2.dist-info → enkryptai_sdk-1.0.3.dist-info}/METADATA +1 -1
- {enkryptai_sdk-1.0.2.dist-info → enkryptai_sdk-1.0.3.dist-info}/RECORD +6 -6
- {enkryptai_sdk-1.0.2.dist-info → enkryptai_sdk-1.0.3.dist-info}/WHEEL +0 -0
- {enkryptai_sdk-1.0.2.dist-info → enkryptai_sdk-1.0.3.dist-info}/licenses/LICENSE +0 -0
- {enkryptai_sdk-1.0.2.dist-info → enkryptai_sdk-1.0.3.dist-info}/top_level.txt +0 -0
enkryptai_sdk/ai_proxy.py
CHANGED
|
@@ -54,7 +54,7 @@ class AIProxyClient(BaseClient):
|
|
|
54
54
|
# Try to parse nested JSON error if it's a string
|
|
55
55
|
if isinstance(error_message, str) and is_json_str:
|
|
56
56
|
import ast
|
|
57
|
-
import json
|
|
57
|
+
# import json
|
|
58
58
|
try:
|
|
59
59
|
# # Using ast.literal_eval to safely evaluate the string as a Python literal
|
|
60
60
|
# # As json.loads is not working with literal string representation of dict
|
|
@@ -65,7 +65,8 @@ class AIProxyClient(BaseClient):
|
|
|
65
65
|
response["error"] = parsed_error.get("error", parsed_error)
|
|
66
66
|
if "enkrypt_policy_detections" in parsed_error:
|
|
67
67
|
response["enkrypt_policy_detections"] = parsed_error["enkrypt_policy_detections"]
|
|
68
|
-
except json.JSONDecodeError:
|
|
68
|
+
# except json.JSONDecodeError:
|
|
69
|
+
except Exception:
|
|
69
70
|
# If parsing fails, keep the original error
|
|
70
71
|
pass
|
|
71
72
|
|
|
@@ -78,9 +79,10 @@ class AIProxyClient(BaseClient):
|
|
|
78
79
|
try:
|
|
79
80
|
# print("Error in response: ", response)
|
|
80
81
|
return ChatCompletionErrorResponse.from_dict(response)
|
|
81
|
-
except (json.JSONDecodeError, TypeError, ValueError, SyntaxError):
|
|
82
|
+
# except (json.JSONDecodeError, TypeError, ValueError, SyntaxError):
|
|
83
|
+
except Exception:
|
|
82
84
|
# Fallback to direct error if error object can't be parsed
|
|
83
|
-
print("Failed to parse error response: ", response)
|
|
85
|
+
# print("Failed to parse error response: ", response)
|
|
84
86
|
return ChatCompletionDirectErrorResponse.from_dict(response)
|
|
85
87
|
raise AIProxyClientError(response["error"])
|
|
86
88
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
enkryptai_sdk/__init__.py,sha256=rP6PtntJogJauj1lKWK8DkiBr3uYjireIUamr6aflu0,763
|
|
2
|
-
enkryptai_sdk/ai_proxy.py,sha256=
|
|
2
|
+
enkryptai_sdk/ai_proxy.py,sha256=pD6kPmD9H0gttN28cezgV7_IVelLXAHNR5cPeXCM8Ew,3799
|
|
3
3
|
enkryptai_sdk/base.py,sha256=MlEDcEIjXo35kat9XkGUu7VB2fIvJk38C94wAeO9bEw,1304
|
|
4
4
|
enkryptai_sdk/config.py,sha256=IpB8_aO4zXdvv061v24oh83oyJ5Tp1QBQTzeuW4h9QY,8828
|
|
5
5
|
enkryptai_sdk/datasets.py,sha256=xekcdY9wIniw2TnylaK6o1RNZ5DRoluNOGawBkVgaM0,4881
|
|
@@ -18,8 +18,8 @@ enkryptai_sdk/dto/deployments.py,sha256=lsKdG09C-rceIjGvEyYOBf5zBjrk7ma8NpPfgrAg
|
|
|
18
18
|
enkryptai_sdk/dto/guardrails.py,sha256=XMFco-KlEqI4TYoJAyxxTrk-OFixtEcftBpG1SXFH4k,39583
|
|
19
19
|
enkryptai_sdk/dto/models.py,sha256=O4gVhVTenlsytNJIvk2gO5530KZWMye6FCVCtF5IW-A,11700
|
|
20
20
|
enkryptai_sdk/dto/red_team.py,sha256=BoOPYFjIONIC0XPuyJtkx_qLVYi2kLGEA4CzlySgbJA,13829
|
|
21
|
-
enkryptai_sdk-1.0.
|
|
22
|
-
enkryptai_sdk-1.0.
|
|
23
|
-
enkryptai_sdk-1.0.
|
|
24
|
-
enkryptai_sdk-1.0.
|
|
25
|
-
enkryptai_sdk-1.0.
|
|
21
|
+
enkryptai_sdk-1.0.3.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
+
enkryptai_sdk-1.0.3.dist-info/METADATA,sha256=PlZ1NVD9UO0SSbtjtLeEc6coTHRI3eLvgE3c2bLmgNM,43207
|
|
23
|
+
enkryptai_sdk-1.0.3.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
24
|
+
enkryptai_sdk-1.0.3.dist-info/top_level.txt,sha256=s2X9UJJwvJamNmr6ZXWyyQe60sXtQGWFuaBYfhgHI_4,14
|
|
25
|
+
enkryptai_sdk-1.0.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|