payi 0.1.0a117__py3-none-any.whl → 0.1.0a119__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.
Potentially problematic release.
This version of payi might be problematic. Click here for more details.
- payi/_version.py +1 -1
- payi/lib/BedrockInstrumentor.py +2 -0
- payi/lib/instrument.py +21 -11
- {payi-0.1.0a117.dist-info → payi-0.1.0a119.dist-info}/METADATA +1 -1
- {payi-0.1.0a117.dist-info → payi-0.1.0a119.dist-info}/RECORD +7 -7
- {payi-0.1.0a117.dist-info → payi-0.1.0a119.dist-info}/WHEEL +0 -0
- {payi-0.1.0a117.dist-info → payi-0.1.0a119.dist-info}/licenses/LICENSE +0 -0
payi/_version.py
CHANGED
payi/lib/BedrockInstrumentor.py
CHANGED
|
@@ -513,6 +513,8 @@ class _BedrockInvokeProviderRequest(_BedrockProviderRequest):
|
|
|
513
513
|
class _BedrockConverseProviderRequest(_BedrockProviderRequest):
|
|
514
514
|
@override
|
|
515
515
|
def process_request(self, instance: Any, extra_headers: 'dict[str, str]', args: Sequence[Any], kwargs: Any) -> bool:
|
|
516
|
+
super().process_request(instance, extra_headers, args, kwargs)
|
|
517
|
+
|
|
516
518
|
guardrail_config = kwargs.get("guardrailConfig", {})
|
|
517
519
|
if guardrail_config:
|
|
518
520
|
guardrailIdentifier = guardrail_config.get("guardrailIdentifier", "")
|
payi/lib/instrument.py
CHANGED
|
@@ -571,7 +571,7 @@ class _PayiInstrumentor:
|
|
|
571
571
|
# Try to get the response body as JSON
|
|
572
572
|
body = e.body
|
|
573
573
|
if body is None:
|
|
574
|
-
self._logger.
|
|
574
|
+
self._logger.warning(f"Pay-i connection exception {e} has no body")
|
|
575
575
|
return XproxyError(code="unknown_error", message=str(e))
|
|
576
576
|
|
|
577
577
|
# If body is bytes, decode to string
|
|
@@ -585,8 +585,9 @@ class _PayiInstrumentor:
|
|
|
585
585
|
if not body_dict:
|
|
586
586
|
try:
|
|
587
587
|
body_dict = json.loads(body) # type: ignore
|
|
588
|
-
except Exception
|
|
589
|
-
|
|
588
|
+
except Exception:
|
|
589
|
+
body_type = type(body).__name__ # type: ignore
|
|
590
|
+
self._logger.warning(f"Pay-i connection exception {e} cannot parse response JSON body for body type {body_type}")
|
|
590
591
|
return XproxyError(code="invalid_json", message=str(e))
|
|
591
592
|
|
|
592
593
|
xproxy_error = body_dict.get("xproxy_error", {})
|
|
@@ -595,7 +596,7 @@ class _PayiInstrumentor:
|
|
|
595
596
|
return XproxyError(code=code, message=message)
|
|
596
597
|
|
|
597
598
|
except Exception as ex:
|
|
598
|
-
self._logger.
|
|
599
|
+
self._logger.warning(f"Pay-i connection exception {e} _process_api_status_error handled exception {ex}")
|
|
599
600
|
return XproxyError(code="exception", message=str(ex))
|
|
600
601
|
|
|
601
602
|
def _ingest_units_worker(self, request: _ProviderRequest) -> Optional[Union[XproxyResult, XproxyError]]:
|
|
@@ -989,12 +990,14 @@ class _PayiInstrumentor:
|
|
|
989
990
|
|
|
990
991
|
# after _udpate_headers, all metadata to add to ingest is in extra_headers, keyed by the xproxy-xxx header name
|
|
991
992
|
extra_headers: Optional[dict[str, str]] = kwargs.get("extra_headers")
|
|
992
|
-
|
|
993
|
-
extra_headers = {}
|
|
993
|
+
extra_headers = (extra_headers or {}).copy()
|
|
994
994
|
self._update_extra_headers(context, extra_headers)
|
|
995
995
|
|
|
996
996
|
if context.get("proxy", self._proxy_default):
|
|
997
|
-
if
|
|
997
|
+
if not request.supports_extra_headers:
|
|
998
|
+
kwargs.pop("extra_headers", None)
|
|
999
|
+
elif extra_headers:
|
|
1000
|
+
# Pass the copy to the wrapped function. Assumes anthropic and openai clients
|
|
998
1001
|
kwargs["extra_headers"] = extra_headers
|
|
999
1002
|
|
|
1000
1003
|
self._logger.debug(f"async_invoke_wrapper: sending proxy request")
|
|
@@ -1025,6 +1028,10 @@ class _PayiInstrumentor:
|
|
|
1025
1028
|
self._prepare_ingest(request, context, extra_headers, args, kwargs)
|
|
1026
1029
|
self._logger.debug(f"async_invoke_wrapper: calling wrapped instance (stream={stream})")
|
|
1027
1030
|
|
|
1031
|
+
if "extra_headers" in kwargs:
|
|
1032
|
+
# replace the original extra_headers with the updated copy which has all of the Pay-i headers removed
|
|
1033
|
+
kwargs["extra_headers"] = extra_headers
|
|
1034
|
+
|
|
1028
1035
|
sw.start()
|
|
1029
1036
|
response = await wrapped(*args, **kwargs)
|
|
1030
1037
|
|
|
@@ -1109,15 +1116,14 @@ class _PayiInstrumentor:
|
|
|
1109
1116
|
|
|
1110
1117
|
# after _udpate_headers, all metadata to add to ingest is in extra_headers, keyed by the xproxy-xxx header name
|
|
1111
1118
|
extra_headers: Optional[dict[str, str]] = kwargs.get("extra_headers")
|
|
1112
|
-
|
|
1113
|
-
extra_headers = {}
|
|
1119
|
+
extra_headers = (extra_headers or {}).copy()
|
|
1114
1120
|
self._update_extra_headers(context, extra_headers)
|
|
1115
1121
|
|
|
1116
1122
|
if context.get("proxy", self._proxy_default):
|
|
1117
1123
|
if not request.supports_extra_headers:
|
|
1118
1124
|
kwargs.pop("extra_headers", None)
|
|
1119
|
-
elif
|
|
1120
|
-
#
|
|
1125
|
+
elif extra_headers:
|
|
1126
|
+
# Pass the copy to the wrapped function. Assumes anthropic and openai clients
|
|
1121
1127
|
kwargs["extra_headers"] = extra_headers
|
|
1122
1128
|
|
|
1123
1129
|
self._logger.debug(f"invoke_wrapper: sending proxy request")
|
|
@@ -1148,6 +1154,10 @@ class _PayiInstrumentor:
|
|
|
1148
1154
|
self._prepare_ingest(request, context, extra_headers, args, kwargs)
|
|
1149
1155
|
self._logger.debug(f"invoke_wrapper: calling wrapped instance (stream={stream})")
|
|
1150
1156
|
|
|
1157
|
+
if "extra_headers" in kwargs:
|
|
1158
|
+
# replace the original extra_headers with the updated copy which has all of the Pay-i headers removed
|
|
1159
|
+
kwargs["extra_headers"] = extra_headers
|
|
1160
|
+
|
|
1151
1161
|
sw.start()
|
|
1152
1162
|
response = wrapped(*args, **kwargs)
|
|
1153
1163
|
|
|
@@ -11,7 +11,7 @@ payi/_resource.py,sha256=j2jIkTr8OIC8sU6-05nxSaCyj4MaFlbZrwlyg4_xJos,1088
|
|
|
11
11
|
payi/_response.py,sha256=rh9oJAvCKcPwQFm4iqH_iVrmK8bNx--YP_A2a4kN1OU,28776
|
|
12
12
|
payi/_streaming.py,sha256=Z_wIyo206T6Jqh2rolFg2VXZgX24PahLmpURp0-NssU,10092
|
|
13
13
|
payi/_types.py,sha256=2pzimmgO1SZhjEsqgq0eOheAFRCdT4qakXMZm8cGeI0,7294
|
|
14
|
-
payi/_version.py,sha256=
|
|
14
|
+
payi/_version.py,sha256=hXAufnsNH5vNZqhITRS6ohEnXE5aepQldW_2L860_Ik,166
|
|
15
15
|
payi/pagination.py,sha256=k2356QGPOUSjRF2vHpwLBdF6P-2vnQzFfRIJQAHGQ7A,1258
|
|
16
16
|
payi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
payi/_utils/__init__.py,sha256=7fch0GT9zpNnErbciSpUNa-SjTxxjY6kxHxKMOM4AGs,2305
|
|
@@ -28,14 +28,14 @@ payi/_utils/_typing.py,sha256=N_5PPuFNsaygbtA_npZd98SVN1LQQvFTKL6bkWPBZGU,4786
|
|
|
28
28
|
payi/_utils/_utils.py,sha256=D2QE7mVPNEJzaB50u8rvDQAUDS5jx7JoeFD7zdj-TeI,12231
|
|
29
29
|
payi/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
|
|
30
30
|
payi/lib/AnthropicInstrumentor.py,sha256=SI6nzU-eVufHbxV5gxgrZDhx3TewRVnsvtwDuwEG6WU,16484
|
|
31
|
-
payi/lib/BedrockInstrumentor.py,sha256=
|
|
31
|
+
payi/lib/BedrockInstrumentor.py,sha256=sbjq5GKBOjjId1cj4x0vHQIGc_JBxewSE08cgvyAD3E,26441
|
|
32
32
|
payi/lib/GoogleGenAiInstrumentor.py,sha256=LHiEZ7G5IhCcDlpVzQlXW9Ok96MHLeq7emEhFzPBTm0,8836
|
|
33
33
|
payi/lib/OpenAIInstrumentor.py,sha256=_ULwIli11XP1yZK_pMGXuaSmHZ5pozuEt_v5DfhNuGw,22914
|
|
34
34
|
payi/lib/Stopwatch.py,sha256=7OJlxvr2Jyb6Zr1LYCYKczRB7rDVKkIR7gc4YoleNdE,764
|
|
35
35
|
payi/lib/VertexInstrumentor.py,sha256=OWuMPiW4LdLhj6DSAAy5qZiosVo8DSAuFWGxYpEucoE,7431
|
|
36
36
|
payi/lib/VertexRequest.py,sha256=42F7xCRYY6h3EMUZD1x4-_cwyAcVhnzT9M5zl4KwtE0,11801
|
|
37
37
|
payi/lib/helpers.py,sha256=jcMyxsuWmyPymDCYmDbQAb6IgbkmkiiNUaxeEPkCKZs,4457
|
|
38
|
-
payi/lib/instrument.py,sha256=
|
|
38
|
+
payi/lib/instrument.py,sha256=gEP6onrXVRWl6e1DqIrG1FU56A8nb6opQhkSzruk640,77348
|
|
39
39
|
payi/lib/version_helper.py,sha256=v0lC3kuaXn6PBDolE3mkmwJiA8Ot3z4RkVR7wlBuZCs,540
|
|
40
40
|
payi/lib/data/cohere_embed_english_v3.json,sha256=YEWwjml3_i16cdsOx_7UKe6xpVFnxTEhP8T1n54R6gY,718306
|
|
41
41
|
payi/resources/__init__.py,sha256=B2bn1ZfCf6TbHlzZvy5TpFPtALnFcBRPYVKQH3S5qfQ,2457
|
|
@@ -142,7 +142,7 @@ payi/types/use_cases/definitions/kpi_retrieve_response.py,sha256=uQXliSvS3k-yDYw
|
|
|
142
142
|
payi/types/use_cases/definitions/kpi_update_params.py,sha256=jbawdWAdMnsTWVH0qfQGb8W7_TXe3lq4zjSRu44d8p8,373
|
|
143
143
|
payi/types/use_cases/definitions/kpi_update_response.py,sha256=zLyEoT0S8d7XHsnXZYT8tM7yDw0Aze0Mk-_Z6QeMtc8,459
|
|
144
144
|
payi/types/use_cases/definitions/limit_config_create_params.py,sha256=sodtLT84tBmuO_0d-h0CZWCh4vWojJMtUbMjBmEN3IE,492
|
|
145
|
-
payi-0.1.
|
|
146
|
-
payi-0.1.
|
|
147
|
-
payi-0.1.
|
|
148
|
-
payi-0.1.
|
|
145
|
+
payi-0.1.0a119.dist-info/METADATA,sha256=a4dgBvrw-bwPoinDeyYpCa4JPqxA7mJYDSRfJU6X7t0,16324
|
|
146
|
+
payi-0.1.0a119.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
147
|
+
payi-0.1.0a119.dist-info/licenses/LICENSE,sha256=CQt03aM-P4a3Yg5qBg3JSLVoQS3smMyvx7tYg_6V7Gk,11334
|
|
148
|
+
payi-0.1.0a119.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|