payi 0.1.0a38__py3-none-any.whl → 0.1.0a40__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.38" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.40" # x-release-please-version
@@ -1,6 +1,7 @@
1
1
  import logging
2
- from typing import Any
2
+ from typing import Any, Union
3
3
 
4
+ import tiktoken
4
5
  from wrapt import wrap_function_wrapper # type: ignore
5
6
 
6
7
  from payi.types import IngestUnitsParams
@@ -49,6 +50,7 @@ def chat_wrapper(
49
50
  return instrumentor.chat_wrapper(
50
51
  "system.anthropic",
51
52
  process_chunk,
53
+ process_request,
52
54
  process_synchronous_response,
53
55
  wrapped,
54
56
  instance,
@@ -62,7 +64,9 @@ def process_chunk(chunk: Any, ingest: IngestUnitsParams) -> None:
62
64
  usage = chunk.message.usage
63
65
  units = ingest["units"]
64
66
 
65
- units["text"] = Units(input=usage.input_tokens, output=0)
67
+ input = PayiInstrumentor.update_for_vision(usage.input_tokens, units)
68
+
69
+ units["text"] = Units(input=input, output=0)
66
70
 
67
71
  if hasattr(usage, "cache_creation_input_tokens") and usage.cache_creation_input_tokens > 0:
68
72
  text_cache_write = usage.cache_creation_input_tokens
@@ -91,7 +95,41 @@ def process_synchronous_response(response: Any, ingest: IngestUnitsParams, log_p
91
95
  text_cache_read = usage.cache_read_input_tokens
92
96
  units["text_cache_read"] = Units(input=text_cache_read, output=0)
93
97
 
98
+ input = PayiInstrumentor.update_for_vision(input, units)
99
+
94
100
  units["text"] = Units(input=input, output=ouptut)
95
101
 
96
102
  if log_prompt_and_response:
97
103
  ingest["provider_response_json"] = response.to_json()
104
+
105
+ def has_image_and_get_texts(encoding: tiktoken.Encoding, content: Union[str, 'list[Any]']) -> 'tuple[bool, int]':
106
+ if isinstance(content, str):
107
+ return False, 0
108
+ elif isinstance(content, list): # type: ignore
109
+ has_image = any(item.get("type") == "image" for item in content)
110
+ if has_image is False:
111
+ return has_image, 0
112
+
113
+ token_count = sum(len(encoding.encode(item.get("text", ""))) for item in content if item.get("type") == "text")
114
+ return has_image, token_count
115
+
116
+ def process_request(ingest: IngestUnitsParams, kwargs: Any) -> None:
117
+ messages = kwargs.get("messages")
118
+ if not messages or len(messages) == 0:
119
+ return
120
+
121
+ estimated_token_count = 0
122
+ has_image = False
123
+
124
+ enc = tiktoken.get_encoding("cl100k_base")
125
+
126
+ for message in messages:
127
+ msg_has_image, msg_prompt_tokens = has_image_and_get_texts(enc, message.get('content', ''))
128
+ if msg_has_image:
129
+ has_image = True
130
+ estimated_token_count += msg_prompt_tokens
131
+
132
+ if not has_image or estimated_token_count == 0:
133
+ return
134
+
135
+ ingest["units"][PayiInstrumentor.estimated_prompt_tokens] = Units(input=estimated_token_count, output=0)
@@ -1,8 +1,9 @@
1
1
  import json
2
2
  import logging
3
- from typing import Any
3
+ from typing import Any, Union
4
4
  from importlib.metadata import version
5
5
 
6
+ import tiktoken
6
7
  from wrapt import wrap_function_wrapper # type: ignore
7
8
 
8
9
  from payi.types import IngestUnitsParams
@@ -38,6 +39,7 @@ def chat_wrapper(
38
39
  return instrumentor.chat_wrapper(
39
40
  "system.openai",
40
41
  process_chat_chunk,
42
+ process_request,
41
43
  process_chat_synchronous_response,
42
44
  wrapped,
43
45
  instance,
@@ -84,6 +86,41 @@ def add_usage_units(usage: "dict[str, Any]", units: "dict[str, Units]") -> None:
84
86
  if input_cache != 0:
85
87
  units["text_cache_read"] = Units(input=input_cache, output=0)
86
88
 
87
- input -= input_cache
89
+ input = PayiInstrumentor.update_for_vision(input - input_cache, units)
88
90
 
89
91
  units["text"] = Units(input=input, output=output)
92
+
93
+ def has_image_and_get_texts(encoding: tiktoken.Encoding, content: Union[str, 'list[Any]']) -> 'tuple[bool, int]':
94
+ if isinstance(content, str):
95
+ return False, 0
96
+ elif isinstance(content, list): # type: ignore
97
+ has_image = any(item.get("type") == "image_url" for item in content)
98
+ if has_image is False:
99
+ return has_image, 0
100
+
101
+ token_count = sum(len(encoding.encode(item.get("text", ""))) for item in content if item.get("type") == "text")
102
+ return has_image, token_count
103
+
104
+ def process_request(ingest: IngestUnitsParams, kwargs: Any) -> None:
105
+ messages = kwargs.get("messages")
106
+ if not messages or len(messages) == 0:
107
+ return
108
+
109
+ estimated_token_count = 0
110
+ has_image = False
111
+
112
+ try:
113
+ enc = tiktoken.encoding_for_model(kwargs.get("model"))
114
+ except KeyError:
115
+ enc = tiktoken.get_encoding("o200k_base")
116
+
117
+ for message in messages:
118
+ msg_has_image, msg_prompt_tokens = has_image_and_get_texts(enc, message.get('content', ''))
119
+ if msg_has_image:
120
+ has_image = True
121
+ estimated_token_count += msg_prompt_tokens
122
+
123
+ if not has_image or estimated_token_count == 0:
124
+ return
125
+
126
+ ingest["units"][PayiInstrumentor.estimated_prompt_tokens] = Units(input=estimated_token_count, output=0)
payi/lib/instrument.py CHANGED
@@ -10,12 +10,15 @@ from wrapt import ObjectProxy # type: ignore
10
10
 
11
11
  from payi import Payi, AsyncPayi
12
12
  from payi.types import IngestUnitsParams
13
+ from payi.types.ingest_units_params import Units
13
14
 
14
15
  from .Stopwatch import Stopwatch
15
16
  from .Instruments import Instruments
16
17
 
17
18
 
18
19
  class PayiInstrumentor:
20
+ estimated_prompt_tokens: str = "estimated_prompt_tokens"
21
+
19
22
  def __init__(
20
23
  self,
21
24
  payi: Union[Payi, AsyncPayi, None] = None,
@@ -204,11 +207,12 @@ class PayiInstrumentor:
204
207
  self,
205
208
  category: str,
206
209
  process_chunk: Callable[[Any, IngestUnitsParams], None],
210
+ process_request: Optional[Callable[[IngestUnitsParams, Any], None]],
207
211
  process_synchronous_response: Optional[Callable[[Any, IngestUnitsParams, bool], None]],
208
212
  wrapped: Any,
209
213
  instance: Any,
210
214
  args: Any,
211
- kwargs: Any,
215
+ kwargs: 'dict[str, Any]',
212
216
  ) -> Any:
213
217
  context = self.get_context()
214
218
 
@@ -226,7 +230,7 @@ class PayiInstrumentor:
226
230
 
227
231
  return wrapped(*args, **kwargs)
228
232
 
229
- ingest: IngestUnitsParams = {"category": category, "resource": kwargs.get("model"), "units": {}}
233
+ ingest: IngestUnitsParams = {"category": category, "resource": kwargs.get("model"), "units": {}} # type: ignore
230
234
 
231
235
  # blocked_limit = next((limit for limit in (context.get('limit_ids') or []) if limit in self._blocked_limits), None)
232
236
  # if blocked_limit:
@@ -235,8 +239,10 @@ class PayiInstrumentor:
235
239
  # f_back excludes the current frame, strip() cleans up whitespace and newlines
236
240
  stack = [frame.strip() for frame in traceback.format_stack(current_frame.f_back)] # type: ignore
237
241
 
238
- # TODO add back once feature is in prod
239
- # ingest['properties'] = { 'system.stack_trace': json.dumps(stack) }
242
+ ingest['properties'] = { 'system.stack_trace': json.dumps(stack) }
243
+
244
+ if process_request:
245
+ process_request(ingest, kwargs)
240
246
 
241
247
  sw = Stopwatch()
242
248
  stream = kwargs.get("stream", False)
@@ -354,6 +360,17 @@ class PayiInstrumentor:
354
360
  if experience_id is not None:
355
361
  extra_headers["xProxy-Experience-ID"] = experience_id
356
362
 
363
+ @staticmethod
364
+ def update_for_vision(input: int, units: 'dict[str, Units]') -> int:
365
+ if PayiInstrumentor.estimated_prompt_tokens in units:
366
+ prompt_token_estimate: int = units.pop(PayiInstrumentor.estimated_prompt_tokens)["input"] # type: ignore
367
+ vision = input - prompt_token_estimate
368
+ if (vision > 0):
369
+ units["vision"] = Units(input=vision, output=0)
370
+ input = prompt_token_estimate
371
+
372
+ return input
373
+
357
374
  @staticmethod
358
375
  def payi_wrapper(func: Any) -> Any:
359
376
  def _payi_wrapper(o: Any) -> Any:
payi/resources/ingest.py CHANGED
@@ -24,8 +24,6 @@ from .._response import (
24
24
  )
25
25
  from .._base_client import make_request_options
26
26
  from ..types.ingest_response import IngestResponse
27
- from ..types.ingest_event_param import IngestEventParam
28
- from ..types.bulk_ingest_response import BulkIngestResponse
29
27
  from ..types.pay_i_common_models_api_router_header_info_param import PayICommonModelsAPIRouterHeaderInfoParam
30
28
 
31
29
  __all__ = ["IngestResource", "AsyncIngestResource"]
@@ -51,41 +49,6 @@ class IngestResource(SyncAPIResource):
51
49
  """
52
50
  return IngestResourceWithStreamingResponse(self)
53
51
 
54
- def bulk(
55
- self,
56
- *,
57
- events: Iterable[IngestEventParam],
58
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
59
- # The extra values given here take precedence over values defined on the client or passed to this method.
60
- extra_headers: Headers | None = None,
61
- extra_query: Query | None = None,
62
- extra_body: Body | None = None,
63
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
64
- ) -> BulkIngestResponse:
65
- """
66
- Bulk Ingest
67
-
68
- Args:
69
-
70
- items (Iterable[IngestUnitsParams]): The items to ingest
71
-
72
- extra_headers: Send extra headers
73
-
74
- extra_query: Add additional query parameters to the request
75
-
76
- extra_body: Add additional JSON properties to the request
77
-
78
- timeout: Override the client-level default timeout for this request, in seconds
79
- """
80
- return self._post(
81
- "/api/v1/ingest/bulk",
82
- body=maybe_transform(events, Iterable[IngestEventParam]),
83
- options=make_request_options(
84
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
85
- ),
86
- cast_to=BulkIngestResponse,
87
- )
88
-
89
52
  def units(
90
53
  self,
91
54
  *,
@@ -237,40 +200,6 @@ class AsyncIngestResource(AsyncAPIResource):
237
200
  """
238
201
  return AsyncIngestResourceWithStreamingResponse(self)
239
202
 
240
- async def bulk(
241
- self,
242
- *,
243
- events: Iterable[IngestEventParam],
244
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
245
- # The extra values given here take precedence over values defined on the client or passed to this method.
246
- extra_headers: Headers | None = None,
247
- extra_query: Query | None = None,
248
- extra_body: Body | None = None,
249
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
250
- ) -> BulkIngestResponse:
251
- """
252
- Bulk Ingest
253
-
254
- Args:
255
- items (Iterable[IngestUnitsParams]): The items to ingest
256
-
257
- extra_headers: Send extra headers
258
-
259
- extra_query: Add additional query parameters to the request
260
-
261
- extra_body: Add additional JSON properties to the request
262
-
263
- timeout: Override the client-level default timeout for this request, in seconds
264
- """
265
- return await self._post(
266
- "/api/v1/ingest/bulk",
267
- body=await async_maybe_transform(events, Iterable[IngestEventParam]),
268
- options=make_request_options(
269
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
270
- ),
271
- cast_to=BulkIngestResponse,
272
- )
273
-
274
203
  async def units(
275
204
  self,
276
205
  *,
@@ -405,9 +334,6 @@ class IngestResourceWithRawResponse:
405
334
  def __init__(self, ingest: IngestResource) -> None:
406
335
  self._ingest = ingest
407
336
 
408
- self.bulk = to_raw_response_wrapper(
409
- ingest.bulk,
410
- )
411
337
  self.units = to_raw_response_wrapper(
412
338
  ingest.units,
413
339
  )
@@ -417,9 +343,6 @@ class AsyncIngestResourceWithRawResponse:
417
343
  def __init__(self, ingest: AsyncIngestResource) -> None:
418
344
  self._ingest = ingest
419
345
 
420
- self.bulk = async_to_raw_response_wrapper(
421
- ingest.bulk,
422
- )
423
346
  self.units = async_to_raw_response_wrapper(
424
347
  ingest.units,
425
348
  )
@@ -429,9 +352,6 @@ class IngestResourceWithStreamingResponse:
429
352
  def __init__(self, ingest: IngestResource) -> None:
430
353
  self._ingest = ingest
431
354
 
432
- self.bulk = to_streamed_response_wrapper(
433
- ingest.bulk,
434
- )
435
355
  self.units = to_streamed_response_wrapper(
436
356
  ingest.units,
437
357
  )
@@ -441,9 +361,6 @@ class AsyncIngestResourceWithStreamingResponse:
441
361
  def __init__(self, ingest: AsyncIngestResource) -> None:
442
362
  self._ingest = ingest
443
363
 
444
- self.bulk = async_to_streamed_response_wrapper(
445
- ingest.bulk,
446
- )
447
364
  self.units = async_to_streamed_response_wrapper(
448
365
  ingest.units,
449
366
  )
payi/types/__init__.py CHANGED
@@ -15,13 +15,10 @@ from .default_response import DefaultResponse as DefaultResponse
15
15
  from .paged_limit_list import PagedLimitList as PagedLimitList
16
16
  from .category_response import CategoryResponse as CategoryResponse
17
17
  from .limit_list_params import LimitListParams as LimitListParams
18
- from .ingest_bulk_params import IngestBulkParams as IngestBulkParams
19
- from .ingest_event_param import IngestEventParam as IngestEventParam
20
18
  from .limit_reset_params import LimitResetParams as LimitResetParams
21
19
  from .ingest_units_params import IngestUnitsParams as IngestUnitsParams
22
20
  from .limit_create_params import LimitCreateParams as LimitCreateParams
23
21
  from .limit_update_params import LimitUpdateParams as LimitUpdateParams
24
- from .bulk_ingest_response import BulkIngestResponse as BulkIngestResponse
25
22
  from .category_list_response import CategoryListResponse as CategoryListResponse
26
23
  from .limit_history_response import LimitHistoryResponse as LimitHistoryResponse
27
24
  from .category_delete_response import CategoryDeleteResponse as CategoryDeleteResponse
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: payi
3
- Version: 0.1.0a38
3
+ Version: 0.1.0a40
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
@@ -27,6 +27,7 @@ Requires-Dist: distro<2,>=1.7.0
27
27
  Requires-Dist: httpx<1,>=0.23.0
28
28
  Requires-Dist: pydantic<3,>=1.9.0
29
29
  Requires-Dist: sniffio
30
+ Requires-Dist: tiktoken>=0.8.0
30
31
  Requires-Dist: typing-extensions<5,>=4.10
31
32
  Requires-Dist: wrapt>=1.17.2
32
33
  Description-Content-Type: text/markdown
@@ -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=uhFgvjXGv4Bcm_dtpDLj6GUOkYi8xP6Mz9Ctz2H_Lqc,165
14
+ payi/_version.py,sha256=70Q3C2mH_Y5XHCDAYiBgNkVy3fyBDWf8eUqRwndh9Zc,165
15
15
  payi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  payi/_utils/__init__.py,sha256=PNZ_QJuzZEgyYXqkO1HVhGkj5IU9bglVUcw7H-Knjzw,2062
17
17
  payi/_utils/_logs.py,sha256=fmnf5D9TOgkgZKfgYmSa3PiUc3SZgkchn6CzJUeo0SQ,768
@@ -23,15 +23,15 @@ payi/_utils/_transform.py,sha256=Dkkyr7OveGmOolepcvXmVJWE3kqim4b0nM0h7yWbgeY,134
23
23
  payi/_utils/_typing.py,sha256=nTJz0jcrQbEgxwy4TtAkNxuU0QHHlmc6mQtA6vIR8tg,4501
24
24
  payi/_utils/_utils.py,sha256=8UmbPOy_AAr2uUjjFui-VZSrVBHRj6bfNEKRp5YZP2A,12004
25
25
  payi/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
26
- payi/lib/AnthropicInstrumentor.py,sha256=aJDG90CeOmPNPq49UXm4yc59hoI1zVI406fNGeT_n8U,3149
26
+ payi/lib/AnthropicInstrumentor.py,sha256=XMLr8BIrBo7U3VPBnhyp9Wj-icZmu0MGVvvyDPmlF4c,4549
27
27
  payi/lib/Instruments.py,sha256=cyL2jxjpRluP9rN8Vn1nmVXq2NNLdZuFIsHMQWWqat4,115
28
- payi/lib/OpenAIInstrumentor.py,sha256=eABTqxFLP109fOto33rBbXLh0FdQPh0a9VoMG4d6zGo,2575
28
+ payi/lib/OpenAIInstrumentor.py,sha256=G3H8s1bNnq-LECAHjCkQDTG59pwnLPXKQKlQbhqgs4k,3998
29
29
  payi/lib/Stopwatch.py,sha256=vFyGVRvkppamP7W0IuZyypKLMIaqjhB7fcRG0dNyfnQ,757
30
30
  payi/lib/helpers.py,sha256=ZgkY8UE2YRc7ok2Pmxg_T9UMqKI8D8542JY3CP8RZCM,1597
31
- payi/lib/instrument.py,sha256=Ds49BFxqWnUMezL1tRr1IPBbb8rejDrjyi6t4YO9rCU,19549
31
+ payi/lib/instrument.py,sha256=rLSwXRQZkTmMpWGpTzgZ42_4BOxJjGrTR3hwpF8XHro,20279
32
32
  payi/resources/__init__.py,sha256=isHGXSl9kOrZDduKrX3UenTwrdTpuKJVBjw6NYSBV20,3592
33
33
  payi/resources/billing_models.py,sha256=5w3RfGXtGlyq5vbTw6hQrx1UlzRBtlq8ArcFlf5e3TY,20152
34
- payi/resources/ingest.py,sha256=JPtO7foPsftAgG92kSgU29_yOJSYuvIQtQB8WpRZuoQ,18567
34
+ payi/resources/ingest.py,sha256=SvQspsYled4_ErOZKzVtazBIk0tUC1e34Lw8qw4SNEM,15484
35
35
  payi/resources/price_modifiers.py,sha256=t-k2F_zf2FhoxiqDHAPBPvhSgTjewlJqh50y58FNMuw,13475
36
36
  payi/resources/categories/__init__.py,sha256=w5gMiPdBSzJA_qfoVtFBElaoe8wGf_O63R7R1Spr6Gk,1093
37
37
  payi/resources/categories/categories.py,sha256=FohmajDcadMXzhG3Z1HKGkbSImO7rhzQ0olZXHz8z48,16074
@@ -49,12 +49,11 @@ payi/resources/requests/__init__.py,sha256=k7ipgDb5QXAv7WYhgQq0-6Zn9INJikMzRGexu
49
49
  payi/resources/requests/properties.py,sha256=ZsUeTMKQB4PNXn-jeoRwG-fqwpXzkRQyrFB8GmaNiQg,6466
50
50
  payi/resources/requests/requests.py,sha256=uxfdUe_mNmG5kzHTa4YcS5m2wwIc5h__YSx54LfiLWQ,4840
51
51
  payi/resources/requests/result.py,sha256=dEIwYEi_p36t_hErr_V1E2hmBLLgopcLnIReAWT8ygk,6161
52
- payi/types/__init__.py,sha256=WZhGgB9kGD48NljvFFu3TeLhA_PKqDdMUsnxvSKxhc4,2854
52
+ payi/types/__init__.py,sha256=a_uGQ-yPLCCjeyJRE4xAzI_0MjoKkuIoRMQXuSEL8VI,2641
53
53
  payi/types/billing_model.py,sha256=zwpKldc0WvS3iGKtDb9KvfxCd3lkv8F4TwFy3ciGMXg,639
54
54
  payi/types/billing_model_create_params.py,sha256=iVvmCcw0VxXGI_0YolknD3gmDH2lXVydU1dg2IY4dC4,547
55
55
  payi/types/billing_model_list_response.py,sha256=hOFjJPQAKiWEArZeZwd8e1lDi5e41zbN6NvV_1rzJeM,290
56
56
  payi/types/billing_model_update_params.py,sha256=NHNxDUZyYeYEroSyUx8eVh-kyY2YUo3jfRI-eMx2QAY,547
57
- payi/types/bulk_ingest_response.py,sha256=78J3vlL7muZx9Z20H--UkvM8P19g0cDL9SZoHy7XM68,1330
58
57
  payi/types/category_delete_resource_response.py,sha256=PLz4wZA1XMpS9SUYB_j4hEw5EoZ0VVE9Ll-MQ26SAfc,339
59
58
  payi/types/category_delete_response.py,sha256=exq8rNDGoq2-YN528V8osdcmuptJ-k63rmCvPMm6hLA,323
60
59
  payi/types/category_list_resources_response.py,sha256=n0DxY7N3Iftwfl0lUEx5v55V0kxbOX0EgjXlEfJtYRQ,337
@@ -65,8 +64,6 @@ payi/types/cost_data.py,sha256=1i842P25SBy2sB3OWGj9LO_mMKtzmyUPBrqY_mSw01o,488
65
64
  payi/types/cost_details.py,sha256=w9p79opEG3kcsjkRRP7niaMcUswdfB4Y7HCkVTcQ1zQ,307
66
65
  payi/types/default_response.py,sha256=o617LpRsCIZHCZxAc5nVI2JQ3HPGZo4gCDvSDkxkIJ8,270
67
66
  payi/types/experience_instance_response.py,sha256=N07MH6hjs1ISHLVpR2FG-u4awsZ_GGi97UNMXAWV1yA,296
68
- payi/types/ingest_bulk_params.py,sha256=d76YwiXaNeltLS3w86ZxLzTKGa7ymGLJDSelaMQGf8Y,382
69
- payi/types/ingest_event_param.py,sha256=wA9YuiQceNL3veHO_rVuKZg9o-EB1WLoz0aaF6Wcm-k,1498
70
67
  payi/types/ingest_response.py,sha256=KZfsgUhC942QkkjDFMqjJwCRoO2vkXv-Sx3X_xjijfg,1449
71
68
  payi/types/ingest_units_params.py,sha256=0s_j6268ZmeXDw9lQ_HKLldA_EvNyPcOxM6kFxLwxkA,1749
72
69
  payi/types/limit_create_params.py,sha256=Av8oMCxlKH7VB2MtYN5-25rAjqDDTPHjsXIQ2xubmck,549
@@ -112,7 +109,7 @@ payi/types/requests/request_result.py,sha256=phYQiqhwNaR9igP-Fhs34Y-__dlT7L4wq-r
112
109
  payi/types/shared/__init__.py,sha256=-xz5dxK5LBjLnsi2LpLq5btaGDFp-mSjJ0y2qKy0Yus,264
113
110
  payi/types/shared/evaluation_response.py,sha256=ejEToMA57PUu1SldEtJ5z9r4fAO3U0tvdjbsyIoVX1s,214
114
111
  payi/types/shared/pay_i_common_models_budget_management_cost_details_base.py,sha256=XmIzJXy4zAi-mfrDvEXiYjO3qF1EvugGUl-Gijj4TA4,268
115
- payi-0.1.0a38.dist-info/METADATA,sha256=5g142UgydrzpGRqyttKbGlDCw-CUXaxsAfKnhw1r7I8,12594
116
- payi-0.1.0a38.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
117
- payi-0.1.0a38.dist-info/licenses/LICENSE,sha256=CQt03aM-P4a3Yg5qBg3JSLVoQS3smMyvx7tYg_6V7Gk,11334
118
- payi-0.1.0a38.dist-info/RECORD,,
112
+ payi-0.1.0a40.dist-info/METADATA,sha256=qTLzlfTKFZ8cEWce30AegO7WzqqjejiYc6kJi3SqYN8,12625
113
+ payi-0.1.0a40.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
114
+ payi-0.1.0a40.dist-info/licenses/LICENSE,sha256=CQt03aM-P4a3Yg5qBg3JSLVoQS3smMyvx7tYg_6V7Gk,11334
115
+ payi-0.1.0a40.dist-info/RECORD,,
@@ -1,51 +0,0 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- from typing import List, Optional
4
- from datetime import datetime
5
-
6
- from pydantic import Field as FieldInfo
7
-
8
- from .._models import BaseModel
9
-
10
- __all__ = ["BulkIngestResponse", "Error", "ErrorXproxyResult", "ErrorXproxyResultXproxyError"]
11
-
12
-
13
- class ErrorXproxyResultXproxyError(BaseModel):
14
- code: Optional[str] = None
15
-
16
- message: Optional[str] = None
17
-
18
-
19
- class ErrorXproxyResult(BaseModel):
20
- message: str
21
-
22
- status_code: int = FieldInfo(alias="statusCode")
23
-
24
- xproxy_error: Optional[ErrorXproxyResultXproxyError] = None
25
-
26
-
27
- class Error(BaseModel):
28
- item_index: Optional[int] = None
29
-
30
- xproxy_result: Optional[ErrorXproxyResult] = None
31
- """
32
- Represents an generic error that occurred as a result of processing a request.
33
- APIM returns an (not customizable) error response body of { "statusCode",
34
- "message" } and this class matches this schema. Derived classes may add
35
- additional required fields if these classes are specified as produced as a
36
- return type specific endpoints.
37
- """
38
-
39
-
40
- class BulkIngestResponse(BaseModel):
41
- ingest_count: int
42
-
43
- ingest_timestamp: datetime
44
-
45
- request_id: str
46
-
47
- error_count: Optional[int] = None
48
-
49
- errors: Optional[List[Error]] = None
50
-
51
- total_count: Optional[int] = None
@@ -1,14 +0,0 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- from __future__ import annotations
4
-
5
- from typing import Iterable
6
- from typing_extensions import Required, TypedDict
7
-
8
- from .ingest_event_param import IngestEventParam
9
-
10
- __all__ = ["IngestBulkParams"]
11
-
12
-
13
- class IngestBulkParams(TypedDict, total=False):
14
- events: Required[Iterable[IngestEventParam]]
@@ -1,60 +0,0 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- from __future__ import annotations
4
-
5
- from typing import Dict, List, Union, Iterable, Optional
6
- from datetime import datetime
7
- from typing_extensions import Required, Annotated, TypedDict
8
-
9
- from .._utils import PropertyInfo
10
- from .pay_i_common_models_api_router_header_info_param import PayICommonModelsAPIRouterHeaderInfoParam
11
-
12
- __all__ = ["IngestEventParam", "Units"]
13
-
14
-
15
- class Units(TypedDict, total=False):
16
- input: int
17
-
18
- output: int
19
-
20
-
21
- class IngestEventParam(TypedDict, total=False):
22
- category: Required[str]
23
-
24
- resource: Required[str]
25
-
26
- units: Required[Dict[str, Units]]
27
-
28
- csat_rating: Optional[int]
29
-
30
- end_to_end_latency_ms: Optional[int]
31
-
32
- event_timestamp: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
33
-
34
- experience_id: Optional[str]
35
-
36
- experience_name: Optional[str]
37
-
38
- experience_properties: Optional[Dict[str, str]]
39
-
40
- http_status_code: Optional[int]
41
-
42
- limit_ids: Optional[List[str]]
43
-
44
- properties: Optional[Dict[str, str]]
45
-
46
- provider_request_headers: Optional[Iterable[PayICommonModelsAPIRouterHeaderInfoParam]]
47
-
48
- provider_request_json: Optional[str]
49
-
50
- provider_response_headers: Optional[Iterable[PayICommonModelsAPIRouterHeaderInfoParam]]
51
-
52
- provider_response_json: Union[str, List[str], None]
53
-
54
- provider_uri: Optional[str]
55
-
56
- request_tags: Optional[List[str]]
57
-
58
- time_to_first_token_ms: Optional[int]
59
-
60
- user_id: Optional[str]