dexa-ai-sdk 0.3.2__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 (87) hide show
  1. dexa_ai_sdk-0.3.2/PKG-INFO +223 -0
  2. dexa_ai_sdk-0.3.2/README.md +196 -0
  3. dexa_ai_sdk-0.3.2/__init__.py +197 -0
  4. dexa_ai_sdk-0.3.2/_default_clients.py +33 -0
  5. dexa_ai_sdk-0.3.2/client.py +218 -0
  6. dexa_ai_sdk-0.3.2/core/__init__.py +127 -0
  7. dexa_ai_sdk-0.3.2/core/api_error.py +23 -0
  8. dexa_ai_sdk-0.3.2/core/client_wrapper.py +132 -0
  9. dexa_ai_sdk-0.3.2/core/datetime_utils.py +70 -0
  10. dexa_ai_sdk-0.3.2/core/file.py +67 -0
  11. dexa_ai_sdk-0.3.2/core/force_multipart.py +18 -0
  12. dexa_ai_sdk-0.3.2/core/http_client.py +975 -0
  13. dexa_ai_sdk-0.3.2/core/http_response.py +63 -0
  14. dexa_ai_sdk-0.3.2/core/http_sse/__init__.py +42 -0
  15. dexa_ai_sdk-0.3.2/core/http_sse/_api.py +455 -0
  16. dexa_ai_sdk-0.3.2/core/http_sse/_decoders.py +74 -0
  17. dexa_ai_sdk-0.3.2/core/http_sse/_exceptions.py +7 -0
  18. dexa_ai_sdk-0.3.2/core/http_sse/_models.py +17 -0
  19. dexa_ai_sdk-0.3.2/core/jsonable_encoder.py +133 -0
  20. dexa_ai_sdk-0.3.2/core/logging.py +107 -0
  21. dexa_ai_sdk-0.3.2/core/parse_error.py +36 -0
  22. dexa_ai_sdk-0.3.2/core/pydantic_utilities.py +486 -0
  23. dexa_ai_sdk-0.3.2/core/query_encoder.py +58 -0
  24. dexa_ai_sdk-0.3.2/core/remove_none_from_dict.py +11 -0
  25. dexa_ai_sdk-0.3.2/core/request_options.py +43 -0
  26. dexa_ai_sdk-0.3.2/core/serialization.py +347 -0
  27. dexa_ai_sdk-0.3.2/dexa_ai_sdk.egg-info/PKG-INFO +223 -0
  28. dexa_ai_sdk-0.3.2/dexa_ai_sdk.egg-info/SOURCES.txt +162 -0
  29. dexa_ai_sdk-0.3.2/dexa_ai_sdk.egg-info/dependency_links.txt +1 -0
  30. dexa_ai_sdk-0.3.2/dexa_ai_sdk.egg-info/requires.txt +3 -0
  31. dexa_ai_sdk-0.3.2/dexa_ai_sdk.egg-info/top_level.txt +1 -0
  32. dexa_ai_sdk-0.3.2/environment.py +7 -0
  33. dexa_ai_sdk-0.3.2/errors/__init__.py +40 -0
  34. dexa_ai_sdk-0.3.2/errors/bad_request_error.py +11 -0
  35. dexa_ai_sdk-0.3.2/errors/internal_server_error.py +11 -0
  36. dexa_ai_sdk-0.3.2/errors/unprocessable_entity_error.py +11 -0
  37. dexa_ai_sdk-0.3.2/pyproject.toml +66 -0
  38. dexa_ai_sdk-0.3.2/setup.cfg +4 -0
  39. dexa_ai_sdk-0.3.2/tasks/__init__.py +61 -0
  40. dexa_ai_sdk-0.3.2/tasks/client.py +766 -0
  41. dexa_ai_sdk-0.3.2/tasks/raw_client.py +1146 -0
  42. dexa_ai_sdk-0.3.2/tasks/types/__init__.py +59 -0
  43. dexa_ai_sdk-0.3.2/tasks/types/decide_request_output_language.py +29 -0
  44. dexa_ai_sdk-0.3.2/tasks/types/decide_request_response_format.py +20 -0
  45. dexa_ai_sdk-0.3.2/tasks/types/decide_request_response_format_type.py +5 -0
  46. dexa_ai_sdk-0.3.2/tasks/types/decide_request_target_language.py +29 -0
  47. dexa_ai_sdk-0.3.2/tasks/types/extract_request_output_language.py +29 -0
  48. dexa_ai_sdk-0.3.2/tasks/types/extract_request_response_format.py +20 -0
  49. dexa_ai_sdk-0.3.2/tasks/types/extract_request_response_format_type.py +5 -0
  50. dexa_ai_sdk-0.3.2/tasks/types/extract_request_target_language.py +29 -0
  51. dexa_ai_sdk-0.3.2/tests/test_aiohttp_autodetect.py +113 -0
  52. dexa_ai_sdk-0.3.2/types/__init__.py +144 -0
  53. dexa_ai_sdk-0.3.2/types/audio_input.py +30 -0
  54. dexa_ai_sdk-0.3.2/types/audio_input_type.py +5 -0
  55. dexa_ai_sdk-0.3.2/types/choice.py +22 -0
  56. dexa_ai_sdk-0.3.2/types/choice_finish_reason.py +5 -0
  57. dexa_ai_sdk-0.3.2/types/content_part.py +30 -0
  58. dexa_ai_sdk-0.3.2/types/content_part_language.py +29 -0
  59. dexa_ai_sdk-0.3.2/types/content_part_type.py +5 -0
  60. dexa_ai_sdk-0.3.2/types/decide_response.py +28 -0
  61. dexa_ai_sdk-0.3.2/types/decide_result.py +20 -0
  62. dexa_ai_sdk-0.3.2/types/decide_task.py +26 -0
  63. dexa_ai_sdk-0.3.2/types/decide_task_target_language.py +29 -0
  64. dexa_ai_sdk-0.3.2/types/error_response.py +20 -0
  65. dexa_ai_sdk-0.3.2/types/error_response_error.py +22 -0
  66. dexa_ai_sdk-0.3.2/types/extract_response.py +30 -0
  67. dexa_ai_sdk-0.3.2/types/extract_task.py +30 -0
  68. dexa_ai_sdk-0.3.2/types/extract_task_target_language.py +29 -0
  69. dexa_ai_sdk-0.3.2/types/image_input.py +30 -0
  70. dexa_ai_sdk-0.3.2/types/image_input_type.py +5 -0
  71. dexa_ai_sdk-0.3.2/types/image_url.py +21 -0
  72. dexa_ai_sdk-0.3.2/types/image_url_detail.py +5 -0
  73. dexa_ai_sdk-0.3.2/types/message.py +24 -0
  74. dexa_ai_sdk-0.3.2/types/message_content.py +7 -0
  75. dexa_ai_sdk-0.3.2/types/message_language.py +29 -0
  76. dexa_ai_sdk-0.3.2/types/message_role.py +5 -0
  77. dexa_ai_sdk-0.3.2/types/response_message.py +23 -0
  78. dexa_ai_sdk-0.3.2/types/response_message_language.py +29 -0
  79. dexa_ai_sdk-0.3.2/types/response_message_role.py +5 -0
  80. dexa_ai_sdk-0.3.2/types/run_tasks_request.py +43 -0
  81. dexa_ai_sdk-0.3.2/types/run_tasks_request_output_language.py +29 -0
  82. dexa_ai_sdk-0.3.2/types/run_tasks_request_response_format.py +20 -0
  83. dexa_ai_sdk-0.3.2/types/run_tasks_request_response_format_type.py +5 -0
  84. dexa_ai_sdk-0.3.2/types/run_tasks_request_target_language.py +29 -0
  85. dexa_ai_sdk-0.3.2/types/run_tasks_response.py +30 -0
  86. dexa_ai_sdk-0.3.2/types/task.py +57 -0
  87. dexa_ai_sdk-0.3.2/types/usage.py +21 -0
