mirascope 2.0.0a6__py3-none-any.whl → 2.0.1__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 (226) hide show
  1. mirascope/api/_generated/__init__.py +186 -5
  2. mirascope/api/_generated/annotations/client.py +38 -6
  3. mirascope/api/_generated/annotations/raw_client.py +366 -47
  4. mirascope/api/_generated/annotations/types/annotations_create_response.py +19 -6
  5. mirascope/api/_generated/annotations/types/annotations_get_response.py +19 -6
  6. mirascope/api/_generated/annotations/types/annotations_list_response_annotations_item.py +22 -7
  7. mirascope/api/_generated/annotations/types/annotations_update_response.py +19 -6
  8. mirascope/api/_generated/api_keys/__init__.py +12 -2
  9. mirascope/api/_generated/api_keys/client.py +107 -6
  10. mirascope/api/_generated/api_keys/raw_client.py +486 -38
  11. mirascope/api/_generated/api_keys/types/__init__.py +7 -1
  12. mirascope/api/_generated/api_keys/types/api_keys_list_all_for_org_response_item.py +40 -0
  13. mirascope/api/_generated/client.py +36 -0
  14. mirascope/api/_generated/docs/raw_client.py +71 -9
  15. mirascope/api/_generated/environment.py +3 -3
  16. mirascope/api/_generated/environments/__init__.py +6 -0
  17. mirascope/api/_generated/environments/client.py +158 -9
  18. mirascope/api/_generated/environments/raw_client.py +620 -52
  19. mirascope/api/_generated/environments/types/__init__.py +10 -0
  20. mirascope/api/_generated/environments/types/environments_get_analytics_response.py +60 -0
  21. mirascope/api/_generated/environments/types/environments_get_analytics_response_top_functions_item.py +24 -0
  22. mirascope/api/_generated/{organizations/types/organizations_credits_response.py → environments/types/environments_get_analytics_response_top_models_item.py} +6 -3
  23. mirascope/api/_generated/errors/__init__.py +6 -0
  24. mirascope/api/_generated/errors/bad_request_error.py +5 -2
  25. mirascope/api/_generated/errors/conflict_error.py +5 -2
  26. mirascope/api/_generated/errors/payment_required_error.py +15 -0
  27. mirascope/api/_generated/errors/service_unavailable_error.py +14 -0
  28. mirascope/api/_generated/errors/too_many_requests_error.py +15 -0
  29. mirascope/api/_generated/functions/__init__.py +10 -0
  30. mirascope/api/_generated/functions/client.py +222 -8
  31. mirascope/api/_generated/functions/raw_client.py +975 -134
  32. mirascope/api/_generated/functions/types/__init__.py +28 -4
  33. mirascope/api/_generated/functions/types/functions_get_by_env_response.py +53 -0
  34. mirascope/api/_generated/functions/types/functions_get_by_env_response_dependencies_value.py +22 -0
  35. mirascope/api/_generated/functions/types/functions_list_by_env_response.py +25 -0
  36. mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item.py +56 -0
  37. mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item_dependencies_value.py +22 -0
  38. mirascope/api/_generated/health/raw_client.py +74 -10
  39. mirascope/api/_generated/organization_invitations/__init__.py +33 -0
  40. mirascope/api/_generated/organization_invitations/client.py +546 -0
  41. mirascope/api/_generated/organization_invitations/raw_client.py +1519 -0
  42. mirascope/api/_generated/organization_invitations/types/__init__.py +53 -0
  43. mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response.py +34 -0
  44. mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response_role.py +7 -0
  45. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_request_role.py +7 -0
  46. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response.py +48 -0
  47. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_role.py +7 -0
  48. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_status.py +7 -0
  49. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response.py +48 -0
  50. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_role.py +7 -0
  51. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_status.py +7 -0
  52. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item.py +48 -0
  53. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_role.py +7 -0
  54. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_status.py +7 -0
  55. mirascope/api/_generated/organization_memberships/__init__.py +19 -0
  56. mirascope/api/_generated/organization_memberships/client.py +302 -0
  57. mirascope/api/_generated/organization_memberships/raw_client.py +736 -0
  58. mirascope/api/_generated/organization_memberships/types/__init__.py +27 -0
  59. mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item.py +33 -0
  60. mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item_role.py +7 -0
  61. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_request_role.py +7 -0
  62. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response.py +31 -0
  63. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response_role.py +7 -0
  64. mirascope/api/_generated/organizations/__init__.py +26 -2
  65. mirascope/api/_generated/organizations/client.py +442 -20
  66. mirascope/api/_generated/organizations/raw_client.py +1763 -164
  67. mirascope/api/_generated/organizations/types/__init__.py +48 -2
  68. mirascope/api/_generated/organizations/types/organizations_create_payment_intent_response.py +24 -0
  69. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_request_target_plan.py +7 -0
  70. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response.py +47 -0
  71. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item.py +33 -0
  72. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item_resource.py +7 -0
  73. mirascope/api/_generated/organizations/types/organizations_router_balance_response.py +24 -0
  74. mirascope/api/_generated/organizations/types/organizations_subscription_response.py +53 -0
  75. mirascope/api/_generated/organizations/types/organizations_subscription_response_current_plan.py +7 -0
  76. mirascope/api/_generated/organizations/types/organizations_subscription_response_payment_method.py +26 -0
  77. mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change.py +34 -0
  78. mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change_target_plan.py +7 -0
  79. mirascope/api/_generated/organizations/types/organizations_update_subscription_request_target_plan.py +7 -0
  80. mirascope/api/_generated/organizations/types/organizations_update_subscription_response.py +35 -0
  81. mirascope/api/_generated/project_memberships/__init__.py +25 -0
  82. mirascope/api/_generated/project_memberships/client.py +437 -0
  83. mirascope/api/_generated/project_memberships/raw_client.py +1039 -0
  84. mirascope/api/_generated/project_memberships/types/__init__.py +29 -0
  85. mirascope/api/_generated/project_memberships/types/project_memberships_create_request_role.py +7 -0
  86. mirascope/api/_generated/project_memberships/types/project_memberships_create_response.py +35 -0
  87. mirascope/api/_generated/project_memberships/types/project_memberships_create_response_role.py +7 -0
  88. mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item.py +33 -0
  89. mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item_role.py +7 -0
  90. mirascope/api/_generated/project_memberships/types/project_memberships_update_request_role.py +7 -0
  91. mirascope/api/_generated/project_memberships/types/project_memberships_update_response.py +35 -0
  92. mirascope/api/_generated/project_memberships/types/project_memberships_update_response_role.py +7 -0
  93. mirascope/api/_generated/projects/raw_client.py +415 -58
  94. mirascope/api/_generated/reference.md +2767 -397
  95. mirascope/api/_generated/tags/__init__.py +19 -0
  96. mirascope/api/_generated/tags/client.py +504 -0
  97. mirascope/api/_generated/tags/raw_client.py +1288 -0
  98. mirascope/api/_generated/tags/types/__init__.py +17 -0
  99. mirascope/api/_generated/tags/types/tags_create_response.py +41 -0
  100. mirascope/api/_generated/tags/types/tags_get_response.py +41 -0
  101. mirascope/api/_generated/tags/types/tags_list_response.py +23 -0
  102. mirascope/api/_generated/tags/types/tags_list_response_tags_item.py +41 -0
  103. mirascope/api/_generated/tags/types/tags_update_response.py +41 -0
  104. mirascope/api/_generated/token_cost/__init__.py +7 -0
  105. mirascope/api/_generated/token_cost/client.py +160 -0
  106. mirascope/api/_generated/token_cost/raw_client.py +264 -0
  107. mirascope/api/_generated/token_cost/types/__init__.py +8 -0
  108. mirascope/api/_generated/token_cost/types/token_cost_calculate_request_usage.py +54 -0
  109. mirascope/api/_generated/token_cost/types/token_cost_calculate_response.py +52 -0
  110. mirascope/api/_generated/traces/__init__.py +20 -0
  111. mirascope/api/_generated/traces/client.py +543 -0
  112. mirascope/api/_generated/traces/raw_client.py +1366 -96
  113. mirascope/api/_generated/traces/types/__init__.py +28 -0
  114. mirascope/api/_generated/traces/types/traces_get_analytics_summary_response.py +6 -0
  115. mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response.py +33 -0
  116. mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response_spans_item.py +88 -0
  117. mirascope/api/_generated/traces/types/traces_get_trace_detail_response_spans_item.py +0 -2
  118. mirascope/api/_generated/traces/types/traces_list_by_function_hash_response.py +25 -0
  119. mirascope/api/_generated/traces/types/traces_list_by_function_hash_response_traces_item.py +44 -0
  120. mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item.py +26 -0
  121. mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item_operator.py +7 -0
  122. mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_by.py +7 -0
  123. mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_order.py +7 -0
  124. mirascope/api/_generated/traces/types/traces_search_by_env_response.py +26 -0
  125. mirascope/api/_generated/traces/types/traces_search_by_env_response_spans_item.py +50 -0
  126. mirascope/api/_generated/traces/types/traces_search_response_spans_item.py +10 -1
  127. mirascope/api/_generated/types/__init__.py +32 -2
  128. mirascope/api/_generated/types/bad_request_error_body.py +50 -0
  129. mirascope/api/_generated/types/date.py +3 -0
  130. mirascope/api/_generated/types/immutable_resource_error.py +22 -0
  131. mirascope/api/_generated/types/internal_server_error_body.py +3 -3
  132. mirascope/api/_generated/types/plan_limit_exceeded_error.py +32 -0
  133. mirascope/api/_generated/types/plan_limit_exceeded_error_tag.py +7 -0
  134. mirascope/api/_generated/types/pricing_unavailable_error.py +23 -0
  135. mirascope/api/_generated/types/rate_limit_error.py +31 -0
  136. mirascope/api/_generated/types/rate_limit_error_tag.py +5 -0
  137. mirascope/api/_generated/types/service_unavailable_error_body.py +24 -0
  138. mirascope/api/_generated/types/service_unavailable_error_tag.py +7 -0
  139. mirascope/api/_generated/types/subscription_past_due_error.py +31 -0
  140. mirascope/api/_generated/types/subscription_past_due_error_tag.py +7 -0
  141. mirascope/api/settings.py +19 -1
  142. mirascope/llm/__init__.py +53 -10
  143. mirascope/llm/calls/__init__.py +2 -1
  144. mirascope/llm/calls/calls.py +3 -1
  145. mirascope/llm/calls/decorator.py +21 -7
  146. mirascope/llm/content/tool_output.py +22 -5
  147. mirascope/llm/exceptions.py +284 -71
  148. mirascope/llm/formatting/__init__.py +17 -0
  149. mirascope/llm/formatting/format.py +112 -35
  150. mirascope/llm/formatting/output_parser.py +178 -0
  151. mirascope/llm/formatting/partial.py +80 -7
  152. mirascope/llm/formatting/primitives.py +192 -0
  153. mirascope/llm/formatting/types.py +20 -8
  154. mirascope/llm/messages/__init__.py +3 -0
  155. mirascope/llm/messages/_utils.py +34 -0
  156. mirascope/llm/models/__init__.py +5 -0
  157. mirascope/llm/models/models.py +137 -69
  158. mirascope/llm/{providers/base → models}/params.py +7 -57
  159. mirascope/llm/models/thinking_config.py +61 -0
  160. mirascope/llm/prompts/_utils.py +0 -32
  161. mirascope/llm/prompts/decorator.py +16 -5
  162. mirascope/llm/prompts/prompts.py +131 -68
  163. mirascope/llm/providers/__init__.py +1 -4
  164. mirascope/llm/providers/anthropic/_utils/__init__.py +2 -0
  165. mirascope/llm/providers/anthropic/_utils/beta_decode.py +18 -9
  166. mirascope/llm/providers/anthropic/_utils/beta_encode.py +62 -13
  167. mirascope/llm/providers/anthropic/_utils/decode.py +18 -9
  168. mirascope/llm/providers/anthropic/_utils/encode.py +26 -7
  169. mirascope/llm/providers/anthropic/_utils/errors.py +2 -2
  170. mirascope/llm/providers/anthropic/beta_provider.py +64 -18
  171. mirascope/llm/providers/anthropic/provider.py +91 -33
  172. mirascope/llm/providers/base/__init__.py +0 -4
  173. mirascope/llm/providers/base/_utils.py +55 -6
  174. mirascope/llm/providers/base/base_provider.py +116 -37
  175. mirascope/llm/providers/google/_utils/__init__.py +2 -0
  176. mirascope/llm/providers/google/_utils/decode.py +20 -7
  177. mirascope/llm/providers/google/_utils/encode.py +26 -7
  178. mirascope/llm/providers/google/_utils/errors.py +3 -2
  179. mirascope/llm/providers/google/provider.py +64 -18
  180. mirascope/llm/providers/mirascope/_utils.py +13 -17
  181. mirascope/llm/providers/mirascope/provider.py +49 -18
  182. mirascope/llm/providers/mlx/_utils.py +7 -2
  183. mirascope/llm/providers/mlx/encoding/base.py +5 -2
  184. mirascope/llm/providers/mlx/encoding/transformers.py +5 -2
  185. mirascope/llm/providers/mlx/mlx.py +23 -6
  186. mirascope/llm/providers/mlx/provider.py +42 -13
  187. mirascope/llm/providers/openai/_utils/errors.py +2 -2
  188. mirascope/llm/providers/openai/completions/_utils/encode.py +20 -16
  189. mirascope/llm/providers/openai/completions/base_provider.py +40 -11
  190. mirascope/llm/providers/openai/provider.py +40 -10
  191. mirascope/llm/providers/openai/responses/_utils/__init__.py +2 -0
  192. mirascope/llm/providers/openai/responses/_utils/decode.py +19 -6
  193. mirascope/llm/providers/openai/responses/_utils/encode.py +22 -10
  194. mirascope/llm/providers/openai/responses/provider.py +56 -18
  195. mirascope/llm/providers/provider_registry.py +93 -19
  196. mirascope/llm/responses/__init__.py +6 -1
  197. mirascope/llm/responses/_utils.py +102 -12
  198. mirascope/llm/responses/base_response.py +5 -2
  199. mirascope/llm/responses/base_stream_response.py +115 -25
  200. mirascope/llm/responses/response.py +2 -1
  201. mirascope/llm/responses/root_response.py +89 -17
  202. mirascope/llm/responses/stream_response.py +6 -9
  203. mirascope/llm/tools/decorator.py +9 -4
  204. mirascope/llm/tools/tool_schema.py +12 -6
  205. mirascope/llm/tools/toolkit.py +35 -27
  206. mirascope/llm/tools/tools.py +45 -20
  207. mirascope/ops/__init__.py +4 -0
  208. mirascope/ops/_internal/configuration.py +82 -31
  209. mirascope/ops/_internal/exporters/exporters.py +64 -11
  210. mirascope/ops/_internal/instrumentation/llm/common.py +530 -0
  211. mirascope/ops/_internal/instrumentation/llm/cost.py +190 -0
  212. mirascope/ops/_internal/instrumentation/llm/encode.py +1 -1
  213. mirascope/ops/_internal/instrumentation/llm/llm.py +116 -1242
  214. mirascope/ops/_internal/instrumentation/llm/model.py +1798 -0
  215. mirascope/ops/_internal/instrumentation/llm/response.py +521 -0
  216. mirascope/ops/_internal/instrumentation/llm/serialize.py +300 -0
  217. mirascope/ops/_internal/protocols.py +83 -1
  218. mirascope/ops/_internal/traced_calls.py +4 -0
  219. mirascope/ops/_internal/traced_functions.py +118 -8
  220. mirascope/ops/_internal/tracing.py +78 -1
  221. mirascope/ops/_internal/utils.py +52 -4
  222. {mirascope-2.0.0a6.dist-info → mirascope-2.0.1.dist-info}/METADATA +12 -11
  223. mirascope-2.0.1.dist-info/RECORD +423 -0
  224. {mirascope-2.0.0a6.dist-info → mirascope-2.0.1.dist-info}/licenses/LICENSE +1 -1
  225. mirascope-2.0.0a6.dist-info/RECORD +0 -316
  226. {mirascope-2.0.0a6.dist-info → mirascope-2.0.1.dist-info}/WHEEL +0 -0
