samplehc 0.18.0__py3-none-any.whl → 0.19.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 +5 -2
- samplehc/_compat.py +3 -3
- samplehc/_utils/_json.py +35 -0
- samplehc/_version.py +1 -1
- samplehc/resources/v2/documents/documents.py +44 -2
- samplehc/types/v2/document_extract_params.py +20 -1
- {samplehc-0.18.0.dist-info → samplehc-0.19.0.dist-info}/METADATA +1 -1
- {samplehc-0.18.0.dist-info → samplehc-0.19.0.dist-info}/RECORD +10 -9
- {samplehc-0.18.0.dist-info → samplehc-0.19.0.dist-info}/WHEEL +0 -0
- {samplehc-0.18.0.dist-info → samplehc-0.19.0.dist-info}/licenses/LICENSE +0 -0
samplehc/_base_client.py
CHANGED
|
@@ -86,6 +86,7 @@ from ._exceptions import (
|
|
|
86
86
|
APIConnectionError,
|
|
87
87
|
APIResponseValidationError,
|
|
88
88
|
)
|
|
89
|
+
from ._utils._json import openapi_dumps
|
|
89
90
|
|
|
90
91
|
log: logging.Logger = logging.getLogger(__name__)
|
|
91
92
|
|
|
@@ -554,8 +555,10 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
554
555
|
kwargs["content"] = options.content
|
|
555
556
|
elif isinstance(json_data, bytes):
|
|
556
557
|
kwargs["content"] = json_data
|
|
557
|
-
|
|
558
|
-
|
|
558
|
+
elif not files:
|
|
559
|
+
# Don't set content when JSON is sent as multipart/form-data,
|
|
560
|
+
# since httpx's content param overrides other body arguments
|
|
561
|
+
kwargs["content"] = openapi_dumps(json_data) if is_given(json_data) and json_data is not None else None
|
|
559
562
|
kwargs["files"] = files
|
|
560
563
|
else:
|
|
561
564
|
headers.pop("Content-Type", None)
|
samplehc/_compat.py
CHANGED
|
@@ -139,6 +139,7 @@ def model_dump(
|
|
|
139
139
|
exclude_defaults: bool = False,
|
|
140
140
|
warnings: bool = True,
|
|
141
141
|
mode: Literal["json", "python"] = "python",
|
|
142
|
+
by_alias: bool | None = None,
|
|
142
143
|
) -> dict[str, Any]:
|
|
143
144
|
if (not PYDANTIC_V1) or hasattr(model, "model_dump"):
|
|
144
145
|
return model.model_dump(
|
|
@@ -148,13 +149,12 @@ def model_dump(
|
|
|
148
149
|
exclude_defaults=exclude_defaults,
|
|
149
150
|
# warnings are not supported in Pydantic v1
|
|
150
151
|
warnings=True if PYDANTIC_V1 else warnings,
|
|
152
|
+
by_alias=by_alias,
|
|
151
153
|
)
|
|
152
154
|
return cast(
|
|
153
155
|
"dict[str, Any]",
|
|
154
156
|
model.dict( # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
|
|
155
|
-
exclude=exclude,
|
|
156
|
-
exclude_unset=exclude_unset,
|
|
157
|
-
exclude_defaults=exclude_defaults,
|
|
157
|
+
exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, by_alias=bool(by_alias)
|
|
158
158
|
),
|
|
159
159
|
)
|
|
160
160
|
|
samplehc/_utils/_json.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from typing import Any
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from typing_extensions import override
|
|
5
|
+
|
|
6
|
+
import pydantic
|
|
7
|
+
|
|
8
|
+
from .._compat import model_dump
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def openapi_dumps(obj: Any) -> bytes:
|
|
12
|
+
"""
|
|
13
|
+
Serialize an object to UTF-8 encoded JSON bytes.
|
|
14
|
+
|
|
15
|
+
Extends the standard json.dumps with support for additional types
|
|
16
|
+
commonly used in the SDK, such as `datetime`, `pydantic.BaseModel`, etc.
|
|
17
|
+
"""
|
|
18
|
+
return json.dumps(
|
|
19
|
+
obj,
|
|
20
|
+
cls=_CustomEncoder,
|
|
21
|
+
# Uses the same defaults as httpx's JSON serialization
|
|
22
|
+
ensure_ascii=False,
|
|
23
|
+
separators=(",", ":"),
|
|
24
|
+
allow_nan=False,
|
|
25
|
+
).encode()
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class _CustomEncoder(json.JSONEncoder):
|
|
29
|
+
@override
|
|
30
|
+
def default(self, o: Any) -> Any:
|
|
31
|
+
if isinstance(o, datetime):
|
|
32
|
+
return o.isoformat()
|
|
33
|
+
if isinstance(o, pydantic.BaseModel):
|
|
34
|
+
return model_dump(o, exclude_unset=True, mode="json", by_alias=True)
|
|
35
|
+
return super().default(o)
|
samplehc/_version.py
CHANGED
|
@@ -278,8 +278,26 @@ class DocumentsResource(SyncAPIResource):
|
|
|
278
278
|
documents: Iterable[document_extract_params.Document],
|
|
279
279
|
prompt: str,
|
|
280
280
|
response_json_schema: Dict[str, object],
|
|
281
|
-
model: Literal[
|
|
281
|
+
model: Literal[
|
|
282
|
+
"reasoning-3-mini",
|
|
283
|
+
"reasoning-3",
|
|
284
|
+
"base-5",
|
|
285
|
+
"base-5-mini",
|
|
286
|
+
"base-5-nano",
|
|
287
|
+
"base-4.1",
|
|
288
|
+
"base-4.1-mini",
|
|
289
|
+
"base-4.1-nano",
|
|
290
|
+
"base-5.2",
|
|
291
|
+
"base-5.2-chat-latest",
|
|
292
|
+
"gemini-3-pro",
|
|
293
|
+
"gemini-3-flash",
|
|
294
|
+
"gemini-2.5-pro",
|
|
295
|
+
"gemini-2.5-flash",
|
|
296
|
+
"gemini-2.5-flash-lite",
|
|
297
|
+
]
|
|
298
|
+
| Omit = omit,
|
|
282
299
|
ocr_enhance: document_extract_params.OcrEnhance | Omit = omit,
|
|
300
|
+
ocr_quality: Literal["high", "low"] | Omit = omit,
|
|
283
301
|
priority: Literal["interactive", "non-interactive"] | Omit = omit,
|
|
284
302
|
reasoning_effort: Literal["low", "medium", "high"] | Omit = omit,
|
|
285
303
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -304,6 +322,8 @@ class DocumentsResource(SyncAPIResource):
|
|
|
304
322
|
|
|
305
323
|
ocr_enhance: OCR enhancement configuration for figure and text analysis.
|
|
306
324
|
|
|
325
|
+
ocr_quality: OCR quality setting
|
|
326
|
+
|
|
307
327
|
priority: The priority of the extraction task. Non-interactive is lower priority.
|
|
308
328
|
|
|
309
329
|
reasoning_effort: Optional control over the reasoning effort for extraction.
|
|
@@ -325,6 +345,7 @@ class DocumentsResource(SyncAPIResource):
|
|
|
325
345
|
"response_json_schema": response_json_schema,
|
|
326
346
|
"model": model,
|
|
327
347
|
"ocr_enhance": ocr_enhance,
|
|
348
|
+
"ocr_quality": ocr_quality,
|
|
328
349
|
"priority": priority,
|
|
329
350
|
"reasoning_effort": reasoning_effort,
|
|
330
351
|
},
|
|
@@ -850,8 +871,26 @@ class AsyncDocumentsResource(AsyncAPIResource):
|
|
|
850
871
|
documents: Iterable[document_extract_params.Document],
|
|
851
872
|
prompt: str,
|
|
852
873
|
response_json_schema: Dict[str, object],
|
|
853
|
-
model: Literal[
|
|
874
|
+
model: Literal[
|
|
875
|
+
"reasoning-3-mini",
|
|
876
|
+
"reasoning-3",
|
|
877
|
+
"base-5",
|
|
878
|
+
"base-5-mini",
|
|
879
|
+
"base-5-nano",
|
|
880
|
+
"base-4.1",
|
|
881
|
+
"base-4.1-mini",
|
|
882
|
+
"base-4.1-nano",
|
|
883
|
+
"base-5.2",
|
|
884
|
+
"base-5.2-chat-latest",
|
|
885
|
+
"gemini-3-pro",
|
|
886
|
+
"gemini-3-flash",
|
|
887
|
+
"gemini-2.5-pro",
|
|
888
|
+
"gemini-2.5-flash",
|
|
889
|
+
"gemini-2.5-flash-lite",
|
|
890
|
+
]
|
|
891
|
+
| Omit = omit,
|
|
854
892
|
ocr_enhance: document_extract_params.OcrEnhance | Omit = omit,
|
|
893
|
+
ocr_quality: Literal["high", "low"] | Omit = omit,
|
|
855
894
|
priority: Literal["interactive", "non-interactive"] | Omit = omit,
|
|
856
895
|
reasoning_effort: Literal["low", "medium", "high"] | Omit = omit,
|
|
857
896
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -876,6 +915,8 @@ class AsyncDocumentsResource(AsyncAPIResource):
|
|
|
876
915
|
|
|
877
916
|
ocr_enhance: OCR enhancement configuration for figure and text analysis.
|
|
878
917
|
|
|
918
|
+
ocr_quality: OCR quality setting
|
|
919
|
+
|
|
879
920
|
priority: The priority of the extraction task. Non-interactive is lower priority.
|
|
880
921
|
|
|
881
922
|
reasoning_effort: Optional control over the reasoning effort for extraction.
|
|
@@ -897,6 +938,7 @@ class AsyncDocumentsResource(AsyncAPIResource):
|
|
|
897
938
|
"response_json_schema": response_json_schema,
|
|
898
939
|
"model": model,
|
|
899
940
|
"ocr_enhance": ocr_enhance,
|
|
941
|
+
"ocr_quality": ocr_quality,
|
|
900
942
|
"priority": priority,
|
|
901
943
|
"reasoning_effort": reasoning_effort,
|
|
902
944
|
},
|
|
@@ -27,12 +27,31 @@ class DocumentExtractParams(TypedDict, total=False):
|
|
|
27
27
|
response_json_schema: Required[Annotated[Dict[str, object], PropertyInfo(alias="responseJsonSchema")]]
|
|
28
28
|
"""A JSON schema defining the structure of the desired extraction output."""
|
|
29
29
|
|
|
30
|
-
model: Literal[
|
|
30
|
+
model: Literal[
|
|
31
|
+
"reasoning-3-mini",
|
|
32
|
+
"reasoning-3",
|
|
33
|
+
"base-5",
|
|
34
|
+
"base-5-mini",
|
|
35
|
+
"base-5-nano",
|
|
36
|
+
"base-4.1",
|
|
37
|
+
"base-4.1-mini",
|
|
38
|
+
"base-4.1-nano",
|
|
39
|
+
"base-5.2",
|
|
40
|
+
"base-5.2-chat-latest",
|
|
41
|
+
"gemini-3-pro",
|
|
42
|
+
"gemini-3-flash",
|
|
43
|
+
"gemini-2.5-pro",
|
|
44
|
+
"gemini-2.5-flash",
|
|
45
|
+
"gemini-2.5-flash-lite",
|
|
46
|
+
]
|
|
31
47
|
"""The model to use for extraction."""
|
|
32
48
|
|
|
33
49
|
ocr_enhance: Annotated[OcrEnhance, PropertyInfo(alias="ocrEnhance")]
|
|
34
50
|
"""OCR enhancement configuration for figure and text analysis."""
|
|
35
51
|
|
|
52
|
+
ocr_quality: Annotated[Literal["high", "low"], PropertyInfo(alias="ocrQuality")]
|
|
53
|
+
"""OCR quality setting"""
|
|
54
|
+
|
|
36
55
|
priority: Literal["interactive", "non-interactive"]
|
|
37
56
|
"""The priority of the extraction task. Non-interactive is lower priority."""
|
|
38
57
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: samplehc
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.19.0
|
|
4
4
|
Summary: The official Python library for the Sample Healthcare API
|
|
5
5
|
Project-URL: Homepage, https://github.com/samplehc/samplehc-python
|
|
6
6
|
Project-URL: Repository, https://github.com/samplehc/samplehc-python
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
samplehc/__init__.py,sha256=Kze-TKDp8j_TYknemcBAyGIxn7a_RUlisf07X8IYIVI,2731
|
|
2
|
-
samplehc/_base_client.py,sha256=
|
|
2
|
+
samplehc/_base_client.py,sha256=SdMJDhn67yatN8KvVlRaqegWGv7ICogzbSBNkhe3pys,73660
|
|
3
3
|
samplehc/_client.py,sha256=-VgT2RjwwXmWayeZy98IhH_F-AkMOt6zOidBZIbrHCE,16714
|
|
4
|
-
samplehc/_compat.py,sha256=
|
|
4
|
+
samplehc/_compat.py,sha256=teO44AYozpv2wFRrUi7brcZfGPpFSERQZ4fcdX6zVvs,6627
|
|
5
5
|
samplehc/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
|
|
6
6
|
samplehc/_exceptions.py,sha256=MxVd0pThtjM7aV1xjQcQ6nGSfxJMa5xPhoLsmtSxQgU,3240
|
|
7
7
|
samplehc/_files.py,sha256=KnEzGi_O756MvKyJ4fOCW_u3JhOeWPQ4RsmDvqihDQU,3545
|
|
@@ -11,11 +11,12 @@ samplehc/_resource.py,sha256=Mdg6fhf_5wYd2K2JZ4BQIJMPqJOWetqpJE3h3MmGZJE,1160
|
|
|
11
11
|
samplehc/_response.py,sha256=UzsuYRbic274gcdUWq9ShPkdRt7VrzkjaqwSwdxqWIs,28816
|
|
12
12
|
samplehc/_streaming.py,sha256=Wsd0pUQJT1ZW9v_iBIFKDS9lukt3M0X96f3Enqx1PYY,10261
|
|
13
13
|
samplehc/_types.py,sha256=j9OfrgjmrZOU2T8RbK9QKC0plnD1UCUWuH5oRR2oY3c,7596
|
|
14
|
-
samplehc/_version.py,sha256=
|
|
14
|
+
samplehc/_version.py,sha256=IP7a2R_g2pCu-BZ2HiQDOEYKCJV_Uffum0wTW-WNCpg,161
|
|
15
15
|
samplehc/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
samplehc/_utils/__init__.py,sha256=7fch0GT9zpNnErbciSpUNa-SjTxxjY6kxHxKMOM4AGs,2305
|
|
17
17
|
samplehc/_utils/_compat.py,sha256=D8gtAvjJQrDWt9upS0XaG9Rr5l1QhiAx_I_1utT_tt0,1195
|
|
18
18
|
samplehc/_utils/_datetime_parse.py,sha256=bABTs0Bc6rabdFvnIwXjEhWL15TcRgWZ_6XGTqN8xUk,4204
|
|
19
|
+
samplehc/_utils/_json.py,sha256=bl95uuIWwgSfXX-gP1trK_lDAPwJujYfJ05Cxo2SEC4,962
|
|
19
20
|
samplehc/_utils/_logs.py,sha256=EEt3P1dtoGlkVTZOwVml4xf3j9DvdDTzG2TpBjcQINc,789
|
|
20
21
|
samplehc/_utils/_proxy.py,sha256=aglnj2yBTDyGX9Akk2crZHrl10oqRmceUy2Zp008XEs,1975
|
|
21
22
|
samplehc/_utils/_reflection.py,sha256=ZmGkIgT_PuwedyNBrrKGbxoWtkpytJNU1uU4QHnmEMU,1364
|
|
@@ -34,7 +35,7 @@ samplehc/resources/v2/database.py,sha256=lFLepM70TzkRBaejyfU5GmE3PfgIaBi_liRTpJs
|
|
|
34
35
|
samplehc/resources/v2/events.py,sha256=Kdx2fSNGr21YA7fAHvs9huMGDRra8bsvnxiO1B1ZlSE,6658
|
|
35
36
|
samplehc/resources/v2/v2.py,sha256=9cVu2WRE07VCDJrQZIhdjJkzcvuyLrWHLamWGhZnNiY,8210
|
|
36
37
|
samplehc/resources/v2/documents/__init__.py,sha256=wGPR6hdfmDxt-nXn0cDIud1eZAEs_j3kZd4KrxnuoEg,1993
|
|
37
|
-
samplehc/resources/v2/documents/documents.py,sha256=
|
|
38
|
+
samplehc/resources/v2/documents/documents.py,sha256=5bp9x9SZ4mOqnYgwv9l7CWlUsCxcURFgDcpkAiXdWqk,57688
|
|
38
39
|
samplehc/resources/v2/documents/formats.py,sha256=lB60NUBPBceC1XUbL04lsGIsyVWlqsOE8kQkw5oKIM0,6993
|
|
39
40
|
samplehc/resources/v2/documents/legacy.py,sha256=CbDfHJK_U-sDW1rIp8Hj7pTKKHscwmdijSx4mWALQk8,14095
|
|
40
41
|
samplehc/resources/v2/documents/templates.py,sha256=P6gbC8JxEKXN05yCO2NUXGv-ooLBkwQvDpOy4KccprY,17115
|
|
@@ -56,7 +57,7 @@ samplehc/types/v2/document_combine_params.py,sha256=U4VK6S19oy0n8-ZF6jWFWwwQweWj
|
|
|
56
57
|
samplehc/types/v2/document_combine_response.py,sha256=SVnRhWvEA-p2MuRJiJLiaVnutlw185xAAwcCp5-xP3w,559
|
|
57
58
|
samplehc/types/v2/document_create_from_splits_params.py,sha256=XVmvzvrYPQY_Z8omsLnFx0zeMvPcKnA9chC_KLTIpkc,878
|
|
58
59
|
samplehc/types/v2/document_create_from_splits_response.py,sha256=VJQCsIWz839BeXyht8fVSmrvfknMiXJDPt7ZAclGKP4,900
|
|
59
|
-
samplehc/types/v2/document_extract_params.py,sha256=
|
|
60
|
+
samplehc/types/v2/document_extract_params.py,sha256=DVjKrkMcjiTsmoMyEORDjQOzVfeyNFuwZe52BvvL5xU,2815
|
|
60
61
|
samplehc/types/v2/document_extract_response.py,sha256=k4nKL53ZSLoAmMdlCPZIpjkTdRuOGqG3u-qJyW1kmD4,424
|
|
61
62
|
samplehc/types/v2/document_generate_csv_params.py,sha256=N_GL20AyXcSG0QAkIJBbtyoq9ZW7RESAyhURmagzOTc,1063
|
|
62
63
|
samplehc/types/v2/document_generate_csv_response.py,sha256=n8jk3gbEU6rASKTVNCtY7Z9dDxYOWFm4nqFgbfBOcJM,539
|
|
@@ -86,7 +87,7 @@ samplehc/types/v2/documents/template_generate_document_async_params.py,sha256=5a
|
|
|
86
87
|
samplehc/types/v2/documents/template_generate_document_async_response.py,sha256=xFivOxAB8jahS6vKcr-3TGR4IhF0INDH37nivTVoHSk,402
|
|
87
88
|
samplehc/types/v2/documents/template_render_document_params.py,sha256=egYW79gF_UNjE8wTmiwtbgOozqVDa6i8Db0yjwt5IXE,905
|
|
88
89
|
samplehc/types/v2/documents/template_render_document_response.py,sha256=yN2JLDHszpaA9RZq8INdJIue_JkrLON3xqWMh-z3MCc,367
|
|
89
|
-
samplehc-0.
|
|
90
|
-
samplehc-0.
|
|
91
|
-
samplehc-0.
|
|
92
|
-
samplehc-0.
|
|
90
|
+
samplehc-0.19.0.dist-info/METADATA,sha256=B0bWzR-Ai67O2kw5JgyNvGm-XVps5xBr9DEbTKoA4B0,14336
|
|
91
|
+
samplehc-0.19.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
92
|
+
samplehc-0.19.0.dist-info/licenses/LICENSE,sha256=ll_q1imgsIlRXL5pk6VmrO0f_L0thzOlPI2cc7qcqc0,11347
|
|
93
|
+
samplehc-0.19.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|