payi 0.1.0a113__py3-none-any.whl → 0.1.0a114__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.113" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.114" # x-release-please-version
@@ -245,7 +245,7 @@ class _AnthropicProviderRequest(_ProviderRequest):
245
245
  return True
246
246
 
247
247
  def anthropic_process_compute_input_cost(request: _ProviderRequest, usage: 'dict[str, Any]') -> int:
248
- input = usage['input_tokens']
248
+ input = usage.get('input_tokens', 0)
249
249
  units: dict[str, Units] = request._ingest["units"]
250
250
 
251
251
  cache_creation_input_tokens = usage.get("cache_creation_input_tokens", 0)
@@ -282,11 +282,11 @@ def anthropic_process_compute_input_cost(request: _ProviderRequest, usage: 'dict
282
282
  return _PayiInstrumentor.update_for_vision(input, units, request._estimated_prompt_tokens, is_large_context=request._is_large_context)
283
283
 
284
284
  def anthropic_process_synchronous_response(request: _ProviderRequest, response: 'dict[str, Any]', log_prompt_and_response: bool, assign_id: bool) -> Any:
285
- usage = response['usage']
285
+ usage = response.get('usage', {})
286
286
  units: dict[str, Units] = request._ingest["units"]
287
287
 
288
288
  input_tokens = anthropic_process_compute_input_cost(request, usage)
289
- output = usage['output_tokens']
289
+ output = usage.get('output_tokens', 0)
290
290
 
291
291
  large_context = "_large_context" if request._is_large_context else ""
292
292
  units["text"+large_context] = Units(input=input_tokens, output=output)
@@ -327,7 +327,7 @@ def anthropic_process_chunk(request: _ProviderRequest, chunk: 'dict[str, Any]',
327
327
  if model and 'resource' in request._ingest:
328
328
  request._instrumentor._logger.debug(f"Anthropic streaming, reported model: {model}, instrumented model {request._ingest['resource']}")
329
329
 
330
- usage = message['usage']
330
+ usage = message.get('usage', {})
331
331
  units = request._ingest["units"]
332
332
 
333
333
  input = anthropic_process_compute_input_cost(request, usage)
@@ -424,10 +424,10 @@ class _BedrockConverseProviderRequest(_BedrockProviderRequest):
424
424
  log_prompt_and_response: bool,
425
425
  kwargs: Any) -> Any:
426
426
 
427
- usage = response["usage"]
428
- input = usage["inputTokens"]
429
- output = usage["outputTokens"]
430
-
427
+ usage = response.get("usage", {})
428
+ input = usage.get("inputTokens", 0)
429
+ output = usage.get("outputTokens", 0)
430
+
431
431
  units: dict[str, Units] = self._ingest["units"]
432
432
  units["text"] = Units(input=input, output=output)
433
433
 
@@ -456,9 +456,9 @@ class _BedrockConverseProviderRequest(_BedrockProviderRequest):
456
456
  metadata = chunk.get("metadata", {})
457
457
 
458
458
  if metadata:
459
- usage = metadata['usage']
460
- input = usage["inputTokens"]
461
- output = usage["outputTokens"]
459
+ usage = metadata.get('usage', {})
460
+ input = usage.get("inputTokens", 0)
461
+ output = usage.get("outputTokens", 0)
462
462
  self._ingest["units"]["text"] = Units(input=input, output=output)
463
463
 
464
464
  ingest = True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: payi
3
- Version: 0.1.0a113
3
+ Version: 0.1.0a114
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=7jE5MoQQFVoVxw5vVzvZ2Ao0kcjfNOGsBgyJfLBEnMo,6195
14
- payi/_version.py,sha256=6EkmubL78eoxEMUlUQ6w1xFWXoNtf9nv86J32AfJMuQ,166
14
+ payi/_version.py,sha256=Youinej2btWjxpYxdf0vmSfYqlK1BlAwZE05kzSgcD4,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=PNZ_QJuzZEgyYXqkO1HVhGkj5IU9bglVUcw7H-Knjzw,2062
@@ -25,8 +25,8 @@ payi/_utils/_transform.py,sha256=n7kskEWz6o__aoNvhFoGVyDoalNe6mJwp-g7BWkdj88,156
25
25
  payi/_utils/_typing.py,sha256=D0DbbNu8GnYQTSICnTSHDGsYXj8TcAKyhejb0XcnjtY,4602
26
26
  payi/_utils/_utils.py,sha256=ts4CiiuNpFiGB6YMdkQRh2SZvYvsl7mAF-JWHCcLDf4,12312
27
27
  payi/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
28
- payi/lib/AnthropicInstrumentor.py,sha256=_moPMUCps6kExYxrkD9xpIbeVIj13MtYkzGpwAA6laA,16453
29
- payi/lib/BedrockInstrumentor.py,sha256=sfkFeSmsNRTo_4kExdpylzSeZEyA1lIFU3UJGse8AI8,19834
28
+ payi/lib/AnthropicInstrumentor.py,sha256=40jxGiG4od7g68gPLYGXvBrt-cbHorugb7wgZ8vHq-c,16483
29
+ payi/lib/BedrockInstrumentor.py,sha256=HllGynSJ7GDqI3ZuZrNwquPie7uPnh20RrYKbiBY-Sc,19870
30
30
  payi/lib/GoogleGenAiInstrumentor.py,sha256=LHiEZ7G5IhCcDlpVzQlXW9Ok96MHLeq7emEhFzPBTm0,8836
31
31
  payi/lib/OpenAIInstrumentor.py,sha256=_ULwIli11XP1yZK_pMGXuaSmHZ5pozuEt_v5DfhNuGw,22914
32
32
  payi/lib/Stopwatch.py,sha256=7OJlxvr2Jyb6Zr1LYCYKczRB7rDVKkIR7gc4YoleNdE,764
@@ -140,7 +140,7 @@ payi/types/use_cases/definitions/kpi_retrieve_response.py,sha256=uQXliSvS3k-yDYw
140
140
  payi/types/use_cases/definitions/kpi_update_params.py,sha256=jbawdWAdMnsTWVH0qfQGb8W7_TXe3lq4zjSRu44d8p8,373
141
141
  payi/types/use_cases/definitions/kpi_update_response.py,sha256=zLyEoT0S8d7XHsnXZYT8tM7yDw0Aze0Mk-_Z6QeMtc8,459
142
142
  payi/types/use_cases/definitions/limit_config_create_params.py,sha256=pzQza_16N3z8cFNEKr6gPbFvuGFrwNuGxAYb--Kbo2M,449
143
- payi-0.1.0a113.dist-info/METADATA,sha256=jsjlj2fj6pGW_1fG2E7TM2RHYyqTDzi4gCOrmROILZY,16324
144
- payi-0.1.0a113.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
145
- payi-0.1.0a113.dist-info/licenses/LICENSE,sha256=CQt03aM-P4a3Yg5qBg3JSLVoQS3smMyvx7tYg_6V7Gk,11334
146
- payi-0.1.0a113.dist-info/RECORD,,
143
+ payi-0.1.0a114.dist-info/METADATA,sha256=tcxlWZyeZyVyU9dfPsIVEr8ukAILzjDi1hxY4o1Rf9o,16324
144
+ payi-0.1.0a114.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
145
+ payi-0.1.0a114.dist-info/licenses/LICENSE,sha256=CQt03aM-P4a3Yg5qBg3JSLVoQS3smMyvx7tYg_6V7Gk,11334
146
+ payi-0.1.0a114.dist-info/RECORD,,