@@ -0,0 +1,223 @@
1
+ Metadata-Version: 2.4
2
+ Name: dexa-ai-sdk
3
+ Version: 0.3.2
4
+ Summary: Dexa is the Python client for the Decide + Extract API. Run decide and extract tasks against one context in a single request.
5
+ Author: Durga Sai
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/dsainvg/decide-extract-sdk
8
+ Project-URL: Repository, https://github.com/dsainvg/decide-extract-sdk
9
+ Project-URL: Documentation, https://dsainvg.github.io/decide-extract-sdk/
10
+ Project-URL: Changelog, https://github.com/dsainvg/decide-extract-sdk/blob/main/CHANGELOG.md
11
+ Keywords: fern,sdk,openapi,llm,dexa-ai-sdk,decide,extract
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.9
23
+ Description-Content-Type: text/markdown
24
+ Requires-Dist: httpx>=0.21.0
25
+ Requires-Dist: pydantic>=2.0.0
26
+ Requires-Dist: typing-extensions>=4.0.0
27
+
28
+ # Dsainvg Python Library
29
+
30
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=Dsainvg%2FPython)
31
+ [![pypi](https://img.shields.io/pypi/v/dsainvg_decide_extractor_sdk)](https://pypi.python.org/pypi/dsainvg_decide_extractor_sdk)
32
+
33
+ The Dsainvg Python library provides convenient access to the Dsainvg APIs from Python.
34
+
35
+ ## Table of Contents
36
+
37
+ - [Installation](#installation)
38
+ - [Reference](#reference)
39
+ - [Usage](#usage)
40
+ - [Environments](#environments)
41
+ - [Async Client](#async-client)
42
+ - [Exception Handling](#exception-handling)
43
+ - [Advanced](#advanced)
44
+ - [Access Raw Response Data](#access-raw-response-data)
45
+ - [Retries](#retries)
46
+ - [Timeouts](#timeouts)
47
+ - [Custom Client](#custom-client)
48
+ - [Contributing](#contributing)
49
+
50
+ ## Installation
51
+
52
+ ```sh
53
+ pip install dsainvg_decide_extractor_sdk
54
+ ```
55
+
56
+ ## Reference
57
+
58
+ A full reference for this library is available [here](./reference.md).
59
+
60
+ ## Usage
61
+
62
+ Instantiate and use the client with the following:
63
+
64
+ ```python
65
+ from dsainvg_decide_extractor_sdk import DexaAiSdk, Task_Decide
66
+
67
+ client = DexaAiSdk()
68
+
69
+ client.tasks.run_tasks(
70
+ model="model",
71
+ tasks=[
72
+ Task_Decide(
73
+ name="name",
74
+ question="question",
75
+ )
76
+ ],
77
+ )
78
+ ```
79
+
80
+ ## Environments
81
+
82
+ This SDK allows you to configure different environments for API requests.
83
+
84
+ ```python
85
+ from dsainvg_decide_extractor_sdk import DexaAiSdk
86
+ from dsainvg_decide_extractor_sdk.environment import DexaAiSdkEnvironment
87
+
88
+ client = DexaAiSdk(
89
+ environment=DexaAiSdkEnvironment.DEFAULT,
90
+ )
91
+ ```
92
+
93
+ ## Async Client
94
+
95
+ The SDK also exports an `async` client so that you can make non-blocking calls to our API. Note that if you are constructing an Async httpx client class to pass into this client, use `httpx.AsyncClient()` instead of `httpx.Client()` (e.g. for the `httpx_client` parameter of this client).
96
+
97
+ ```python
98
+ import asyncio
99
+
100
+ from dsainvg_decide_extractor_sdk import AsyncDexaAiSdk
101
+
102
+ client = AsyncDexaAiSdk()
103
+
104
+
105
+ async def main() -> None:
106
+ await client.tasks.run_tasks(
107
+ model="model",
108
+ tasks=[
109
+ Task_Decide(
110
+ name="name",
111
+ question="question",
112
+ )
113
+ ],
114
+ )
115
+
116
+
117
+ asyncio.run(main())
118
+ ```
119
+
120
+ ## Exception Handling
121
+
122
+ When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
123
+ will be thrown.
124
+
125
+ ```python
126
+ from dsainvg_decide_extractor_sdk.core.api_error import ApiError
127
+
128
+ try:
129
+ client.tasks.run_tasks(...)
130
+ except ApiError as e:
131
+ print(e.status_code)
132
+ print(e.body)
133
+ ```
134
+
135
+ ## Advanced
136
+
137
+ ### Access Raw Response Data
138
+
139
+ The SDK provides access to raw response data, including headers, through the `.with_raw_response` property.
140
+ The `.with_raw_response` property returns a "raw" client that can be used to access the `.headers` and `.data` attributes.
141
+
142
+ ```python
143
+ from dsainvg_decide_extractor_sdk import DexaAiSdk
144
+
145
+ client = DexaAiSdk(...)
146
+ response = client.tasks.with_raw_response.run_tasks(...)
147
+ print(response.headers) # access the response headers
148
+ print(response.status_code) # access the response status code
149
+ print(response.data) # access the underlying object
150
+ ```
151
+
152
+ ### Retries
153
+
154
+ The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
155
+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
156
+ retry limit (default: 2).
157
+
158
+ Which status codes are retried depends on the `retryStatusCodes` generator configuration:
159
+
160
+ **`legacy`** (current default): retries on
161
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
162
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
163
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
164
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500)
165
+
166
+ **`recommended`**: retries on
167
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
168
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
169
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
170
+ - [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway)
171
+ - [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable)
172
+ - [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout)
173
+
174
+ Use the `max_retries` request option to configure this behavior.
175
+
176
+ ```python
177
+ client.tasks.run_tasks(..., request_options={
178
+ "max_retries": 1
179
+ })
180
+ ```
181
+
182
+ ### Timeouts
183
+
184
+ The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
185
+
186
+ ```python
187
+ from dsainvg_decide_extractor_sdk import DexaAiSdk
188
+
189
+ client = DexaAiSdk(..., timeout=20.0)
190
+
191
+ # Override timeout for a specific method
192
+ client.tasks.run_tasks(..., request_options={
193
+ "timeout": 1
194
+ })
195
+ ```
196
+
197
+ ### Custom Client
198
+
199
+ You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
200
+ and transports.
201
+
202
+ ```python
203
+ import httpx
204
+ from dsainvg_decide_extractor_sdk import DexaAiSdk
205
+
206
+ client = DexaAiSdk(
207
+ ...,
208
+ httpx_client=httpx.Client(
209
+ proxy="http://my.test.proxy.example.com",
210
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
211
+ ),
212
+ )
213
+ ```
214
+
215
+ ## Contributing
216
+
217
+ While we value open-source contributions to this SDK, this library is generated programmatically.
218
+ Additions made directly to this library would have to be moved over to our generation code,
219
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
220
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
221
+ an issue first to discuss with us!
222
+
223
+ On the other hand, contributions to the README are always very welcome!
@@ -0,0 +1,196 @@
1
+ # Dsainvg Python Library
2
+
3
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=Dsainvg%2FPython)
4
+ [![pypi](https://img.shields.io/pypi/v/dsainvg_decide_extractor_sdk)](https://pypi.python.org/pypi/dsainvg_decide_extractor_sdk)
5
+
6
+ The Dsainvg Python library provides convenient access to the Dsainvg APIs from Python.
7
+
8
+ ## Table of Contents
9
+
10
+ - [Installation](#installation)
11
+ - [Reference](#reference)
12
+ - [Usage](#usage)
13
+ - [Environments](#environments)
14
+ - [Async Client](#async-client)
15
+ - [Exception Handling](#exception-handling)
16
+ - [Advanced](#advanced)
17
+ - [Access Raw Response Data](#access-raw-response-data)
18
+ - [Retries](#retries)
19
+ - [Timeouts](#timeouts)
20
+ - [Custom Client](#custom-client)
21
+ - [Contributing](#contributing)
22
+
23
+ ## Installation
24
+
25
+ ```sh
26
+ pip install dsainvg_decide_extractor_sdk
27
+ ```
28
+
29
+ ## Reference
30
+
31
+ A full reference for this library is available [here](./reference.md).
32
+
33
+ ## Usage
34
+
35
+ Instantiate and use the client with the following:
36
+
37
+ ```python
38
+ from dsainvg_decide_extractor_sdk import DexaAiSdk, Task_Decide
39
+
40
+ client = DexaAiSdk()
41
+
42
+ client.tasks.run_tasks(
43
+ model="model",
44
+ tasks=[
45
+ Task_Decide(
46
+ name="name",
47
+ question="question",
48
+ )
49
+ ],
50
+ )
51
+ ```
52
+
53
+ ## Environments
54
+
55
+ This SDK allows you to configure different environments for API requests.
56
+
57
+ ```python
58
+ from dsainvg_decide_extractor_sdk import DexaAiSdk
59
+ from dsainvg_decide_extractor_sdk.environment import DexaAiSdkEnvironment
60
+
61
+ client = DexaAiSdk(
62
+ environment=DexaAiSdkEnvironment.DEFAULT,
63
+ )
64
+ ```
65
+
66
+ ## Async Client
67
+
68
+ The SDK also exports an `async` client so that you can make non-blocking calls to our API. Note that if you are constructing an Async httpx client class to pass into this client, use `httpx.AsyncClient()` instead of `httpx.Client()` (e.g. for the `httpx_client` parameter of this client).
69
+
70
+ ```python
71
+ import asyncio
72
+
73
+ from dsainvg_decide_extractor_sdk import AsyncDexaAiSdk
74
+
75
+ client = AsyncDexaAiSdk()
76
+
77
+
78
+ async def main() -> None:
79
+ await client.tasks.run_tasks(
80
+ model="model",
81
+ tasks=[
82
+ Task_Decide(
83
+ name="name",
84
+ question="question",
85
+ )
86
+ ],
87
+ )
88
+
89
+
90
+ asyncio.run(main())
91
+ ```
92
+
93
+ ## Exception Handling
94
+
95
+ When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
96
+ will be thrown.
97
+
98
+ ```python
99
+ from dsainvg_decide_extractor_sdk.core.api_error import ApiError
100
+
101
+ try:
102
+ client.tasks.run_tasks(...)
103
+ except ApiError as e:
104
+ print(e.status_code)
105
+ print(e.body)
106
+ ```
107
+
108
+ ## Advanced
109
+
110
+ ### Access Raw Response Data
111
+
112
+ The SDK provides access to raw response data, including headers, through the `.with_raw_response` property.
113
+ The `.with_raw_response` property returns a "raw" client that can be used to access the `.headers` and `.data` attributes.
114
+
115
+ ```python
116
+ from dsainvg_decide_extractor_sdk import DexaAiSdk
117
+
118
+ client = DexaAiSdk(...)
119
+ response = client.tasks.with_raw_response.run_tasks(...)
120
+ print(response.headers) # access the response headers
121
+ print(response.status_code) # access the response status code
122
+ print(response.data) # access the underlying object
123
+ ```
124
+
125
+ ### Retries
126
+
127
+ The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
128
+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
129
+ retry limit (default: 2).
130
+
131
+ Which status codes are retried depends on the `retryStatusCodes` generator configuration:
132
+
133
+ **`legacy`** (current default): retries on
134
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
135
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
136
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
137
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500)
138
+
139
+ **`recommended`**: retries on
140
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
141
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
142
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
143
+ - [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway)
144
+ - [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable)
145
+ - [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout)
146
+
147
+ Use the `max_retries` request option to configure this behavior.
148
+
149
+ ```python
150
+ client.tasks.run_tasks(..., request_options={
151
+ "max_retries": 1
152
+ })
153
+ ```
154
+
155
+ ### Timeouts
156
+
157
+ The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
158
+
159
+ ```python
160
+ from dsainvg_decide_extractor_sdk import DexaAiSdk
161
+
162
+ client = DexaAiSdk(..., timeout=20.0)
163
+
164
+ # Override timeout for a specific method
165
+ client.tasks.run_tasks(..., request_options={
166
+ "timeout": 1
167
+ })
168
+ ```
169
+
170
+ ### Custom Client
171
+
172
+ You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
173
+ and transports.
174
+
175
+ ```python
176
+ import httpx
177
+ from dsainvg_decide_extractor_sdk import DexaAiSdk
178
+
179
+ client = DexaAiSdk(
180
+ ...,
181
+ httpx_client=httpx.Client(
182
+ proxy="http://my.test.proxy.example.com",
183
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
184
+ ),
185
+ )
186
+ ```
187
+
188
+ ## Contributing
189
+
190
+ While we value open-source contributions to this SDK, this library is generated programmatically.
191
+ Additions made directly to this library would have to be moved over to our generation code,
192
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
193
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
194
+ an issue first to discuss with us!
195
+
196
+ On the other hand, contributions to the README are always very welcome!
@@ -0,0 +1,197 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ import typing
6
+ from importlib import import_module
7
+
8
+ if typing.TYPE_CHECKING:
9
+ from .types import (
10
+ AudioInput,
11
+ AudioInputType,
12
+ Choice,
13
+ ChoiceFinishReason,
14
+ ContentPart,
15
+ ContentPartLanguage,
16
+ ContentPartType,
17
+ DecideResponse,
18
+ DecideResult,
19
+ DecideTask,
20
+ DecideTaskTargetLanguage,
21
+ ErrorResponse,
22
+ ErrorResponseError,
23
+ ExtractResponse,
24
+ ExtractTask,
25
+ ExtractTaskTargetLanguage,
26
+ ImageInput,
27
+ ImageInputType,
28
+ ImageUrl,
29
+ ImageUrlDetail,
30
+ Message,
31
+ MessageContent,
32
+ MessageLanguage,
33
+ MessageRole,
34
+ ResponseMessage,
35
+ ResponseMessageLanguage,
36
+ ResponseMessageRole,
37
+ RunTasksRequest,
38
+ RunTasksRequestOutputLanguage,
39
+ RunTasksRequestResponseFormat,
40
+ RunTasksRequestResponseFormatType,
41
+ RunTasksRequestTargetLanguage,
42
+ RunTasksResponse,
43
+ Task,
44
+ Task_Decide,
45
+ Task_Extract,
46
+ Usage,
47
+ )
48
+ from .errors import BadRequestError, InternalServerError, UnprocessableEntityError
49
+ from . import tasks
50
+ from ._default_clients import DefaultAioHttpClient, DefaultAsyncHttpxClient
51
+ from .client import AsyncDexaAiSdk, DexaAiSdk
52
+ from .environment import DexaAiSdkEnvironment
53
+ from .tasks import (
54
+ DecideRequestOutputLanguage,
55
+ DecideRequestResponseFormat,
56
+ DecideRequestResponseFormatType,
57
+ DecideRequestTargetLanguage,
58
+ ExtractRequestOutputLanguage,
59
+ ExtractRequestResponseFormat,
60
+ ExtractRequestResponseFormatType,
61
+ ExtractRequestTargetLanguage,
62
+ )
63
+ _dynamic_imports: typing.Dict[str, str] = {
64
+ "AsyncDexaAiSdk": ".client",
65
+ "AudioInput": ".types",
66
+ "AudioInputType": ".types",
67
+ "BadRequestError": ".errors",
68
+ "Choice": ".types",
69
+ "ChoiceFinishReason": ".types",
70
+ "ContentPart": ".types",
71
+ "ContentPartLanguage": ".types",
72
+ "ContentPartType": ".types",
73
+ "DecideRequestOutputLanguage": ".tasks",
74
+ "DecideRequestResponseFormat": ".tasks",
75
+ "DecideRequestResponseFormatType": ".tasks",
76
+ "DecideRequestTargetLanguage": ".tasks",
77
+ "DecideResponse": ".types",
78
+ "DecideResult": ".types",
79
+ "DecideTask": ".types",
80
+ "DecideTaskTargetLanguage": ".types",
81
+ "DefaultAioHttpClient": "._default_clients",
82
+ "DefaultAsyncHttpxClient": "._default_clients",
83
+ "DexaAiSdk": ".client",
84
+ "DexaAiSdkEnvironment": ".environment",
85
+ "ErrorResponse": ".types",
86
+ "ErrorResponseError": ".types",
87
+ "ExtractRequestOutputLanguage": ".tasks",
88
+ "ExtractRequestResponseFormat": ".tasks",
89
+ "ExtractRequestResponseFormatType": ".tasks",
90
+ "ExtractRequestTargetLanguage": ".tasks",
91
+ "ExtractResponse": ".types",
92
+ "ExtractTask": ".types",
93
+ "ExtractTaskTargetLanguage": ".types",
94
+ "ImageInput": ".types",
95
+ "ImageInputType": ".types",
96
+ "ImageUrl": ".types",
97
+ "ImageUrlDetail": ".types",
98
+ "InternalServerError": ".errors",
99
+ "Message": ".types",
100
+ "MessageContent": ".types",
101
+ "MessageLanguage": ".types",
102
+ "MessageRole": ".types",
103
+ "ResponseMessage": ".types",
104
+ "ResponseMessageLanguage": ".types",
105
+ "ResponseMessageRole": ".types",
106
+ "RunTasksRequest": ".types",
107
+ "RunTasksRequestOutputLanguage": ".types",
108
+ "RunTasksRequestResponseFormat": ".types",
109
+ "RunTasksRequestResponseFormatType": ".types",
110
+ "RunTasksRequestTargetLanguage": ".types",
111
+ "RunTasksResponse": ".types",
112
+ "Task": ".types",
113
+ "Task_Decide": ".types",
114
+ "Task_Extract": ".types",
115
+ "UnprocessableEntityError": ".errors",
116
+ "Usage": ".types",
117
+ "tasks": ".tasks",
118
+ }
119
+
120
+
121
+ def __getattr__(attr_name: str) -> typing.Any:
122
+ module_name = _dynamic_imports.get(attr_name)
123
+ if module_name is None:
124
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
125
+ try:
126
+ module = import_module(module_name, __package__)
127
+ if module_name == f".{attr_name}":
128
+ return module
129
+ else:
130
+ return getattr(module, attr_name)
131
+ except ImportError as e:
132
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
133
+ except AttributeError as e:
134
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
135
+
136
+
137
+ def __dir__():
138
+ lazy_attrs = list(_dynamic_imports.keys())
139
+ return sorted(lazy_attrs)
140
+
141
+
142
+ __all__ = [
143
+ "AsyncDexaAiSdk",
144
+ "AudioInput",
145
+ "AudioInputType",
146
+ "BadRequestError",
147
+ "Choice",
148
+ "ChoiceFinishReason",
149
+ "ContentPart",
150
+ "ContentPartLanguage",
151
+ "ContentPartType",
152
+ "DecideRequestOutputLanguage",
153
+ "DecideRequestResponseFormat",
154
+ "DecideRequestResponseFormatType",
155
+ "DecideRequestTargetLanguage",
156
+ "DecideResponse",
157
+ "DecideResult",
158
+ "DecideTask",
159
+ "DecideTaskTargetLanguage",
160
+ "DefaultAioHttpClient",
161
+ "DefaultAsyncHttpxClient",
162
+ "DexaAiSdk",
163
+ "DexaAiSdkEnvironment",
164
+ "ErrorResponse",
165
+ "ErrorResponseError",
166
+ "ExtractRequestOutputLanguage",
167
+ "ExtractRequestResponseFormat",
168
+ "ExtractRequestResponseFormatType",
169
+ "ExtractRequestTargetLanguage",
170
+ "ExtractResponse",
171
+ "ExtractTask",
172
+ "ExtractTaskTargetLanguage",
173
+ "ImageInput",
174
+ "ImageInputType",
175
+ "ImageUrl",
176
+ "ImageUrlDetail",
177
+ "InternalServerError",
178
+ "Message",
179
+ "MessageContent",
180
+ "MessageLanguage",
181
+ "MessageRole",
182
+ "ResponseMessage",
183
+ "ResponseMessageLanguage",
184
+ "ResponseMessageRole",
185
+ "RunTasksRequest",
186
+ "RunTasksRequestOutputLanguage",
187
+ "RunTasksRequestResponseFormat",
188
+ "RunTasksRequestResponseFormatType",
189
+ "RunTasksRequestTargetLanguage",
190
+ "RunTasksResponse",
191
+ "Task",
192
+ "Task_Decide",
193
+ "Task_Extract",
194
+ "UnprocessableEntityError",
195
+ "Usage",
196
+ "tasks",
197
+ ]
@@ -0,0 +1,33 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import httpx
6
+
7
+ SDK_DEFAULT_TIMEOUT = 60
8
+
9
+ try:
10
+ import httpx_aiohttp # type: ignore[import-not-found]
11
+ except ImportError:
12
+
13
+ class DefaultAioHttpClient(httpx.AsyncClient): # type: ignore
14
+ def __init__(self, **kwargs: typing.Any) -> None:
15
+ raise RuntimeError(
16
+ "To use the aiohttp client, install the aiohttp extra: "
17
+ "pip install dsainvg_decide_extractor_sdk[aiohttp]"
18
+ )
19
+
20
+ else:
21
+
22
+ class DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore
23
+ def __init__(self, **kwargs: typing.Any) -> None:
24
+ kwargs.setdefault("timeout", SDK_DEFAULT_TIMEOUT)
25
+ kwargs.setdefault("follow_redirects", True)
26
+ super().__init__(**kwargs)
27
+
28
+
29
+ class DefaultAsyncHttpxClient(httpx.AsyncClient):
30
+ def __init__(self, **kwargs: typing.Any) -> None:
31
+ kwargs.setdefault("timeout", SDK_DEFAULT_TIMEOUT)
32
+ kwargs.setdefault("follow_redirects", True)
33
+ super().__init__(**kwargs)