payi 0.1.0a117__py3-none-any.whl → 0.1.0a118__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 CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "payi"
4
- __version__ = "0.1.0-alpha.117" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.118" # x-release-please-version
@@ -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
@@ -989,12 +989,14 @@ class _PayiInstrumentor:
989
989
 
990
990
  # after _udpate_headers, all metadata to add to ingest is in extra_headers, keyed by the xproxy-xxx header name
991
991
  extra_headers: Optional[dict[str, str]] = kwargs.get("extra_headers")
992
- if extra_headers is None:
993
- extra_headers = {}
992
+ extra_headers = (extra_headers or {}).copy()
994
993
  self._update_extra_headers(context, extra_headers)
995
994
 
996
995
  if context.get("proxy", self._proxy_default):
997
- if "extra_headers" not in kwargs and extra_headers:
996
+ if not request.supports_extra_headers:
997
+ kwargs.pop("extra_headers", None)
998
+ elif extra_headers:
999
+ # Pass the copy to the wrapped function. Assumes anthropic and openai clients
998
1000
  kwargs["extra_headers"] = extra_headers
999
1001
 
1000
1002
  self._logger.debug(f"async_invoke_wrapper: sending proxy request")
@@ -1025,6 +1027,10 @@ class _PayiInstrumentor:
1025
1027
  self._prepare_ingest(request, context, extra_headers, args, kwargs)
1026
1028
  self._logger.debug(f"async_invoke_wrapper: calling wrapped instance (stream={stream})")
1027
1029
 
1030
+ if "extra_headers" in kwargs:
1031
+ # replace the original extra_headers with the updated copy which has all of the Pay-i headers removed
1032
+ kwargs["extra_headers"] = extra_headers
1033
+
1028
1034
  sw.start()
1029
1035
  response = await wrapped(*args, **kwargs)
1030
1036
 
@@ -1109,15 +1115,14 @@ class _PayiInstrumentor:
1109
1115
 
1110
1116
  # after _udpate_headers, all metadata to add to ingest is in extra_headers, keyed by the xproxy-xxx header name
1111
1117
  extra_headers: Optional[dict[str, str]] = kwargs.get("extra_headers")
1112
- if extra_headers is None:
1113
- extra_headers = {}
1118
+ extra_headers = (extra_headers or {}).copy()
1114
1119
  self._update_extra_headers(context, extra_headers)
1115
1120
 
1116
1121
  if context.get("proxy", self._proxy_default):
1117
1122
  if not request.supports_extra_headers:
1118
1123
  kwargs.pop("extra_headers", None)
1119
- elif "extra_headers" not in kwargs and extra_headers:
1120
- # assumes anthropic and openai clients
1124
+ elif extra_headers:
1125
+ # Pass the copy to the wrapped function. Assumes anthropic and openai clients
1121
1126
  kwargs["extra_headers"] = extra_headers
1122
1127
 
1123
1128
  self._logger.debug(f"invoke_wrapper: sending proxy request")
@@ -1148,6 +1153,10 @@ class _PayiInstrumentor:
1148
1153
  self._prepare_ingest(request, context, extra_headers, args, kwargs)
1149
1154
  self._logger.debug(f"invoke_wrapper: calling wrapped instance (stream={stream})")
1150
1155
 
1156
+ if "extra_headers" in kwargs:
1157
+ # replace the original extra_headers with the updated copy which has all of the Pay-i headers removed
1158
+ kwargs["extra_headers"] = extra_headers
1159
+
1151
1160
  sw.start()
1152
1161
  response = wrapped(*args, **kwargs)
1153
1162
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: payi
3
- Version: 0.1.0a117
3
+ Version: 0.1.0a118
4
4
  Summary: The official Python library for the payi API
5
5
  Project-URL: Homepage, https://github.com/Pay-i/pay-i-python
6
6
  Project-URL: Repository, https://github.com/Pay-i/pay-i-python
@@ -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=CT_7R67aFGN6tU15d9jDUpNrFSdQKg2LnZnzMCLaoAA,166
14
+ payi/_version.py,sha256=J2yZW7ac0_TIjzZBm13WClbFoPqUwzI0MqI0RXSmQzo,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=AAuYBJrLiInz8F6vRcogVMFAHL1gVzn4VHUafjOgrCo,26361
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=CASgkSmnAhMqK5DeE6veRkr-7AbJaC_xu-KlLfmsfIo,76634
38
+ payi/lib/instrument.py,sha256=ifiRiXoha71X2H_du5yRSdVpJmt7A1e7BCMbI99pMSs,77212
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.0a117.dist-info/METADATA,sha256=U3BPRxFBRJUJDmd0UMvdQ734n6NP2l4VYuZqqKByt7Y,16324
146
- payi-0.1.0a117.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
147
- payi-0.1.0a117.dist-info/licenses/LICENSE,sha256=CQt03aM-P4a3Yg5qBg3JSLVoQS3smMyvx7tYg_6V7Gk,11334
148
- payi-0.1.0a117.dist-info/RECORD,,
145
+ payi-0.1.0a118.dist-info/METADATA,sha256=5XR7vidFVfH3Xbdqd0HEGx0mH09koNDEggOxBm4eXdw,16324
146
+ payi-0.1.0a118.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
147
+ payi-0.1.0a118.dist-info/licenses/LICENSE,sha256=CQt03aM-P4a3Yg5qBg3JSLVoQS3smMyvx7tYg_6V7Gk,11334
148
+ payi-0.1.0a118.dist-info/RECORD,,