payi 0.1.0a65__py3-none-any.whl → 0.1.0a67__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.65" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.67" # x-release-please-version
payi/lib/helpers.py CHANGED
@@ -50,6 +50,7 @@ def create_headers(
50
50
  use_case_name: Union[str, None] = None,
51
51
  use_case_version: Union[int, None] = None,
52
52
  route_as_resource: Union[str, None] = None,
53
+ resource_scope: Union[str, None] = None,
53
54
  ) -> Dict[str, str]:
54
55
  headers: Dict[str, str] = {}
55
56
 
@@ -71,6 +72,8 @@ def create_headers(
71
72
  headers.update({ PayiHeaderNames.use_case_version: str(use_case_version)})
72
73
  if route_as_resource:
73
74
  headers.update({ PayiHeaderNames.route_as_resource: route_as_resource})
75
+ if resource_scope:
76
+ headers.update({ PayiHeaderNames.resource_scope: resource_scope })
74
77
  return headers
75
78
 
76
79
  def _resolve_payi_base_url(payi_base_url: Union[str, None]) -> str:
payi/lib/instrument.py CHANGED
@@ -6,6 +6,7 @@ import logging
6
6
  import traceback
7
7
  from enum import Enum
8
8
  from typing import Any, Set, Union, Callable, Optional, TypedDict
9
+ from datetime import datetime, timezone
9
10
 
10
11
  import nest_asyncio # type: ignore
11
12
  from wrapt import ObjectProxy # type: ignore
@@ -38,7 +39,7 @@ class _ProviderRequest:
38
39
 
39
40
  class PayiInstrumentConfig(TypedDict, total=False):
40
41
  proxy: bool
41
- global_instrumentation_enabled: bool
42
+ global_instrumentation: bool
42
43
  limit_ids: Optional["list[str]"]
43
44
  experience_name: Optional[str]
44
45
  experience_id: Optional[str]
@@ -89,9 +90,9 @@ class _PayiInstrumentor:
89
90
  else:
90
91
  self._instrument_specific(instruments)
91
92
 
92
- global_instrumentation_enabled = global_config.pop("global_instrumentation_enabled", True) if global_config else True
93
+ global_instrumentation = global_config.pop("global_instrumentation", True) if global_config else True
93
94
 
94
- if global_instrumentation_enabled:
95
+ if global_instrumentation:
95
96
  if global_config is None:
96
97
  global_config = {}
97
98
  if "proxy" not in global_config:
@@ -447,7 +448,7 @@ class _PayiInstrumentor:
447
448
  self,
448
449
  ingest: IngestUnitsParams,
449
450
  ingest_extra_headers: "dict[str, str]", # do not coflict potential kwargs["extra_headers"]
450
- **kwargs: Any,
451
+ kwargs: Any,
451
452
  ) -> None:
452
453
  limit_ids = ingest_extra_headers.pop(PayiHeaderNames.limit_ids, None)
453
454
  request_tags = ingest_extra_headers.pop(PayiHeaderNames.request_tags, None)
@@ -494,6 +495,8 @@ class _PayiInstrumentor:
494
495
  if self._log_prompt_and_response:
495
496
  ingest["provider_request_json"] = json.dumps(provider_prompt)
496
497
 
