partite-ai 1.0.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 (110) hide show
  1. partite_ai-1.0.0/LICENSE +21 -0
  2. partite_ai-1.0.0/PKG-INFO +262 -0
  3. partite_ai-1.0.0/README.md +228 -0
  4. partite_ai-1.0.0/pyproject.toml +99 -0
  5. partite_ai-1.0.0/src/partite_ai/__init__.py +338 -0
  6. partite_ai-1.0.0/src/partite_ai/_default_clients.py +30 -0
  7. partite_ai-1.0.0/src/partite_ai/client.py +236 -0
  8. partite_ai-1.0.0/src/partite_ai/conversations/__init__.py +34 -0
  9. partite_ai-1.0.0/src/partite_ai/conversations/client.py +1087 -0
  10. partite_ai-1.0.0/src/partite_ai/conversations/raw_client.py +2178 -0
  11. partite_ai-1.0.0/src/partite_ai/conversations/types/__init__.py +38 -0
  12. partite_ai-1.0.0/src/partite_ai/conversations/types/list_intents_response.py +20 -0
  13. partite_ai-1.0.0/src/partite_ai/conversations/types/list_requests_response.py +24 -0
  14. partite_ai-1.0.0/src/partite_ai/core/__init__.py +134 -0
  15. partite_ai-1.0.0/src/partite_ai/core/api_error.py +23 -0
  16. partite_ai-1.0.0/src/partite_ai/core/client_options.py +119 -0
  17. partite_ai-1.0.0/src/partite_ai/core/client_wrapper.py +142 -0
  18. partite_ai-1.0.0/src/partite_ai/core/datetime_utils.py +70 -0
  19. partite_ai-1.0.0/src/partite_ai/core/file.py +67 -0
  20. partite_ai-1.0.0/src/partite_ai/core/force_multipart.py +18 -0
  21. partite_ai-1.0.0/src/partite_ai/core/http_client.py +965 -0
  22. partite_ai-1.0.0/src/partite_ai/core/http_response.py +63 -0
  23. partite_ai-1.0.0/src/partite_ai/core/http_sse/__init__.py +42 -0
  24. partite_ai-1.0.0/src/partite_ai/core/http_sse/_api.py +455 -0
  25. partite_ai-1.0.0/src/partite_ai/core/http_sse/_decoders.py +74 -0
  26. partite_ai-1.0.0/src/partite_ai/core/http_sse/_exceptions.py +7 -0
  27. partite_ai-1.0.0/src/partite_ai/core/http_sse/_models.py +17 -0
  28. partite_ai-1.0.0/src/partite_ai/core/jsonable_encoder.py +133 -0
  29. partite_ai-1.0.0/src/partite_ai/core/logging.py +107 -0
  30. partite_ai-1.0.0/src/partite_ai/core/parse_error.py +36 -0
  31. partite_ai-1.0.0/src/partite_ai/core/pydantic_utilities.py +486 -0
  32. partite_ai-1.0.0/src/partite_ai/core/query_encoder.py +58 -0
  33. partite_ai-1.0.0/src/partite_ai/core/remove_none_from_dict.py +11 -0
  34. partite_ai-1.0.0/src/partite_ai/core/request_options.py +39 -0
  35. partite_ai-1.0.0/src/partite_ai/core/serialization.py +347 -0
  36. partite_ai-1.0.0/src/partite_ai/core/stream.py +148 -0
  37. partite_ai-1.0.0/src/partite_ai/environment.py +7 -0
  38. partite_ai-1.0.0/src/partite_ai/errors/__init__.py +59 -0
  39. partite_ai-1.0.0/src/partite_ai/errors/bad_request_error.py +11 -0
  40. partite_ai-1.0.0/src/partite_ai/errors/conflict_error.py +11 -0
  41. partite_ai-1.0.0/src/partite_ai/errors/content_too_large_error.py +11 -0
  42. partite_ai-1.0.0/src/partite_ai/errors/forbidden_error.py +11 -0
  43. partite_ai-1.0.0/src/partite_ai/errors/internal_server_error.py +11 -0
  44. partite_ai-1.0.0/src/partite_ai/errors/not_acceptable_error.py +11 -0
  45. partite_ai-1.0.0/src/partite_ai/errors/not_found_error.py +11 -0
  46. partite_ai-1.0.0/src/partite_ai/errors/unsupported_media_type_error.py +11 -0
  47. partite_ai-1.0.0/src/partite_ai/notification_channels/__init__.py +4 -0
  48. partite_ai-1.0.0/src/partite_ai/notification_channels/client.py +195 -0
  49. partite_ai-1.0.0/src/partite_ai/notification_channels/raw_client.py +416 -0
  50. partite_ai-1.0.0/src/partite_ai/py.typed +0 -0
  51. partite_ai-1.0.0/src/partite_ai/types/__init__.py +287 -0
  52. partite_ai-1.0.0/src/partite_ai/types/a2ui_presentation.py +24 -0
  53. partite_ai-1.0.0/src/partite_ai/types/a2ui_surface_components.py +22 -0
  54. partite_ai-1.0.0/src/partite_ai/types/a2ui_surfaces.py +28 -0
  55. partite_ai-1.0.0/src/partite_ai/types/approval_tool.py +34 -0
  56. partite_ai-1.0.0/src/partite_ai/types/approval_tool_memory.py +27 -0
  57. partite_ai-1.0.0/src/partite_ai/types/approval_tool_memory_operation.py +5 -0
  58. partite_ai-1.0.0/src/partite_ai/types/approval_tool_source.py +26 -0
  59. partite_ai-1.0.0/src/partite_ai/types/approval_tool_source_kind.py +7 -0
  60. partite_ai-1.0.0/src/partite_ai/types/boundary_problem.py +37 -0
  61. partite_ai-1.0.0/src/partite_ai/types/cancelled_event.py +24 -0
  62. partite_ai-1.0.0/src/partite_ai/types/client_task.py +33 -0
  63. partite_ai-1.0.0/src/partite_ai/types/client_task_data.py +29 -0
  64. partite_ai-1.0.0/src/partite_ai/types/conversation.py +31 -0
  65. partite_ai-1.0.0/src/partite_ai/types/conversation_mesh.py +37 -0
  66. partite_ai-1.0.0/src/partite_ai/types/conversation_mesh_version.py +24 -0
  67. partite_ai-1.0.0/src/partite_ai/types/create_conversation_params.py +55 -0
  68. partite_ai-1.0.0/src/partite_ai/types/create_request_params.py +33 -0
  69. partite_ai-1.0.0/src/partite_ai/types/created_conversation.py +25 -0
  70. partite_ai-1.0.0/src/partite_ai/types/error_event.py +24 -0
  71. partite_ai-1.0.0/src/partite_ai/types/intent.py +33 -0
  72. partite_ai-1.0.0/src/partite_ai/types/intent_responses_item.py +25 -0
  73. partite_ai-1.0.0/src/partite_ai/types/message_event.py +24 -0
  74. partite_ai-1.0.0/src/partite_ai/types/notification_channel_created.py +26 -0
  75. partite_ai-1.0.0/src/partite_ai/types/notification_channel_event.py +49 -0
  76. partite_ai-1.0.0/src/partite_ai/types/notification_channel_event_list.py +28 -0
  77. partite_ai-1.0.0/src/partite_ai/types/notification_channel_event_type.py +5 -0
  78. partite_ai-1.0.0/src/partite_ai/types/notification_channel_message_event.py +28 -0
  79. partite_ai-1.0.0/src/partite_ai/types/notification_channel_server_error_event.py +23 -0
  80. partite_ai-1.0.0/src/partite_ai/types/notification_channel_sse_event.py +52 -0
  81. partite_ai-1.0.0/src/partite_ai/types/notification_channel_stream_data.py +56 -0
  82. partite_ai-1.0.0/src/partite_ai/types/open_client_task.py +27 -0
  83. partite_ai-1.0.0/src/partite_ai/types/open_tool_call_approval.py +27 -0
  84. partite_ai-1.0.0/src/partite_ai/types/presentation.py +30 -0
  85. partite_ai-1.0.0/src/partite_ai/types/problem.py +30 -0
  86. partite_ai-1.0.0/src/partite_ai/types/reference.py +8 -0
  87. partite_ai-1.0.0/src/partite_ai/types/request.py +45 -0
  88. partite_ai-1.0.0/src/partite_ai/types/request_event.py +159 -0
  89. partite_ai-1.0.0/src/partite_ai/types/request_server_sent_event.py +30 -0
  90. partite_ai-1.0.0/src/partite_ai/types/request_server_sent_event_event.py +18 -0
  91. partite_ai-1.0.0/src/partite_ai/types/request_status.py +5 -0
  92. partite_ai-1.0.0/src/partite_ai/types/request_stream_event.py +198 -0
  93. partite_ai-1.0.0/src/partite_ai/types/resource.py +46 -0
  94. partite_ai-1.0.0/src/partite_ai/types/resource_kind.py +5 -0
  95. partite_ai-1.0.0/src/partite_ai/types/resource_list.py +20 -0
  96. partite_ai-1.0.0/src/partite_ai/types/response_event.py +24 -0
  97. partite_ai-1.0.0/src/partite_ai/types/server_error_event.py +23 -0
  98. partite_ai-1.0.0/src/partite_ai/types/started_event.py +24 -0
  99. partite_ai-1.0.0/src/partite_ai/types/tag.py +24 -0
  100. partite_ai-1.0.0/src/partite_ai/types/task.py +56 -0
  101. partite_ai-1.0.0/src/partite_ai/types/task_data.py +54 -0
  102. partite_ai-1.0.0/src/partite_ai/types/task_event.py +25 -0
  103. partite_ai-1.0.0/src/partite_ai/types/task_response_event.py +33 -0
  104. partite_ai-1.0.0/src/partite_ai/types/task_response_event_data.py +7 -0
  105. partite_ai-1.0.0/src/partite_ai/types/task_response_event_data_one.py +5 -0
  106. partite_ai-1.0.0/src/partite_ai/types/thinking_event.py +24 -0
  107. partite_ai-1.0.0/src/partite_ai/types/tool_call_approval.py +34 -0
  108. partite_ai-1.0.0/src/partite_ai/types/tool_call_approval_data.py +29 -0
  109. partite_ai-1.0.0/src/partite_ai/types/tool_call_approval_response.py +31 -0
  110. partite_ai-1.0.0/src/partite_ai/version.py +3 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Partite AI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,262 @@
1
+ Metadata-Version: 2.4
2
+ Name: partite_ai
3
+ Version: 1.0.0
4
+ Summary:
5
+ License-Expression: MIT
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.10,<4.0
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: Operating System :: MacOS
10
+ Classifier: Operating System :: Microsoft :: Windows
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Operating System :: POSIX
13
+ Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
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: Programming Language :: Python :: 3.14
21
+ Classifier: Programming Language :: Python :: 3.15
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Typing :: Typed
24
+ Provides-Extra: aiohttp
25
+ Requires-Dist: aiohttp (>=3.14.1,<4) ; (python_version >= "3.10") and (extra == "aiohttp")
26
+ Requires-Dist: httpx (>=0.21.2)
27
+ Requires-Dist: httpx-aiohttp (>=0.1.8,<0.2.0) ; (python_version >= "3.10") and (extra == "aiohttp")
28
+ Requires-Dist: pydantic (>=1.9.2)
29
+ Requires-Dist: pydantic-core (>=2.18.2,<3.0.0)
30
+ Requires-Dist: typing_extensions (>=4.0.0)
31
+ Project-URL: Repository, https://github.com/partite-ai/sdk-python
32
+ Description-Content-Type: text/markdown
33
+
34
+ # Partite AI Python Library
35
+
36
+ [![pypi](https://img.shields.io/pypi/v/partite_ai)](https://pypi.python.org/pypi/partite_ai)
37
+
38
+ The Partite AI Python library provides convenient access to the Partite AI APIs from Python.
39
+
40
+ ## Table of Contents
41
+
42
+ - [Installation](#installation)
43
+ - [Reference](#reference)
44
+ - [Usage](#usage)
45
+ - [Environments](#environments)
46
+ - [Async Client](#async-client)
47
+ - [Exception Handling](#exception-handling)
48
+ - [Streaming](#streaming)
49
+ - [Advanced](#advanced)
50
+ - [Access Raw Response Data](#access-raw-response-data)
51
+ - [Retries](#retries)
52
+ - [Timeouts](#timeouts)
53
+ - [Request Options](#request-options)
54
+ - [Custom Client](#custom-client)
55
+ - [Contributing](#contributing)
56
+
57
+ ## Installation
58
+
59
+ ```sh
60
+ pip install partite_ai
61
+ ```
62
+
63
+ ## Reference
64
+
65
+ A full reference for this library is available [here](./reference.md).
66
+
67
+ ## Usage
68
+
69
+ Instantiate and use the client with the following:
70
+
71
+ ```python
72
+ from partite_ai import PartiteAiApi, CreateConversationParams
73
+
74
+ client = PartiteAiApi(
75
+ api_key="<token>",
76
+ )
77
+
78
+ client.conversations.create_conversation(
79
+ attachments=["example_attachments"],
80
+ params=CreateConversationParams(),
81
+ )
82
+ ```
83
+
84
+ ## Environments
85
+
86
+ This SDK allows you to configure different environments for API requests.
87
+
88
+ ```python
89
+ from partite_ai import PartiteAiApi
90
+ from partite_ai.environment import PartiteAiApiEnvironment
91
+
92
+ client = PartiteAiApi(
93
+ environment=PartiteAiApiEnvironment.DEFAULT,
94
+ )
95
+ ```
96
+
97
+ ## Async Client
98
+
99
+ 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).
100
+
101
+ ```python
102
+ import asyncio
103
+
104
+ from partite_ai import AsyncPartiteAiApi
105
+
106
+ client = AsyncPartiteAiApi(
107
+ api_key="<token>",
108
+ )
109
+
110
+
111
+ async def main() -> None:
112
+ await client.conversations.create_conversation(
113
+ attachments=["example_attachments"],
114
+ params=CreateConversationParams(),
115
+ )
116
+
117
+
118
+ asyncio.run(main())
119
+ ```
120
+
121
+ ## Exception Handling
122
+
123
+ When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
124
+ will be thrown.
125
+
126
+ ```python
127
+ from partite_ai.core.api_error import ApiError
128
+
129
+ try:
130
+ client.conversations.create_conversation(...)
131
+ except ApiError as e:
132
+ print(e.status_code)
133
+ print(e.body)
134
+ ```
135
+
136
+ ## Streaming
137
+
138
+ The SDK supports streaming responses, as well, the response will be a generator that you can loop over.
139
+
140
+ ```python
141
+ from partite_ai import PartiteAiApi
142
+
143
+ client = PartiteAiApi(
144
+ api_key="<token>",
145
+ )
146
+
147
+ client.conversations.stream_request_events(
148
+ conversation_id="extid=thread-42",
149
+ request_id="request_id",
150
+ )
151
+ ```
152
+
153
+ ## Advanced
154
+
155
+ ### Access Raw Response Data
156
+
157
+ The SDK provides access to raw response data, including headers, through the `.with_raw_response` property.
158
+ The `.with_raw_response` property returns a "raw" client that can be used to access the `.headers` and `.data` attributes.
159
+
160
+ ```python
161
+ from partite_ai import PartiteAiApi
162
+
163
+ client = PartiteAiApi(...)
164
+ response = client.conversations.with_raw_response.create_conversation(...)
165
+ print(response.headers) # access the response headers
166
+ print(response.status_code) # access the response status code
167
+ print(response.data) # access the underlying object
168
+ ```
169
+
170
+ ### Retries
171
+
172
+ The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
173
+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
174
+ retry limit (default: 2).
175
+
176
+ Which status codes are retried depends on the `retryStatusCodes` generator configuration:
177
+
178
+ **`legacy`** (current default): retries on
179
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
180
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
181
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
182
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500)
183
+
184
+ **`recommended`**: retries on
185
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
186
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
187
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
188
+ - [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway)
189
+ - [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable)
190
+ - [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout)
191
+
192
+ Use the `max_retries` option, on the client constructor or with `with_options`, to configure this behavior.
193
+
194
+ ```python
195
+ client.with_options(max_retries=1).conversations.create_conversation(...)
196
+ ```
197
+
198
+ ### Timeouts
199
+
200
+ The SDK defaults to a 60 second timeout. You can configure this with a timeout option on the client, or for
201
+ the requests made through a client scoped with `with_options`.
202
+
203
+ ```python
204
+ from partite_ai import PartiteAiApi
205
+
206
+ client = PartiteAiApi(..., timeout=20.0)
207
+
208
+ # Override the timeout for requests made through a scoped client
209
+ client.with_options(timeout=1).conversations.create_conversation(...)
210
+ ```
211
+
212
+ ### Request Options
213
+
214
+ SDK settings such as timeouts, retries and additional headers or query parameters are not method arguments;
215
+ they are set on a client. `with_options(...)` returns a copy of a client (or of any sub-client) whose requests
216
+ all use the given options, sharing the original's connection pool and leaving the original unchanged. The
217
+ accepted options are `timeout`, `max_retries`, `additional_headers`, `additional_query_parameters`,
218
+ `additional_body_parameters` and `chunk_size`.
219
+
220
+ ```python
221
+ scoped = client.with_options(
222
+ additional_headers={"X-Custom-Header": "value"},
223
+ additional_query_parameters={"custom_param": "value"},
224
+ )
225
+ scoped.conversations.create_conversation(...)
226
+
227
+ # Calls chain: later options win, and header/query/body dicts are merged
228
+ scoped.with_options(timeout=5).conversations.create_conversation(...)
229
+
230
+ # Sub-clients can be scoped too
231
+ conversations = client.conversations.with_options(max_retries=0)
232
+ conversations.create_conversation(...)
233
+ ```
234
+
235
+ ### Custom Client
236
+
237
+ You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
238
+ and transports.
239
+
240
+ ```python
241
+ import httpx
242
+ from partite_ai import PartiteAiApi
243
+
244
+ client = PartiteAiApi(
245
+ ...,
246
+ httpx_client=httpx.Client(
247
+ proxy="http://my.test.proxy.example.com",
248
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
249
+ ),
250
+ )
251
+ ```
252
+
253
+ ## Contributing
254
+
255
+ While we value open-source contributions to this SDK, this library is generated programmatically.
256
+ Additions made directly to this library would have to be moved over to our generation code,
257
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
258
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
259
+ an issue first to discuss with us!
260
+
261
+ On the other hand, contributions to the README are always very welcome!
262
+
@@ -0,0 +1,228 @@
1
+ # Partite AI Python Library
2
+
3
+ [![pypi](https://img.shields.io/pypi/v/partite_ai)](https://pypi.python.org/pypi/partite_ai)
4
+
5
+ The Partite AI Python library provides convenient access to the Partite AI APIs from Python.
6
+
7
+ ## Table of Contents
8
+
9
+ - [Installation](#installation)
10
+ - [Reference](#reference)
11
+ - [Usage](#usage)
12
+ - [Environments](#environments)
13
+ - [Async Client](#async-client)
14
+ - [Exception Handling](#exception-handling)
15
+ - [Streaming](#streaming)
16
+ - [Advanced](#advanced)
17
+ - [Access Raw Response Data](#access-raw-response-data)
18
+ - [Retries](#retries)
19
+ - [Timeouts](#timeouts)
20
+ - [Request Options](#request-options)
21
+ - [Custom Client](#custom-client)
22
+ - [Contributing](#contributing)
23
+
24
+ ## Installation
25
+
26
+ ```sh
27
+ pip install partite_ai
28
+ ```
29
+
30
+ ## Reference
31
+
32
+ A full reference for this library is available [here](./reference.md).
33
+
34
+ ## Usage
35
+
36
+ Instantiate and use the client with the following:
37
+
38
+ ```python
39
+ from partite_ai import PartiteAiApi, CreateConversationParams
40
+
41
+ client = PartiteAiApi(
42
+ api_key="<token>",
43
+ )
44
+
45
+ client.conversations.create_conversation(
46
+ attachments=["example_attachments"],
47
+ params=CreateConversationParams(),
48
+ )
49
+ ```
50
+
51
+ ## Environments
52
+
53
+ This SDK allows you to configure different environments for API requests.
54
+
55
+ ```python
56
+ from partite_ai import PartiteAiApi
57
+ from partite_ai.environment import PartiteAiApiEnvironment
58
+
59
+ client = PartiteAiApi(
60
+ environment=PartiteAiApiEnvironment.DEFAULT,
61
+ )
62
+ ```
63
+
64
+ ## Async Client
65
+
66
+ 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).
67
+
68
+ ```python
69
+ import asyncio
70
+
71
+ from partite_ai import AsyncPartiteAiApi
72
+
73
+ client = AsyncPartiteAiApi(
74
+ api_key="<token>",
75
+ )
76
+
77
+
78
+ async def main() -> None:
79
+ await client.conversations.create_conversation(
80
+ attachments=["example_attachments"],
81
+ params=CreateConversationParams(),
82
+ )
83
+
84
+
85
+ asyncio.run(main())
86
+ ```
87
+
88
+ ## Exception Handling
89
+
90
+ When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
91
+ will be thrown.
92
+
93
+ ```python
94
+ from partite_ai.core.api_error import ApiError
95
+
96
+ try:
97
+ client.conversations.create_conversation(...)
98
+ except ApiError as e:
99
+ print(e.status_code)
100
+ print(e.body)
101
+ ```
102
+
103
+ ## Streaming
104
+
105
+ The SDK supports streaming responses, as well, the response will be a generator that you can loop over.
106
+
107
+ ```python
108
+ from partite_ai import PartiteAiApi
109
+
110
+ client = PartiteAiApi(
111
+ api_key="<token>",
112
+ )
113
+
114
+ client.conversations.stream_request_events(
115
+ conversation_id="extid=thread-42",
116
+ request_id="request_id",
117
+ )
118
+ ```
119
+
120
+ ## Advanced
121
+
122
+ ### Access Raw Response Data
123
+
124
+ The SDK provides access to raw response data, including headers, through the `.with_raw_response` property.
125
+ The `.with_raw_response` property returns a "raw" client that can be used to access the `.headers` and `.data` attributes.
126
+
127
+ ```python
128
+ from partite_ai import PartiteAiApi
129
+
130
+ client = PartiteAiApi(...)
131
+ response = client.conversations.with_raw_response.create_conversation(...)
132
+ print(response.headers) # access the response headers
133
+ print(response.status_code) # access the response status code
134
+ print(response.data) # access the underlying object
135
+ ```
136
+
137
+ ### Retries
138
+
139
+ The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
140
+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
141
+ retry limit (default: 2).
142
+
143
+ Which status codes are retried depends on the `retryStatusCodes` generator configuration:
144
+
145
+ **`legacy`** (current default): retries on
146
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
147
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
148
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
149
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500)
150
+
151
+ **`recommended`**: retries on
152
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
153
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
154
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
155
+ - [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway)
156
+ - [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable)
157
+ - [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout)
158
+
159
+ Use the `max_retries` option, on the client constructor or with `with_options`, to configure this behavior.
160
+
161
+ ```python
162
+ client.with_options(max_retries=1).conversations.create_conversation(...)
163
+ ```
164
+
165
+ ### Timeouts
166
+
167
+ The SDK defaults to a 60 second timeout. You can configure this with a timeout option on the client, or for
168
+ the requests made through a client scoped with `with_options`.
169
+
170
+ ```python
171
+ from partite_ai import PartiteAiApi
172
+
173
+ client = PartiteAiApi(..., timeout=20.0)
174
+
175
+ # Override the timeout for requests made through a scoped client
176
+ client.with_options(timeout=1).conversations.create_conversation(...)
177
+ ```
178
+
179
+ ### Request Options
180
+
181
+ SDK settings such as timeouts, retries and additional headers or query parameters are not method arguments;
182
+ they are set on a client. `with_options(...)` returns a copy of a client (or of any sub-client) whose requests
183
+ all use the given options, sharing the original's connection pool and leaving the original unchanged. The
184
+ accepted options are `timeout`, `max_retries`, `additional_headers`, `additional_query_parameters`,
185
+ `additional_body_parameters` and `chunk_size`.
186
+
187
+ ```python
188
+ scoped = client.with_options(
189
+ additional_headers={"X-Custom-Header": "value"},
190
+ additional_query_parameters={"custom_param": "value"},
191
+ )
192
+ scoped.conversations.create_conversation(...)
193
+
194
+ # Calls chain: later options win, and header/query/body dicts are merged
195
+ scoped.with_options(timeout=5).conversations.create_conversation(...)
196
+
197
+ # Sub-clients can be scoped too
198
+ conversations = client.conversations.with_options(max_retries=0)
199
+ conversations.create_conversation(...)
200
+ ```
201
+
202
+ ### Custom Client
203
+
204
+ You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
205
+ and transports.
206
+
207
+ ```python
208
+ import httpx
209
+ from partite_ai import PartiteAiApi
210
+
211
+ client = PartiteAiApi(
212
+ ...,
213
+ httpx_client=httpx.Client(
214
+ proxy="http://my.test.proxy.example.com",
215
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
216
+ ),
217
+ )
218
+ ```
219
+
220
+ ## Contributing
221
+
222
+ While we value open-source contributions to this SDK, this library is generated programmatically.
223
+ Additions made directly to this library would have to be moved over to our generation code,
224
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
225
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
226
+ an issue first to discuss with us!
227
+
228
+ On the other hand, contributions to the README are always very welcome!
@@ -0,0 +1,99 @@
1
+ [project]
2
+ name = "partite_ai"
3
+ dynamic = ["version"]
4
+ license = "MIT"
5
+ license-files = ["LICENSE"]
6
+
7
+ [tool.poetry]
8
+ name = "partite_ai"
9
+ version = "1.0.0"
10
+ description = ""
11
+ readme = "README.md"
12
+ authors = []
13
+ keywords = []
14
+ license = "MIT"
15
+ classifiers = [
16
+ "Intended Audience :: Developers",
17
+ "Programming Language :: Python",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Programming Language :: Python :: 3.14",
24
+ "Programming Language :: Python :: 3.15",
25
+ "Operating System :: OS Independent",
26
+ "Operating System :: POSIX",
27
+ "Operating System :: MacOS",
28
+ "Operating System :: POSIX :: Linux",
29
+ "Operating System :: Microsoft :: Windows",
30
+ "Topic :: Software Development :: Libraries :: Python Modules",
31
+ "Typing :: Typed"
32
+ ]
33
+ packages = [
34
+ { include = "partite_ai", from = "src"}
35
+ ]
36
+
37
+ [tool.poetry.urls]
38
+ Repository = 'https://github.com/partite-ai/sdk-python'
39
+
40
+ [tool.poetry.dependencies]
41
+ python = "^3.10"
42
+ aiohttp = { version = ">=3.14.1,<4", optional = true, python = ">=3.10"}
43
+ httpx = ">=0.21.2"
44
+ httpx-aiohttp = { version = "^0.1.8", optional = true, python = ">=3.10"}
45
+ pydantic = ">= 1.9.2"
46
+ pydantic-core = ">=2.18.2,<3.0.0"
47
+ typing_extensions = ">= 4.0.0"
48
+
49
+ [tool.poetry.group.dev.dependencies]
50
+ mypy = "==1.13.0"
51
+ pytest = "^9.0.3"
52
+ pytest-asyncio = "^1.0.0"
53
+ pytest-xdist = "^3.6.1"
54
+ python-dateutil = "^2.9.0"
55
+ types-python-dateutil = "^2.9.0.20240316"
56
+ urllib3 = ">=2.6.3,<3.0.0"
57
+ ruff = "==0.11.5"
58
+
59
+ [tool.pytest.ini_options]
60
+ testpaths = [ "tests" ]
61
+ asyncio_mode = "auto"
62
+ norecursedirs = [ "src" ]
63
+ markers = [
64
+ "aiohttp: tests that require httpx_aiohttp to be installed",
65
+ ]
66
+
67
+ [tool.mypy]
68
+ plugins = ["pydantic.mypy"]
69
+
70
+ [tool.ruff]
71
+ line-length = 120
72
+
73
+ [tool.ruff.lint]
74
+ select = [
75
+ "E", # pycodestyle errors
76
+ "F", # pyflakes
77
+ "I", # isort
78
+ ]
79
+ ignore = [
80
+ "E402", # Module level import not at top of file
81
+ "E501", # Line too long
82
+ "E711", # Comparison to `None` should be `cond is not None`
83
+ "E712", # Avoid equality comparisons to `True`; use `if ...:` checks
84
+ "E721", # Use `is` and `is not` for type comparisons, or `isinstance()` for insinstance checks
85
+ "E722", # Do not use bare `except`
86
+ "E731", # Do not assign a `lambda` expression, use a `def`
87
+ "F821", # Undefined name
88
+ "F841" # Local variable ... is assigned to but never used
89
+ ]
90
+
91
+ [tool.ruff.lint.isort]
92
+ section-order = ["future", "standard-library", "third-party", "first-party"]
93
+
94
+ [build-system]
95
+ requires = ["poetry-core"]
96
+ build-backend = "poetry.core.masonry.api"
97
+
98
+ [tool.poetry.extras]
99
+ aiohttp=["aiohttp", "httpx-aiohttp"]