samplehc 0.18.0__tar.gz → 0.19.0__tar.gz

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.
Files changed (136) hide show
  1. samplehc-0.19.0/.release-please-manifest.json +3 -0
  2. {samplehc-0.18.0 → samplehc-0.19.0}/CHANGELOG.md +16 -0
  3. {samplehc-0.18.0 → samplehc-0.19.0}/PKG-INFO +1 -1
  4. {samplehc-0.18.0 → samplehc-0.19.0}/pyproject.toml +1 -1
  5. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_base_client.py +5 -2
  6. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_compat.py +3 -3
  7. samplehc-0.19.0/src/samplehc/_utils/_json.py +35 -0
  8. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_version.py +1 -1
  9. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/resources/v2/documents/documents.py +44 -2
  10. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/document_extract_params.py +20 -1
  11. {samplehc-0.18.0 → samplehc-0.19.0}/tests/api_resources/v2/test_documents.py +2 -0
  12. samplehc-0.19.0/tests/test_utils/test_json.py +126 -0
  13. samplehc-0.18.0/.release-please-manifest.json +0 -3
  14. {samplehc-0.18.0 → samplehc-0.19.0}/.gitignore +0 -0
  15. {samplehc-0.18.0 → samplehc-0.19.0}/CONTRIBUTING.md +0 -0
  16. {samplehc-0.18.0 → samplehc-0.19.0}/LICENSE +0 -0
  17. {samplehc-0.18.0 → samplehc-0.19.0}/README.md +0 -0
  18. {samplehc-0.18.0 → samplehc-0.19.0}/SECURITY.md +0 -0
  19. {samplehc-0.18.0 → samplehc-0.19.0}/api.md +0 -0
  20. {samplehc-0.18.0 → samplehc-0.19.0}/bin/check-release-environment +0 -0
  21. {samplehc-0.18.0 → samplehc-0.19.0}/bin/publish-pypi +0 -0
  22. {samplehc-0.18.0 → samplehc-0.19.0}/examples/.keep +0 -0
  23. {samplehc-0.18.0 → samplehc-0.19.0}/noxfile.py +0 -0
  24. {samplehc-0.18.0 → samplehc-0.19.0}/release-please-config.json +0 -0
  25. {samplehc-0.18.0 → samplehc-0.19.0}/requirements-dev.lock +0 -0
  26. {samplehc-0.18.0 → samplehc-0.19.0}/requirements.lock +0 -0
  27. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/__init__.py +0 -0
  28. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_client.py +0 -0
  29. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_constants.py +0 -0
  30. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_exceptions.py +0 -0
  31. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_files.py +0 -0
  32. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_models.py +0 -0
  33. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_qs.py +0 -0
  34. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_resource.py +0 -0
  35. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_response.py +0 -0
  36. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_streaming.py +0 -0
  37. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_types.py +0 -0
  38. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_utils/__init__.py +0 -0
  39. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_utils/_compat.py +0 -0
  40. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_utils/_datetime_parse.py +0 -0
  41. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_utils/_logs.py +0 -0
  42. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_utils/_proxy.py +0 -0
  43. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_utils/_reflection.py +0 -0
  44. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_utils/_resources_proxy.py +0 -0
  45. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_utils/_streams.py +0 -0
  46. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_utils/_sync.py +0 -0
  47. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_utils/_transform.py +0 -0
  48. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_utils/_typing.py +0 -0
  49. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/_utils/_utils.py +0 -0
  50. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/lib/.keep +0 -0
  51. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/py.typed +0 -0
  52. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/resources/__init__.py +0 -0
  53. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/resources/v2/__init__.py +0 -0
  54. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/resources/v2/async_results.py +0 -0
  55. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/resources/v2/communication.py +0 -0
  56. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/resources/v2/database.py +0 -0
  57. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/resources/v2/documents/__init__.py +0 -0
  58. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/resources/v2/documents/formats.py +0 -0
  59. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/resources/v2/documents/legacy.py +0 -0
  60. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/resources/v2/documents/templates.py +0 -0
  61. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/resources/v2/events.py +0 -0
  62. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/resources/v2/v2.py +0 -0
  63. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/__init__.py +0 -0
  64. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/__init__.py +0 -0
  65. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/async_result_sleep_params.py +0 -0
  66. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/async_result_sleep_response.py +0 -0
  67. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/communication_send_email_params.py +0 -0
  68. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/communication_send_email_response.py +0 -0
  69. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/communication_send_fax_params.py +0 -0
  70. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/communication_send_fax_response.py +0 -0
  71. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/communication_send_letter_params.py +0 -0
  72. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/communication_send_letter_response.py +0 -0
  73. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/database_execute_sql_params.py +0 -0
  74. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/database_execute_sql_response.py +0 -0
  75. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/document_classify_params.py +0 -0
  76. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/document_classify_response.py +0 -0
  77. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/document_combine_params.py +0 -0
  78. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/document_combine_response.py +0 -0
  79. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/document_create_from_splits_params.py +0 -0
  80. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/document_create_from_splits_response.py +0 -0
  81. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/document_extract_response.py +0 -0
  82. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/document_generate_csv_params.py +0 -0
  83. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/document_generate_csv_response.py +0 -0
  84. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/document_presigned_upload_url_params.py +0 -0
  85. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/document_presigned_upload_url_response.py +0 -0
  86. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/document_retrieve_csv_content_response.py +0 -0
  87. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/document_retrieve_metadata_response.py +0 -0
  88. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/document_retrieve_response.py +0 -0
  89. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/document_search_params.py +0 -0
  90. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/document_search_response.py +0 -0
  91. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/document_split_params.py +0 -0
  92. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/document_split_response.py +0 -0
  93. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/document_transform_json_to_html_params.py +0 -0
  94. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/document_transform_json_to_html_response.py +0 -0
  95. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/documents/__init__.py +0 -0
  96. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/documents/format_create_pdf_params.py +0 -0
  97. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/documents/format_create_pdf_response.py +0 -0
  98. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/documents/legacy_extract_params.py +0 -0
  99. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/documents/legacy_extract_response.py +0 -0
  100. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/documents/legacy_reason_params.py +0 -0
  101. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/documents/legacy_reason_response.py +0 -0
  102. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/documents/legacy_split_params.py +0 -0
  103. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/documents/legacy_split_response.py +0 -0
  104. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/documents/template_generate_document_async_params.py +0 -0
  105. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/documents/template_generate_document_async_response.py +0 -0
  106. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/documents/template_render_document_params.py +0 -0
  107. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/documents/template_render_document_response.py +0 -0
  108. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/event_emit_params.py +0 -0
  109. {samplehc-0.18.0 → samplehc-0.19.0}/src/samplehc/types/v2/event_emit_response.py +0 -0
  110. {samplehc-0.18.0 → samplehc-0.19.0}/tests/__init__.py +0 -0
  111. {samplehc-0.18.0 → samplehc-0.19.0}/tests/api_resources/__init__.py +0 -0
  112. {samplehc-0.18.0 → samplehc-0.19.0}/tests/api_resources/v2/__init__.py +0 -0
  113. {samplehc-0.18.0 → samplehc-0.19.0}/tests/api_resources/v2/documents/__init__.py +0 -0
  114. {samplehc-0.18.0 → samplehc-0.19.0}/tests/api_resources/v2/documents/test_formats.py +0 -0
  115. {samplehc-0.18.0 → samplehc-0.19.0}/tests/api_resources/v2/documents/test_legacy.py +0 -0
  116. {samplehc-0.18.0 → samplehc-0.19.0}/tests/api_resources/v2/documents/test_templates.py +0 -0
  117. {samplehc-0.18.0 → samplehc-0.19.0}/tests/api_resources/v2/test_async_results.py +0 -0
  118. {samplehc-0.18.0 → samplehc-0.19.0}/tests/api_resources/v2/test_communication.py +0 -0
  119. {samplehc-0.18.0 → samplehc-0.19.0}/tests/api_resources/v2/test_database.py +0 -0
  120. {samplehc-0.18.0 → samplehc-0.19.0}/tests/api_resources/v2/test_events.py +0 -0
  121. {samplehc-0.18.0 → samplehc-0.19.0}/tests/conftest.py +0 -0
  122. {samplehc-0.18.0 → samplehc-0.19.0}/tests/sample_file.txt +0 -0
  123. {samplehc-0.18.0 → samplehc-0.19.0}/tests/test_client.py +0 -0
  124. {samplehc-0.18.0 → samplehc-0.19.0}/tests/test_deepcopy.py +0 -0
  125. {samplehc-0.18.0 → samplehc-0.19.0}/tests/test_extract_files.py +0 -0
  126. {samplehc-0.18.0 → samplehc-0.19.0}/tests/test_files.py +0 -0
  127. {samplehc-0.18.0 → samplehc-0.19.0}/tests/test_models.py +0 -0
  128. {samplehc-0.18.0 → samplehc-0.19.0}/tests/test_qs.py +0 -0
  129. {samplehc-0.18.0 → samplehc-0.19.0}/tests/test_required_args.py +0 -0
  130. {samplehc-0.18.0 → samplehc-0.19.0}/tests/test_response.py +0 -0
  131. {samplehc-0.18.0 → samplehc-0.19.0}/tests/test_streaming.py +0 -0
  132. {samplehc-0.18.0 → samplehc-0.19.0}/tests/test_transform.py +0 -0
  133. {samplehc-0.18.0 → samplehc-0.19.0}/tests/test_utils/test_datetime_parse.py +0 -0
  134. {samplehc-0.18.0 → samplehc-0.19.0}/tests/test_utils/test_proxy.py +0 -0
  135. {samplehc-0.18.0 → samplehc-0.19.0}/tests/test_utils/test_typing.py +0 -0
  136. {samplehc-0.18.0 → samplehc-0.19.0}/tests/utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.19.0"