@@ -14,12 +14,16 @@ 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 ..types.already_exists_error import AlreadyExistsError
18
- from ..types.http_api_decode_error import HttpApiDecodeError
17
+ from ..errors.service_unavailable_error import ServiceUnavailableError
18
+ from ..errors.too_many_requests_error import TooManyRequestsError
19
19
  from ..types.not_found_error_body import NotFoundErrorBody
20
20
  from ..types.permission_denied_error import PermissionDeniedError
21
+ from ..types.rate_limit_error import RateLimitError
21
22
  from .types.api_keys_create_response import ApiKeysCreateResponse
22
23
  from .types.api_keys_get_response import ApiKeysGetResponse
24
+ from .types.api_keys_list_all_for_org_response_item import (
25
+ ApiKeysListAllForOrgResponseItem,
26
+ )
23
27
  from .types.api_keys_list_response_item import ApiKeysListResponseItem
24
28
 
25
29
  # this is used as the default value for optional parameters
@@ -30,6 +34,108 @@ class RawApiKeysClient:
30
34
  def __init__(self, *, client_wrapper: SyncClientWrapper):
31
35
  self._client_wrapper = client_wrapper
32
36
 
37
+ def api_keys_list_all_for_org(
38
+ self,
39
+ organization_id: str,
40
+ *,
41
+ request_options: typing.Optional[RequestOptions] = None,
42
+ ) -> HttpResponse[typing.List[ApiKeysListAllForOrgResponseItem]]:
43
+ """
44
+ Parameters
45
+ ----------
46
+ organization_id : str
47
+
48
+ request_options : typing.Optional[RequestOptions]
49
+ Request-specific configuration.
50
+
51
+ Returns
52
+ -------
53
+ HttpResponse[typing.List[ApiKeysListAllForOrgResponseItem]]
54
+ Success
55
+ """
56
+ _response = self._client_wrapper.httpx_client.request(
57
+ f"organizations/{jsonable_encoder(organization_id)}/api-keys",
58
+ method="GET",
59
+ request_options=request_options,
60
+ )
61
+ try:
62
+ if 200 <= _response.status_code < 300:
63
+ _data = typing.cast(
64
+ typing.List[ApiKeysListAllForOrgResponseItem],
65
+ parse_obj_as(
66
+ type_=typing.List[ApiKeysListAllForOrgResponseItem], # type: ignore
67
+ object_=_response.json(),
68
+ ),
69
+ )
70
+ return HttpResponse(response=_response, data=_data)
71
+ if _response.status_code == 400:
72
+ raise BadRequestError(
73
+ headers=dict(_response.headers),
74
+ body=typing.cast(
75
+ typing.Optional[typing.Any],
76
+ parse_obj_as(
77
+ type_=typing.Optional[typing.Any], # type: ignore
78
+ object_=_response.json(),
79
+ ),
80
+ ),
81
+ )
82
+ if _response.status_code == 404:
83
+ raise NotFoundError(
84
+ headers=dict(_response.headers),
85
+ body=typing.cast(
86
+ NotFoundErrorBody,
87
+ parse_obj_as(
88
+ type_=NotFoundErrorBody, # type: ignore
89
+ object_=_response.json(),
90
+ ),
91
+ ),
92
+ )
93
+ if _response.status_code == 429:
94
+ raise TooManyRequestsError(
95
+ headers=dict(_response.headers),
96
+ body=typing.cast(
97
+ RateLimitError,
98
+ parse_obj_as(
99
+ type_=RateLimitError, # type: ignore
100
+ object_=_response.json(),
101
+ ),
102
+ ),
103
+ )
104
+ if _response.status_code == 500:
105
+ raise InternalServerError(
106
+ headers=dict(_response.headers),
107
+ body=typing.cast(
108
+ typing.Optional[typing.Any],
109
+ parse_obj_as(
110
+ type_=typing.Optional[typing.Any], # type: ignore
111
+ object_=_response.json(),
112
+ ),
113
+ ),
114
+ )
115
+ if _response.status_code == 503:
116
+ raise ServiceUnavailableError(
117
+ headers=dict(_response.headers),
118
+ body=typing.cast(
119
+ typing.Optional[typing.Any],
120
+ parse_obj_as(
121
+ type_=typing.Optional[typing.Any], # type: ignore
122
+ object_=_response.json(),
123
+ ),
124
+ ),
125
+ )
126
+ _response_json = _response.json()
127
+ except JSONDecodeError:
128
+ raise ApiError(
129
+ status_code=_response.status_code,
130
+ headers=dict(_response.headers),
131
+ body=_response.text,
132
+ )
133
+ raise ApiError(
134
+ status_code=_response.status_code,
135
+ headers=dict(_response.headers),
136
+ body=_response_json,
137
+ )
138
+
33
139
  def api_keys_list(
34
140
  self,
35
141
  organization_id: str,
@@ -74,9 +180,9 @@ class RawApiKeysClient:
74
180
  raise BadRequestError(
75
181
  headers=dict(_response.headers),
76
182
  body=typing.cast(
77
- HttpApiDecodeError,
183
+ typing.Optional[typing.Any],
78
184
  parse_obj_as(
79
- type_=HttpApiDecodeError, # type: ignore
185
+ type_=typing.Optional[typing.Any], # type: ignore
80
186
  object_=_response.json(),
81
187
  ),
82
188
  ),
@@ -103,6 +209,17 @@ class RawApiKeysClient:
103
209
  ),
104
210
  ),