498
+ ingest["event_timestamp"] = datetime.now(timezone.utc)
499
+
497
500
  async def achat_wrapper(
498
501
  self,
499
502
  category: str,
@@ -567,7 +570,7 @@ class _PayiInstrumentor:
567
570
  stream = False
568
571
 
569
572
  try:
570
- self._prepare_ingest(provider._ingest, extra_headers, **kwargs)
573
+ self._prepare_ingest(provider._ingest, extra_headers, kwargs)
571
574
  sw.start()
572
575
  response = await wrapped(*args, **kwargs)
573
576
 
@@ -691,7 +694,7 @@ class _PayiInstrumentor:
691
694
  stream = False
692
695
 
693
696
  try:
694
- self._prepare_ingest(provider._ingest, extra_headers, **kwargs)
697
+ self._prepare_ingest(provider._ingest, extra_headers, kwargs)
695
698
  sw.start()
696
699
  response = wrapped(*args, **kwargs)
697
700
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: payi
3
- Version: 0.1.0a65
3
+ Version: 0.1.0a67
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=CfrNS_3wbL8o9dRyRVfZQ5E1GUlA4CUIUEK8olmfGqE,28777
12
12
  payi/_streaming.py,sha256=Z_wIyo206T6Jqh2rolFg2VXZgX24PahLmpURp0-NssU,10092
13
13
  payi/_types.py,sha256=2mbMK86K3W1aMTW7sOGQ-VND6-A2IuXKm8p4sYFztBU,6141
14
- payi/_version.py,sha256=DNP1TOymCfAVVUyTcBcwVSj1Nor6vREMNSwCUds3Phk,165
14
+ payi/_version.py,sha256=JhfCJv12UX_CPNC6OUb3nHG23Bmu--kjLXVyzZw-GF0,165
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=PNZ_QJuzZEgyYXqkO1HVhGkj5IU9bglVUcw7H-Knjzw,2062
@@ -28,8 +28,8 @@ payi/lib/AnthropicInstrumentor.py,sha256=OivTBeTnwVYDaaoGDj2V77JmjEb2aKQ6Se295VA
28
28
  payi/lib/BedrockInstrumentor.py,sha256=CDfZ_IDEuQ2PrLcmtKGOX69sPhiKqKNIoZ2c0W0mIR8,10595
29
29
  payi/lib/OpenAIInstrumentor.py,sha256=_LV_IqWBAqvBlzbYQHolVmGioTn60-zUkNgp179rIFk,8305
30
30
  payi/lib/Stopwatch.py,sha256=7OJlxvr2Jyb6Zr1LYCYKczRB7rDVKkIR7gc4YoleNdE,764
31
- payi/lib/helpers.py,sha256=dEscgoiCneUx1rbgayt8P-s-xi0gKiN2vWiKYMS7oiQ,3830
32
- payi/lib/instrument.py,sha256=zIo8ZdU2qQchC_d48OcH_Df5tYTWI7JGVGm08p2Riak,43079
31
+ payi/lib/helpers.py,sha256=ar9so8_sJaEV_Ned-XvCl-JTe5cRoYlL9JQJwp4ZvyQ,3973
32
+ payi/lib/instrument.py,sha256=879NVtiGSbaumaLFAWBurKMR81NPMHKUMBflB7dEEzY,43153
33
33
  payi/resources/__init__.py,sha256=1rtrPLWbNt8oJGOp6nwPumKLJ-ftez0B6qwLFyfcoP4,2972
34
34
  payi/resources/ingest.py,sha256=ifKMKylIkfCF-uGFPttr_VG3vWxsqntOOBrrU4_g1zk,21627
35
35
  payi/resources/categories/__init__.py,sha256=w5gMiPdBSzJA_qfoVtFBElaoe8wGf_O63R7R1Spr6Gk,1093
@@ -135,7 +135,7 @@ payi/types/use_cases/definitions/kpi_retrieve_response.py,sha256=uQXliSvS3k-yDYw
135
135
  payi/types/use_cases/definitions/kpi_update_params.py,sha256=jbawdWAdMnsTWVH0qfQGb8W7_TXe3lq4zjSRu44d8p8,373
136
136
  payi/types/use_cases/definitions/kpi_update_response.py,sha256=zLyEoT0S8d7XHsnXZYT8tM7yDw0Aze0Mk-_Z6QeMtc8,459
137
137
  payi/types/use_cases/definitions/limit_config_create_params.py,sha256=pzQza_16N3z8cFNEKr6gPbFvuGFrwNuGxAYb--Kbo2M,449
138
- payi-0.1.0a65.dist-info/METADATA,sha256=tYqX7J8pbMs3G74yZiX9T4cJ6wl3UQYn4OMCOUTnSBc,15290
139
- payi-0.1.0a65.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
140
- payi-0.1.0a65.dist-info/licenses/LICENSE,sha256=CQt03aM-P4a3Yg5qBg3JSLVoQS3smMyvx7tYg_6V7Gk,11334
141
- payi-0.1.0a65.dist-info/RECORD,,
138
+ payi-0.1.0a67.dist-info/METADATA,sha256=B52R87Hz90PbqcNprJqMLx2ID6WEsF7VTOj_1fVx1L8,15290
139
+ payi-0.1.0a67.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
140
+ payi-0.1.0a67.dist-info/licenses/LICENSE,sha256=CQt03aM-P4a3Yg5qBg3JSLVoQS3smMyvx7tYg_6V7Gk,11334
141
+ payi-0.1.0a67.dist-info/RECORD,,