samplehc 0.13.0__py3-none-any.whl → 0.15.0__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.
- samplehc/_base_client.py +8 -2
- samplehc/_client.py +105 -29
- samplehc/_models.py +37 -15
- samplehc/_streaming.py +12 -12
- samplehc/_types.py +3 -2
- samplehc/_utils/_sync.py +3 -31
- samplehc/_utils/_utils.py +1 -1
- samplehc/_version.py +1 -1
- samplehc/resources/v2/__init__.py +0 -28
- samplehc/resources/v2/documents/documents.py +8 -0
- samplehc/resources/v2/integrations/__init__.py +14 -0
- samplehc/resources/v2/integrations/integrations.py +32 -0
- samplehc/resources/v2/integrations/wellsky/__init__.py +33 -0
- samplehc/resources/v2/integrations/wellsky/patients.py +324 -0
- samplehc/resources/v2/integrations/wellsky/wellsky.py +102 -0
- samplehc/resources/v2/tasks/tasks.py +12 -3
- samplehc/resources/v2/v2.py +0 -64
- samplehc/types/v1_query_audit_logs_response.py +4 -0
- samplehc/types/v2/__init__.py +0 -2
- samplehc/types/v2/clearinghouse/claim_submit_response.py +5 -0
- samplehc/types/v2/clearinghouse/payer_list_response.py +2 -0
- samplehc/types/v2/clearinghouse/payer_search_response.py +2 -0
- samplehc/types/v2/clearinghouse_check_eligibility_response.py +4 -0
- samplehc/types/v2/clearinghouse_run_discovery_response.py +2 -0
- samplehc/types/v2/communication_send_fax_params.py +2 -0
- samplehc/types/v2/communication_send_fax_response.py +2 -0
- samplehc/types/v2/communication_send_letter_params.py +8 -0
- samplehc/types/v2/communication_send_letter_response.py +2 -0
- samplehc/types/v2/database_execute_sql_response.py +2 -0
- samplehc/types/v2/document_classify_params.py +2 -0
- samplehc/types/v2/document_classify_response.py +2 -0
- samplehc/types/v2/document_combine_response.py +4 -0
- samplehc/types/v2/document_create_from_splits_params.py +2 -0
- samplehc/types/v2/document_create_from_splits_response.py +2 -0
- samplehc/types/v2/document_extract_params.py +40 -3
- samplehc/types/v2/document_extract_response.py +2 -0
- samplehc/types/v2/document_generate_csv_response.py +4 -0
- samplehc/types/v2/document_presigned_upload_url_response.py +2 -0
- samplehc/types/v2/document_retrieve_csv_content_response.py +2 -0
- samplehc/types/v2/document_retrieve_metadata_response.py +2 -0
- samplehc/types/v2/document_search_response.py +2 -0
- samplehc/types/v2/document_split_params.py +2 -0
- samplehc/types/v2/document_split_response.py +2 -0
- samplehc/types/v2/documents/format_create_pdf_response.py +2 -0
- samplehc/types/v2/documents/legacy_extract_response.py +2 -0
- samplehc/types/v2/documents/legacy_reason_response.py +2 -0
- samplehc/types/v2/documents/legacy_split_params.py +2 -0
- samplehc/types/v2/documents/legacy_split_response.py +2 -0
- samplehc/types/v2/documents/pdf_template_retrieve_metadata_response.py +2 -0
- samplehc/types/v2/documents/template_render_document_response.py +2 -0
- samplehc/types/v2/hie/document_upload_params.py +2 -0
- samplehc/types/v2/integrations/glidian/prior_authorization_create_draft_response.py +2 -0
- samplehc/types/v2/integrations/glidian/prior_authorization_retrieve_record_response.py +2 -0
- samplehc/types/v2/integrations/glidian/prior_authorization_submit_response.py +2 -0
- samplehc/types/v2/integrations/glidian/prior_authorization_update_record_response.py +2 -0
- samplehc/types/v2/integrations/glidian/prior_authorizations/clinical_question_list_response.py +2 -0
- samplehc/types/v2/integrations/glidian/prior_authorizations/clinical_question_update_response.py +2 -0
- samplehc/types/v2/integrations/kno2/message_get_attachment_response.py +2 -0
- samplehc/types/v2/integrations/kno2/message_retrieve_response.py +2 -0
- samplehc/types/v2/integrations/wellsky/__init__.py +6 -0
- samplehc/types/v2/integrations/wellsky/patient_add_params.py +13 -0
- samplehc/types/v2/integrations/wellsky/patient_search_params.py +32 -0
- samplehc/types/v2/policy_list_companies_response.py +2 -0
- samplehc/types/v2/policy_list_plans_response.py +2 -0
- samplehc/types/v2/policy_list_response.py +2 -0
- samplehc/types/v2/policy_retrieve_presigned_url_response.py +2 -0
- samplehc/types/v2/policy_retrieve_text_response.py +2 -0
- samplehc/types/v2/task_cancel_response.py +2 -0
- samplehc/types/v2/task_complete_response.py +2 -0
- samplehc/types/v2/task_update_column_params.py +6 -3
- samplehc/types/v2/workflow_run_resume_when_complete_response.py +2 -0
- samplehc/types/v2/workflow_run_retrieve_response.py +2 -0
- samplehc/types/v2/workflow_runs/step_get_output_response.py +2 -0
- samplehc/types/v2/workflow_start_response.py +2 -0
- {samplehc-0.13.0.dist-info → samplehc-0.15.0.dist-info}/METADATA +8 -7
- {samplehc-0.13.0.dist-info → samplehc-0.15.0.dist-info}/RECORD +78 -91
- {samplehc-0.13.0.dist-info → samplehc-0.15.0.dist-info}/licenses/LICENSE +1 -1
- samplehc/resources/v2/browser_agents/__init__.py +0 -33
- samplehc/resources/v2/browser_agents/browser_agents.py +0 -209
- samplehc/resources/v2/browser_agents/runs/__init__.py +0 -33
- samplehc/resources/v2/browser_agents/runs/help_requests.py +0 -191
- samplehc/resources/v2/browser_agents/runs/runs.py +0 -233
- samplehc/resources/v2/browser_automation/__init__.py +0 -33
- samplehc/resources/v2/browser_automation/availity.py +0 -249
- samplehc/resources/v2/browser_automation/browser_automation.py +0 -102
- samplehc/types/v2/browser_agent_invoke_params.py +0 -13
- samplehc/types/v2/browser_agent_invoke_response.py +0 -15
- samplehc/types/v2/browser_agents/__init__.py +0 -6
- samplehc/types/v2/browser_agents/run_list_events_params.py +0 -15
- samplehc/types/v2/browser_agents/run_list_events_response.py +0 -30
- samplehc/types/v2/browser_agents/runs/__init__.py +0 -6
- samplehc/types/v2/browser_agents/runs/help_request_resolve_params.py +0 -18
- samplehc/types/v2/browser_agents/runs/help_request_resolve_response.py +0 -28
- samplehc/types/v2/browser_automation/__init__.py +0 -6
- samplehc/types/v2/browser_automation/availity_submit_appeal_params.py +0 -59
- samplehc/types/v2/browser_automation/availity_submit_appeal_response.py +0 -12
- {samplehc-0.13.0.dist-info → samplehc-0.15.0.dist-info}/WHEEL +0 -0
samplehc/_base_client.py
CHANGED
|
@@ -1247,9 +1247,12 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
1247
1247
|
*,
|
|
1248
1248
|
cast_to: Type[ResponseT],
|
|
1249
1249
|
body: Body | None = None,
|
|
1250
|
+
files: RequestFiles | None = None,
|
|
1250
1251
|
options: RequestOptions = {},
|
|
1251
1252
|
) -> ResponseT:
|
|
1252
|
-
opts = FinalRequestOptions.construct(
|
|
1253
|
+
opts = FinalRequestOptions.construct(
|
|
1254
|
+
method="patch", url=path, json_data=body, files=to_httpx_files(files), **options
|
|
1255
|
+
)
|
|
1253
1256
|
return self.request(cast_to, opts)
|
|
1254
1257
|
|
|
1255
1258
|
def put(
|
|
@@ -1767,9 +1770,12 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1767
1770
|
*,
|
|
1768
1771
|
cast_to: Type[ResponseT],
|
|
1769
1772
|
body: Body | None = None,
|
|
1773
|
+
files: RequestFiles | None = None,
|
|
1770
1774
|
options: RequestOptions = {},
|
|
1771
1775
|
) -> ResponseT:
|
|
1772
|
-
opts = FinalRequestOptions.construct(
|
|
1776
|
+
opts = FinalRequestOptions.construct(
|
|
1777
|
+
method="patch", url=path, json_data=body, files=await async_to_httpx_files(files), **options
|
|
1778
|
+
)
|
|
1773
1779
|
return await self.request(cast_to, opts)
|
|
1774
1780
|
|
|
1775
1781
|
async def put(
|
samplehc/_client.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import os
|
|
6
|
-
from typing import Any, Mapping
|
|
6
|
+
from typing import TYPE_CHECKING, Any, Mapping
|
|
7
7
|
from typing_extensions import Self, override
|
|
8
8
|
|
|
9
9
|
import httpx
|
|
@@ -21,6 +21,7 @@ from ._types import (
|
|
|
21
21
|
not_given,
|
|
22
22
|
)
|
|
23
23
|
from ._utils import is_given, get_async_library
|
|
24
|
+
from ._compat import cached_property
|
|
24
25
|
from ._version import __version__
|
|
25
26
|
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
|
|
26
27
|
from ._exceptions import APIStatusError
|
|
@@ -29,8 +30,11 @@ from ._base_client import (
|
|
|
29
30
|
SyncAPIClient,
|
|
30
31
|
AsyncAPIClient,
|
|
31
32
|
)
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
|
|
34
|
+
if TYPE_CHECKING:
|
|
35
|
+
from .resources import v1, v2
|
|
36
|
+
from .resources.v1.v1 import V1Resource, AsyncV1Resource
|
|
37
|
+
from .resources.v2.v2 import V2Resource, AsyncV2Resource
|
|
34
38
|
|
|
35
39
|
__all__ = [
|
|
36
40
|
"Timeout",
|
|
@@ -45,11 +49,6 @@ __all__ = [
|
|
|
45
49
|
|
|
46
50
|
|
|
47
51
|
class SampleHealthcare(SyncAPIClient):
|
|
48
|
-
v1: v1.V1Resource
|
|
49
|
-
v2: v2.V2Resource
|
|
50
|
-
with_raw_response: SampleHealthcareWithRawResponse
|
|
51
|
-
with_streaming_response: SampleHealthcareWithStreamedResponse
|
|
52
|
-
|
|
53
52
|
# client options
|
|
54
53
|
api_key: str | None
|
|
55
54
|
|
|
@@ -100,10 +99,25 @@ class SampleHealthcare(SyncAPIClient):
|
|
|
100
99
|
_strict_response_validation=_strict_response_validation,
|
|
101
100
|
)
|
|
102
101
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
@cached_property
|
|
103
|
+
def v1(self) -> V1Resource:
|
|
104
|
+
from .resources.v1 import V1Resource
|
|
105
|
+
|
|
106
|
+
return V1Resource(self)
|
|
107
|
+
|
|
108
|
+
@cached_property
|
|
109
|
+
def v2(self) -> V2Resource:
|
|
110
|
+
from .resources.v2 import V2Resource
|
|
111
|
+
|
|
112
|
+
return V2Resource(self)
|
|
113
|
+
|
|
114
|
+
@cached_property
|
|
115
|
+
def with_raw_response(self) -> SampleHealthcareWithRawResponse:
|
|
116
|
+
return SampleHealthcareWithRawResponse(self)
|
|
117
|
+
|
|
118
|
+
@cached_property
|
|
119
|
+
def with_streaming_response(self) -> SampleHealthcareWithStreamedResponse:
|
|
120
|
+
return SampleHealthcareWithStreamedResponse(self)
|
|
107
121
|
|
|
108
122
|
@property
|
|
109
123
|
@override
|
|
@@ -224,11 +238,6 @@ class SampleHealthcare(SyncAPIClient):
|
|
|
224
238
|
|
|
225
239
|
|
|
226
240
|
class AsyncSampleHealthcare(AsyncAPIClient):
|
|
227
|
-
v1: v1.AsyncV1Resource
|
|
228
|
-
v2: v2.AsyncV2Resource
|
|
229
|
-
with_raw_response: AsyncSampleHealthcareWithRawResponse
|
|
230
|
-
with_streaming_response: AsyncSampleHealthcareWithStreamedResponse
|
|
231
|
-
|
|
232
241
|
# client options
|
|
233
242
|
api_key: str | None
|
|
234
243
|
|
|
@@ -279,10 +288,25 @@ class AsyncSampleHealthcare(AsyncAPIClient):
|
|
|
279
288
|
_strict_response_validation=_strict_response_validation,
|
|
280
289
|
)
|
|
281
290
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
291
|
+
@cached_property
|
|
292
|
+
def v1(self) -> AsyncV1Resource:
|
|
293
|
+
from .resources.v1 import AsyncV1Resource
|
|
294
|
+
|
|
295
|
+
return AsyncV1Resource(self)
|
|
296
|
+
|
|
297
|
+
@cached_property
|
|
298
|
+
def v2(self) -> AsyncV2Resource:
|
|
299
|
+
from .resources.v2 import AsyncV2Resource
|
|
300
|
+
|
|
301
|
+
return AsyncV2Resource(self)
|
|
302
|
+
|
|
303
|
+
@cached_property
|
|
304
|
+
def with_raw_response(self) -> AsyncSampleHealthcareWithRawResponse:
|
|
305
|
+
return AsyncSampleHealthcareWithRawResponse(self)
|
|
306
|
+
|
|
307
|
+
@cached_property
|
|
308
|
+
def with_streaming_response(self) -> AsyncSampleHealthcareWithStreamedResponse:
|
|
309
|
+
return AsyncSampleHealthcareWithStreamedResponse(self)
|
|
286
310
|
|
|
287
311
|
@property
|
|
288
312
|
@override
|
|
@@ -403,27 +427,79 @@ class AsyncSampleHealthcare(AsyncAPIClient):
|
|
|
403
427
|
|
|
404
428
|
|
|
405
429
|
class SampleHealthcareWithRawResponse:
|
|
430
|
+
_client: SampleHealthcare
|
|
431
|
+
|
|
406
432
|
def __init__(self, client: SampleHealthcare) -> None:
|
|
407
|
-
self.
|
|
408
|
-
|
|
433
|
+
self._client = client
|
|
434
|
+
|
|
435
|
+
@cached_property
|
|
436
|
+
def v1(self) -> v1.V1ResourceWithRawResponse:
|
|
437
|
+
from .resources.v1 import V1ResourceWithRawResponse
|
|
438
|
+
|
|
439
|
+
return V1ResourceWithRawResponse(self._client.v1)
|
|
440
|
+
|
|
441
|
+
@cached_property
|
|
442
|
+
def v2(self) -> v2.V2ResourceWithRawResponse:
|
|
443
|
+
from .resources.v2 import V2ResourceWithRawResponse
|
|
444
|
+
|
|
445
|
+
return V2ResourceWithRawResponse(self._client.v2)
|
|
409
446
|
|
|
410
447
|
|
|
411
448
|
class AsyncSampleHealthcareWithRawResponse:
|
|
449
|
+
_client: AsyncSampleHealthcare
|
|
450
|
+
|
|
412
451
|
def __init__(self, client: AsyncSampleHealthcare) -> None:
|
|
413
|
-
self.
|
|
414
|
-
|
|
452
|
+
self._client = client
|
|
453
|
+
|
|
454
|
+
@cached_property
|
|
455
|
+
def v1(self) -> v1.AsyncV1ResourceWithRawResponse:
|
|
456
|
+
from .resources.v1 import AsyncV1ResourceWithRawResponse
|
|
457
|
+
|
|
458
|
+
return AsyncV1ResourceWithRawResponse(self._client.v1)
|
|
459
|
+
|
|
460
|
+
@cached_property
|
|
461
|
+
def v2(self) -> v2.AsyncV2ResourceWithRawResponse:
|
|
462
|
+
from .resources.v2 import AsyncV2ResourceWithRawResponse
|
|
463
|
+
|
|
464
|
+
return AsyncV2ResourceWithRawResponse(self._client.v2)
|
|
415
465
|
|
|
416
466
|
|
|
417
467
|
class SampleHealthcareWithStreamedResponse:
|
|
468
|
+
_client: SampleHealthcare
|
|
469
|
+
|
|
418
470
|
def __init__(self, client: SampleHealthcare) -> None:
|
|
419
|
-
self.
|
|
420
|
-
|
|
471
|
+
self._client = client
|
|
472
|
+
|
|
473
|
+
@cached_property
|
|
474
|
+
def v1(self) -> v1.V1ResourceWithStreamingResponse:
|
|
475
|
+
from .resources.v1 import V1ResourceWithStreamingResponse
|
|
476
|
+
|
|
477
|
+
return V1ResourceWithStreamingResponse(self._client.v1)
|
|
478
|
+
|
|
479
|
+
@cached_property
|
|
480
|
+
def v2(self) -> v2.V2ResourceWithStreamingResponse:
|
|
481
|
+
from .resources.v2 import V2ResourceWithStreamingResponse
|
|
482
|
+
|
|
483
|
+
return V2ResourceWithStreamingResponse(self._client.v2)
|
|
421
484
|
|
|
422
485
|
|
|
423
486
|
class AsyncSampleHealthcareWithStreamedResponse:
|
|
487
|
+
_client: AsyncSampleHealthcare
|
|
488
|
+
|
|
424
489
|
def __init__(self, client: AsyncSampleHealthcare) -> None:
|
|
425
|
-
self.
|
|
426
|
-
|
|
490
|
+
self._client = client
|
|
491
|
+
|
|
492
|
+
@cached_property
|
|
493
|
+
def v1(self) -> v1.AsyncV1ResourceWithStreamingResponse:
|
|
494
|
+
from .resources.v1 import AsyncV1ResourceWithStreamingResponse
|
|
495
|
+
|
|
496
|
+
return AsyncV1ResourceWithStreamingResponse(self._client.v1)
|
|
497
|
+
|
|
498
|
+
@cached_property
|
|
499
|
+
def v2(self) -> v2.AsyncV2ResourceWithStreamingResponse:
|
|
500
|
+
from .resources.v2 import AsyncV2ResourceWithStreamingResponse
|
|
501
|
+
|
|
502
|
+
return AsyncV2ResourceWithStreamingResponse(self._client.v2)
|
|
427
503
|
|
|
428
504
|
|
|
429
505
|
Client = SampleHealthcare
|
samplehc/_models.py
CHANGED
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
4
|
import inspect
|
|
5
|
+
import weakref
|
|
5
6
|
from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast
|
|
6
7
|
from datetime import date, datetime
|
|
7
8
|
from typing_extensions import (
|
|
@@ -256,15 +257,16 @@ class BaseModel(pydantic.BaseModel):
|
|
|
256
257
|
mode: Literal["json", "python"] | str = "python",
|
|
257
258
|
include: IncEx | None = None,
|
|
258
259
|
exclude: IncEx | None = None,
|
|
260
|
+
context: Any | None = None,
|
|
259
261
|
by_alias: bool | None = None,
|
|
260
262
|
exclude_unset: bool = False,
|
|
261
263
|
exclude_defaults: bool = False,
|
|
262
264
|
exclude_none: bool = False,
|
|
265
|
+
exclude_computed_fields: bool = False,
|
|
263
266
|
round_trip: bool = False,
|
|
264
267
|
warnings: bool | Literal["none", "warn", "error"] = True,
|
|
265
|
-
context: dict[str, Any] | None = None,
|
|
266
|
-
serialize_as_any: bool = False,
|
|
267
268
|
fallback: Callable[[Any], Any] | None = None,
|
|
269
|
+
serialize_as_any: bool = False,
|
|
268
270
|
) -> dict[str, Any]:
|
|
269
271
|
"""Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump
|
|
270
272
|
|
|
@@ -272,16 +274,24 @@ class BaseModel(pydantic.BaseModel):
|
|
|
272
274
|
|
|
273
275
|
Args:
|
|
274
276
|
mode: The mode in which `to_python` should run.
|
|
275
|
-
If mode is 'json', the
|
|
276
|
-
If mode is 'python', the
|
|
277
|
-
include: A
|
|
278
|
-
exclude: A
|
|
277
|
+
If mode is 'json', the output will only contain JSON serializable types.
|
|
278
|
+
If mode is 'python', the output may contain non-JSON-serializable Python objects.
|
|
279
|
+
include: A set of fields to include in the output.
|
|
280
|
+
exclude: A set of fields to exclude from the output.
|
|
281
|
+
context: Additional context to pass to the serializer.
|
|
279
282
|
by_alias: Whether to use the field's alias in the dictionary key if defined.
|
|
280
|
-
exclude_unset: Whether to exclude fields that
|
|
281
|
-
exclude_defaults: Whether to exclude fields that are set to their default value
|
|
282
|
-
exclude_none: Whether to exclude fields that have a value of `None
|
|
283
|
-
|
|
284
|
-
|
|
283
|
+
exclude_unset: Whether to exclude fields that have not been explicitly set.
|
|
284
|
+
exclude_defaults: Whether to exclude fields that are set to their default value.
|
|
285
|
+
exclude_none: Whether to exclude fields that have a value of `None`.
|
|
286
|
+
exclude_computed_fields: Whether to exclude computed fields.
|
|
287
|
+
While this can be useful for round-tripping, it is usually recommended to use the dedicated
|
|
288
|
+
`round_trip` parameter instead.
|
|
289
|
+
round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T].
|
|
290
|
+
warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors,
|
|
291
|
+
"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError].
|
|
292
|
+
fallback: A function to call when an unknown value is encountered. If not provided,
|
|
293
|
+
a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised.
|
|
294
|
+
serialize_as_any: Whether to serialize fields with duck-typing serialization behavior.
|
|
285
295
|
|
|
286
296
|
Returns:
|
|
287
297
|
A dictionary representation of the model.
|
|
@@ -298,6 +308,8 @@ class BaseModel(pydantic.BaseModel):
|
|
|
298
308
|
raise ValueError("serialize_as_any is only supported in Pydantic v2")
|
|
299
309
|
if fallback is not None:
|
|
300
310
|
raise ValueError("fallback is only supported in Pydantic v2")
|
|
311
|
+
if exclude_computed_fields != False:
|
|
312
|
+
raise ValueError("exclude_computed_fields is only supported in Pydantic v2")
|
|
301
313
|
dumped = super().dict( # pyright: ignore[reportDeprecated]
|
|
302
314
|
include=include,
|
|
303
315
|
exclude=exclude,
|
|
@@ -314,15 +326,17 @@ class BaseModel(pydantic.BaseModel):
|
|
|
314
326
|
self,
|
|
315
327
|
*,
|
|
316
328
|
indent: int | None = None,
|
|
329
|
+
ensure_ascii: bool = False,
|
|
317
330
|
include: IncEx | None = None,
|
|
318
331
|
exclude: IncEx | None = None,
|
|
332
|
+
context: Any | None = None,
|
|
319
333
|
by_alias: bool | None = None,
|
|
320
334
|
exclude_unset: bool = False,
|
|
321
335
|
exclude_defaults: bool = False,
|
|
322
336
|
exclude_none: bool = False,
|
|
337
|
+
exclude_computed_fields: bool = False,
|
|
323
338
|
round_trip: bool = False,
|
|
324
339
|
warnings: bool | Literal["none", "warn", "error"] = True,
|
|
325
|
-
context: dict[str, Any] | None = None,
|
|
326
340
|
fallback: Callable[[Any], Any] | None = None,
|
|
327
341
|
serialize_as_any: bool = False,
|
|
328
342
|
) -> str:
|
|
@@ -354,6 +368,10 @@ class BaseModel(pydantic.BaseModel):
|
|
|
354
368
|
raise ValueError("serialize_as_any is only supported in Pydantic v2")
|
|
355
369
|
if fallback is not None:
|
|
356
370
|
raise ValueError("fallback is only supported in Pydantic v2")
|
|
371
|
+
if ensure_ascii != False:
|
|
372
|
+
raise ValueError("ensure_ascii is only supported in Pydantic v2")
|
|
373
|
+
if exclude_computed_fields != False:
|
|
374
|
+
raise ValueError("exclude_computed_fields is only supported in Pydantic v2")
|
|
357
375
|
return super().json( # type: ignore[reportDeprecated]
|
|
358
376
|
indent=indent,
|
|
359
377
|
include=include,
|
|
@@ -573,6 +591,9 @@ class CachedDiscriminatorType(Protocol):
|
|
|
573
591
|
__discriminator__: DiscriminatorDetails
|
|
574
592
|
|
|
575
593
|
|
|
594
|
+
DISCRIMINATOR_CACHE: weakref.WeakKeyDictionary[type, DiscriminatorDetails] = weakref.WeakKeyDictionary()
|
|
595
|
+
|
|
596
|
+
|
|
576
597
|
class DiscriminatorDetails:
|
|
577
598
|
field_name: str
|
|
578
599
|
"""The name of the discriminator field in the variant class, e.g.
|
|
@@ -615,8 +636,9 @@ class DiscriminatorDetails:
|
|
|
615
636
|
|
|
616
637
|
|
|
617
638
|
def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, ...]) -> DiscriminatorDetails | None:
|
|
618
|
-
|
|
619
|
-
|
|
639
|
+
cached = DISCRIMINATOR_CACHE.get(union)
|
|
640
|
+
if cached is not None:
|
|
641
|
+
return cached
|
|
620
642
|
|
|
621
643
|
discriminator_field_name: str | None = None
|
|
622
644
|
|
|
@@ -669,7 +691,7 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,
|
|
|
669
691
|
discriminator_field=discriminator_field_name,
|
|
670
692
|
discriminator_alias=discriminator_alias,
|
|
671
693
|
)
|
|
672
|
-
|
|
694
|
+
DISCRIMINATOR_CACHE.setdefault(union, details)
|
|
673
695
|
return details
|
|
674
696
|
|
|
675
697
|
|
samplehc/_streaming.py
CHANGED
|
@@ -54,12 +54,12 @@ class Stream(Generic[_T]):
|
|
|
54
54
|
process_data = self._client._process_response_data
|
|
55
55
|
iterator = self._iter_events()
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
try:
|
|
58
|
+
for sse in iterator:
|
|
59
|
+
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
|
|
60
|
+
finally:
|
|
61
|
+
# Ensure the response is closed even if the consumer doesn't read all data
|
|
62
|
+
response.close()
|
|
63
63
|
|
|
64
64
|
def __enter__(self) -> Self:
|
|
65
65
|
return self
|
|
@@ -118,12 +118,12 @@ class AsyncStream(Generic[_T]):
|
|
|
118
118
|
process_data = self._client._process_response_data
|
|
119
119
|
iterator = self._iter_events()
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
try:
|
|
122
|
+
async for sse in iterator:
|
|
123
|
+
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
|
|
124
|
+
finally:
|
|
125
|
+
# Ensure the response is closed even if the consumer doesn't read all data
|
|
126
|
+
await response.aclose()
|
|
127
127
|
|
|
128
128
|
async def __aenter__(self) -> Self:
|
|
129
129
|
return self
|
samplehc/_types.py
CHANGED
|
@@ -243,6 +243,9 @@ _T_co = TypeVar("_T_co", covariant=True)
|
|
|
243
243
|
if TYPE_CHECKING:
|
|
244
244
|
# This works because str.__contains__ does not accept object (either in typeshed or at runtime)
|
|
245
245
|
# https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285
|
|
246
|
+
#
|
|
247
|
+
# Note: index() and count() methods are intentionally omitted to allow pyright to properly
|
|
248
|
+
# infer TypedDict types when dict literals are used in lists assigned to SequenceNotStr.
|
|
246
249
|
class SequenceNotStr(Protocol[_T_co]):
|
|
247
250
|
@overload
|
|
248
251
|
def __getitem__(self, index: SupportsIndex, /) -> _T_co: ...
|
|
@@ -251,8 +254,6 @@ if TYPE_CHECKING:
|
|
|
251
254
|
def __contains__(self, value: object, /) -> bool: ...
|
|
252
255
|
def __len__(self) -> int: ...
|
|
253
256
|
def __iter__(self) -> Iterator[_T_co]: ...
|
|
254
|
-
def index(self, value: Any, start: int = 0, stop: int = ..., /) -> int: ...
|
|
255
|
-
def count(self, value: Any, /) -> int: ...
|
|
256
257
|
def __reversed__(self) -> Iterator[_T_co]: ...
|
|
257
258
|
else:
|
|
258
259
|
# just point this to a normal `Sequence` at runtime to avoid having to special case
|
samplehc/_utils/_sync.py
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import sys
|
|
4
3
|
import asyncio
|
|
5
4
|
import functools
|
|
6
|
-
import
|
|
7
|
-
from typing import Any, TypeVar, Callable, Awaitable
|
|
5
|
+
from typing import TypeVar, Callable, Awaitable
|
|
8
6
|
from typing_extensions import ParamSpec
|
|
9
7
|
|
|
10
8
|
import anyio
|
|
@@ -15,34 +13,11 @@ T_Retval = TypeVar("T_Retval")
|
|
|
15
13
|
T_ParamSpec = ParamSpec("T_ParamSpec")
|
|
16
14
|
|
|
17
15
|
|
|
18
|
-
if sys.version_info >= (3, 9):
|
|
19
|
-
_asyncio_to_thread = asyncio.to_thread
|
|
20
|
-
else:
|
|
21
|
-
# backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread
|
|
22
|
-
# for Python 3.8 support
|
|
23
|
-
async def _asyncio_to_thread(
|
|
24
|
-
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
|
|
25
|
-
) -> Any:
|
|
26
|
-
"""Asynchronously run function *func* in a separate thread.
|
|
27
|
-
|
|
28
|
-
Any *args and **kwargs supplied for this function are directly passed
|
|
29
|
-
to *func*. Also, the current :class:`contextvars.Context` is propagated,
|
|
30
|
-
allowing context variables from the main thread to be accessed in the
|
|
31
|
-
separate thread.
|
|
32
|
-
|
|
33
|
-
Returns a coroutine that can be awaited to get the eventual result of *func*.
|
|
34
|
-
"""
|
|
35
|
-
loop = asyncio.events.get_running_loop()
|
|
36
|
-
ctx = contextvars.copy_context()
|
|
37
|
-
func_call = functools.partial(ctx.run, func, *args, **kwargs)
|
|
38
|
-
return await loop.run_in_executor(None, func_call)
|
|
39
|
-
|
|
40
|
-
|
|
41
16
|
async def to_thread(
|
|
42
17
|
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
|
|
43
18
|
) -> T_Retval:
|
|
44
19
|
if sniffio.current_async_library() == "asyncio":
|
|
45
|
-
return await
|
|
20
|
+
return await asyncio.to_thread(func, *args, **kwargs)
|
|
46
21
|
|
|
47
22
|
return await anyio.to_thread.run_sync(
|
|
48
23
|
functools.partial(func, *args, **kwargs),
|
|
@@ -53,10 +28,7 @@ async def to_thread(
|
|
|
53
28
|
def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]:
|
|
54
29
|
"""
|
|
55
30
|
Take a blocking function and create an async one that receives the same
|
|
56
|
-
positional and keyword arguments.
|
|
57
|
-
asyncio.to_thread to run the function in a separate thread. For python version
|
|
58
|
-
3.8, it uses locally defined copy of the asyncio.to_thread function which was
|
|
59
|
-
introduced in python 3.9.
|
|
31
|
+
positional and keyword arguments.
|
|
60
32
|
|
|
61
33
|
Usage:
|
|
62
34
|
|
samplehc/_utils/_utils.py
CHANGED
|
@@ -133,7 +133,7 @@ def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]:
|
|
|
133
133
|
# Type safe methods for narrowing types with TypeVars.
|
|
134
134
|
# The default narrowing for isinstance(obj, dict) is dict[unknown, unknown],
|
|
135
135
|
# however this cause Pyright to rightfully report errors. As we know we don't
|
|
136
|
-
# care about the contained types we can safely use `object` in
|
|
136
|
+
# care about the contained types we can safely use `object` in its place.
|
|
137
137
|
#
|
|
138
138
|
# There are two separate functions defined, `is_*` and `is_*_t` for different use cases.
|
|
139
139
|
# `is_*` is for when you're dealing with an unknown input
|
samplehc/_version.py
CHANGED
|
@@ -112,22 +112,6 @@ from .workflow_runs import (
|
|
|
112
112
|
WorkflowRunsResourceWithStreamingResponse,
|
|
113
113
|
AsyncWorkflowRunsResourceWithStreamingResponse,
|
|
114
114
|
)
|
|
115
|
-
from .browser_agents import (
|
|
116
|
-
BrowserAgentsResource,
|
|
117
|
-
AsyncBrowserAgentsResource,
|
|
118
|
-
BrowserAgentsResourceWithRawResponse,
|
|
119
|
-
AsyncBrowserAgentsResourceWithRawResponse,
|
|
120
|
-
BrowserAgentsResourceWithStreamingResponse,
|
|
121
|
-
AsyncBrowserAgentsResourceWithStreamingResponse,
|
|
122
|
-
)
|
|
123
|
-
from .browser_automation import (
|
|
124
|
-
BrowserAutomationResource,
|
|
125
|
-
AsyncBrowserAutomationResource,
|
|
126
|
-
BrowserAutomationResourceWithRawResponse,
|
|
127
|
-
AsyncBrowserAutomationResourceWithRawResponse,
|
|
128
|
-
BrowserAutomationResourceWithStreamingResponse,
|
|
129
|
-
AsyncBrowserAutomationResourceWithStreamingResponse,
|
|
130
|
-
)
|
|
131
115
|
|
|
132
116
|
__all__ = [
|
|
133
117
|
"AsyncResultsResource",
|
|
@@ -190,12 +174,6 @@ __all__ = [
|
|
|
190
174
|
"AsyncEventsResourceWithRawResponse",
|
|
191
175
|
"EventsResourceWithStreamingResponse",
|
|
192
176
|
"AsyncEventsResourceWithStreamingResponse",
|
|
193
|
-
"BrowserAgentsResource",
|
|
194
|
-
"AsyncBrowserAgentsResource",
|
|
195
|
-
"BrowserAgentsResourceWithRawResponse",
|
|
196
|
-
"AsyncBrowserAgentsResourceWithRawResponse",
|
|
197
|
-
"BrowserAgentsResourceWithStreamingResponse",
|
|
198
|
-
"AsyncBrowserAgentsResourceWithStreamingResponse",
|
|
199
177
|
"PoliciesResource",
|
|
200
178
|
"AsyncPoliciesResource",
|
|
201
179
|
"PoliciesResourceWithRawResponse",
|
|
@@ -214,12 +192,6 @@ __all__ = [
|
|
|
214
192
|
"AsyncDatabaseResourceWithRawResponse",
|
|
215
193
|
"DatabaseResourceWithStreamingResponse",
|
|
216
194
|
"AsyncDatabaseResourceWithStreamingResponse",
|
|
217
|
-
"BrowserAutomationResource",
|
|
218
|
-
"AsyncBrowserAutomationResource",
|
|
219
|
-
"BrowserAutomationResourceWithRawResponse",
|
|
220
|
-
"AsyncBrowserAutomationResourceWithRawResponse",
|
|
221
|
-
"BrowserAutomationResourceWithStreamingResponse",
|
|
222
|
-
"AsyncBrowserAutomationResourceWithStreamingResponse",
|
|
223
195
|
"V2Resource",
|
|
224
196
|
"AsyncV2Resource",
|
|
225
197
|
"V2ResourceWithRawResponse",
|
|
@@ -293,6 +293,7 @@ class DocumentsResource(SyncAPIResource):
|
|
|
293
293
|
prompt: str,
|
|
294
294
|
response_json_schema: Dict[str, object],
|
|
295
295
|
model: Literal["reasoning-3-mini", "reasoning-3", "base-5", "base-5-mini", "base-5-nano"] | Omit = omit,
|
|
296
|
+
ocr_enhance: document_extract_params.OcrEnhance | Omit = omit,
|
|
296
297
|
priority: Literal["interactive", "non-interactive"] | Omit = omit,
|
|
297
298
|
reasoning_effort: Literal["low", "medium", "high"] | Omit = omit,
|
|
298
299
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -315,6 +316,8 @@ class DocumentsResource(SyncAPIResource):
|
|
|
315
316
|
|
|
316
317
|
model: The model to use for extraction.
|
|
317
318
|
|
|
319
|
+
ocr_enhance: OCR enhancement configuration for figure and text analysis.
|
|
320
|
+
|
|
318
321
|
priority: The priority of the extraction task. Non-interactive is lower priority.
|
|
319
322
|
|
|
320
323
|
reasoning_effort: Optional control over the reasoning effort for extraction.
|
|
@@ -335,6 +338,7 @@ class DocumentsResource(SyncAPIResource):
|
|
|
335
338
|
"prompt": prompt,
|
|
336
339
|
"response_json_schema": response_json_schema,
|
|
337
340
|
"model": model,
|
|
341
|
+
"ocr_enhance": ocr_enhance,
|
|
338
342
|
"priority": priority,
|
|
339
343
|
"reasoning_effort": reasoning_effort,
|
|
340
344
|
},
|
|
@@ -933,6 +937,7 @@ class AsyncDocumentsResource(AsyncAPIResource):
|
|
|
933
937
|
prompt: str,
|
|
934
938
|
response_json_schema: Dict[str, object],
|
|
935
939
|
model: Literal["reasoning-3-mini", "reasoning-3", "base-5", "base-5-mini", "base-5-nano"] | Omit = omit,
|
|
940
|
+
ocr_enhance: document_extract_params.OcrEnhance | Omit = omit,
|
|
936
941
|
priority: Literal["interactive", "non-interactive"] | Omit = omit,
|
|
937
942
|
reasoning_effort: Literal["low", "medium", "high"] | Omit = omit,
|
|
938
943
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -955,6 +960,8 @@ class AsyncDocumentsResource(AsyncAPIResource):
|
|
|
955
960
|
|
|
956
961
|
model: The model to use for extraction.
|
|
957
962
|
|
|
963
|
+
ocr_enhance: OCR enhancement configuration for figure and text analysis.
|
|
964
|
+
|
|
958
965
|
priority: The priority of the extraction task. Non-interactive is lower priority.
|
|
959
966
|
|
|
960
967
|
reasoning_effort: Optional control over the reasoning effort for extraction.
|
|
@@ -975,6 +982,7 @@ class AsyncDocumentsResource(AsyncAPIResource):
|
|
|
975
982
|
"prompt": prompt,
|
|
976
983
|
"response_json_schema": response_json_schema,
|
|
977
984
|
"model": model,
|
|
985
|
+
"ocr_enhance": ocr_enhance,
|
|
978
986
|
"priority": priority,
|
|
979
987
|
"reasoning_effort": reasoning_effort,
|
|
980
988
|
},
|
|
@@ -32,6 +32,14 @@ from .glidian import (
|
|
|
32
32
|
GlidianResourceWithStreamingResponse,
|
|
33
33
|
AsyncGlidianResourceWithStreamingResponse,
|
|
34
34
|
)
|
|
35
|
+
from .wellsky import (
|
|
36
|
+
WellskyResource,
|
|
37
|
+
AsyncWellskyResource,
|
|
38
|
+
WellskyResourceWithRawResponse,
|
|
39
|
+
AsyncWellskyResourceWithRawResponse,
|
|
40
|
+
WellskyResourceWithStreamingResponse,
|
|
41
|
+
AsyncWellskyResourceWithStreamingResponse,
|
|
42
|
+
)
|
|
35
43
|
from .careviso import (
|
|
36
44
|
CarevisoResource,
|
|
37
45
|
AsyncCarevisoResource,
|
|
@@ -72,6 +80,12 @@ __all__ = [
|
|
|
72
80
|
"AsyncSnowflakeResourceWithRawResponse",
|
|
73
81
|
"SnowflakeResourceWithStreamingResponse",
|
|
74
82
|
"AsyncSnowflakeResourceWithStreamingResponse",
|
|
83
|
+
"WellskyResource",
|
|
84
|
+
"AsyncWellskyResource",
|
|
85
|
+
"WellskyResourceWithRawResponse",
|
|
86
|
+
"AsyncWellskyResourceWithRawResponse",
|
|
87
|
+
"WellskyResourceWithStreamingResponse",
|
|
88
|
+
"AsyncWellskyResourceWithStreamingResponse",
|
|
75
89
|
"BankResource",
|
|
76
90
|
"AsyncBankResource",
|
|
77
91
|
"BankResourceWithRawResponse",
|