105
211
  )
212
+ if _response.status_code == 429:
213
+ raise TooManyRequestsError(
214
+ headers=dict(_response.headers),
215
+ body=typing.cast(
216
+ RateLimitError,
217
+ parse_obj_as(
218
+ type_=RateLimitError, # type: ignore
219
+ object_=_response.json(),
220
+ ),
221
+ ),
222
+ )
106
223
  if _response.status_code == 500:
107
224
  raise InternalServerError(
108
225
  headers=dict(_response.headers),
@@ -114,10 +231,29 @@ class RawApiKeysClient:
114
231
  ),
115
232
  ),
116
233
  )
234
+ if _response.status_code == 503:
235
+ raise ServiceUnavailableError(
236
+ headers=dict(_response.headers),
237
+ body=typing.cast(
238
+ typing.Optional[typing.Any],
239
+ parse_obj_as(
240
+ type_=typing.Optional[typing.Any], # type: ignore
241
+ object_=_response.json(),
242
+ ),
243
+ ),
244
+ )
117
245
  _response_json = _response.json()
118
246
  except JSONDecodeError:
119
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
120
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
247
+ raise ApiError(
248
+ status_code=_response.status_code,
249
+ headers=dict(_response.headers),
250
+ body=_response.text,
251
+ )
252
+ raise ApiError(
253
+ status_code=_response.status_code,
254
+ headers=dict(_response.headers),
255
+ body=_response_json,
256
+ )
121
257
 
122
258
  def api_keys_create(
123
259
  self,
@@ -174,9 +310,9 @@ class RawApiKeysClient:
174
310
  raise BadRequestError(
175
311
  headers=dict(_response.headers),
176
312
  body=typing.cast(
177
- HttpApiDecodeError,
313
+ typing.Optional[typing.Any],
178
314
  parse_obj_as(
179
- type_=HttpApiDecodeError, # type: ignore
315
+ type_=typing.Optional[typing.Any], # type: ignore
180
316
  object_=_response.json(),
181
317
  ),
182
318
  ),
@@ -207,9 +343,20 @@ class RawApiKeysClient:
207
343
  raise ConflictError(
208
344
  headers=dict(_response.headers),
209
345
  body=typing.cast(
210
- AlreadyExistsError,
346
+ typing.Optional[typing.Any],
347
+ parse_obj_as(
348
+ type_=typing.Optional[typing.Any], # type: ignore
349
+ object_=_response.json(),
350
+ ),
351
+ ),
352
+ )
353
+ if _response.status_code == 429:
354
+ raise TooManyRequestsError(
355
+ headers=dict(_response.headers),
356
+ body=typing.cast(
357
+ RateLimitError,
211
358
  parse_obj_as(
212
- type_=AlreadyExistsError, # type: ignore
359
+ type_=RateLimitError, # type: ignore
213
360
  object_=_response.json(),
214
361
  ),
215
362
  ),
@@ -225,10 +372,29 @@ class RawApiKeysClient:
225
372
  ),
226
373
  ),
227
374
  )
375
+ if _response.status_code == 503:
376
+ raise ServiceUnavailableError(
377
+ headers=dict(_response.headers),
378
+ body=typing.cast(
379
+ typing.Optional[typing.Any],
380
+ parse_obj_as(
381
+ type_=typing.Optional[typing.Any], # type: ignore
382
+ object_=_response.json(),
383
+ ),
384
+ ),
385
+ )
228
386
  _response_json = _response.json()
229
387
  except JSONDecodeError:
230
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
231
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
388
+ raise ApiError(
389
+ status_code=_response.status_code,
390
+ headers=dict(_response.headers),
391
+ body=_response.text,
392
+ )
393
+ raise ApiError(
394
+ status_code=_response.status_code,
395
+ headers=dict(_response.headers),
396
+ body=_response_json,
397
+ )
232
398
 
233
399
  def api_keys_get(
234
400
  self,
@@ -277,9 +443,9 @@ class RawApiKeysClient:
277
443
  raise BadRequestError(
278
444
  headers=dict(_response.headers),
279
445
  body=typing.cast(
280
- HttpApiDecodeError,
446
+ typing.Optional[typing.Any],
281
447
  parse_obj_as(
282
- type_=HttpApiDecodeError, # type: ignore
448
+ type_=typing.Optional[typing.Any], # type: ignore
283
449
  object_=_response.json(),
284
450
  ),
285
451
  ),
@@ -306,6 +472,17 @@ class RawApiKeysClient:
306
472
  ),
307
473
  ),
308
474
  )
475
+ if _response.status_code == 429:
476
+ raise TooManyRequestsError(
477
+ headers=dict(_response.headers),
478
+ body=typing.cast(
479
+ RateLimitError,
480
+ parse_obj_as(
481
+ type_=RateLimitError, # type: ignore
482
+ object_=_response.json(),
483
+ ),
484
+ ),
485
+ )
309
486
  if _response.status_code == 500:
310
487
  raise InternalServerError(
311
488
  headers=dict(_response.headers),
@@ -317,10 +494,29 @@ class RawApiKeysClient:
317
494
  ),
318
495
  ),
319
496
  )
497
+ if _response.status_code == 503:
498
+ raise ServiceUnavailableError(
499
+ headers=dict(_response.headers),
500
+ body=typing.cast(
501
+ typing.Optional[typing.Any],
502
+ parse_obj_as(
503
+ type_=typing.Optional[typing.Any], # type: ignore
504
+ object_=_response.json(),
505
+ ),
506
+ ),
507
+ )
320
508
  _response_json = _response.json()
321
509
  except JSONDecodeError:
322
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
323
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
510
+ raise ApiError(
511
+ status_code=_response.status_code,
512
+ headers=dict(_response.headers),
513
+ body=_response.text,
514
+ )
515
+ raise ApiError(
516
+ status_code=_response.status_code,
517
+ headers=dict(_response.headers),
518
+ body=_response_json,
519
+ )
324
520
 
325
521
  def api_keys_delete(
326
522
  self,
@@ -361,9 +557,9 @@ class RawApiKeysClient:
361
557
  raise BadRequestError(
362
558
  headers=dict(_response.headers),
363
559
  body=typing.cast(
364
- HttpApiDecodeError,
560
+ typing.Optional[typing.Any],
365
561
  parse_obj_as(
366
- type_=HttpApiDecodeError, # type: ignore
562
+ type_=typing.Optional[typing.Any], # type: ignore
367
563
  object_=_response.json(),
368
564
  ),
369
565
  ),
@@ -390,6 +586,17 @@ class RawApiKeysClient:
390
586
  ),
391
587
  ),
392
588
  )
589
+ if _response.status_code == 429:
590
+ raise TooManyRequestsError(
591
+ headers=dict(_response.headers),
592
+ body=typing.cast(
593
+ RateLimitError,
594
+ parse_obj_as(
595
+ type_=RateLimitError, # type: ignore
596
+ object_=_response.json(),
597
+ ),
598
+ ),
599
+ )
393
600
  if _response.status_code == 500:
394
601
  raise InternalServerError(
395
602
  headers=dict(_response.headers),
@@ -401,16 +608,137 @@ class RawApiKeysClient:
401
608
  ),
402
609
  ),
403
610
  )
611
+ if _response.status_code == 503:
612
+ raise ServiceUnavailableError(
613
+ headers=dict(_response.headers),
614
+ body=typing.cast(
615
+ typing.Optional[typing.Any],
616
+ parse_obj_as(
617
+ type_=typing.Optional[typing.Any], # type: ignore
618
+ object_=_response.json(),
619
+ ),
620
+ ),
621
+ )
404
622
  _response_json = _response.json()
405
623
  except JSONDecodeError:
406
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
407
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
624
+ raise ApiError(
625
+ status_code=_response.status_code,
626
+ headers=dict(_response.headers),
627
+ body=_response.text,
628
+ )
629
+ raise ApiError(
630
+ status_code=_response.status_code,
631
+ headers=dict(_response.headers),
632
+ body=_response_json,
633
+ )
408
634
 
409
635
 
410
636
  class AsyncRawApiKeysClient:
411
637
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
412
638
  self._client_wrapper = client_wrapper
413
639
 