3
+ }
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.19.0 (2026-02-03)
4
+
5
+ Full Changelog: [v0.18.0...v0.19.0](https://github.com/samplehc/samplehc-python/compare/v0.18.0...v0.19.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([5690ad0](https://github.com/samplehc/samplehc-python/commit/5690ad076a7117489783a902c86823bd131007e0))
10
+ * **api:** api update ([907015e](https://github.com/samplehc/samplehc-python/commit/907015e44e80c084a433cc168cbbd3f8936de9a8))
11
+ * **api:** api update ([a894f7d](https://github.com/samplehc/samplehc-python/commit/a894f7dfb69e26535b858f010a47664a2649ffc8))
12
+ * **client:** add custom JSON encoder for extended type support ([61b182a](https://github.com/samplehc/samplehc-python/commit/61b182a434c0b6488cd1d64bd8aeaafe4ef6c477))
13
+
14
+
15
+ ### Chores
16
+
17
+ * **ci:** upgrade `actions/github-script` ([17e3e4f](https://github.com/samplehc/samplehc-python/commit/17e3e4fb991e6fd0a6fd9adcb9f50eea85e3046c))
18
+
3
19
  ## 0.18.0 (2026-01-23)
4
20
 
5
21
  Full Changelog: [v0.17.0...v0.18.0](https://github.com/samplehc/samplehc-python/compare/v0.17.0...v0.18.0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: samplehc
3
- Version: 0.18.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,6 +1,6 @@
1
1
  [project]
2
2
  name = "samplehc"
3
- version = "0.18.0"
3
+ version = "0.19.0"
4
4
  description = "The official Python library for the Sample Healthcare API"
5
5
  dynamic = ["readme"]
6
6
  license = "Apache-2.0"
@@ -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
- else:
558
- kwargs["json"] = json_data if is_given(json_data) else None
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)
@@ -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
 
@@ -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)
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "samplehc"
4
- __version__ = "0.18.0" # x-release-please-version
4
+ __version__ = "0.19.0" # x-release-please-version
@@ -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["reasoning-3-mini", "reasoning-3", "base-5", "base-5-mini", "base-5-nano"] | Omit = omit,
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["reasoning-3-mini", "reasoning-3", "base-5", "base-5-mini", "base-5-nano"] | Omit = omit,
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["reasoning-3-mini", "reasoning-3", "base-5", "base-5-mini", "base-5-nano"]
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
 
@@ -253,6 +253,7 @@ class TestDocuments:
253
253
  ],
254
254
  "summarize_figures": True,
255
255
  },
256
+ ocr_quality="high",
256
257
  priority="interactive",
257
258
  reasoning_effort="low",
258
259
  )
@@ -866,6 +867,7 @@ class TestAsyncDocuments:
866
867
  ],
867
868
  "summarize_figures": True,
868
869
  },
870
+ ocr_quality="high",
869
871
  priority="interactive",
870
872
  reasoning_effort="low",
871
873
  )
@@ -0,0 +1,126 @@
1
+ from __future__ import annotations
2
+
3
+ import datetime
4
+ from typing import Union
5
+
6
+ import pydantic
7
+
8
+ from samplehc import _compat
9
+ from samplehc._utils._json import openapi_dumps
10
+
11
+
12
+ class TestOpenapiDumps:
13
+ def test_basic(self) -> None:
14
+ data = {"key": "value", "number": 42}
15
+ json_bytes = openapi_dumps(data)
16
+ assert json_bytes == b'{"key":"value","number":42}'
17
+
18
+ def test_datetime_serialization(self) -> None:
19
+ dt = datetime.datetime(2023, 1, 1, 12, 0, 0)
20
+ data = {"datetime": dt}
21
+ json_bytes = openapi_dumps(data)
22
+ assert json_bytes == b'{"datetime":"2023-01-01T12:00:00"}'
23
+
24
+ def test_pydantic_model_serialization(self) -> None:
25
+ class User(pydantic.BaseModel):
26
+ first_name: str
27
+ last_name: str
28
+ age: int
29
+
30
+ model_instance = User(first_name="John", last_name="Kramer", age=83)
31
+ data = {"model": model_instance}
32
+ json_bytes = openapi_dumps(data)
33
+ assert json_bytes == b'{"model":{"first_name":"John","last_name":"Kramer","age":83}}'
34
+
35
+ def test_pydantic_model_with_default_values(self) -> None:
36
+ class User(pydantic.BaseModel):
37
+ name: str
38
+ role: str = "user"
39
+ active: bool = True
40
+ score: int = 0
41
+
42
+ model_instance = User(name="Alice")
43
+ data = {"model": model_instance}
44
+ json_bytes = openapi_dumps(data)
45
+ assert json_bytes == b'{"model":{"name":"Alice"}}'
46
+
47
+ def test_pydantic_model_with_default_values_overridden(self) -> None:
48
+ class User(pydantic.BaseModel):
49
+ name: str
50
+ role: str = "user"
51
+ active: bool = True
52
+
53
+ model_instance = User(name="Bob", role="admin", active=False)
54
+ data = {"model": model_instance}
55
+ json_bytes = openapi_dumps(data)
56
+ assert json_bytes == b'{"model":{"name":"Bob","role":"admin","active":false}}'
57
+
58
+ def test_pydantic_model_with_alias(self) -> None:
59
+ class User(pydantic.BaseModel):
60
+ first_name: str = pydantic.Field(alias="firstName")
61
+ last_name: str = pydantic.Field(alias="lastName")
62
+
63
+ model_instance = User(firstName="John", lastName="Doe")
64
+ data = {"model": model_instance}
65
+ json_bytes = openapi_dumps(data)
66
+ assert json_bytes == b'{"model":{"firstName":"John","lastName":"Doe"}}'
67
+
68
+ def test_pydantic_model_with_alias_and_default(self) -> None:
69
+ class User(pydantic.BaseModel):
70
+ user_name: str = pydantic.Field(alias="userName")
71
+ user_role: str = pydantic.Field(default="member", alias="userRole")
72
+ is_active: bool = pydantic.Field(default=True, alias="isActive")
73
+
74
+ model_instance = User(userName="charlie")
75
+ data = {"model": model_instance}
76
+ json_bytes = openapi_dumps(data)
77
+ assert json_bytes == b'{"model":{"userName":"charlie"}}'
78
+
79
+ model_with_overrides = User(userName="diana", userRole="admin", isActive=False)
80
+ data = {"model": model_with_overrides}
81
+ json_bytes = openapi_dumps(data)
82
+ assert json_bytes == b'{"model":{"userName":"diana","userRole":"admin","isActive":false}}'
83
+
84
+ def test_pydantic_model_with_nested_models_and_defaults(self) -> None:
85
+ class Address(pydantic.BaseModel):
86
+ street: str
87
+ city: str = "Unknown"
88
+
89
+ class User(pydantic.BaseModel):
90
+ name: str
91
+ address: Address
92
+ verified: bool = False
93
+
94
+ if _compat.PYDANTIC_V1:
95
+ # to handle forward references in Pydantic v1
96
+ User.update_forward_refs(**locals()) # type: ignore[reportDeprecated]
97
+
98
+ address = Address(street="123 Main St")
99
+ user = User(name="Diana", address=address)
100
+ data = {"user": user}
101
+ json_bytes = openapi_dumps(data)
102
+ assert json_bytes == b'{"user":{"name":"Diana","address":{"street":"123 Main St"}}}'
103
+
104
+ address_with_city = Address(street="456 Oak Ave", city="Boston")
105
+ user_verified = User(name="Eve", address=address_with_city, verified=True)
106
+ data = {"user": user_verified}
107
+ json_bytes = openapi_dumps(data)
108
+ assert (
109
+ json_bytes == b'{"user":{"name":"Eve","address":{"street":"456 Oak Ave","city":"Boston"},"verified":true}}'
110
+ )
111
+
112
+ def test_pydantic_model_with_optional_fields(self) -> None:
113
+ class User(pydantic.BaseModel):
114
+ name: str
115
+ email: Union[str, None]
116
+ phone: Union[str, None]
117
+
118
+ model_with_none = User(name="Eve", email=None, phone=None)
119
+ data = {"model": model_with_none}
120
+ json_bytes = openapi_dumps(data)
121
+ assert json_bytes == b'{"model":{"name":"Eve","email":null,"phone":null}}'
122
+
123
+ model_with_values = User(name="Frank", email="frank@example.com", phone=None)
124
+ data = {"model": model_with_values}
125
+ json_bytes = openapi_dumps(data)
126
+ assert json_bytes == b'{"model":{"name":"Frank","email":"frank@example.com","phone":null}}'
@@ -1,3 +0,0 @@
1
- {
2
- ".": "0.18.0"
3
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes