mirascope 2.0.0a6__py3-none-any.whl → 2.0.2__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.
Files changed (230) hide show
  1. mirascope/_utils.py +34 -0
  2. mirascope/api/_generated/__init__.py +186 -5
  3. mirascope/api/_generated/annotations/client.py +38 -6
  4. mirascope/api/_generated/annotations/raw_client.py +366 -47
  5. mirascope/api/_generated/annotations/types/annotations_create_response.py +19 -6
  6. mirascope/api/_generated/annotations/types/annotations_get_response.py +19 -6
  7. mirascope/api/_generated/annotations/types/annotations_list_response_annotations_item.py +22 -7
  8. mirascope/api/_generated/annotations/types/annotations_update_response.py +19 -6
  9. mirascope/api/_generated/api_keys/__init__.py +12 -2
  10. mirascope/api/_generated/api_keys/client.py +107 -6
  11. mirascope/api/_generated/api_keys/raw_client.py +486 -38
  12. mirascope/api/_generated/api_keys/types/__init__.py +7 -1
  13. mirascope/api/_generated/api_keys/types/api_keys_list_all_for_org_response_item.py +40 -0
  14. mirascope/api/_generated/client.py +36 -0
  15. mirascope/api/_generated/docs/raw_client.py +71 -9
  16. mirascope/api/_generated/environment.py +3 -3
  17. mirascope/api/_generated/environments/__init__.py +6 -0
  18. mirascope/api/_generated/environments/client.py +158 -9
  19. mirascope/api/_generated/environments/raw_client.py +620 -52
  20. mirascope/api/_generated/environments/types/__init__.py +10 -0
  21. mirascope/api/_generated/environments/types/environments_get_analytics_response.py +60 -0
  22. mirascope/api/_generated/environments/types/environments_get_analytics_response_top_functions_item.py +24 -0
  23. mirascope/api/_generated/{organizations/types/organizations_credits_response.py → environments/types/environments_get_analytics_response_top_models_item.py} +6 -3
  24. mirascope/api/_generated/errors/__init__.py +6 -0
  25. mirascope/api/_generated/errors/bad_request_error.py +5 -2
  26. mirascope/api/_generated/errors/conflict_error.py +5 -2
  27. mirascope/api/_generated/errors/payment_required_error.py +15 -0
  28. mirascope/api/_generated/errors/service_unavailable_error.py +14 -0
  29. mirascope/api/_generated/errors/too_many_requests_error.py +15 -0
  30. mirascope/api/_generated/functions/__init__.py +10 -0
  31. mirascope/api/_generated/functions/client.py +222 -8
  32. mirascope/api/_generated/functions/raw_client.py +975 -134
  33. mirascope/api/_generated/functions/types/__init__.py +28 -4
  34. mirascope/api/_generated/functions/types/functions_get_by_env_response.py +53 -0
  35. mirascope/api/_generated/functions/types/functions_get_by_env_response_dependencies_value.py +22 -0
  36. mirascope/api/_generated/functions/types/functions_list_by_env_response.py +25 -0
  37. mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item.py +56 -0
  38. mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item_dependencies_value.py +22 -0
  39. mirascope/api/_generated/health/raw_client.py +74 -10
  40. mirascope/api/_generated/organization_invitations/__init__.py +33 -0
  41. mirascope/api/_generated/organization_invitations/client.py +546 -0
  42. mirascope/api/_generated/organization_invitations/raw_client.py +1519 -0
  43. mirascope/api/_generated/organization_invitations/types/__init__.py +53 -0
  44. mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response.py +34 -0
  45. mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response_role.py +7 -0
  46. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_request_role.py +7 -0
  47. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response.py +48 -0
  48. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_role.py +7 -0
  49. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_status.py +7 -0
  50. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response.py +48 -0
  51. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_role.py +7 -0
  52. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_status.py +7 -0
  53. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item.py +48 -0
  54. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_role.py +7 -0
  55. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_status.py +7 -0
  56. mirascope/api/_generated/organization_memberships/__init__.py +19 -0
  57. mirascope/api/_generated/organization_memberships/client.py +302 -0
  58. mirascope/api/_generated/organization_memberships/raw_client.py +736 -0
  59. mirascope/api/_generated/organization_memberships/types/__init__.py +27 -0
  60. mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item.py +33 -0
  61. mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item_role.py +7 -0
  62. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_request_role.py +7 -0
  63. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response.py +31 -0
  64. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response_role.py +7 -0
  65. mirascope/api/_generated/organizations/__init__.py +26 -2
  66. mirascope/api/_generated/organizations/client.py +442 -20
  67. mirascope/api/_generated/organizations/raw_client.py +1763 -164
  68. mirascope/api/_generated/organizations/types/__init__.py +48 -2
  69. mirascope/api/_generated/organizations/types/organizations_create_payment_intent_response.py +24 -0
  70. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_request_target_plan.py +7 -0
  71. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response.py +47 -0
  72. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item.py +33 -0
  73. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item_resource.py +7 -0
  74. mirascope/api/_generated/organizations/types/organizations_router_balance_response.py +24 -0
  75. mirascope/api/_generated/organizations/types/organizations_subscription_response.py +53 -0
  76. mirascope/api/_generated/organizations/types/organizations_subscription_response_current_plan.py +7 -0
  77. mirascope/api/_generated/organizations/types/organizations_subscription_response_payment_method.py +26 -0
  78. mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change.py +34 -0
  79. mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change_target_plan.py +7 -0
  80. mirascope/api/_generated/organizations/types/organizations_update_subscription_request_target_plan.py +7 -0
  81. mirascope/api/_generated/organizations/types/organizations_update_subscription_response.py +35 -0
  82. mirascope/api/_generated/project_memberships/__init__.py +25 -0
  83. mirascope/api/_generated/project_memberships/client.py +437 -0
  84. mirascope/api/_generated/project_memberships/raw_client.py +1039 -0
  85. mirascope/api/_generated/project_memberships/types/__init__.py +29 -0
  86. mirascope/api/_generated/project_memberships/types/project_memberships_create_request_role.py +7 -0
  87. mirascope/api/_generated/project_memberships/types/project_memberships_create_response.py +35 -0
  88. mirascope/api/_generated/project_memberships/types/project_memberships_create_response_role.py +7 -0
  89. mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item.py +33 -0
  90. mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item_role.py +7 -0
  91. mirascope/api/_generated/project_memberships/types/project_memberships_update_request_role.py +7 -0
  92. mirascope/api/_generated/project_memberships/types/project_memberships_update_response.py +35 -0
  93. mirascope/api/_generated/project_memberships/types/project_memberships_update_response_role.py +7 -0
  94. mirascope/api/_generated/projects/raw_client.py +415 -58
  95. mirascope/api/_generated/reference.md +2767 -397
  96. mirascope/api/_generated/tags/__init__.py +19 -0
  97. mirascope/api/_generated/tags/client.py +504 -0
  98. mirascope/api/_generated/tags/raw_client.py +1288 -0
  99. mirascope/api/_generated/tags/types/__init__.py +17 -0
  100. mirascope/api/_generated/tags/types/tags_create_response.py +41 -0
  101. mirascope/api/_generated/tags/types/tags_get_response.py +41 -0
  102. mirascope/api/_generated/tags/types/tags_list_response.py +23 -0
  103. mirascope/api/_generated/tags/types/tags_list_response_tags_item.py +41 -0
  104. mirascope/api/_generated/tags/types/tags_update_response.py +41 -0
  105. mirascope/api/_generated/token_cost/__init__.py +7 -0
  106. mirascope/api/_generated/token_cost/client.py +160 -0
  107. mirascope/api/_generated/token_cost/raw_client.py +264 -0
  108. mirascope/api/_generated/token_cost/types/__init__.py +8 -0
  109. mirascope/api/_generated/token_cost/types/token_cost_calculate_request_usage.py +54 -0
  110. mirascope/api/_generated/token_cost/types/token_cost_calculate_response.py +52 -0
  111. mirascope/api/_generated/traces/__init__.py +20 -0
  112. mirascope/api/_generated/traces/client.py +543 -0
  113. mirascope/api/_generated/traces/raw_client.py +1366 -96
  114. mirascope/api/_generated/traces/types/__init__.py +28 -0
  115. mirascope/api/_generated/traces/types/traces_get_analytics_summary_response.py +6 -0
  116. mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response.py +33 -0
  117. mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response_spans_item.py +88 -0
  118. mirascope/api/_generated/traces/types/traces_get_trace_detail_response_spans_item.py +0 -2
  119. mirascope/api/_generated/traces/types/traces_list_by_function_hash_response.py +25 -0
  120. mirascope/api/_generated/traces/types/traces_list_by_function_hash_response_traces_item.py +44 -0
  121. mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item.py +26 -0
  122. mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item_operator.py +7 -0
  123. mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_by.py +7 -0
  124. mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_order.py +7 -0
  125. mirascope/api/_generated/traces/types/traces_search_by_env_response.py +26 -0
  126. mirascope/api/_generated/traces/types/traces_search_by_env_response_spans_item.py +50 -0
  127. mirascope/api/_generated/traces/types/traces_search_response_spans_item.py +10 -1
  128. mirascope/api/_generated/types/__init__.py +32 -2
  129. mirascope/api/_generated/types/bad_request_error_body.py +50 -0
  130. mirascope/api/_generated/types/date.py +3 -0
  131. mirascope/api/_generated/types/immutable_resource_error.py +22 -0
  132. mirascope/api/_generated/types/internal_server_error_body.py +3 -3
  133. mirascope/api/_generated/types/plan_limit_exceeded_error.py +32 -0
  134. mirascope/api/_generated/types/plan_limit_exceeded_error_tag.py +7 -0
  135. mirascope/api/_generated/types/pricing_unavailable_error.py +23 -0
  136. mirascope/api/_generated/types/rate_limit_error.py +31 -0
  137. mirascope/api/_generated/types/rate_limit_error_tag.py +5 -0
  138. mirascope/api/_generated/types/service_unavailable_error_body.py +24 -0
  139. mirascope/api/_generated/types/service_unavailable_error_tag.py +7 -0
  140. mirascope/api/_generated/types/subscription_past_due_error.py +31 -0
  141. mirascope/api/_generated/types/subscription_past_due_error_tag.py +7 -0
  142. mirascope/api/settings.py +19 -1
  143. mirascope/llm/__init__.py +53 -10
  144. mirascope/llm/calls/__init__.py +2 -1
  145. mirascope/llm/calls/calls.py +29 -20
  146. mirascope/llm/calls/decorator.py +21 -7
  147. mirascope/llm/content/tool_output.py +22 -5
  148. mirascope/llm/exceptions.py +284 -71
  149. mirascope/llm/formatting/__init__.py +17 -0
  150. mirascope/llm/formatting/format.py +112 -35
  151. mirascope/llm/formatting/output_parser.py +178 -0
  152. mirascope/llm/formatting/partial.py +80 -7
  153. mirascope/llm/formatting/primitives.py +192 -0
  154. mirascope/llm/formatting/types.py +20 -8
  155. mirascope/llm/messages/__init__.py +3 -0
  156. mirascope/llm/messages/_utils.py +34 -0
  157. mirascope/llm/models/__init__.py +5 -0
  158. mirascope/llm/models/models.py +137 -69
  159. mirascope/llm/{providers/base → models}/params.py +7 -57
  160. mirascope/llm/models/thinking_config.py +61 -0
  161. mirascope/llm/prompts/_utils.py +0 -32
  162. mirascope/llm/prompts/decorator.py +16 -5
  163. mirascope/llm/prompts/prompts.py +160 -92
  164. mirascope/llm/providers/__init__.py +1 -4
  165. mirascope/llm/providers/anthropic/_utils/__init__.py +2 -0
  166. mirascope/llm/providers/anthropic/_utils/beta_decode.py +18 -9
  167. mirascope/llm/providers/anthropic/_utils/beta_encode.py +62 -13
  168. mirascope/llm/providers/anthropic/_utils/decode.py +18 -9
  169. mirascope/llm/providers/anthropic/_utils/encode.py +26 -7
  170. mirascope/llm/providers/anthropic/_utils/errors.py +2 -2
  171. mirascope/llm/providers/anthropic/beta_provider.py +64 -18
  172. mirascope/llm/providers/anthropic/provider.py +91 -33
  173. mirascope/llm/providers/base/__init__.py +0 -4
  174. mirascope/llm/providers/base/_utils.py +55 -6
  175. mirascope/llm/providers/base/base_provider.py +116 -37
  176. mirascope/llm/providers/google/_utils/__init__.py +2 -0
  177. mirascope/llm/providers/google/_utils/decode.py +20 -7
  178. mirascope/llm/providers/google/_utils/encode.py +26 -7
  179. mirascope/llm/providers/google/_utils/errors.py +3 -2
  180. mirascope/llm/providers/google/provider.py +64 -18
  181. mirascope/llm/providers/mirascope/_utils.py +13 -17
  182. mirascope/llm/providers/mirascope/provider.py +49 -18
  183. mirascope/llm/providers/mlx/_utils.py +7 -2
  184. mirascope/llm/providers/mlx/encoding/base.py +5 -2
  185. mirascope/llm/providers/mlx/encoding/transformers.py +5 -2
  186. mirascope/llm/providers/mlx/mlx.py +23 -6
  187. mirascope/llm/providers/mlx/provider.py +42 -13
  188. mirascope/llm/providers/openai/_utils/errors.py +2 -2
  189. mirascope/llm/providers/openai/completions/_utils/encode.py +20 -16
  190. mirascope/llm/providers/openai/completions/base_provider.py +40 -11
  191. mirascope/llm/providers/openai/provider.py +40 -10
  192. mirascope/llm/providers/openai/responses/_utils/__init__.py +2 -0
  193. mirascope/llm/providers/openai/responses/_utils/decode.py +19 -6
  194. mirascope/llm/providers/openai/responses/_utils/encode.py +22 -10
  195. mirascope/llm/providers/openai/responses/provider.py +56 -18
  196. mirascope/llm/providers/provider_registry.py +93 -19
  197. mirascope/llm/responses/__init__.py +6 -1
  198. mirascope/llm/responses/_utils.py +102 -12
  199. mirascope/llm/responses/base_response.py +5 -2
  200. mirascope/llm/responses/base_stream_response.py +115 -25
  201. mirascope/llm/responses/response.py +2 -1
  202. mirascope/llm/responses/root_response.py +89 -17
  203. mirascope/llm/responses/stream_response.py +6 -9
  204. mirascope/llm/tools/decorator.py +9 -4
  205. mirascope/llm/tools/tool_schema.py +17 -6
  206. mirascope/llm/tools/toolkit.py +35 -27
  207. mirascope/llm/tools/tools.py +45 -20
  208. mirascope/ops/__init__.py +4 -0
  209. mirascope/ops/_internal/closure.py +4 -1
  210. mirascope/ops/_internal/configuration.py +82 -31
  211. mirascope/ops/_internal/exporters/exporters.py +55 -35
  212. mirascope/ops/_internal/exporters/utils.py +37 -0
  213. mirascope/ops/_internal/instrumentation/llm/common.py +530 -0
  214. mirascope/ops/_internal/instrumentation/llm/cost.py +190 -0
  215. mirascope/ops/_internal/instrumentation/llm/encode.py +1 -1
  216. mirascope/ops/_internal/instrumentation/llm/llm.py +116 -1242
  217. mirascope/ops/_internal/instrumentation/llm/model.py +1798 -0
  218. mirascope/ops/_internal/instrumentation/llm/response.py +521 -0
  219. mirascope/ops/_internal/instrumentation/llm/serialize.py +300 -0
  220. mirascope/ops/_internal/protocols.py +83 -1
  221. mirascope/ops/_internal/traced_calls.py +18 -0
  222. mirascope/ops/_internal/traced_functions.py +125 -10
  223. mirascope/ops/_internal/tracing.py +78 -1
  224. mirascope/ops/_internal/utils.py +60 -4
  225. mirascope/ops/_internal/versioned_functions.py +1 -1
  226. {mirascope-2.0.0a6.dist-info → mirascope-2.0.2.dist-info}/METADATA +12 -11
  227. mirascope-2.0.2.dist-info/RECORD +424 -0
  228. {mirascope-2.0.0a6.dist-info → mirascope-2.0.2.dist-info}/licenses/LICENSE +1 -1
  229. mirascope-2.0.0a6.dist-info/RECORD +0 -316
  230. {mirascope-2.0.0a6.dist-info → mirascope-2.0.2.dist-info}/WHEEL +0 -0
@@ -14,12 +14,13 @@ from ..errors.conflict_error import ConflictError
14
14
  from ..errors.forbidden_error import ForbiddenError
15
15
  from ..errors.internal_server_error import InternalServerError
16
16
  from ..errors.not_found_error import NotFoundError
17
+ from ..errors.service_unavailable_error import ServiceUnavailableError
18
+ from ..errors.too_many_requests_error import TooManyRequestsError
17
19
  from ..errors.unauthorized_error import UnauthorizedError
18
- from ..types.already_exists_error import AlreadyExistsError
19
- from ..types.http_api_decode_error import HttpApiDecodeError
20
20
  from ..types.not_found_error_body import NotFoundErrorBody
21
21
  from ..types.number_from_string import NumberFromString
22
22
  from ..types.permission_denied_error import PermissionDeniedError
23
+ from ..types.rate_limit_error import RateLimitError
23
24
  from ..types.unauthorized_error_body import UnauthorizedErrorBody
24
25
  from .types.annotations_create_request_label import AnnotationsCreateRequestLabel
25
26
  from .types.annotations_create_response import AnnotationsCreateResponse
@@ -94,9 +95,9 @@ class RawAnnotationsClient:
94
95
  raise BadRequestError(
95
96
  headers=dict(_response.headers),
96
97
  body=typing.cast(
97
- HttpApiDecodeError,
98
+ typing.Optional[typing.Any],
98
99
  parse_obj_as(
99
- type_=HttpApiDecodeError, # type: ignore
100
+ type_=typing.Optional[typing.Any], # type: ignore
100
101
  object_=_response.json(),
101
102
  ),
102
103
  ),
@@ -134,6 +135,17 @@ class RawAnnotationsClient:
134
135
  ),
135
136
  ),
136
137
  )
138
+ if _response.status_code == 429:
139
+ raise TooManyRequestsError(
140
+ headers=dict(_response.headers),
141
+ body=typing.cast(
142
+ RateLimitError,
143
+ parse_obj_as(
144
+ type_=RateLimitError, # type: ignore
145
+ object_=_response.json(),
146
+ ),
147
+ ),
148
+ )
137
149
  if _response.status_code == 500:
138
150
  raise InternalServerError(
139
151
  headers=dict(_response.headers),
@@ -145,10 +157,29 @@ class RawAnnotationsClient:
145
157
  ),
146
158
  ),
147
159
  )
160
+ if _response.status_code == 503:
161
+ raise ServiceUnavailableError(
162
+ headers=dict(_response.headers),
163
+ body=typing.cast(
164
+ typing.Optional[typing.Any],
165
+ parse_obj_as(
166
+ type_=typing.Optional[typing.Any], # type: ignore
167
+ object_=_response.json(),
168
+ ),
169
+ ),
170
+ )
148
171
  _response_json = _response.json()
149
172
  except JSONDecodeError:
150
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
151
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
173
+ raise ApiError(
174
+ status_code=_response.status_code,
175
+ headers=dict(_response.headers),
176
+ body=_response.text,
177
+ )
178
+ raise ApiError(
179
+ status_code=_response.status_code,
180
+ headers=dict(_response.headers),
181
+ body=_response_json,
182
+ )
152
183
 
153
184
  def create(
154
185
  self,
@@ -158,6 +189,7 @@ class RawAnnotationsClient:
158
189
  label: typing.Optional[AnnotationsCreateRequestLabel] = OMIT,
159
190
  reasoning: typing.Optional[str] = OMIT,
160
191
  metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
192
+ tags: typing.Optional[typing.Sequence[str]] = OMIT,
161
193
  request_options: typing.Optional[RequestOptions] = None,
162
194
  ) -> HttpResponse[AnnotationsCreateResponse]:
163
195
  """
@@ -173,6 +205,8 @@ class RawAnnotationsClient:
173
205
 
174
206
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
175
207
 
208
+ tags : typing.Optional[typing.Sequence[str]]
209
+
176
210
  request_options : typing.Optional[RequestOptions]
177
211
  Request-specific configuration.
178
212
 
@@ -190,6 +224,7 @@ class RawAnnotationsClient:
190
224
  "label": label,
191
225
  "reasoning": reasoning,
192
226
  "metadata": metadata,
227
+ "tags": tags,
193
228
  },
194
229
  headers={
195
230
  "content-type": "application/json",
@@ -211,9 +246,9 @@ class RawAnnotationsClient:
211
246
  raise BadRequestError(
212
247
  headers=dict(_response.headers),
213
248
  body=typing.cast(
214
- HttpApiDecodeError,
249
+ typing.Optional[typing.Any],
215
250
  parse_obj_as(
216
- type_=HttpApiDecodeError, # type: ignore
251
+ type_=typing.Optional[typing.Any], # type: ignore
217
252
  object_=_response.json(),
218
253
  ),
219
254
  ),
@@ -255,9 +290,20 @@ class RawAnnotationsClient:
255
290
  raise ConflictError(
256
291
  headers=dict(_response.headers),
257
292
  body=typing.cast(
258
- AlreadyExistsError,
293
+ typing.Optional[typing.Any],
294
+ parse_obj_as(
295
+ type_=typing.Optional[typing.Any], # type: ignore
296
+ object_=_response.json(),
297
+ ),
298
+ ),
299
+ )
300
+ if _response.status_code == 429:
301
+ raise TooManyRequestsError(
302
+ headers=dict(_response.headers),
303
+ body=typing.cast(
304
+ RateLimitError,
259
305
  parse_obj_as(
260
- type_=AlreadyExistsError, # type: ignore
306
+ type_=RateLimitError, # type: ignore
261
307
  object_=_response.json(),
262
308
  ),
263
309
  ),
@@ -273,10 +319,29 @@ class RawAnnotationsClient:
273
319
  ),
274
320
  ),
275
321
  )
322
+ if _response.status_code == 503:
323
+ raise ServiceUnavailableError(
324
+ headers=dict(_response.headers),
325
+ body=typing.cast(
326
+ typing.Optional[typing.Any],
327
+ parse_obj_as(
328
+ type_=typing.Optional[typing.Any], # type: ignore
329
+ object_=_response.json(),
330
+ ),
331
+ ),
332
+ )
276
333
  _response_json = _response.json()
277
334
  except JSONDecodeError:
278
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
279
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
335
+ raise ApiError(
336
+ status_code=_response.status_code,
337
+ headers=dict(_response.headers),
338
+ body=_response.text,
339
+ )
340
+ raise ApiError(
341
+ status_code=_response.status_code,
342
+ headers=dict(_response.headers),
343
+ body=_response_json,
344
+ )
280
345
 
281
346
  def get(
282
347
  self, id: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -313,9 +378,9 @@ class RawAnnotationsClient:
313
378
  raise BadRequestError(
314
379
  headers=dict(_response.headers),
315
380
  body=typing.cast(
316
- HttpApiDecodeError,
381
+ typing.Optional[typing.Any],
317
382
  parse_obj_as(
318
- type_=HttpApiDecodeError, # type: ignore
383
+ type_=typing.Optional[typing.Any], # type: ignore
319
384
  object_=_response.json(),
320
385
  ),
321
386
  ),
@@ -353,6 +418,17 @@ class RawAnnotationsClient:
353
418
  ),
354
419
  ),
355
420
  )
421
+ if _response.status_code == 429:
422
+ raise TooManyRequestsError(
423
+ headers=dict(_response.headers),
424
+ body=typing.cast(
425
+ RateLimitError,
426
+ parse_obj_as(
427
+ type_=RateLimitError, # type: ignore
428
+ object_=_response.json(),
429
+ ),
430
+ ),
431
+ )
356
432
  if _response.status_code == 500:
357
433
  raise InternalServerError(
358
434
  headers=dict(_response.headers),
@@ -364,10 +440,29 @@ class RawAnnotationsClient:
364
440
  ),
365
441
  ),
366
442
  )
443
+ if _response.status_code == 503:
444
+ raise ServiceUnavailableError(
445
+ headers=dict(_response.headers),
446
+ body=typing.cast(
447
+ typing.Optional[typing.Any],
448
+ parse_obj_as(
449
+ type_=typing.Optional[typing.Any], # type: ignore
450
+ object_=_response.json(),
451
+ ),
452
+ ),
453
+ )
367
454
  _response_json = _response.json()
368
455
  except JSONDecodeError:
369
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
370
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
456
+ raise ApiError(
457
+ status_code=_response.status_code,
458
+ headers=dict(_response.headers),
459
+ body=_response.text,
460
+ )
461
+ raise ApiError(
462
+ status_code=_response.status_code,
463
+ headers=dict(_response.headers),
464
+ body=_response_json,
465
+ )
371
466
 
372
467
  def update(
373
468
  self,
@@ -376,6 +471,7 @@ class RawAnnotationsClient:
376
471
  label: typing.Optional[AnnotationsUpdateRequestLabel] = OMIT,
377
472
  reasoning: typing.Optional[str] = OMIT,
378
473
  metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
474
+ tags: typing.Optional[typing.Sequence[str]] = OMIT,
379
475
  request_options: typing.Optional[RequestOptions] = None,
380
476
  ) -> HttpResponse[AnnotationsUpdateResponse]:
381
477
  """
@@ -389,6 +485,8 @@ class RawAnnotationsClient:
389
485
 
390
486
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
391
487
 
488
+ tags : typing.Optional[typing.Sequence[str]]
489
+
392
490
  request_options : typing.Optional[RequestOptions]
393
491
  Request-specific configuration.
394
492
 
@@ -404,6 +502,7 @@ class RawAnnotationsClient:
404
502
  "label": label,
405
503
  "reasoning": reasoning,
406
504
  "metadata": metadata,
505
+ "tags": tags,
407
506
  },
408
507
  headers={
409
508
  "content-type": "application/json",
@@ -425,9 +524,9 @@ class RawAnnotationsClient:
425
524
  raise BadRequestError(
426
525
  headers=dict(_response.headers),
427
526
  body=typing.cast(
428
- HttpApiDecodeError,
527
+ typing.Optional[typing.Any],
429
528
  parse_obj_as(
430
- type_=HttpApiDecodeError, # type: ignore
529
+ type_=typing.Optional[typing.Any], # type: ignore
431
530
  object_=_response.json(),
432
531
  ),
433
532
  ),
@@ -465,6 +564,17 @@ class RawAnnotationsClient:
465
564
  ),
466
565
  ),
467
566
  )
567
+ if _response.status_code == 429:
568
+ raise TooManyRequestsError(
569
+ headers=dict(_response.headers),
570
+ body=typing.cast(
571
+ RateLimitError,
572
+ parse_obj_as(
573
+ type_=RateLimitError, # type: ignore
574
+ object_=_response.json(),
575
+ ),
576
+ ),
577
+ )
468
578
  if _response.status_code == 500:
469
579
  raise InternalServerError(
470
580
  headers=dict(_response.headers),
@@ -476,12 +586,33 @@ class RawAnnotationsClient:
476
586
  ),
477
587
  ),
478
588
  )
589
+ if _response.status_code == 503:
590
+ raise ServiceUnavailableError(
591
+ headers=dict(_response.headers),
592
+ body=typing.cast(
593
+ typing.Optional[typing.Any],
594
+ parse_obj_as(
595
+ type_=typing.Optional[typing.Any], # type: ignore
596
+ object_=_response.json(),
597
+ ),
598
+ ),
599
+ )
479
600
  _response_json = _response.json()
480
601
  except JSONDecodeError:
481
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
482
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
602
+ raise ApiError(
603
+ status_code=_response.status_code,
604
+ headers=dict(_response.headers),
605
+ body=_response.text,
606
+ )
607
+ raise ApiError(
608
+ status_code=_response.status_code,
609
+ headers=dict(_response.headers),
610
+ body=_response_json,
611
+ )
483
612
 
484
- def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
613
+ def delete(
614
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
615
+ ) -> HttpResponse[None]:
485
616
  """
486
617
  Parameters
487
618
  ----------
@@ -506,9 +637,9 @@ class RawAnnotationsClient:
506
637
  raise BadRequestError(
507
638
  headers=dict(_response.headers),
508
639
  body=typing.cast(
509
- HttpApiDecodeError,
640
+ typing.Optional[typing.Any],
510
641
  parse_obj_as(
511
- type_=HttpApiDecodeError, # type: ignore
642
+ type_=typing.Optional[typing.Any], # type: ignore
512
643
  object_=_response.json(),
513
644
  ),
514
645
  ),
@@ -546,6 +677,17 @@ class RawAnnotationsClient:
546
677
  ),
547
678
  ),
548
679
  )
680
+ if _response.status_code == 429:
681
+ raise TooManyRequestsError(
682
+ headers=dict(_response.headers),
683
+ body=typing.cast(
684
+ RateLimitError,
685
+ parse_obj_as(
686
+ type_=RateLimitError, # type: ignore
687
+ object_=_response.json(),
688
+ ),
689
+ ),
690
+ )
549
691
  if _response.status_code == 500:
550
692
  raise InternalServerError(
551
693
  headers=dict(_response.headers),
@@ -557,10 +699,29 @@ class RawAnnotationsClient:
557
699
  ),
558
700
  ),
559
701
  )
702
+ if _response.status_code == 503:
703
+ raise ServiceUnavailableError(
704
+ headers=dict(_response.headers),
705
+ body=typing.cast(
706
+ typing.Optional[typing.Any],
707
+ parse_obj_as(
708
+ type_=typing.Optional[typing.Any], # type: ignore
709
+ object_=_response.json(),
710
+ ),
711
+ ),
712
+ )
560
713
  _response_json = _response.json()
561
714
  except JSONDecodeError:
562
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
563
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
715
+ raise ApiError(
716
+ status_code=_response.status_code,
717
+ headers=dict(_response.headers),
718
+ body=_response.text,
719
+ )
720
+ raise ApiError(
721
+ status_code=_response.status_code,
722
+ headers=dict(_response.headers),
723
+ body=_response_json,
724
+ )
564
725
 
565
726
 
566
727
  class AsyncRawAnnotationsClient:
@@ -624,9 +785,9 @@ class AsyncRawAnnotationsClient:
624
785
  raise BadRequestError(
625
786
  headers=dict(_response.headers),
626
787
  body=typing.cast(
627
- HttpApiDecodeError,
788
+ typing.Optional[typing.Any],
628
789
  parse_obj_as(
629
- type_=HttpApiDecodeError, # type: ignore
790
+ type_=typing.Optional[typing.Any], # type: ignore
630
791
  object_=_response.json(),
631
792
  ),
632
793
  ),
@@ -664,6 +825,17 @@ class AsyncRawAnnotationsClient:
664
825
  ),
665
826
  ),
666
827
  )
828
+ if _response.status_code == 429:
829
+ raise TooManyRequestsError(
830
+ headers=dict(_response.headers),
831
+ body=typing.cast(
832
+ RateLimitError,
833
+ parse_obj_as(
834
+ type_=RateLimitError, # type: ignore
835
+ object_=_response.json(),
836
+ ),
837
+ ),
838
+ )
667
839
  if _response.status_code == 500:
668
840
  raise InternalServerError(
669
841
  headers=dict(_response.headers),
@@ -675,10 +847,29 @@ class AsyncRawAnnotationsClient:
675
847
  ),
676
848
  ),
677
849
  )
850
+ if _response.status_code == 503:
851
+ raise ServiceUnavailableError(
852
+ headers=dict(_response.headers),
853
+ body=typing.cast(
854
+ typing.Optional[typing.Any],
855
+ parse_obj_as(
856
+ type_=typing.Optional[typing.Any], # type: ignore
857
+ object_=_response.json(),
858
+ ),
859
+ ),
860
+ )
678
861
  _response_json = _response.json()
679
862
  except JSONDecodeError:
680
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
681
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
863
+ raise ApiError(
864
+ status_code=_response.status_code,
865
+ headers=dict(_response.headers),
866
+ body=_response.text,
867
+ )
868
+ raise ApiError(
869
+ status_code=_response.status_code,
870
+ headers=dict(_response.headers),
871
+ body=_response_json,
872
+ )
682
873
 
683
874
  async def create(
684
875
  self,
@@ -688,6 +879,7 @@ class AsyncRawAnnotationsClient:
688
879
  label: typing.Optional[AnnotationsCreateRequestLabel] = OMIT,
689
880
  reasoning: typing.Optional[str] = OMIT,
690
881
  metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
882
+ tags: typing.Optional[typing.Sequence[str]] = OMIT,
691
883
  request_options: typing.Optional[RequestOptions] = None,
692
884
  ) -> AsyncHttpResponse[AnnotationsCreateResponse]:
693
885
  """
@@ -703,6 +895,8 @@ class AsyncRawAnnotationsClient:
703
895
 
704
896
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
705
897
 
898
+ tags : typing.Optional[typing.Sequence[str]]
899
+
706
900
  request_options : typing.Optional[RequestOptions]
707
901
  Request-specific configuration.
708
902
 
@@ -720,6 +914,7 @@ class AsyncRawAnnotationsClient:
720
914
  "label": label,
721
915
  "reasoning": reasoning,
722
916
  "metadata": metadata,
917
+ "tags": tags,
723
918
  },
724
919
  headers={
725
920
  "content-type": "application/json",
@@ -741,9 +936,9 @@ class AsyncRawAnnotationsClient:
741
936
  raise BadRequestError(
742
937
  headers=dict(_response.headers),
743
938
  body=typing.cast(
744
- HttpApiDecodeError,
939
+ typing.Optional[typing.Any],
745
940
  parse_obj_as(
746
- type_=HttpApiDecodeError, # type: ignore
941
+ type_=typing.Optional[typing.Any], # type: ignore
747
942
  object_=_response.json(),
748
943
  ),
749
944
  ),
@@ -785,9 +980,20 @@ class AsyncRawAnnotationsClient:
785
980
  raise ConflictError(
786
981
  headers=dict(_response.headers),
787
982
  body=typing.cast(
788
- AlreadyExistsError,
983
+ typing.Optional[typing.Any],
984
+ parse_obj_as(
985
+ type_=typing.Optional[typing.Any], # type: ignore
986
+ object_=_response.json(),
987
+ ),
988
+ ),
989
+ )
990
+ if _response.status_code == 429:
991
+ raise TooManyRequestsError(
992
+ headers=dict(_response.headers),
993
+ body=typing.cast(
994
+ RateLimitError,
789
995
  parse_obj_as(
790
- type_=AlreadyExistsError, # type: ignore
996
+ type_=RateLimitError, # type: ignore
791
997
  object_=_response.json(),
792
998
  ),
793
999
  ),
@@ -803,10 +1009,29 @@ class AsyncRawAnnotationsClient:
803
1009
  ),
804
1010
  ),
805
1011
  )
1012
+ if _response.status_code == 503:
1013
+ raise ServiceUnavailableError(
1014
+ headers=dict(_response.headers),
1015
+ body=typing.cast(
1016
+ typing.Optional[typing.Any],
1017
+ parse_obj_as(
1018
+ type_=typing.Optional[typing.Any], # type: ignore
1019
+ object_=_response.json(),
1020
+ ),
1021
+ ),
1022
+ )
806
1023
  _response_json = _response.json()
807
1024
  except JSONDecodeError:
808
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
809
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1025
+ raise ApiError(
1026
+ status_code=_response.status_code,
1027
+ headers=dict(_response.headers),
1028
+ body=_response.text,
1029
+ )
1030
+ raise ApiError(
1031
+ status_code=_response.status_code,
1032
+ headers=dict(_response.headers),
1033
+ body=_response_json,
1034
+ )
810
1035
 
811
1036
  async def get(
812
1037
  self, id: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -843,9 +1068,9 @@ class AsyncRawAnnotationsClient:
843
1068
  raise BadRequestError(
844
1069
  headers=dict(_response.headers),
845
1070
  body=typing.cast(
846
- HttpApiDecodeError,
1071
+ typing.Optional[typing.Any],
847
1072
  parse_obj_as(
848
- type_=HttpApiDecodeError, # type: ignore
1073
+ type_=typing.Optional[typing.Any], # type: ignore
849
1074
  object_=_response.json(),
850
1075
  ),
851
1076
  ),
@@ -883,6 +1108,17 @@ class AsyncRawAnnotationsClient:
883
1108
  ),
884
1109
  ),
885
1110
  )
1111
+ if _response.status_code == 429:
1112
+ raise TooManyRequestsError(
1113
+ headers=dict(_response.headers),
1114
+ body=typing.cast(
1115
+ RateLimitError,
1116
+ parse_obj_as(
1117
+ type_=RateLimitError, # type: ignore
1118
+ object_=_response.json(),
1119
+ ),
1120
+ ),
1121
+ )
886
1122
  if _response.status_code == 500:
887
1123
  raise InternalServerError(
888
1124
  headers=dict(_response.headers),
@@ -894,10 +1130,29 @@ class AsyncRawAnnotationsClient:
894
1130
  ),
895
1131
  ),
896
1132
  )
1133
+ if _response.status_code == 503:
1134
+ raise ServiceUnavailableError(
1135
+ headers=dict(_response.headers),
1136
+ body=typing.cast(
1137
+ typing.Optional[typing.Any],
1138
+ parse_obj_as(
1139
+ type_=typing.Optional[typing.Any], # type: ignore
1140
+ object_=_response.json(),
1141
+ ),
1142
+ ),
1143
+ )
897
1144
  _response_json = _response.json()
898
1145
  except JSONDecodeError:
899
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
900
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1146
+ raise ApiError(
1147
+ status_code=_response.status_code,
1148
+ headers=dict(_response.headers),
1149
+ body=_response.text,
1150
+ )
1151
+ raise ApiError(
1152
+ status_code=_response.status_code,
1153
+ headers=dict(_response.headers),
1154
+ body=_response_json,
1155
+ )
901
1156
 