640
+ async def api_keys_list_all_for_org(
641
+ self,
642
+ organization_id: str,
643
+ *,
644
+ request_options: typing.Optional[RequestOptions] = None,
645
+ ) -> AsyncHttpResponse[typing.List[ApiKeysListAllForOrgResponseItem]]:
646
+ """
647
+ Parameters
648
+ ----------
649
+ organization_id : str
650
+
651
+ request_options : typing.Optional[RequestOptions]
652
+ Request-specific configuration.
653
+
654
+ Returns
655
+ -------
656
+ AsyncHttpResponse[typing.List[ApiKeysListAllForOrgResponseItem]]
657
+ Success
658
+ """
659
+ _response = await self._client_wrapper.httpx_client.request(
660
+ f"organizations/{jsonable_encoder(organization_id)}/api-keys",
661
+ method="GET",
662
+ request_options=request_options,
663
+ )
664
+ try:
665
+ if 200 <= _response.status_code < 300:
666
+ _data = typing.cast(
667
+ typing.List[ApiKeysListAllForOrgResponseItem],
668
+ parse_obj_as(
669
+ type_=typing.List[ApiKeysListAllForOrgResponseItem], # type: ignore
670
+ object_=_response.json(),
671
+ ),
672
+ )
673
+ return AsyncHttpResponse(response=_response, data=_data)
674
+ if _response.status_code == 400:
675
+ raise BadRequestError(
676
+ headers=dict(_response.headers),
677
+ body=typing.cast(
678
+ typing.Optional[typing.Any],
679
+ parse_obj_as(
680
+ type_=typing.Optional[typing.Any], # type: ignore
681
+ object_=_response.json(),
682
+ ),
683
+ ),
684
+ )
685
+ if _response.status_code == 404:
686
+ raise NotFoundError(
687
+ headers=dict(_response.headers),
688
+ body=typing.cast(
689
+ NotFoundErrorBody,
690
+ parse_obj_as(
691
+ type_=NotFoundErrorBody, # type: ignore
692
+ object_=_response.json(),
693
+ ),
694
+ ),
695
+ )
696
+ if _response.status_code == 429:
697
+ raise TooManyRequestsError(
698
+ headers=dict(_response.headers),
699
+ body=typing.cast(
700
+ RateLimitError,
701
+ parse_obj_as(
702
+ type_=RateLimitError, # type: ignore
703
+ object_=_response.json(),
704
+ ),
705
+ ),
706
+ )
707
+ if _response.status_code == 500:
708
+ raise InternalServerError(
709
+ headers=dict(_response.headers),
710
+ body=typing.cast(
711
+ typing.Optional[typing.Any],
712
+ parse_obj_as(
713
+ type_=typing.Optional[typing.Any], # type: ignore
714
+ object_=_response.json(),
715
+ ),
716
+ ),
717
+ )
718
+ if _response.status_code == 503:
719
+ raise ServiceUnavailableError(
720
+ headers=dict(_response.headers),
721
+ body=typing.cast(
722
+ typing.Optional[typing.Any],
723
+ parse_obj_as(
724
+ type_=typing.Optional[typing.Any], # type: ignore
725
+ object_=_response.json(),
726
+ ),
727
+ ),
728
+ )
729
+ _response_json = _response.json()
730
+ except JSONDecodeError:
731
+ raise ApiError(
732
+ status_code=_response.status_code,
733
+ headers=dict(_response.headers),
734
+ body=_response.text,
735
+ )
736
+ raise ApiError(
737
+ status_code=_response.status_code,
738
+ headers=dict(_response.headers),
739
+ body=_response_json,
740
+ )
741
+
414
742
  async def api_keys_list(
415
743
  self,
416
744
  organization_id: str,
@@ -455,9 +783,9 @@ class AsyncRawApiKeysClient:
455
783
  raise BadRequestError(
456
784
  headers=dict(_response.headers),
457
785
  body=typing.cast(
458
- HttpApiDecodeError,
786
+ typing.Optional[typing.Any],
459
787
  parse_obj_as(
460
- type_=HttpApiDecodeError, # type: ignore
788
+ type_=typing.Optional[typing.Any], # type: ignore
461
789
  object_=_response.json(),
462
790
  ),
463
791
  ),
@@ -484,6 +812,17 @@ class AsyncRawApiKeysClient:
484
812
  ),
485
813
  ),
486
814
  )
815
+ if _response.status_code == 429:
816
+ raise TooManyRequestsError(
817
+ headers=dict(_response.headers),
818
+ body=typing.cast(
819
+ RateLimitError,
820
+ parse_obj_as(
821
+ type_=RateLimitError, # type: ignore
822
+ object_=_response.json(),
823
+ ),
824
+ ),
825
+ )
487
826
  if _response.status_code == 500:
488
827
  raise InternalServerError(
489
828
  headers=dict(_response.headers),
@@ -495,10 +834,29 @@ class AsyncRawApiKeysClient:
495
834
  ),
496
835
  ),
497
836
  )
837
+ if _response.status_code == 503:
838
+ raise ServiceUnavailableError(
839
+ headers=dict(_response.headers),
840
+ body=typing.cast(
841
+ typing.Optional[typing.Any],
842
+ parse_obj_as(
843
+ type_=typing.Optional[typing.Any], # type: ignore
844
+ object_=_response.json(),
845
+ ),
846
+ ),
847
+ )
498
848
  _response_json = _response.json()
499
849
  except JSONDecodeError:
500
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
501
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
850
+ raise ApiError(
851
+ status_code=_response.status_code,
852
+ headers=dict(_response.headers),
853
+ body=_response.text,
854
+ )
855
+ raise ApiError(
856
+ status_code=_response.status_code,
857
+ headers=dict(_response.headers),
858
+ body=_response_json,
859
+ )
502
860
 
503
861
  async def api_keys_create(
504
862
  self,
@@ -555,9 +913,9 @@ class AsyncRawApiKeysClient:
555
913
  raise BadRequestError(
556
914
  headers=dict(_response.headers),
557
915
  body=typing.cast(
558
- HttpApiDecodeError,
916
+ typing.Optional[typing.Any],
559
917
  parse_obj_as(
560
- type_=HttpApiDecodeError, # type: ignore
918
+ type_=typing.Optional[typing.Any], # type: ignore
561
919
  object_=_response.json(),
562
920
  ),
563
921
  ),
@@ -588,9 +946,20 @@ class AsyncRawApiKeysClient:
588
946
  raise ConflictError(
589
947
  headers=dict(_response.headers),
590
948
  body=typing.cast(
591
- AlreadyExistsError,
949
+ typing.Optional[typing.Any],
950
+ parse_obj_as(
951
+ type_=typing.Optional[typing.Any], # type: ignore
952
+ object_=_response.json(),
953
+ ),
954
+ ),
955
+ )
956
+ if _response.status_code == 429:
957
+ raise TooManyRequestsError(
958
+ headers=dict(_response.headers),
959
+ body=typing.cast(
960
+ RateLimitError,
592
961
  parse_obj_as(
593
- type_=AlreadyExistsError, # type: ignore
962
+ type_=RateLimitError, # type: ignore
594
963
  object_=_response.json(),
595
964
  ),
596
965
  ),
@@ -606,10 +975,29 @@ class AsyncRawApiKeysClient:
606
975
  ),
607
976
  ),
608
977
  )
