payi 0.1.0a52__py3-none-any.whl → 0.1.0a55__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/_base_client.py +9 -98
- payi/_client.py +2 -2
- payi/_models.py +5 -2
- payi/_version.py +1 -1
- payi/lib/helpers.py +12 -1
- payi/resources/ingest.py +50 -8
- payi/types/ingest_bulk_params.py +2 -2
- {payi-0.1.0a52.dist-info → payi-0.1.0a55.dist-info}/METADATA +26 -5
- {payi-0.1.0a52.dist-info → payi-0.1.0a55.dist-info}/RECORD +11 -11
- {payi-0.1.0a52.dist-info → payi-0.1.0a55.dist-info}/WHEEL +1 -1
- {payi-0.1.0a52.dist-info → payi-0.1.0a55.dist-info}/licenses/LICENSE +0 -0
payi/_base_client.py
CHANGED
|
@@ -9,7 +9,6 @@ import asyncio
|
|
|
9
9
|
import inspect
|
|
10
10
|
import logging
|
|
11
11
|
import platform
|
|
12
|
-
import warnings
|
|
13
12
|
import email.utils
|
|
14
13
|
from types import TracebackType
|
|
15
14
|
from random import random
|
|
@@ -36,7 +35,7 @@ import anyio
|
|
|
36
35
|
import httpx
|
|
37
36
|
import distro
|
|
38
37
|
import pydantic
|
|
39
|
-
from httpx import URL
|
|
38
|
+
from httpx import URL
|
|
40
39
|
from pydantic import PrivateAttr
|
|
41
40
|
|
|
42
41
|
from . import _exceptions
|
|
@@ -51,19 +50,16 @@ from ._types import (
|
|
|
51
50
|
Timeout,
|
|
52
51
|
NotGiven,
|
|
53
52
|
ResponseT,
|
|
54
|
-
Transport,
|
|
55
53
|
AnyMapping,
|
|
56
54
|
PostParser,
|
|
57
|
-
ProxiesTypes,
|
|
58
55
|
RequestFiles,
|
|
59
56
|
HttpxSendArgs,
|
|
60
|
-
AsyncTransport,
|
|
61
57
|
RequestOptions,
|
|
62
58
|
HttpxRequestFiles,
|
|
63
59
|
ModelBuilderProtocol,
|
|
64
60
|
)
|
|
65
61
|
from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping
|
|
66
|
-
from ._compat import model_copy, model_dump
|
|
62
|
+
from ._compat import PYDANTIC_V2, model_copy, model_dump
|
|
67
63
|
from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type
|
|
68
64
|
from ._response import (
|
|
69
65
|
APIResponse,
|
|
@@ -207,6 +203,9 @@ class BaseSyncPage(BasePage[_T], Generic[_T]):
|
|
|
207
203
|
model: Type[_T],
|
|
208
204
|
options: FinalRequestOptions,
|
|
209
205
|
) -> None:
|
|
206
|
+
if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
|
|
207
|
+
self.__pydantic_private__ = {}
|
|
208
|
+
|
|
210
209
|
self._model = model
|
|
211
210
|
self._client = client
|
|
212
211
|
self._options = options
|
|
@@ -292,6 +291,9 @@ class BaseAsyncPage(BasePage[_T], Generic[_T]):
|
|
|
292
291
|
client: AsyncAPIClient,
|
|
293
292
|
options: FinalRequestOptions,
|
|
294
293
|
) -> None:
|
|
294
|
+
if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
|
|
295
|
+
self.__pydantic_private__ = {}
|
|
296
|
+
|
|
295
297
|
self._model = model
|
|
296
298
|
self._client = client
|
|
297
299
|
self._options = options
|
|
@@ -331,9 +333,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
331
333
|
_base_url: URL
|
|
332
334
|
max_retries: int
|
|
333
335
|
timeout: Union[float, Timeout, None]
|
|
334
|
-
_limits: httpx.Limits
|
|
335
|
-
_proxies: ProxiesTypes | None
|
|
336
|
-
_transport: Transport | AsyncTransport | None
|
|
337
336
|
_strict_response_validation: bool
|
|
338
337
|
_idempotency_header: str | None
|
|
339
338
|
_default_stream_cls: type[_DefaultStreamT] | None = None
|
|
@@ -346,9 +345,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
346
345
|
_strict_response_validation: bool,
|
|
347
346
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
348
347
|
timeout: float | Timeout | None = DEFAULT_TIMEOUT,
|
|
349
|
-
limits: httpx.Limits,
|
|
350
|
-
transport: Transport | AsyncTransport | None,
|
|
351
|
-
proxies: ProxiesTypes | None,
|
|
352
348
|
custom_headers: Mapping[str, str] | None = None,
|
|
353
349
|
custom_query: Mapping[str, object] | None = None,
|
|
354
350
|
) -> None:
|
|
@@ -356,9 +352,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
356
352
|
self._base_url = self._enforce_trailing_slash(URL(base_url))
|
|
357
353
|
self.max_retries = max_retries
|
|
358
354
|
self.timeout = timeout
|
|
359
|
-
self._limits = limits
|
|
360
|
-
self._proxies = proxies
|
|
361
|
-
self._transport = transport
|
|
362
355
|
self._custom_headers = custom_headers or {}
|
|
363
356
|
self._custom_query = custom_query or {}
|
|
364
357
|
self._strict_response_validation = _strict_response_validation
|
|
@@ -518,7 +511,7 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
518
511
|
# so that passing a `TypedDict` doesn't cause an error.
|
|
519
512
|
# https://github.com/microsoft/pyright/issues/3526#event-6715453066
|
|
520
513
|
params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None,
|
|
521
|
-
json=json_data,
|
|
514
|
+
json=json_data if is_given(json_data) else None,
|
|
522
515
|
files=files,
|
|
523
516
|
**kwargs,
|
|
524
517
|
)
|
|
@@ -794,46 +787,11 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
794
787
|
base_url: str | URL,
|
|
795
788
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
796
789
|
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
|
|
797
|
-
transport: Transport | None = None,
|
|
798
|
-
proxies: ProxiesTypes | None = None,
|
|
799
|
-
limits: Limits | None = None,
|
|
800
790
|
http_client: httpx.Client | None = None,
|
|
801
791
|
custom_headers: Mapping[str, str] | None = None,
|
|
802
792
|
custom_query: Mapping[str, object] | None = None,
|
|
803
793
|
_strict_response_validation: bool,
|
|
804
794
|
) -> None:
|
|
805
|
-
kwargs: dict[str, Any] = {}
|
|
806
|
-
if limits is not None:
|
|
807
|
-
warnings.warn(
|
|
808
|
-
"The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
|
|
809
|
-
category=DeprecationWarning,
|
|
810
|
-
stacklevel=3,
|
|
811
|
-
)
|
|
812
|
-
if http_client is not None:
|
|
813
|
-
raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`")
|
|
814
|
-
else:
|
|
815
|
-
limits = DEFAULT_CONNECTION_LIMITS
|
|
816
|
-
|
|
817
|
-
if transport is not None:
|
|
818
|
-
kwargs["transport"] = transport
|
|
819
|
-
warnings.warn(
|
|
820
|
-
"The `transport` argument is deprecated. The `http_client` argument should be passed instead",
|
|
821
|
-
category=DeprecationWarning,
|
|
822
|
-
stacklevel=3,
|
|
823
|
-
)
|
|
824
|
-
if http_client is not None:
|
|
825
|
-
raise ValueError("The `http_client` argument is mutually exclusive with `transport`")
|
|
826
|
-
|
|
827
|
-
if proxies is not None:
|
|
828
|
-
kwargs["proxies"] = proxies
|
|
829
|
-
warnings.warn(
|
|
830
|
-
"The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
|
|
831
|
-
category=DeprecationWarning,
|
|
832
|
-
stacklevel=3,
|
|
833
|
-
)
|
|
834
|
-
if http_client is not None:
|
|
835
|
-
raise ValueError("The `http_client` argument is mutually exclusive with `proxies`")
|
|
836
|
-
|
|
837
795
|
if not is_given(timeout):
|
|
838
796
|
# if the user passed in a custom http client with a non-default
|
|
839
797
|
# timeout set then we use that timeout.
|
|
@@ -854,12 +812,9 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
854
812
|
|
|
855
813
|
super().__init__(
|
|
856
814
|
version=version,
|
|
857
|
-
limits=limits,
|
|
858
815
|
# cast to a valid type because mypy doesn't understand our type narrowing
|
|
859
816
|
timeout=cast(Timeout, timeout),
|
|
860
|
-
proxies=proxies,
|
|
861
817
|
base_url=base_url,
|
|
862
|
-
transport=transport,
|
|
863
818
|
max_retries=max_retries,
|
|
864
819
|
custom_query=custom_query,
|
|
865
820
|
custom_headers=custom_headers,
|
|
@@ -869,9 +824,6 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
869
824
|
base_url=base_url,
|
|
870
825
|
# cast to a valid type because mypy doesn't understand our type narrowing
|
|
871
826
|
timeout=cast(Timeout, timeout),
|
|
872
|
-
limits=limits,
|
|
873
|
-
follow_redirects=True,
|
|
874
|
-
**kwargs, # type: ignore
|
|
875
827
|
)
|
|
876
828
|
|
|
877
829
|
def is_closed(self) -> bool:
|
|
@@ -1366,45 +1318,10 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1366
1318
|
_strict_response_validation: bool,
|
|
1367
1319
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
1368
1320
|
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
|
|
1369
|
-
transport: AsyncTransport | None = None,
|
|
1370
|
-
proxies: ProxiesTypes | None = None,
|
|
1371
|
-
limits: Limits | None = None,
|
|
1372
1321
|
http_client: httpx.AsyncClient | None = None,
|
|
1373
1322
|
custom_headers: Mapping[str, str] | None = None,
|
|
1374
1323
|
custom_query: Mapping[str, object] | None = None,
|
|
1375
1324
|
) -> None:
|
|
1376
|
-
kwargs: dict[str, Any] = {}
|
|
1377
|
-
if limits is not None:
|
|
1378
|
-
warnings.warn(
|
|
1379
|
-
"The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
|
|
1380
|
-
category=DeprecationWarning,
|
|
1381
|
-
stacklevel=3,
|
|
1382
|
-
)
|
|
1383
|
-
if http_client is not None:
|
|
1384
|
-
raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`")
|
|
1385
|
-
else:
|
|
1386
|
-
limits = DEFAULT_CONNECTION_LIMITS
|
|
1387
|
-
|
|
1388
|
-
if transport is not None:
|
|
1389
|
-
kwargs["transport"] = transport
|
|
1390
|
-
warnings.warn(
|
|
1391
|
-
"The `transport` argument is deprecated. The `http_client` argument should be passed instead",
|
|
1392
|
-
category=DeprecationWarning,
|
|
1393
|
-
stacklevel=3,
|
|
1394
|
-
)
|
|
1395
|
-
if http_client is not None:
|
|
1396
|
-
raise ValueError("The `http_client` argument is mutually exclusive with `transport`")
|
|
1397
|
-
|
|
1398
|
-
if proxies is not None:
|
|
1399
|
-
kwargs["proxies"] = proxies
|
|
1400
|
-
warnings.warn(
|
|
1401
|
-
"The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
|
|
1402
|
-
category=DeprecationWarning,
|
|
1403
|
-
stacklevel=3,
|
|
1404
|
-
)
|
|
1405
|
-
if http_client is not None:
|
|
1406
|
-
raise ValueError("The `http_client` argument is mutually exclusive with `proxies`")
|
|
1407
|
-
|
|
1408
1325
|
if not is_given(timeout):
|
|
1409
1326
|
# if the user passed in a custom http client with a non-default
|
|
1410
1327
|
# timeout set then we use that timeout.
|
|
@@ -1426,11 +1343,8 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1426
1343
|
super().__init__(
|
|
1427
1344
|
version=version,
|
|
1428
1345
|
base_url=base_url,
|
|
1429
|
-
limits=limits,
|
|
1430
1346
|
# cast to a valid type because mypy doesn't understand our type narrowing
|
|
1431
1347
|
timeout=cast(Timeout, timeout),
|
|
1432
|
-
proxies=proxies,
|
|
1433
|
-
transport=transport,
|
|
1434
1348
|
max_retries=max_retries,
|
|
1435
1349
|
custom_query=custom_query,
|
|
1436
1350
|
custom_headers=custom_headers,
|
|
@@ -1440,9 +1354,6 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1440
1354
|
base_url=base_url,
|
|
1441
1355
|
# cast to a valid type because mypy doesn't understand our type narrowing
|
|
1442
1356
|
timeout=cast(Timeout, timeout),
|
|
1443
|
-
limits=limits,
|
|
1444
|
-
follow_redirects=True,
|
|
1445
|
-
**kwargs, # type: ignore
|
|
1446
1357
|
)
|
|
1447
1358
|
|
|
1448
1359
|
def is_closed(self) -> bool:
|
payi/_client.py
CHANGED
|
@@ -77,7 +77,7 @@ class Payi(SyncAPIClient):
|
|
|
77
77
|
# part of our public interface in the future.
|
|
78
78
|
_strict_response_validation: bool = False,
|
|
79
79
|
) -> None:
|
|
80
|
-
"""Construct a new synchronous
|
|
80
|
+
"""Construct a new synchronous Payi client instance.
|
|
81
81
|
|
|
82
82
|
This automatically infers the `api_key` argument from the `PAYI_API_KEY` environment variable if it is not provided.
|
|
83
83
|
"""
|
|
@@ -257,7 +257,7 @@ class AsyncPayi(AsyncAPIClient):
|
|
|
257
257
|
# part of our public interface in the future.
|
|
258
258
|
_strict_response_validation: bool = False,
|
|
259
259
|
) -> None:
|
|
260
|
-
"""Construct a new async
|
|
260
|
+
"""Construct a new async AsyncPayi client instance.
|
|
261
261
|
|
|
262
262
|
This automatically infers the `api_key` argument from the `PAYI_API_KEY` environment variable if it is not provided.
|
|
263
263
|
"""
|
payi/_models.py
CHANGED
|
@@ -65,7 +65,7 @@ from ._compat import (
|
|
|
65
65
|
from ._constants import RAW_RESPONSE_HEADER
|
|
66
66
|
|
|
67
67
|
if TYPE_CHECKING:
|
|
68
|
-
from pydantic_core.core_schema import ModelField, LiteralSchema, ModelFieldsSchema
|
|
68
|
+
from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema
|
|
69
69
|
|
|
70
70
|
__all__ = ["BaseModel", "GenericModel"]
|
|
71
71
|
|
|
@@ -646,15 +646,18 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,
|
|
|
646
646
|
|
|
647
647
|
def _extract_field_schema_pv2(model: type[BaseModel], field_name: str) -> ModelField | None:
|
|
648
648
|
schema = model.__pydantic_core_schema__
|
|
649
|
+
if schema["type"] == "definitions":
|
|
650
|
+
schema = schema["schema"]
|
|
651
|
+
|
|
649
652
|
if schema["type"] != "model":
|
|
650
653
|
return None
|
|
651
654
|
|
|
655
|
+
schema = cast("ModelSchema", schema)
|
|
652
656
|
fields_schema = schema["schema"]
|
|
653
657
|
if fields_schema["type"] != "model-fields":
|
|
654
658
|
return None
|
|
655
659
|
|
|
656
660
|
fields_schema = cast("ModelFieldsSchema", fields_schema)
|
|
657
|
-
|
|
658
661
|
field = fields_schema["fields"].get(field_name)
|
|
659
662
|
if not field:
|
|
660
663
|
return None
|
payi/_version.py
CHANGED
payi/lib/helpers.py
CHANGED
|
@@ -7,6 +7,9 @@ class PayiHeaderNames:
|
|
|
7
7
|
request_tags:str = "xProxy-Request-Tags"
|
|
8
8
|
experience_id:str = "xProxy-Experience-ID"
|
|
9
9
|
experience_name:str = "xProxy-Experience-Name"
|
|
10
|
+
use_case_id:str = "xProxy-UseCase-ID"
|
|
11
|
+
use_case_name:str = "xProxy-UseCase-Name"
|
|
12
|
+
use_case_version:str = "xProxy-UseCase-Version"
|
|
10
13
|
user_id:str = "xProxy-User-ID"
|
|
11
14
|
route_as_resource:str = "xProxy-RouteAs-Resource"
|
|
12
15
|
provider_base_uri = "xProxy-Provider-BaseUri"
|
|
@@ -42,6 +45,9 @@ def create_headers(
|
|
|
42
45
|
user_id: Union[str, None] = None,
|
|
43
46
|
experience_id: Union[str, None] = None,
|
|
44
47
|
experience_name: Union[str, None] = None,
|
|
48
|
+
use_case_id: Union[str, None] = None,
|
|
49
|
+
use_case_name: Union[str, None] = None,
|
|
50
|
+
use_case_version: Union[str, None] = None,
|
|
45
51
|
) -> Dict[str, str]:
|
|
46
52
|
headers: Dict[str, str] = {}
|
|
47
53
|
|
|
@@ -55,7 +61,12 @@ def create_headers(
|
|
|
55
61
|
headers.update({ PayiHeaderNames.experience_id: experience_id})
|
|
56
62
|
if experience_name:
|
|
57
63
|
headers.update({ PayiHeaderNames.experience_name: experience_name})
|
|
58
|
-
|
|
64
|
+
if use_case_id:
|
|
65
|
+
headers.update({ PayiHeaderNames.use_case_id: use_case_id})
|
|
66
|
+
if use_case_name:
|
|
67
|
+
headers.update({ PayiHeaderNames.use_case_name: use_case_name})
|
|
68
|
+
if use_case_version:
|
|
69
|
+
headers.update({ PayiHeaderNames.use_case_version: use_case_version})
|
|
59
70
|
return headers
|
|
60
71
|
|
|
61
72
|
def payi_anthropic_url(payi_base_url: Union[str, None] = None) -> str:
|
payi/resources/ingest.py
CHANGED
|
@@ -54,7 +54,7 @@ class IngestResource(SyncAPIResource):
|
|
|
54
54
|
def bulk(
|
|
55
55
|
self,
|
|
56
56
|
*,
|
|
57
|
-
events: Iterable[IngestEventParam],
|
|
57
|
+
events: Iterable[IngestEventParam] | NotGiven = NOT_GIVEN,
|
|
58
58
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
59
59
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
60
60
|
extra_headers: Headers | None = None,
|
|
@@ -105,6 +105,9 @@ class IngestResource(SyncAPIResource):
|
|
|
105
105
|
request_tags: Optional[list[str]] | NotGiven = NOT_GIVEN,
|
|
106
106
|
experience_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
107
107
|
experience_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
108
|
+
use_case__id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
109
|
+
use_case_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
110
|
+
use_case_version: Optional[str] | NotGiven = NOT_GIVEN,
|
|
108
111
|
user_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
109
112
|
resource_scope: Optional[str] | NotGiven = NOT_GIVEN,
|
|
110
113
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -132,9 +135,15 @@ class IngestResource(SyncAPIResource):
|
|
|
132
135
|
|
|
133
136
|
request_tags (list[str], optional): The request tags to associate with the request. Defaults to None.
|
|
134
137
|
|
|
135
|
-
experience_name (str, optional):
|
|
138
|
+
experience_name (str, optional): DEPRECATED, replaced with use_case_name.
|
|
136
139
|
|
|
137
|
-
experience_id (str, optional):
|
|
140
|
+
experience_id (str, optional): DEPRECATED, replaced with use_case_id.
|
|
141
|
+
|
|
142
|
+
use_case_name (str, optional): The use case name
|
|
143
|
+
|
|
144
|
+
use_case_id (str, optional): The use case instance id
|
|
145
|
+
|
|
146
|
+
use_case_version (str, optional): The use case instance version
|
|
138
147
|
|
|
139
148
|
user_id (str, optional): The user id
|
|
140
149
|
|
|
@@ -175,6 +184,15 @@ class IngestResource(SyncAPIResource):
|
|
|
175
184
|
if experience_id is None or isinstance(experience_id, NotGiven):
|
|
176
185
|
experience_id = NOT_GIVEN
|
|
177
186
|
|
|
187
|
+
if use_case_name is None or isinstance(use_case_name, NotGiven):
|
|
188
|
+
use_case_name = NOT_GIVEN
|
|
189
|
+
|
|
190
|
+
if use_case__id is None or isinstance(use_case__id, NotGiven):
|
|
191
|
+
use_case__id = NOT_GIVEN
|
|
192
|
+
|
|
193
|
+
if use_case_version is None or isinstance(use_case_version, NotGiven):
|
|
194
|
+
use_case_version = NOT_GIVEN
|
|
195
|
+
|
|
178
196
|
if user_id is None or isinstance(user_id, NotGiven):
|
|
179
197
|
user_id = NOT_GIVEN
|
|
180
198
|
|
|
@@ -183,7 +201,10 @@ class IngestResource(SyncAPIResource):
|
|
|
183
201
|
"xProxy-Limit-IDs": valid_ids_str,
|
|
184
202
|
"xProxy-Request-Tags": valid_tags_str,
|
|
185
203
|
"xProxy-Experience-Name": experience_name,
|
|
186
|
-
"xProxy-Experience-
|
|
204
|
+
"xProxy-Experience-ID": experience_id,
|
|
205
|
+
"xProxy-UseCase-ID": use_case__id,
|
|
206
|
+
"xProxy-UseCase-Name": use_case_name,
|
|
207
|
+
"xProxy-UseCase-Version": use_case_version,
|
|
187
208
|
"xProxy-User-ID": user_id,
|
|
188
209
|
"xProxy-Resource-Scope": resource_scope,
|
|
189
210
|
}).items() if value is not None}, # Ensure no 'None' values are included
|
|
@@ -242,7 +263,7 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
242
263
|
async def bulk(
|
|
243
264
|
self,
|
|
244
265
|
*,
|
|
245
|
-
events: Iterable[IngestEventParam],
|
|
266
|
+
events: Iterable[IngestEventParam] | NotGiven = NOT_GIVEN,
|
|
246
267
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
247
268
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
248
269
|
extra_headers: Headers | None = None,
|
|
@@ -293,6 +314,9 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
293
314
|
request_tags: Optional[list[str]] | NotGiven = NOT_GIVEN,
|
|
294
315
|
experience_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
295
316
|
experience_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
317
|
+
use_case_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
318
|
+
use_case_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
319
|
+
use_case_version: Optional[str] | NotGiven = NOT_GIVEN,
|
|
296
320
|
user_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
297
321
|
resource_scope: Union[str, None] | NotGiven = NOT_GIVEN,
|
|
298
322
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -319,9 +343,15 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
319
343
|
|
|
320
344
|
request_tags (list[str], optional): The request tags to associate with the request. Defaults to None.
|
|
321
345
|
|
|
322
|
-
experience_name (str, optional):
|
|
346
|
+
experience_name (str, optional): DEPRECATED, replaced with use_case_name.
|
|
347
|
+
|
|
348
|
+
experience_id (str, optional): DEPRECATED, replaced with use_case_id.
|
|
323
349
|
|
|
324
|
-
|
|
350
|
+
use_case_name (str, optional): The use case name
|
|
351
|
+
|
|
352
|
+
use_case_id (str, optional): The use case instance id
|
|
353
|
+
|
|
354
|
+
use_case_version (str, optional): The use case instance version
|
|
325
355
|
|
|
326
356
|
user_id (str, optional): The user id
|
|
327
357
|
|
|
@@ -362,6 +392,15 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
362
392
|
if experience_id is None or isinstance(experience_id, NotGiven):
|
|
363
393
|
experience_id = NOT_GIVEN
|
|
364
394
|
|
|
395
|
+
if use_case_name is None or isinstance(use_case_name, NotGiven):
|
|
396
|
+
use_case_name = NOT_GIVEN
|
|
397
|
+
|
|
398
|
+
if use_case_id is None or isinstance(use_case_id, NotGiven):
|
|
399
|
+
use_case_id = NOT_GIVEN
|
|
400
|
+
|
|
401
|
+
if use_case_version is None or isinstance(use_case_version, NotGiven):
|
|
402
|
+
use_case_version = NOT_GIVEN
|
|
403
|
+
|
|
365
404
|
if user_id is None or isinstance(user_id, NotGiven):
|
|
366
405
|
user_id = NOT_GIVEN
|
|
367
406
|
|
|
@@ -370,7 +409,10 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
370
409
|
"xProxy-Limit-IDs": valid_ids_str,
|
|
371
410
|
"xProxy-Request-Tags": valid_tags_str,
|
|
372
411
|
"xProxy-Experience-Name": experience_name,
|
|
373
|
-
"xProxy-Experience-
|
|
412
|
+
"xProxy-Experience-ID": experience_id,
|
|
413
|
+
"xProxy-UseCase-ID": use_case_id,
|
|
414
|
+
"xProxy-UseCase-Name": use_case_name,
|
|
415
|
+
"xProxy-UseCase-Version": use_case_version,
|
|
374
416
|
"xProxy-User-ID": user_id,
|
|
375
417
|
"xProxy-Resource-Scope": resource_scope,
|
|
376
418
|
}).items() if value is not None}, # Ensure no 'None' values are included
|
payi/types/ingest_bulk_params.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from typing import Iterable
|
|
6
|
-
from typing_extensions import
|
|
6
|
+
from typing_extensions import TypedDict
|
|
7
7
|
|
|
8
8
|
from .ingest_event_param import IngestEventParam
|
|
9
9
|
|
|
@@ -11,4 +11,4 @@ __all__ = ["IngestBulkParams"]
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class IngestBulkParams(TypedDict, total=False):
|
|
14
|
-
events:
|
|
14
|
+
events: Iterable[IngestEventParam]
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: payi
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.0a55
|
|
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
|
|
7
7
|
Author-email: Payi <support@payi.com>
|
|
8
|
-
License
|
|
9
|
-
License-File: LICENSE
|
|
8
|
+
License: Apache-2.0
|
|
10
9
|
Classifier: Intended Audience :: Developers
|
|
11
10
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
11
|
Classifier: Operating System :: MacOS
|
|
@@ -41,7 +40,7 @@ The Payi Python library provides convenient access to the Payi REST API from any
|
|
|
41
40
|
application. The library includes type definitions for all request params and response fields,
|
|
42
41
|
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
|
|
43
42
|
|
|
44
|
-
It is generated with [Stainless](https://www.
|
|
43
|
+
It is generated with [Stainless](https://www.stainless.com/).
|
|
45
44
|
|
|
46
45
|
## Documentation
|
|
47
46
|
|
|
@@ -114,6 +113,28 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
|
|
|
114
113
|
|
|
115
114
|
Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
|
|
116
115
|
|
|
116
|
+
## Nested params
|
|
117
|
+
|
|
118
|
+
Nested parameters are dictionaries, typed using `TypedDict`, for example:
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
from payi import Payi
|
|
122
|
+
|
|
123
|
+
client = Payi()
|
|
124
|
+
|
|
125
|
+
experience_type = client.experiences.types.create(
|
|
126
|
+
description="x",
|
|
127
|
+
name="x",
|
|
128
|
+
limit_config={
|
|
129
|
+
"max": 0,
|
|
130
|
+
"limit_tags": ["tag1", "tag2"],
|
|
131
|
+
"limit_type": "block",
|
|
132
|
+
"threshold": 0,
|
|
133
|
+
},
|
|
134
|
+
)
|
|
135
|
+
print(experience_type.limit_config)
|
|
136
|
+
```
|
|
137
|
+
|
|
117
138
|
## Handling errors
|
|
118
139
|
|
|
119
140
|
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `payi.APIConnectionError` is raised.
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
payi/__init__.py,sha256=_eeZx9fx2Wp81adXh7qrpkmXCso7TiRSvIlLkQ0sQhY,2399
|
|
2
|
-
payi/_base_client.py,sha256=
|
|
3
|
-
payi/_client.py,sha256=
|
|
2
|
+
payi/_base_client.py,sha256=FSXF70qmWK3orED-9NeOewTYHYhnDt5gu_MYEyGJ8Bs,64955
|
|
3
|
+
payi/_client.py,sha256=nYlt5NMJwXhptCNSf_VTDGIcMCJuMQG132qzaEt89UM,18765
|
|
4
4
|
payi/_compat.py,sha256=VWemUKbj6DDkQ-O4baSpHVLJafotzeXmCQGJugfVTIw,6580
|
|
5
5
|
payi/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
|
|
6
6
|
payi/_exceptions.py,sha256=ItygKNrNXIVY0H6LsGVZvFuAHB3Vtm_VZXmWzCnpHy0,3216
|
|
7
7
|
payi/_files.py,sha256=mf4dOgL4b0ryyZlbqLhggD3GVgDf6XxdGFAgce01ugE,3549
|
|
8
|
-
payi/_models.py,sha256=
|
|
8
|
+
payi/_models.py,sha256=CTC-fpbbGneROztxHX-PkLntPt1ZMmwDqoKY9VAIOVg,29071
|
|
9
9
|
payi/_qs.py,sha256=AOkSz4rHtK4YI3ZU_kzea-zpwBUgEY8WniGmTPyEimc,4846
|
|
10
10
|
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=
|
|
14
|
+
payi/_version.py,sha256=HlY_HgqJYNFrsl-DGWIwr-cTqd3cRZgDOmEmSaA4KUw,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
|
|
@@ -27,11 +27,11 @@ payi/lib/AnthropicInstrumentor.py,sha256=h-yebG7r7cSRVM_utva55Gc4BVcoW6WGrQrDg55
|
|
|
27
27
|
payi/lib/BedrockInstrumentor.py,sha256=4WSZLzLHMv-5U1OFr0ZErESNHTyPHn0kHATUw4HTDkQ,10072
|
|
28
28
|
payi/lib/OpenAIInstrumentor.py,sha256=ZUu-Byhz7AXhvxjOMdX8tB2JOpM5sCj0KnyRB49lQg0,6881
|
|
29
29
|
payi/lib/Stopwatch.py,sha256=7OJlxvr2Jyb6Zr1LYCYKczRB7rDVKkIR7gc4YoleNdE,764
|
|
30
|
-
payi/lib/helpers.py,sha256=
|
|
30
|
+
payi/lib/helpers.py,sha256=uQyxbKvf9ISI44haZNYvLJO5_yndqPc1n61yQJhFJSg,3524
|
|
31
31
|
payi/lib/instrument.py,sha256=Fk-Vh9NEhfp6UNaTAkkEgL5Kiq7nFPDwUT-EuzCMF5Y,37443
|
|
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=
|
|
34
|
+
payi/resources/ingest.py,sha256=dOaJjKiX8Hkr0j79OlnQdgPcDCaOzKluel0tRaQvTSs,21076
|
|
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
|
|
@@ -65,7 +65,7 @@ payi/types/cost_data.py,sha256=1i842P25SBy2sB3OWGj9LO_mMKtzmyUPBrqY_mSw01o,488
|
|
|
65
65
|
payi/types/cost_details.py,sha256=w9p79opEG3kcsjkRRP7niaMcUswdfB4Y7HCkVTcQ1zQ,307
|
|
66
66
|
payi/types/default_response.py,sha256=o617LpRsCIZHCZxAc5nVI2JQ3HPGZo4gCDvSDkxkIJ8,270
|
|
67
67
|
payi/types/experience_instance_response.py,sha256=N07MH6hjs1ISHLVpR2FG-u4awsZ_GGi97UNMXAWV1yA,296
|
|
68
|
-
payi/types/ingest_bulk_params.py,sha256=
|
|
68
|
+
payi/types/ingest_bulk_params.py,sha256=A-IRb39d2tmVzEQqrvhlF_3si-9ufHBKYLlvdXupAHU,362
|
|
69
69
|
payi/types/ingest_event_param.py,sha256=1-pr5wMiWXAGDqBmQHKdpHJy0Fk9vOQl7XTGLtcjtdI,1507
|
|
70
70
|
payi/types/ingest_response.py,sha256=KZfsgUhC942QkkjDFMqjJwCRoO2vkXv-Sx3X_xjijfg,1449
|
|
71
71
|
payi/types/ingest_units_params.py,sha256=QrfkSW-tFDKpn8cPbbyAOhM17W1prC-aJeXMFeGiqJI,1884
|
|
@@ -112,7 +112,7 @@ payi/types/requests/request_result.py,sha256=phYQiqhwNaR9igP-Fhs34Y-__dlT7L4wq-r
|
|
|
112
112
|
payi/types/shared/__init__.py,sha256=-xz5dxK5LBjLnsi2LpLq5btaGDFp-mSjJ0y2qKy0Yus,264
|
|
113
113
|
payi/types/shared/evaluation_response.py,sha256=ejEToMA57PUu1SldEtJ5z9r4fAO3U0tvdjbsyIoVX1s,214
|
|
114
114
|
payi/types/shared/pay_i_common_models_budget_management_cost_details_base.py,sha256=XmIzJXy4zAi-mfrDvEXiYjO3qF1EvugGUl-Gijj4TA4,268
|
|
115
|
-
payi-0.1.
|
|
116
|
-
payi-0.1.
|
|
117
|
-
payi-0.1.
|
|
118
|
-
payi-0.1.
|
|
115
|
+
payi-0.1.0a55.dist-info/METADATA,sha256=1OSHvH0apTw-a9nyEbF3KkJAn9l_4XfilRfeB_aXOCE,13035
|
|
116
|
+
payi-0.1.0a55.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
117
|
+
payi-0.1.0a55.dist-info/licenses/LICENSE,sha256=CQt03aM-P4a3Yg5qBg3JSLVoQS3smMyvx7tYg_6V7Gk,11334
|
|
118
|
+
payi-0.1.0a55.dist-info/RECORD,,
|
|
File without changes
|