902
1157
  async def update(
903
1158
  self,
@@ -906,6 +1161,7 @@ class AsyncRawAnnotationsClient:
906
1161
  label: typing.Optional[AnnotationsUpdateRequestLabel] = OMIT,
907
1162
  reasoning: typing.Optional[str] = OMIT,
908
1163
  metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
1164
+ tags: typing.Optional[typing.Sequence[str]] = OMIT,
909
1165
  request_options: typing.Optional[RequestOptions] = None,
910
1166
  ) -> AsyncHttpResponse[AnnotationsUpdateResponse]:
911
1167
  """
@@ -919,6 +1175,8 @@ class AsyncRawAnnotationsClient:
919
1175
 
920
1176
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
921
1177
 
1178
+ tags : typing.Optional[typing.Sequence[str]]
1179
+
922
1180
  request_options : typing.Optional[RequestOptions]
923
1181
  Request-specific configuration.
924
1182
 
@@ -934,6 +1192,7 @@ class AsyncRawAnnotationsClient:
934
1192
  "label": label,
935
1193
  "reasoning": reasoning,
936
1194
  "metadata": metadata,
1195
+ "tags": tags,
937
1196
  },
938
1197
  headers={
939
1198
  "content-type": "application/json",
@@ -955,9 +1214,9 @@ class AsyncRawAnnotationsClient:
955
1214
  raise BadRequestError(
956
1215
  headers=dict(_response.headers),
957
1216
  body=typing.cast(
958
- HttpApiDecodeError,
1217
+ typing.Optional[typing.Any],
959
1218
  parse_obj_as(
960
- type_=HttpApiDecodeError, # type: ignore
1219
+ type_=typing.Optional[typing.Any], # type: ignore
961
1220
  object_=_response.json(),
962
1221
  ),
963
1222
  ),
@@ -995,6 +1254,17 @@ class AsyncRawAnnotationsClient:
995
1254
  ),
996
1255
  ),
997
1256
  )
1257
+ if _response.status_code == 429:
1258
+ raise TooManyRequestsError(
1259
+ headers=dict(_response.headers),
1260
+ body=typing.cast(
1261
+ RateLimitError,
1262
+ parse_obj_as(
1263
+ type_=RateLimitError, # type: ignore
1264
+ object_=_response.json(),
1265
+ ),
1266
+ ),
1267
+ )
998
1268
  if _response.status_code == 500:
999
1269
  raise InternalServerError(
1000
1270
  headers=dict(_response.headers),
@@ -1006,10 +1276,29 @@ class AsyncRawAnnotationsClient:
1006
1276
  ),
1007
1277
  ),
1008
1278
  )
1279
+ if _response.status_code == 503:
1280
+ raise ServiceUnavailableError(
1281
+ headers=dict(_response.headers),
1282
+ body=typing.cast(
1283
+ typing.Optional[typing.Any],
1284
+ parse_obj_as(
1285
+ type_=typing.Optional[typing.Any], # type: ignore
1286
+ object_=_response.json(),
1287
+ ),
1288
+ ),
1289
+ )
1009
1290
  _response_json = _response.json()
1010
1291
  except JSONDecodeError:
1011
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1012
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1292
+ raise ApiError(
1293
+ status_code=_response.status_code,
1294
+ headers=dict(_response.headers),
1295
+ body=_response.text,
1296
+ )
1297
+ raise ApiError(
1298
+ status_code=_response.status_code,
1299
+ headers=dict(_response.headers),
1300
+ body=_response_json,
1301
+ )
1013
1302
 
1014
1303
  async def delete(
1015
1304
  self, id: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -1038,9 +1327,9 @@ class AsyncRawAnnotationsClient:
1038
1327
  raise BadRequestError(
1039
1328
  headers=dict(_response.headers),
1040
1329
  body=typing.cast(
1041
- HttpApiDecodeError,
1330
+ typing.Optional[typing.Any],
1042
1331
  parse_obj_as(
1043
- type_=HttpApiDecodeError, # type: ignore
1332
+ type_=typing.Optional[typing.Any], # type: ignore
1044
1333
  object_=_response.json(),
1045
1334
  ),
1046
1335
  ),
@@ -1078,6 +1367,17 @@ class AsyncRawAnnotationsClient:
1078
1367
  ),
1079
1368
  ),
1080
1369
  )
1370
+ if _response.status_code == 429:
1371
+ raise TooManyRequestsError(
1372
+ headers=dict(_response.headers),
1373
+ body=typing.cast(
1374
+ RateLimitError,
1375
+ parse_obj_as(
1376
+ type_=RateLimitError, # type: ignore
1377
+ object_=_response.json(),
1378
+ ),
1379
+ ),
1380
+ )
1081
1381
  if _response.status_code == 500:
1082
1382
  raise InternalServerError(
1083
1383
  headers=dict(_response.headers),
@@ -1089,7 +1389,26 @@ class AsyncRawAnnotationsClient:
1089
1389
  ),
1090
1390
  ),
1091
1391
  )
1392
+ if _response.status_code == 503:
1393
+ raise ServiceUnavailableError(
1394
+ headers=dict(_response.headers),
1395
+ body=typing.cast(
1396
+ typing.Optional[typing.Any],
1397
+ parse_obj_as(
1398
+ type_=typing.Optional[typing.Any], # type: ignore
1399
+ object_=_response.json(),
1400
+ ),
1401
+ ),
1402
+ )
1092
1403
  _response_json = _response.json()
1093
1404
  except JSONDecodeError:
1094
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1095
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1405
+ raise ApiError(
1406
+ status_code=_response.status_code,
1407
+ headers=dict(_response.headers),
1408
+ body=_response.text,
1409
+ )
1410
+ raise ApiError(
1411
+ status_code=_response.status_code,
1412
+ headers=dict(_response.headers),
1413
+ body=_response_json,
1414
+ )