978
+ if _response.status_code == 503:
979
+ raise ServiceUnavailableError(
980
+ headers=dict(_response.headers),
981
+ body=typing.cast(
982
+ typing.Optional[typing.Any],
983
+ parse_obj_as(
984
+ type_=typing.Optional[typing.Any], # type: ignore
985
+ object_=_response.json(),
986
+ ),
987
+ ),
988
+ )
609
989
  _response_json = _response.json()
610
990
  except JSONDecodeError:
611
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
612
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
991
+ raise ApiError(
992
+ status_code=_response.status_code,
993
+ headers=dict(_response.headers),
994
+ body=_response.text,
995
+ )
996
+ raise ApiError(
997
+ status_code=_response.status_code,
998
+ headers=dict(_response.headers),
999
+ body=_response_json,
1000
+ )
613
1001
 
614
1002
  async def api_keys_get(
615
1003
  self,
@@ -658,9 +1046,9 @@ class AsyncRawApiKeysClient:
658
1046
  raise BadRequestError(
659
1047
  headers=dict(_response.headers),
660
1048
  body=typing.cast(
661
- HttpApiDecodeError,
1049
+ typing.Optional[typing.Any],
662
1050
  parse_obj_as(
663
- type_=HttpApiDecodeError, # type: ignore
1051
+ type_=typing.Optional[typing.Any], # type: ignore
664
1052
  object_=_response.json(),
665
1053
  ),
666
1054
  ),
@@ -687,6 +1075,17 @@ class AsyncRawApiKeysClient:
687
1075
  ),
688
1076
  ),
689
1077
  )
1078
+ if _response.status_code == 429:
1079
+ raise TooManyRequestsError(
1080
+ headers=dict(_response.headers),
1081
+ body=typing.cast(
1082
+ RateLimitError,
1083
+ parse_obj_as(
1084
+ type_=RateLimitError, # type: ignore
1085
+ object_=_response.json(),
1086
+ ),
1087
+ ),
1088
+ )
690
1089
  if _response.status_code == 500:
691
1090
  raise InternalServerError(
692
1091
  headers=dict(_response.headers),
@@ -698,10 +1097,29 @@ class AsyncRawApiKeysClient:
698
1097
  ),
699
1098
  ),
700
1099
  )
1100
+ if _response.status_code == 503:
1101
+ raise ServiceUnavailableError(
1102
+ headers=dict(_response.headers),
1103
+ body=typing.cast(
1104
+ typing.Optional[typing.Any],
1105
+ parse_obj_as(
1106
+ type_=typing.Optional[typing.Any], # type: ignore
1107
+ object_=_response.json(),
1108
+ ),
1109
+ ),
1110
+ )
701
1111
  _response_json = _response.json()
702
1112
  except JSONDecodeError:
703
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
704
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1113
+ raise ApiError(
1114
+ status_code=_response.status_code,
1115
+ headers=dict(_response.headers),
1116
+ body=_response.text,
1117
+ )
1118
+ raise ApiError(
1119
+ status_code=_response.status_code,
1120
+ headers=dict(_response.headers),
1121
+ body=_response_json,
1122
+ )
705
1123
 
706
1124
  async def api_keys_delete(
707
1125
  self,
@@ -742,9 +1160,9 @@ class AsyncRawApiKeysClient:
742
1160
  raise BadRequestError(
743
1161
  headers=dict(_response.headers),
744
1162
  body=typing.cast(
745
- HttpApiDecodeError,
1163
+ typing.Optional[typing.Any],
746
1164
  parse_obj_as(
747
- type_=HttpApiDecodeError, # type: ignore
1165
+ type_=typing.Optional[typing.Any], # type: ignore
748
1166
  object_=_response.json(),
749
1167
  ),
750
1168
  ),
@@ -771,6 +1189,17 @@ class AsyncRawApiKeysClient:
771
1189
  ),
772
1190
  ),
773
1191
  )
1192
+ if _response.status_code == 429:
1193
+ raise TooManyRequestsError(
1194
+ headers=dict(_response.headers),
1195
+ body=typing.cast(
1196
+ RateLimitError,
1197
+ parse_obj_as(
1198
+ type_=RateLimitError, # type: ignore
1199
+ object_=_response.json(),
1200
+ ),
1201
+ ),
1202
+ )
774
1203
  if _response.status_code == 500:
775
1204
  raise InternalServerError(
776
1205
  headers=dict(_response.headers),
@@ -782,7 +1211,26 @@ class AsyncRawApiKeysClient:
782
1211
  ),
783
1212
  ),
784
1213
  )
1214
+ if _response.status_code == 503:
1215
+ raise ServiceUnavailableError(
1216
+ headers=dict(_response.headers),
1217
+ body=typing.cast(
1218
+ typing.Optional[typing.Any],
1219
+ parse_obj_as(
1220
+ type_=typing.Optional[typing.Any], # type: ignore
1221
+ object_=_response.json(),
1222
+ ),
1223
+ ),
1224
+ )
785
1225
  _response_json = _response.json()
786
1226
  except JSONDecodeError:
787
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
788
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1227
+ raise ApiError(
1228
+ status_code=_response.status_code,
1229
+ headers=dict(_response.headers),
1230
+ body=_response.text,
1231
+ )
1232
+ raise ApiError(
1233
+ status_code=_response.status_code,
1234
+ headers=dict(_response.headers),
1235
+ body=_response_json,
1236
+ )