mirascope 2.0.0__py3-none-any.whl → 2.0.0a0__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 (442) hide show
  1. mirascope/__init__.py +2 -11
  2. mirascope/graphs/__init__.py +22 -0
  3. mirascope/graphs/finite_state_machine.py +625 -0
  4. mirascope/llm/__init__.py +16 -101
  5. mirascope/llm/agents/__init__.py +15 -0
  6. mirascope/llm/agents/agent.py +97 -0
  7. mirascope/llm/agents/agent_template.py +45 -0
  8. mirascope/llm/agents/decorator.py +176 -0
  9. mirascope/llm/calls/__init__.py +1 -2
  10. mirascope/llm/calls/base_call.py +33 -0
  11. mirascope/llm/calls/calls.py +58 -84
  12. mirascope/llm/calls/decorator.py +120 -140
  13. mirascope/llm/clients/__init__.py +34 -0
  14. mirascope/llm/clients/anthropic/__init__.py +11 -0
  15. mirascope/llm/{providers/openai/completions → clients/anthropic}/_utils/__init__.py +0 -2
  16. mirascope/llm/{providers → clients}/anthropic/_utils/decode.py +22 -66
  17. mirascope/llm/clients/anthropic/_utils/encode.py +243 -0
  18. mirascope/llm/clients/anthropic/clients.py +819 -0
  19. mirascope/llm/clients/anthropic/model_ids.py +8 -0
  20. mirascope/llm/{providers → clients}/base/__init__.py +5 -4
  21. mirascope/llm/{providers → clients}/base/_utils.py +17 -78
  22. mirascope/llm/{providers/base/base_provider.py → clients/base/client.py} +145 -468
  23. mirascope/llm/{models → clients/base}/params.py +37 -16
  24. mirascope/llm/clients/google/__init__.py +6 -0
  25. mirascope/llm/{providers/openai/responses → clients/google}/_utils/__init__.py +0 -2
  26. mirascope/llm/{providers → clients}/google/_utils/decode.py +22 -98
  27. mirascope/llm/{providers → clients}/google/_utils/encode.py +46 -168
  28. mirascope/llm/clients/google/clients.py +853 -0
  29. mirascope/llm/clients/google/model_ids.py +15 -0
  30. mirascope/llm/clients/openai/__init__.py +25 -0
  31. mirascope/llm/clients/openai/completions/__init__.py +9 -0
  32. mirascope/llm/{providers/google → clients/openai/completions}/_utils/__init__.py +0 -4
  33. mirascope/llm/{providers → clients}/openai/completions/_utils/decode.py +9 -74
  34. mirascope/llm/{providers → clients}/openai/completions/_utils/encode.py +52 -70
  35. mirascope/llm/clients/openai/completions/_utils/model_features.py +81 -0
  36. mirascope/llm/clients/openai/completions/clients.py +833 -0
  37. mirascope/llm/clients/openai/completions/model_ids.py +8 -0
  38. mirascope/llm/clients/openai/responses/__init__.py +9 -0
  39. mirascope/llm/clients/openai/responses/_utils/__init__.py +13 -0
  40. mirascope/llm/{providers → clients}/openai/responses/_utils/decode.py +14 -80
  41. mirascope/llm/{providers → clients}/openai/responses/_utils/encode.py +41 -92
  42. mirascope/llm/clients/openai/responses/_utils/model_features.py +87 -0
  43. mirascope/llm/clients/openai/responses/clients.py +832 -0
  44. mirascope/llm/clients/openai/responses/model_ids.py +8 -0
  45. mirascope/llm/clients/openai/shared/__init__.py +7 -0
  46. mirascope/llm/clients/openai/shared/_utils.py +55 -0
  47. mirascope/llm/clients/providers.py +175 -0
  48. mirascope/llm/content/__init__.py +2 -3
  49. mirascope/llm/content/tool_call.py +0 -6
  50. mirascope/llm/content/tool_output.py +5 -22
  51. mirascope/llm/context/_utils.py +6 -19
  52. mirascope/llm/exceptions.py +43 -298
  53. mirascope/llm/formatting/__init__.py +2 -19
  54. mirascope/llm/formatting/_utils.py +74 -0
  55. mirascope/llm/formatting/format.py +30 -219
  56. mirascope/llm/formatting/from_call_args.py +2 -2
  57. mirascope/llm/formatting/partial.py +7 -80
  58. mirascope/llm/formatting/types.py +64 -21
  59. mirascope/llm/mcp/__init__.py +2 -2
  60. mirascope/llm/mcp/client.py +118 -0
  61. mirascope/llm/messages/__init__.py +0 -3
  62. mirascope/llm/messages/message.py +5 -13
  63. mirascope/llm/models/__init__.py +2 -7
  64. mirascope/llm/models/models.py +139 -315
  65. mirascope/llm/prompts/__init__.py +12 -13
  66. mirascope/llm/prompts/_utils.py +43 -14
  67. mirascope/llm/prompts/decorator.py +204 -144
  68. mirascope/llm/prompts/protocols.py +59 -25
  69. mirascope/llm/responses/__init__.py +1 -9
  70. mirascope/llm/responses/_utils.py +12 -102
  71. mirascope/llm/responses/base_response.py +6 -18
  72. mirascope/llm/responses/base_stream_response.py +50 -173
  73. mirascope/llm/responses/finish_reason.py +0 -1
  74. mirascope/llm/responses/response.py +13 -34
  75. mirascope/llm/responses/root_response.py +29 -100
  76. mirascope/llm/responses/stream_response.py +31 -40
  77. mirascope/llm/tools/__init__.py +2 -9
  78. mirascope/llm/tools/_utils.py +3 -12
  79. mirascope/llm/tools/decorator.py +16 -25
  80. mirascope/llm/tools/protocols.py +4 -4
  81. mirascope/llm/tools/tool_schema.py +19 -87
  82. mirascope/llm/tools/toolkit.py +27 -35
  83. mirascope/llm/tools/tools.py +41 -135
  84. {mirascope-2.0.0.dist-info → mirascope-2.0.0a0.dist-info}/METADATA +9 -95
  85. mirascope-2.0.0a0.dist-info/RECORD +101 -0
  86. {mirascope-2.0.0.dist-info → mirascope-2.0.0a0.dist-info}/WHEEL +1 -1
  87. {mirascope-2.0.0.dist-info → mirascope-2.0.0a0.dist-info}/licenses/LICENSE +1 -1
  88. mirascope/_stubs.py +0 -363
  89. mirascope/api/__init__.py +0 -14
  90. mirascope/api/_generated/README.md +0 -207
  91. mirascope/api/_generated/__init__.py +0 -440
  92. mirascope/api/_generated/annotations/__init__.py +0 -33
  93. mirascope/api/_generated/annotations/client.py +0 -506
  94. mirascope/api/_generated/annotations/raw_client.py +0 -1414
  95. mirascope/api/_generated/annotations/types/__init__.py +0 -31
  96. mirascope/api/_generated/annotations/types/annotations_create_request_label.py +0 -5
  97. mirascope/api/_generated/annotations/types/annotations_create_response.py +0 -48
  98. mirascope/api/_generated/annotations/types/annotations_create_response_label.py +0 -5
  99. mirascope/api/_generated/annotations/types/annotations_get_response.py +0 -48
  100. mirascope/api/_generated/annotations/types/annotations_get_response_label.py +0 -5
  101. mirascope/api/_generated/annotations/types/annotations_list_request_label.py +0 -5
  102. mirascope/api/_generated/annotations/types/annotations_list_response.py +0 -21
  103. mirascope/api/_generated/annotations/types/annotations_list_response_annotations_item.py +0 -50
  104. mirascope/api/_generated/annotations/types/annotations_list_response_annotations_item_label.py +0 -5
  105. mirascope/api/_generated/annotations/types/annotations_update_request_label.py +0 -5
  106. mirascope/api/_generated/annotations/types/annotations_update_response.py +0 -48
  107. mirascope/api/_generated/annotations/types/annotations_update_response_label.py +0 -5
  108. mirascope/api/_generated/api_keys/__init__.py +0 -17
  109. mirascope/api/_generated/api_keys/client.py +0 -530
  110. mirascope/api/_generated/api_keys/raw_client.py +0 -1236
  111. mirascope/api/_generated/api_keys/types/__init__.py +0 -15
  112. mirascope/api/_generated/api_keys/types/api_keys_create_response.py +0 -28
  113. mirascope/api/_generated/api_keys/types/api_keys_get_response.py +0 -27
  114. mirascope/api/_generated/api_keys/types/api_keys_list_all_for_org_response_item.py +0 -40
  115. mirascope/api/_generated/api_keys/types/api_keys_list_response_item.py +0 -27
  116. mirascope/api/_generated/client.py +0 -211
  117. mirascope/api/_generated/core/__init__.py +0 -52
  118. mirascope/api/_generated/core/api_error.py +0 -23
  119. mirascope/api/_generated/core/client_wrapper.py +0 -46
  120. mirascope/api/_generated/core/datetime_utils.py +0 -28
  121. mirascope/api/_generated/core/file.py +0 -67
  122. mirascope/api/_generated/core/force_multipart.py +0 -16
  123. mirascope/api/_generated/core/http_client.py +0 -543
  124. mirascope/api/_generated/core/http_response.py +0 -55
  125. mirascope/api/_generated/core/jsonable_encoder.py +0 -100
  126. mirascope/api/_generated/core/pydantic_utilities.py +0 -255
  127. mirascope/api/_generated/core/query_encoder.py +0 -58
  128. mirascope/api/_generated/core/remove_none_from_dict.py +0 -11
  129. mirascope/api/_generated/core/request_options.py +0 -35
  130. mirascope/api/_generated/core/serialization.py +0 -276
  131. mirascope/api/_generated/docs/__init__.py +0 -4
  132. mirascope/api/_generated/docs/client.py +0 -91
  133. mirascope/api/_generated/docs/raw_client.py +0 -178
  134. mirascope/api/_generated/environment.py +0 -9
  135. mirascope/api/_generated/environments/__init__.py +0 -23
  136. mirascope/api/_generated/environments/client.py +0 -649
  137. mirascope/api/_generated/environments/raw_client.py +0 -1567
  138. mirascope/api/_generated/environments/types/__init__.py +0 -25
  139. mirascope/api/_generated/environments/types/environments_create_response.py +0 -24
  140. mirascope/api/_generated/environments/types/environments_get_analytics_response.py +0 -60
  141. mirascope/api/_generated/environments/types/environments_get_analytics_response_top_functions_item.py +0 -24
  142. mirascope/api/_generated/environments/types/environments_get_analytics_response_top_models_item.py +0 -22
  143. mirascope/api/_generated/environments/types/environments_get_response.py +0 -24
  144. mirascope/api/_generated/environments/types/environments_list_response_item.py +0 -24
  145. mirascope/api/_generated/environments/types/environments_update_response.py +0 -24
  146. mirascope/api/_generated/errors/__init__.py +0 -25
  147. mirascope/api/_generated/errors/bad_request_error.py +0 -14
  148. mirascope/api/_generated/errors/conflict_error.py +0 -14
  149. mirascope/api/_generated/errors/forbidden_error.py +0 -11
  150. mirascope/api/_generated/errors/internal_server_error.py +0 -10
  151. mirascope/api/_generated/errors/not_found_error.py +0 -11
  152. mirascope/api/_generated/errors/payment_required_error.py +0 -15
  153. mirascope/api/_generated/errors/service_unavailable_error.py +0 -14
  154. mirascope/api/_generated/errors/too_many_requests_error.py +0 -15
  155. mirascope/api/_generated/errors/unauthorized_error.py +0 -11
  156. mirascope/api/_generated/functions/__init__.py +0 -39
  157. mirascope/api/_generated/functions/client.py +0 -647
  158. mirascope/api/_generated/functions/raw_client.py +0 -1890
  159. mirascope/api/_generated/functions/types/__init__.py +0 -53
  160. mirascope/api/_generated/functions/types/functions_create_request_dependencies_value.py +0 -20
  161. mirascope/api/_generated/functions/types/functions_create_response.py +0 -37
  162. mirascope/api/_generated/functions/types/functions_create_response_dependencies_value.py +0 -20
  163. mirascope/api/_generated/functions/types/functions_find_by_hash_response.py +0 -39
  164. mirascope/api/_generated/functions/types/functions_find_by_hash_response_dependencies_value.py +0 -20
  165. mirascope/api/_generated/functions/types/functions_get_by_env_response.py +0 -53
  166. mirascope/api/_generated/functions/types/functions_get_by_env_response_dependencies_value.py +0 -22
  167. mirascope/api/_generated/functions/types/functions_get_response.py +0 -37
  168. mirascope/api/_generated/functions/types/functions_get_response_dependencies_value.py +0 -20
  169. mirascope/api/_generated/functions/types/functions_list_by_env_response.py +0 -25
  170. mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item.py +0 -56
  171. mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item_dependencies_value.py +0 -22
  172. mirascope/api/_generated/functions/types/functions_list_response.py +0 -21
  173. mirascope/api/_generated/functions/types/functions_list_response_functions_item.py +0 -41
  174. mirascope/api/_generated/functions/types/functions_list_response_functions_item_dependencies_value.py +0 -20
  175. mirascope/api/_generated/health/__init__.py +0 -7
  176. mirascope/api/_generated/health/client.py +0 -92
  177. mirascope/api/_generated/health/raw_client.py +0 -175
  178. mirascope/api/_generated/health/types/__init__.py +0 -8
  179. mirascope/api/_generated/health/types/health_check_response.py +0 -22
  180. mirascope/api/_generated/health/types/health_check_response_status.py +0 -5
  181. mirascope/api/_generated/organization_invitations/__init__.py +0 -33
  182. mirascope/api/_generated/organization_invitations/client.py +0 -546
  183. mirascope/api/_generated/organization_invitations/raw_client.py +0 -1519
  184. mirascope/api/_generated/organization_invitations/types/__init__.py +0 -53
  185. mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response.py +0 -34
  186. mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response_role.py +0 -7
  187. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_request_role.py +0 -7
  188. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response.py +0 -48
  189. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_role.py +0 -7
  190. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_status.py +0 -7
  191. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response.py +0 -48
  192. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_role.py +0 -7
  193. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_status.py +0 -7
  194. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item.py +0 -48
  195. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_role.py +0 -7
  196. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_status.py +0 -7
  197. mirascope/api/_generated/organization_memberships/__init__.py +0 -19
  198. mirascope/api/_generated/organization_memberships/client.py +0 -302
  199. mirascope/api/_generated/organization_memberships/raw_client.py +0 -736
  200. mirascope/api/_generated/organization_memberships/types/__init__.py +0 -27
  201. mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item.py +0 -33
  202. mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item_role.py +0 -7
  203. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_request_role.py +0 -7
  204. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response.py +0 -31
  205. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response_role.py +0 -7
  206. mirascope/api/_generated/organizations/__init__.py +0 -51
  207. mirascope/api/_generated/organizations/client.py +0 -869
  208. mirascope/api/_generated/organizations/raw_client.py +0 -2593
  209. mirascope/api/_generated/organizations/types/__init__.py +0 -71
  210. mirascope/api/_generated/organizations/types/organizations_create_payment_intent_response.py +0 -24
  211. mirascope/api/_generated/organizations/types/organizations_create_response.py +0 -26
  212. mirascope/api/_generated/organizations/types/organizations_create_response_role.py +0 -5
  213. mirascope/api/_generated/organizations/types/organizations_get_response.py +0 -26
  214. mirascope/api/_generated/organizations/types/organizations_get_response_role.py +0 -5
  215. mirascope/api/_generated/organizations/types/organizations_list_response_item.py +0 -26
  216. mirascope/api/_generated/organizations/types/organizations_list_response_item_role.py +0 -5
  217. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_request_target_plan.py +0 -7
  218. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response.py +0 -47
  219. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item.py +0 -33
  220. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item_resource.py +0 -7
  221. mirascope/api/_generated/organizations/types/organizations_router_balance_response.py +0 -24
  222. mirascope/api/_generated/organizations/types/organizations_subscription_response.py +0 -53
  223. mirascope/api/_generated/organizations/types/organizations_subscription_response_current_plan.py +0 -7
  224. mirascope/api/_generated/organizations/types/organizations_subscription_response_payment_method.py +0 -26
  225. mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change.py +0 -34
  226. mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change_target_plan.py +0 -7
  227. mirascope/api/_generated/organizations/types/organizations_update_response.py +0 -26
  228. mirascope/api/_generated/organizations/types/organizations_update_response_role.py +0 -5
  229. mirascope/api/_generated/organizations/types/organizations_update_subscription_request_target_plan.py +0 -7
  230. mirascope/api/_generated/organizations/types/organizations_update_subscription_response.py +0 -35
  231. mirascope/api/_generated/project_memberships/__init__.py +0 -25
  232. mirascope/api/_generated/project_memberships/client.py +0 -437
  233. mirascope/api/_generated/project_memberships/raw_client.py +0 -1039
  234. mirascope/api/_generated/project_memberships/types/__init__.py +0 -29
  235. mirascope/api/_generated/project_memberships/types/project_memberships_create_request_role.py +0 -7
  236. mirascope/api/_generated/project_memberships/types/project_memberships_create_response.py +0 -35
  237. mirascope/api/_generated/project_memberships/types/project_memberships_create_response_role.py +0 -7
  238. mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item.py +0 -33
  239. mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item_role.py +0 -7
  240. mirascope/api/_generated/project_memberships/types/project_memberships_update_request_role.py +0 -7
  241. mirascope/api/_generated/project_memberships/types/project_memberships_update_response.py +0 -35
  242. mirascope/api/_generated/project_memberships/types/project_memberships_update_response_role.py +0 -7
  243. mirascope/api/_generated/projects/__init__.py +0 -7
  244. mirascope/api/_generated/projects/client.py +0 -428
  245. mirascope/api/_generated/projects/raw_client.py +0 -1302
  246. mirascope/api/_generated/projects/types/__init__.py +0 -10
  247. mirascope/api/_generated/projects/types/projects_create_response.py +0 -25
  248. mirascope/api/_generated/projects/types/projects_get_response.py +0 -25
  249. mirascope/api/_generated/projects/types/projects_list_response_item.py +0 -25
  250. mirascope/api/_generated/projects/types/projects_update_response.py +0 -25
  251. mirascope/api/_generated/reference.md +0 -4915
  252. mirascope/api/_generated/tags/__init__.py +0 -19
  253. mirascope/api/_generated/tags/client.py +0 -504
  254. mirascope/api/_generated/tags/raw_client.py +0 -1288
  255. mirascope/api/_generated/tags/types/__init__.py +0 -17
  256. mirascope/api/_generated/tags/types/tags_create_response.py +0 -41
  257. mirascope/api/_generated/tags/types/tags_get_response.py +0 -41
  258. mirascope/api/_generated/tags/types/tags_list_response.py +0 -23
  259. mirascope/api/_generated/tags/types/tags_list_response_tags_item.py +0 -41
  260. mirascope/api/_generated/tags/types/tags_update_response.py +0 -41
  261. mirascope/api/_generated/token_cost/__init__.py +0 -7
  262. mirascope/api/_generated/token_cost/client.py +0 -160
  263. mirascope/api/_generated/token_cost/raw_client.py +0 -264
  264. mirascope/api/_generated/token_cost/types/__init__.py +0 -8
  265. mirascope/api/_generated/token_cost/types/token_cost_calculate_request_usage.py +0 -54
  266. mirascope/api/_generated/token_cost/types/token_cost_calculate_response.py +0 -52
  267. mirascope/api/_generated/traces/__init__.py +0 -97
  268. mirascope/api/_generated/traces/client.py +0 -1103
  269. mirascope/api/_generated/traces/raw_client.py +0 -2322
  270. mirascope/api/_generated/traces/types/__init__.py +0 -155
  271. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item.py +0 -29
  272. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource.py +0 -27
  273. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item.py +0 -23
  274. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value.py +0 -38
  275. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value_array_value.py +0 -19
  276. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value_kvlist_value.py +0 -22
  277. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value_kvlist_value_values_item.py +0 -20
  278. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item.py +0 -29
  279. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope.py +0 -31
  280. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item.py +0 -23
  281. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value.py +0 -38
  282. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value_array_value.py +0 -19
  283. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value_kvlist_value.py +0 -22
  284. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value_kvlist_value_values_item.py +0 -22
  285. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item.py +0 -48
  286. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item.py +0 -23
  287. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value.py +0 -38
  288. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value_array_value.py +0 -19
  289. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value_kvlist_value.py +0 -24
  290. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value_kvlist_value_values_item.py +0 -22
  291. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_status.py +0 -20
  292. mirascope/api/_generated/traces/types/traces_create_response.py +0 -24
  293. mirascope/api/_generated/traces/types/traces_create_response_partial_success.py +0 -22
  294. mirascope/api/_generated/traces/types/traces_get_analytics_summary_response.py +0 -60
  295. mirascope/api/_generated/traces/types/traces_get_analytics_summary_response_top_functions_item.py +0 -24
  296. mirascope/api/_generated/traces/types/traces_get_analytics_summary_response_top_models_item.py +0 -22
  297. mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response.py +0 -33
  298. mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response_spans_item.py +0 -88
  299. mirascope/api/_generated/traces/types/traces_get_trace_detail_response.py +0 -33
  300. mirascope/api/_generated/traces/types/traces_get_trace_detail_response_spans_item.py +0 -88
  301. mirascope/api/_generated/traces/types/traces_list_by_function_hash_response.py +0 -25
  302. mirascope/api/_generated/traces/types/traces_list_by_function_hash_response_traces_item.py +0 -44
  303. mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item.py +0 -26
  304. mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item_operator.py +0 -7
  305. mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_by.py +0 -7
  306. mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_order.py +0 -7
  307. mirascope/api/_generated/traces/types/traces_search_by_env_response.py +0 -26
  308. mirascope/api/_generated/traces/types/traces_search_by_env_response_spans_item.py +0 -50
  309. mirascope/api/_generated/traces/types/traces_search_request_attribute_filters_item.py +0 -26
  310. mirascope/api/_generated/traces/types/traces_search_request_attribute_filters_item_operator.py +0 -7
  311. mirascope/api/_generated/traces/types/traces_search_request_sort_by.py +0 -7
  312. mirascope/api/_generated/traces/types/traces_search_request_sort_order.py +0 -5
  313. mirascope/api/_generated/traces/types/traces_search_response.py +0 -26
  314. mirascope/api/_generated/traces/types/traces_search_response_spans_item.py +0 -50
  315. mirascope/api/_generated/types/__init__.py +0 -85
  316. mirascope/api/_generated/types/already_exists_error.py +0 -22
  317. mirascope/api/_generated/types/already_exists_error_tag.py +0 -5
  318. mirascope/api/_generated/types/bad_request_error_body.py +0 -50
  319. mirascope/api/_generated/types/click_house_error.py +0 -22
  320. mirascope/api/_generated/types/database_error.py +0 -22
  321. mirascope/api/_generated/types/database_error_tag.py +0 -5
  322. mirascope/api/_generated/types/date.py +0 -3
  323. mirascope/api/_generated/types/http_api_decode_error.py +0 -27
  324. mirascope/api/_generated/types/http_api_decode_error_tag.py +0 -5
  325. mirascope/api/_generated/types/immutable_resource_error.py +0 -22
  326. mirascope/api/_generated/types/internal_server_error_body.py +0 -49
  327. mirascope/api/_generated/types/issue.py +0 -38
  328. mirascope/api/_generated/types/issue_tag.py +0 -10
  329. mirascope/api/_generated/types/not_found_error_body.py +0 -22
  330. mirascope/api/_generated/types/not_found_error_tag.py +0 -5
  331. mirascope/api/_generated/types/number_from_string.py +0 -3
  332. mirascope/api/_generated/types/permission_denied_error.py +0 -22
  333. mirascope/api/_generated/types/permission_denied_error_tag.py +0 -5
  334. mirascope/api/_generated/types/plan_limit_exceeded_error.py +0 -32
  335. mirascope/api/_generated/types/plan_limit_exceeded_error_tag.py +0 -7
  336. mirascope/api/_generated/types/pricing_unavailable_error.py +0 -23
  337. mirascope/api/_generated/types/property_key.py +0 -7
  338. mirascope/api/_generated/types/property_key_key.py +0 -25
  339. mirascope/api/_generated/types/property_key_key_tag.py +0 -5
  340. mirascope/api/_generated/types/rate_limit_error.py +0 -31
  341. mirascope/api/_generated/types/rate_limit_error_tag.py +0 -5
  342. mirascope/api/_generated/types/service_unavailable_error_body.py +0 -24
  343. mirascope/api/_generated/types/service_unavailable_error_tag.py +0 -7
  344. mirascope/api/_generated/types/stripe_error.py +0 -20
  345. mirascope/api/_generated/types/subscription_past_due_error.py +0 -31
  346. mirascope/api/_generated/types/subscription_past_due_error_tag.py +0 -7
  347. mirascope/api/_generated/types/unauthorized_error_body.py +0 -21
  348. mirascope/api/_generated/types/unauthorized_error_tag.py +0 -5
  349. mirascope/api/client.py +0 -255
  350. mirascope/api/settings.py +0 -99
  351. mirascope/llm/formatting/output_parser.py +0 -178
  352. mirascope/llm/formatting/primitives.py +0 -192
  353. mirascope/llm/mcp/mcp_client.py +0 -130
  354. mirascope/llm/messages/_utils.py +0 -34
  355. mirascope/llm/models/thinking_config.py +0 -61
  356. mirascope/llm/prompts/prompts.py +0 -487
  357. mirascope/llm/providers/__init__.py +0 -62
  358. mirascope/llm/providers/anthropic/__init__.py +0 -11
  359. mirascope/llm/providers/anthropic/_utils/__init__.py +0 -27
  360. mirascope/llm/providers/anthropic/_utils/beta_decode.py +0 -282
  361. mirascope/llm/providers/anthropic/_utils/beta_encode.py +0 -266
  362. mirascope/llm/providers/anthropic/_utils/encode.py +0 -418
  363. mirascope/llm/providers/anthropic/_utils/errors.py +0 -46
  364. mirascope/llm/providers/anthropic/beta_provider.py +0 -374
  365. mirascope/llm/providers/anthropic/model_id.py +0 -23
  366. mirascope/llm/providers/anthropic/model_info.py +0 -87
  367. mirascope/llm/providers/anthropic/provider.py +0 -479
  368. mirascope/llm/providers/google/__init__.py +0 -6
  369. mirascope/llm/providers/google/_utils/errors.py +0 -50
  370. mirascope/llm/providers/google/model_id.py +0 -22
  371. mirascope/llm/providers/google/model_info.py +0 -63
  372. mirascope/llm/providers/google/provider.py +0 -492
  373. mirascope/llm/providers/mirascope/__init__.py +0 -5
  374. mirascope/llm/providers/mirascope/_utils.py +0 -73
  375. mirascope/llm/providers/mirascope/provider.py +0 -349
  376. mirascope/llm/providers/mlx/__init__.py +0 -9
  377. mirascope/llm/providers/mlx/_utils.py +0 -141
  378. mirascope/llm/providers/mlx/encoding/__init__.py +0 -8
  379. mirascope/llm/providers/mlx/encoding/base.py +0 -72
  380. mirascope/llm/providers/mlx/encoding/transformers.py +0 -150
  381. mirascope/llm/providers/mlx/mlx.py +0 -254
  382. mirascope/llm/providers/mlx/model_id.py +0 -17
  383. mirascope/llm/providers/mlx/provider.py +0 -452
  384. mirascope/llm/providers/model_id.py +0 -16
  385. mirascope/llm/providers/ollama/__init__.py +0 -7
  386. mirascope/llm/providers/ollama/provider.py +0 -71
  387. mirascope/llm/providers/openai/__init__.py +0 -15
  388. mirascope/llm/providers/openai/_utils/__init__.py +0 -5
  389. mirascope/llm/providers/openai/_utils/errors.py +0 -46
  390. mirascope/llm/providers/openai/completions/__init__.py +0 -7
  391. mirascope/llm/providers/openai/completions/base_provider.py +0 -542
  392. mirascope/llm/providers/openai/completions/provider.py +0 -22
  393. mirascope/llm/providers/openai/model_id.py +0 -31
  394. mirascope/llm/providers/openai/model_info.py +0 -303
  395. mirascope/llm/providers/openai/provider.py +0 -441
  396. mirascope/llm/providers/openai/responses/__init__.py +0 -5
  397. mirascope/llm/providers/openai/responses/provider.py +0 -513
  398. mirascope/llm/providers/provider_id.py +0 -24
  399. mirascope/llm/providers/provider_registry.py +0 -299
  400. mirascope/llm/providers/together/__init__.py +0 -7
  401. mirascope/llm/providers/together/provider.py +0 -40
  402. mirascope/llm/responses/usage.py +0 -95
  403. mirascope/ops/__init__.py +0 -111
  404. mirascope/ops/_internal/__init__.py +0 -5
  405. mirascope/ops/_internal/closure.py +0 -1169
  406. mirascope/ops/_internal/configuration.py +0 -177
  407. mirascope/ops/_internal/context.py +0 -76
  408. mirascope/ops/_internal/exporters/__init__.py +0 -26
  409. mirascope/ops/_internal/exporters/exporters.py +0 -395
  410. mirascope/ops/_internal/exporters/processors.py +0 -104
  411. mirascope/ops/_internal/exporters/types.py +0 -165
  412. mirascope/ops/_internal/exporters/utils.py +0 -29
  413. mirascope/ops/_internal/instrumentation/__init__.py +0 -8
  414. mirascope/ops/_internal/instrumentation/llm/__init__.py +0 -8
  415. mirascope/ops/_internal/instrumentation/llm/common.py +0 -530
  416. mirascope/ops/_internal/instrumentation/llm/cost.py +0 -190
  417. mirascope/ops/_internal/instrumentation/llm/encode.py +0 -238
  418. mirascope/ops/_internal/instrumentation/llm/gen_ai_types/__init__.py +0 -38
  419. mirascope/ops/_internal/instrumentation/llm/gen_ai_types/gen_ai_input_messages.py +0 -31
  420. mirascope/ops/_internal/instrumentation/llm/gen_ai_types/gen_ai_output_messages.py +0 -38
  421. mirascope/ops/_internal/instrumentation/llm/gen_ai_types/gen_ai_system_instructions.py +0 -18
  422. mirascope/ops/_internal/instrumentation/llm/gen_ai_types/shared.py +0 -100
  423. mirascope/ops/_internal/instrumentation/llm/llm.py +0 -161
  424. mirascope/ops/_internal/instrumentation/llm/model.py +0 -1798
  425. mirascope/ops/_internal/instrumentation/llm/response.py +0 -521
  426. mirascope/ops/_internal/instrumentation/llm/serialize.py +0 -300
  427. mirascope/ops/_internal/propagation.py +0 -198
  428. mirascope/ops/_internal/protocols.py +0 -133
  429. mirascope/ops/_internal/session.py +0 -139
  430. mirascope/ops/_internal/spans.py +0 -232
  431. mirascope/ops/_internal/traced_calls.py +0 -375
  432. mirascope/ops/_internal/traced_functions.py +0 -523
  433. mirascope/ops/_internal/tracing.py +0 -353
  434. mirascope/ops/_internal/types.py +0 -13
  435. mirascope/ops/_internal/utils.py +0 -123
  436. mirascope/ops/_internal/versioned_calls.py +0 -512
  437. mirascope/ops/_internal/versioned_functions.py +0 -357
  438. mirascope/ops/_internal/versioning.py +0 -303
  439. mirascope/ops/exceptions.py +0 -21
  440. mirascope-2.0.0.dist-info/RECORD +0 -423
  441. /mirascope/llm/{providers → clients}/base/kwargs.py +0 -0
  442. /mirascope/llm/{providers → clients}/google/message.py +0 -0
@@ -1,1288 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
- from json.decoder import JSONDecodeError
5
-
6
- from ..core.api_error import ApiError
7
- from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
- from ..core.http_response import AsyncHttpResponse, HttpResponse
9
- from ..core.jsonable_encoder import jsonable_encoder
10
- from ..core.pydantic_utilities import parse_obj_as
11
- from ..core.request_options import RequestOptions
12
- from ..errors.bad_request_error import BadRequestError
13
- from ..errors.conflict_error import ConflictError
14
- from ..errors.forbidden_error import ForbiddenError
15
- from ..errors.internal_server_error import InternalServerError
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
19
- from ..types.not_found_error_body import NotFoundErrorBody
20
- from ..types.permission_denied_error import PermissionDeniedError
21
- from ..types.rate_limit_error import RateLimitError
22
- from .types.tags_create_response import TagsCreateResponse
23
- from .types.tags_get_response import TagsGetResponse
24
- from .types.tags_list_response import TagsListResponse
25
- from .types.tags_update_response import TagsUpdateResponse
26
-
27
- # this is used as the default value for optional parameters
28
- OMIT = typing.cast(typing.Any, ...)
29
-
30
-
31
- class RawTagsClient:
32
- def __init__(self, *, client_wrapper: SyncClientWrapper):
33
- self._client_wrapper = client_wrapper
34
-
35
- def list(
36
- self,
37
- organization_id: str,
38
- project_id: str,
39
- *,
40
- request_options: typing.Optional[RequestOptions] = None,
41
- ) -> HttpResponse[TagsListResponse]:
42
- """
43
- Parameters
44
- ----------
45
- organization_id : str
46
-
47
- project_id : str
48
-
49
- request_options : typing.Optional[RequestOptions]
50
- Request-specific configuration.
51
-
52
- Returns
53
- -------
54
- HttpResponse[TagsListResponse]
55
- Success
56
- """
57
- _response = self._client_wrapper.httpx_client.request(
58
- f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/tags",
59
- method="GET",
60
- request_options=request_options,
61
- )
62
- try:
63
- if 200 <= _response.status_code < 300:
64
- _data = typing.cast(
65
- TagsListResponse,
66
- parse_obj_as(
67
- type_=TagsListResponse, # type: ignore
68
- object_=_response.json(),
69
- ),
70
- )
71
- return HttpResponse(response=_response, data=_data)
72
- if _response.status_code == 400:
73
- raise BadRequestError(
74
- headers=dict(_response.headers),
75
- body=typing.cast(
76
- typing.Optional[typing.Any],
77
- parse_obj_as(
78
- type_=typing.Optional[typing.Any], # type: ignore
79
- object_=_response.json(),
80
- ),
81
- ),
82
- )
83
- if _response.status_code == 403:
84
- raise ForbiddenError(
85
- headers=dict(_response.headers),
86
- body=typing.cast(
87
- PermissionDeniedError,
88
- parse_obj_as(
89
- type_=PermissionDeniedError, # type: ignore
90
- object_=_response.json(),
91
- ),
92
- ),
93
- )
94
- if _response.status_code == 404:
95
- raise NotFoundError(
96
- headers=dict(_response.headers),
97
- body=typing.cast(
98
- NotFoundErrorBody,
99
- parse_obj_as(
100
- type_=NotFoundErrorBody, # type: ignore
101
- object_=_response.json(),
102
- ),
103
- ),
104
- )
105
- if _response.status_code == 429:
106
- raise TooManyRequestsError(
107
- headers=dict(_response.headers),
108
- body=typing.cast(
109
- RateLimitError,
110
- parse_obj_as(
111
- type_=RateLimitError, # type: ignore
112
- object_=_response.json(),
113
- ),
114
- ),
115
- )
116
- if _response.status_code == 500:
117
- raise InternalServerError(
118
- headers=dict(_response.headers),
119
- body=typing.cast(
120
- typing.Optional[typing.Any],
121
- parse_obj_as(
122
- type_=typing.Optional[typing.Any], # type: ignore
123
- object_=_response.json(),
124
- ),
125
- ),
126
- )
127
- if _response.status_code == 503:
128
- raise ServiceUnavailableError(
129
- headers=dict(_response.headers),
130
- body=typing.cast(
131
- typing.Optional[typing.Any],
132
- parse_obj_as(
133
- type_=typing.Optional[typing.Any], # type: ignore
134
- object_=_response.json(),
135
- ),
136
- ),
137
- )
138
- _response_json = _response.json()
139
- except JSONDecodeError:
140
- raise ApiError(
141
- status_code=_response.status_code,
142
- headers=dict(_response.headers),
143
- body=_response.text,
144
- )
145
- raise ApiError(
146
- status_code=_response.status_code,
147
- headers=dict(_response.headers),
148
- body=_response_json,
149
- )
150
-
151
- def create(
152
- self,
153
- organization_id: str,
154
- project_id: str,
155
- *,
156
- name: str,
157
- request_options: typing.Optional[RequestOptions] = None,
158
- ) -> HttpResponse[TagsCreateResponse]:
159
- """
160
- Parameters
161
- ----------
162
- organization_id : str
163
-
164
- project_id : str
165
-
166
- name : str
167
- a string at most 100 character(s) long
168
-
169
- request_options : typing.Optional[RequestOptions]
170
- Request-specific configuration.
171
-
172
- Returns
173
- -------
174
- HttpResponse[TagsCreateResponse]
175
- Success
176
- """
177
- _response = self._client_wrapper.httpx_client.request(
178
- f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/tags",
179
- method="POST",
180
- json={
181
- "name": name,
182
- },
183
- headers={
184
- "content-type": "application/json",
185
- },
186
- request_options=request_options,
187
- omit=OMIT,
188
- )
189
- try:
190
- if 200 <= _response.status_code < 300:
191
- _data = typing.cast(
192
- TagsCreateResponse,
193
- parse_obj_as(
194
- type_=TagsCreateResponse, # type: ignore
195
- object_=_response.json(),
196
- ),
197
- )
198
- return HttpResponse(response=_response, data=_data)
199
- if _response.status_code == 400:
200
- raise BadRequestError(
201
- headers=dict(_response.headers),
202
- body=typing.cast(
203
- typing.Optional[typing.Any],
204
- parse_obj_as(
205
- type_=typing.Optional[typing.Any], # type: ignore
206
- object_=_response.json(),
207
- ),
208
- ),
209
- )
210
- if _response.status_code == 403:
211
- raise ForbiddenError(
212
- headers=dict(_response.headers),
213
- body=typing.cast(
214
- PermissionDeniedError,
215
- parse_obj_as(
216
- type_=PermissionDeniedError, # type: ignore
217
- object_=_response.json(),
218
- ),
219
- ),
220
- )
221
- if _response.status_code == 404:
222
- raise NotFoundError(
223
- headers=dict(_response.headers),
224
- body=typing.cast(
225
- NotFoundErrorBody,
226
- parse_obj_as(
227
- type_=NotFoundErrorBody, # type: ignore
228
- object_=_response.json(),
229
- ),
230
- ),
231
- )
232
- if _response.status_code == 409:
233
- raise ConflictError(
234
- headers=dict(_response.headers),
235
- body=typing.cast(
236
- typing.Optional[typing.Any],
237
- parse_obj_as(
238
- type_=typing.Optional[typing.Any], # type: ignore
239
- object_=_response.json(),
240
- ),
241
- ),
242
- )
243
- if _response.status_code == 429:
244
- raise TooManyRequestsError(
245
- headers=dict(_response.headers),
246
- body=typing.cast(
247
- RateLimitError,
248
- parse_obj_as(
249
- type_=RateLimitError, # type: ignore
250
- object_=_response.json(),
251
- ),
252
- ),
253
- )
254
- if _response.status_code == 500:
255
- raise InternalServerError(
256
- headers=dict(_response.headers),
257
- body=typing.cast(
258
- typing.Optional[typing.Any],
259
- parse_obj_as(
260
- type_=typing.Optional[typing.Any], # type: ignore
261
- object_=_response.json(),
262
- ),
263
- ),
264
- )
265
- if _response.status_code == 503:
266
- raise ServiceUnavailableError(
267
- headers=dict(_response.headers),
268
- body=typing.cast(
269
- typing.Optional[typing.Any],
270
- parse_obj_as(
271
- type_=typing.Optional[typing.Any], # type: ignore
272
- object_=_response.json(),
273
- ),
274
- ),
275
- )
276
- _response_json = _response.json()
277
- except JSONDecodeError:
278
- raise ApiError(
279
- status_code=_response.status_code,
280
- headers=dict(_response.headers),
281
- body=_response.text,
282
- )
283
- raise ApiError(
284
- status_code=_response.status_code,
285
- headers=dict(_response.headers),
286
- body=_response_json,
287
- )
288
-
289
- def get(
290
- self,
291
- organization_id: str,
292
- project_id: str,
293
- tag_id: str,
294
- *,
295
- request_options: typing.Optional[RequestOptions] = None,
296
- ) -> HttpResponse[TagsGetResponse]:
297
- """
298
- Parameters
299
- ----------
300
- organization_id : str
301
-
302
- project_id : str
303
-
304
- tag_id : str
305
-
306
- request_options : typing.Optional[RequestOptions]
307
- Request-specific configuration.
308
-
309
- Returns
310
- -------
311
- HttpResponse[TagsGetResponse]
312
- Success
313
- """
314
- _response = self._client_wrapper.httpx_client.request(
315
- f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/tags/{jsonable_encoder(tag_id)}",
316
- method="GET",
317
- request_options=request_options,
318
- )
319
- try:
320
- if 200 <= _response.status_code < 300:
321
- _data = typing.cast(
322
- TagsGetResponse,
323
- parse_obj_as(
324
- type_=TagsGetResponse, # type: ignore
325
- object_=_response.json(),
326
- ),
327
- )
328
- return HttpResponse(response=_response, data=_data)
329
- if _response.status_code == 400:
330
- raise BadRequestError(
331
- headers=dict(_response.headers),
332
- body=typing.cast(
333
- typing.Optional[typing.Any],
334
- parse_obj_as(
335
- type_=typing.Optional[typing.Any], # type: ignore
336
- object_=_response.json(),
337
- ),
338
- ),
339
- )
340
- if _response.status_code == 403:
341
- raise ForbiddenError(
342
- headers=dict(_response.headers),
343
- body=typing.cast(
344
- PermissionDeniedError,
345
- parse_obj_as(
346
- type_=PermissionDeniedError, # type: ignore
347
- object_=_response.json(),
348
- ),
349
- ),
350
- )
351
- if _response.status_code == 404:
352
- raise NotFoundError(
353
- headers=dict(_response.headers),
354
- body=typing.cast(
355
- NotFoundErrorBody,
356
- parse_obj_as(
357
- type_=NotFoundErrorBody, # type: ignore
358
- object_=_response.json(),
359
- ),
360
- ),
361
- )
362
- if _response.status_code == 429:
363
- raise TooManyRequestsError(
364
- headers=dict(_response.headers),
365
- body=typing.cast(
366
- RateLimitError,
367
- parse_obj_as(
368
- type_=RateLimitError, # type: ignore
369
- object_=_response.json(),
370
- ),
371
- ),
372
- )
373
- if _response.status_code == 500:
374
- raise InternalServerError(
375
- headers=dict(_response.headers),
376
- body=typing.cast(
377
- typing.Optional[typing.Any],
378
- parse_obj_as(
379
- type_=typing.Optional[typing.Any], # type: ignore
380
- object_=_response.json(),
381
- ),
382
- ),
383
- )
384
- if _response.status_code == 503:
385
- raise ServiceUnavailableError(
386
- headers=dict(_response.headers),
387
- body=typing.cast(
388
- typing.Optional[typing.Any],
389
- parse_obj_as(
390
- type_=typing.Optional[typing.Any], # type: ignore
391
- object_=_response.json(),
392
- ),
393
- ),
394
- )
395
- _response_json = _response.json()
396
- except JSONDecodeError:
397
- raise ApiError(
398
- status_code=_response.status_code,
399
- headers=dict(_response.headers),
400
- body=_response.text,
401
- )
402
- raise ApiError(
403
- status_code=_response.status_code,
404
- headers=dict(_response.headers),
405
- body=_response_json,
406
- )
407
-
408
- def update(
409
- self,
410
- organization_id: str,
411
- project_id: str,
412
- tag_id: str,
413
- *,
414
- name: typing.Optional[str] = OMIT,
415
- request_options: typing.Optional[RequestOptions] = None,
416
- ) -> HttpResponse[TagsUpdateResponse]:
417
- """
418
- Parameters
419
- ----------
420
- organization_id : str
421
-
422
- project_id : str
423
-
424
- tag_id : str
425
-
426
- name : typing.Optional[str]
427
- a string at most 100 character(s) long
428
-
429
- request_options : typing.Optional[RequestOptions]
430
- Request-specific configuration.
431
-
432
- Returns
433
- -------
434
- HttpResponse[TagsUpdateResponse]
435
- Success
436
- """
437
- _response = self._client_wrapper.httpx_client.request(
438
- f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/tags/{jsonable_encoder(tag_id)}",
439
- method="PUT",
440
- json={
441
- "name": name,
442
- },
443
- headers={
444
- "content-type": "application/json",
445
- },
446
- request_options=request_options,
447
- omit=OMIT,
448
- )
449
- try:
450
- if 200 <= _response.status_code < 300:
451
- _data = typing.cast(
452
- TagsUpdateResponse,
453
- parse_obj_as(
454
- type_=TagsUpdateResponse, # type: ignore
455
- object_=_response.json(),
456
- ),
457
- )
458
- return HttpResponse(response=_response, data=_data)
459
- if _response.status_code == 400:
460
- raise BadRequestError(
461
- headers=dict(_response.headers),
462
- body=typing.cast(
463
- typing.Optional[typing.Any],
464
- parse_obj_as(
465
- type_=typing.Optional[typing.Any], # type: ignore
466
- object_=_response.json(),
467
- ),
468
- ),
469
- )
470
- if _response.status_code == 403:
471
- raise ForbiddenError(
472
- headers=dict(_response.headers),
473
- body=typing.cast(
474
- PermissionDeniedError,
475
- parse_obj_as(
476
- type_=PermissionDeniedError, # type: ignore
477
- object_=_response.json(),
478
- ),
479
- ),
480
- )
481
- if _response.status_code == 404:
482
- raise NotFoundError(
483
- headers=dict(_response.headers),
484
- body=typing.cast(
485
- NotFoundErrorBody,
486
- parse_obj_as(
487
- type_=NotFoundErrorBody, # type: ignore
488
- object_=_response.json(),
489
- ),
490
- ),
491
- )
492
- if _response.status_code == 409:
493
- raise ConflictError(
494
- headers=dict(_response.headers),
495
- body=typing.cast(
496
- typing.Optional[typing.Any],
497
- parse_obj_as(
498
- type_=typing.Optional[typing.Any], # type: ignore
499
- object_=_response.json(),
500
- ),
501
- ),
502
- )
503
- if _response.status_code == 429:
504
- raise TooManyRequestsError(
505
- headers=dict(_response.headers),
506
- body=typing.cast(
507
- RateLimitError,
508
- parse_obj_as(
509
- type_=RateLimitError, # type: ignore
510
- object_=_response.json(),
511
- ),
512
- ),
513
- )
514
- if _response.status_code == 500:
515
- raise InternalServerError(
516
- headers=dict(_response.headers),
517
- body=typing.cast(
518
- typing.Optional[typing.Any],
519
- parse_obj_as(
520
- type_=typing.Optional[typing.Any], # type: ignore
521
- object_=_response.json(),
522
- ),
523
- ),
524
- )
525
- if _response.status_code == 503:
526
- raise ServiceUnavailableError(
527
- headers=dict(_response.headers),
528
- body=typing.cast(
529
- typing.Optional[typing.Any],
530
- parse_obj_as(
531
- type_=typing.Optional[typing.Any], # type: ignore
532
- object_=_response.json(),
533
- ),
534
- ),
535
- )
536
- _response_json = _response.json()
537
- except JSONDecodeError:
538
- raise ApiError(
539
- status_code=_response.status_code,
540
- headers=dict(_response.headers),
541
- body=_response.text,
542
- )
543
- raise ApiError(
544
- status_code=_response.status_code,
545
- headers=dict(_response.headers),
546
- body=_response_json,
547
- )
548
-
549
- def delete(
550
- self,
551
- organization_id: str,
552
- project_id: str,
553
- tag_id: str,
554
- *,
555
- request_options: typing.Optional[RequestOptions] = None,
556
- ) -> HttpResponse[None]:
557
- """
558
- Parameters
559
- ----------
560
- organization_id : str
561
-
562
- project_id : str
563
-
564
- tag_id : str
565
-
566
- request_options : typing.Optional[RequestOptions]
567
- Request-specific configuration.
568
-
569
- Returns
570
- -------
571
- HttpResponse[None]
572
- """
573
- _response = self._client_wrapper.httpx_client.request(
574
- f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/tags/{jsonable_encoder(tag_id)}",
575
- method="DELETE",
576
- request_options=request_options,
577
- )
578
- try:
579
- if 200 <= _response.status_code < 300:
580
- return HttpResponse(response=_response, data=None)
581
- if _response.status_code == 400:
582
- raise BadRequestError(
583
- headers=dict(_response.headers),
584
- body=typing.cast(
585
- typing.Optional[typing.Any],
586
- parse_obj_as(
587
- type_=typing.Optional[typing.Any], # type: ignore
588
- object_=_response.json(),
589
- ),
590
- ),
591
- )
592
- if _response.status_code == 403:
593
- raise ForbiddenError(
594
- headers=dict(_response.headers),
595
- body=typing.cast(
596
- PermissionDeniedError,
597
- parse_obj_as(
598
- type_=PermissionDeniedError, # type: ignore
599
- object_=_response.json(),
600
- ),
601
- ),
602
- )
603
- if _response.status_code == 404:
604
- raise NotFoundError(
605
- headers=dict(_response.headers),
606
- body=typing.cast(
607
- NotFoundErrorBody,
608
- parse_obj_as(
609
- type_=NotFoundErrorBody, # type: ignore
610
- object_=_response.json(),
611
- ),
612
- ),
613
- )
614
- if _response.status_code == 429:
615
- raise TooManyRequestsError(
616
- headers=dict(_response.headers),
617
- body=typing.cast(
618
- RateLimitError,
619
- parse_obj_as(
620
- type_=RateLimitError, # type: ignore
621
- object_=_response.json(),
622
- ),
623
- ),
624
- )
625
- if _response.status_code == 500:
626
- raise InternalServerError(
627
- headers=dict(_response.headers),
628
- body=typing.cast(
629
- typing.Optional[typing.Any],
630
- parse_obj_as(
631
- type_=typing.Optional[typing.Any], # type: ignore
632
- object_=_response.json(),
633
- ),
634
- ),
635
- )
636
- if _response.status_code == 503:
637
- raise ServiceUnavailableError(
638
- headers=dict(_response.headers),
639
- body=typing.cast(
640
- typing.Optional[typing.Any],
641
- parse_obj_as(
642
- type_=typing.Optional[typing.Any], # type: ignore
643
- object_=_response.json(),
644
- ),
645
- ),
646
- )
647
- _response_json = _response.json()
648
- except JSONDecodeError:
649
- raise ApiError(
650
- status_code=_response.status_code,
651
- headers=dict(_response.headers),
652
- body=_response.text,
653
- )
654
- raise ApiError(
655
- status_code=_response.status_code,
656
- headers=dict(_response.headers),
657
- body=_response_json,
658
- )
659
-
660
-
661
- class AsyncRawTagsClient:
662
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
663
- self._client_wrapper = client_wrapper
664
-
665
- async def list(
666
- self,
667
- organization_id: str,
668
- project_id: str,
669
- *,
670
- request_options: typing.Optional[RequestOptions] = None,
671
- ) -> AsyncHttpResponse[TagsListResponse]:
672
- """
673
- Parameters
674
- ----------
675
- organization_id : str
676
-
677
- project_id : str
678
-
679
- request_options : typing.Optional[RequestOptions]
680
- Request-specific configuration.
681
-
682
- Returns
683
- -------
684
- AsyncHttpResponse[TagsListResponse]
685
- Success
686
- """
687
- _response = await self._client_wrapper.httpx_client.request(
688
- f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/tags",
689
- method="GET",
690
- request_options=request_options,
691
- )
692
- try:
693
- if 200 <= _response.status_code < 300:
694
- _data = typing.cast(
695
- TagsListResponse,
696
- parse_obj_as(
697
- type_=TagsListResponse, # type: ignore
698
- object_=_response.json(),
699
- ),
700
- )
701
- return AsyncHttpResponse(response=_response, data=_data)
702
- if _response.status_code == 400:
703
- raise BadRequestError(
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
- )
713
- if _response.status_code == 403:
714
- raise ForbiddenError(
715
- headers=dict(_response.headers),
716
- body=typing.cast(
717
- PermissionDeniedError,
718
- parse_obj_as(
719
- type_=PermissionDeniedError, # type: ignore
720
- object_=_response.json(),
721
- ),
722
- ),
723
- )
724
- if _response.status_code == 404:
725
- raise NotFoundError(
726
- headers=dict(_response.headers),
727
- body=typing.cast(
728
- NotFoundErrorBody,
729
- parse_obj_as(
730
- type_=NotFoundErrorBody, # type: ignore
731
- object_=_response.json(),
732
- ),
733
- ),
734
- )
735
- if _response.status_code == 429:
736
- raise TooManyRequestsError(
737
- headers=dict(_response.headers),
738
- body=typing.cast(
739
- RateLimitError,
740
- parse_obj_as(
741
- type_=RateLimitError, # type: ignore
742
- object_=_response.json(),
743
- ),
744
- ),
745
- )
746
- if _response.status_code == 500:
747
- raise InternalServerError(
748
- headers=dict(_response.headers),
749
- body=typing.cast(
750
- typing.Optional[typing.Any],
751
- parse_obj_as(
752
- type_=typing.Optional[typing.Any], # type: ignore
753
- object_=_response.json(),
754
- ),
755
- ),
756
- )
757
- if _response.status_code == 503:
758
- raise ServiceUnavailableError(
759
- headers=dict(_response.headers),
760
- body=typing.cast(
761
- typing.Optional[typing.Any],
762
- parse_obj_as(
763
- type_=typing.Optional[typing.Any], # type: ignore
764
- object_=_response.json(),
765
- ),
766
- ),
767
- )
768
- _response_json = _response.json()
769
- except JSONDecodeError:
770
- raise ApiError(
771
- status_code=_response.status_code,
772
- headers=dict(_response.headers),
773
- body=_response.text,
774
- )
775
- raise ApiError(
776
- status_code=_response.status_code,
777
- headers=dict(_response.headers),
778
- body=_response_json,
779
- )
780
-
781
- async def create(
782
- self,
783
- organization_id: str,
784
- project_id: str,
785
- *,
786
- name: str,
787
- request_options: typing.Optional[RequestOptions] = None,
788
- ) -> AsyncHttpResponse[TagsCreateResponse]:
789
- """
790
- Parameters
791
- ----------
792
- organization_id : str
793
-
794
- project_id : str
795
-
796
- name : str
797
- a string at most 100 character(s) long
798
-
799
- request_options : typing.Optional[RequestOptions]
800
- Request-specific configuration.
801
-
802
- Returns
803
- -------
804
- AsyncHttpResponse[TagsCreateResponse]
805
- Success
806
- """
807
- _response = await self._client_wrapper.httpx_client.request(
808
- f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/tags",
809
- method="POST",
810
- json={
811
- "name": name,
812
- },
813
- headers={
814
- "content-type": "application/json",
815
- },
816
- request_options=request_options,
817
- omit=OMIT,
818
- )
819
- try:
820
- if 200 <= _response.status_code < 300:
821
- _data = typing.cast(
822
- TagsCreateResponse,
823
- parse_obj_as(
824
- type_=TagsCreateResponse, # type: ignore
825
- object_=_response.json(),
826
- ),
827
- )
828
- return AsyncHttpResponse(response=_response, data=_data)
829
- if _response.status_code == 400:
830
- raise BadRequestError(
831
- headers=dict(_response.headers),
832
- body=typing.cast(
833
- typing.Optional[typing.Any],
834
- parse_obj_as(
835
- type_=typing.Optional[typing.Any], # type: ignore
836
- object_=_response.json(),
837
- ),
838
- ),
839
- )
840
- if _response.status_code == 403:
841
- raise ForbiddenError(
842
- headers=dict(_response.headers),
843
- body=typing.cast(
844
- PermissionDeniedError,
845
- parse_obj_as(
846
- type_=PermissionDeniedError, # type: ignore
847
- object_=_response.json(),
848
- ),
849
- ),
850
- )
851
- if _response.status_code == 404:
852
- raise NotFoundError(
853
- headers=dict(_response.headers),
854
- body=typing.cast(
855
- NotFoundErrorBody,
856
- parse_obj_as(
857
- type_=NotFoundErrorBody, # type: ignore
858
- object_=_response.json(),
859
- ),
860
- ),
861
- )
862
- if _response.status_code == 409:
863
- raise ConflictError(
864
- headers=dict(_response.headers),
865
- body=typing.cast(
866
- typing.Optional[typing.Any],
867
- parse_obj_as(
868
- type_=typing.Optional[typing.Any], # type: ignore
869
- object_=_response.json(),
870
- ),
871
- ),
872
- )
873
- if _response.status_code == 429:
874
- raise TooManyRequestsError(
875
- headers=dict(_response.headers),
876
- body=typing.cast(
877
- RateLimitError,
878
- parse_obj_as(
879
- type_=RateLimitError, # type: ignore
880
- object_=_response.json(),
881
- ),
882
- ),
883
- )
884
- if _response.status_code == 500:
885
- raise InternalServerError(
886
- headers=dict(_response.headers),
887
- body=typing.cast(
888
- typing.Optional[typing.Any],
889
- parse_obj_as(
890
- type_=typing.Optional[typing.Any], # type: ignore
891
- object_=_response.json(),
892
- ),
893
- ),
894
- )
895
- if _response.status_code == 503:
896
- raise ServiceUnavailableError(
897
- headers=dict(_response.headers),
898
- body=typing.cast(
899
- typing.Optional[typing.Any],
900
- parse_obj_as(
901
- type_=typing.Optional[typing.Any], # type: ignore
902
- object_=_response.json(),
903
- ),
904
- ),
905
- )
906
- _response_json = _response.json()
907
- except JSONDecodeError:
908
- raise ApiError(
909
- status_code=_response.status_code,
910
- headers=dict(_response.headers),
911
- body=_response.text,
912
- )
913
- raise ApiError(
914
- status_code=_response.status_code,
915
- headers=dict(_response.headers),
916
- body=_response_json,
917
- )
918
-
919
- async def get(
920
- self,
921
- organization_id: str,
922
- project_id: str,
923
- tag_id: str,
924
- *,
925
- request_options: typing.Optional[RequestOptions] = None,
926
- ) -> AsyncHttpResponse[TagsGetResponse]:
927
- """
928
- Parameters
929
- ----------
930
- organization_id : str
931
-
932
- project_id : str
933
-
934
- tag_id : str
935
-
936
- request_options : typing.Optional[RequestOptions]
937
- Request-specific configuration.
938
-
939
- Returns
940
- -------
941
- AsyncHttpResponse[TagsGetResponse]
942
- Success
943
- """
944
- _response = await self._client_wrapper.httpx_client.request(
945
- f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/tags/{jsonable_encoder(tag_id)}",
946
- method="GET",
947
- request_options=request_options,
948
- )
949
- try:
950
- if 200 <= _response.status_code < 300:
951
- _data = typing.cast(
952
- TagsGetResponse,
953
- parse_obj_as(
954
- type_=TagsGetResponse, # type: ignore
955
- object_=_response.json(),
956
- ),
957
- )
958
- return AsyncHttpResponse(response=_response, data=_data)
959
- if _response.status_code == 400:
960
- raise BadRequestError(
961
- headers=dict(_response.headers),
962
- body=typing.cast(
963
- typing.Optional[typing.Any],
964
- parse_obj_as(
965
- type_=typing.Optional[typing.Any], # type: ignore
966
- object_=_response.json(),
967
- ),
968
- ),
969
- )
970
- if _response.status_code == 403:
971
- raise ForbiddenError(
972
- headers=dict(_response.headers),
973
- body=typing.cast(
974
- PermissionDeniedError,
975
- parse_obj_as(
976
- type_=PermissionDeniedError, # type: ignore
977
- object_=_response.json(),
978
- ),
979
- ),
980
- )
981
- if _response.status_code == 404:
982
- raise NotFoundError(
983
- headers=dict(_response.headers),
984
- body=typing.cast(
985
- NotFoundErrorBody,
986
- parse_obj_as(
987
- type_=NotFoundErrorBody, # type: ignore
988
- object_=_response.json(),
989
- ),
990
- ),
991
- )
992
- if _response.status_code == 429:
993
- raise TooManyRequestsError(
994
- headers=dict(_response.headers),
995
- body=typing.cast(
996
- RateLimitError,
997
- parse_obj_as(
998
- type_=RateLimitError, # type: ignore
999
- object_=_response.json(),
1000
- ),
1001
- ),
1002
- )
1003
- if _response.status_code == 500:
1004
- raise InternalServerError(
1005
- headers=dict(_response.headers),
1006
- body=typing.cast(
1007
- typing.Optional[typing.Any],
1008
- parse_obj_as(
1009
- type_=typing.Optional[typing.Any], # type: ignore
1010
- object_=_response.json(),
1011
- ),
1012
- ),
1013
- )
1014
- if _response.status_code == 503:
1015
- raise ServiceUnavailableError(
1016
- headers=dict(_response.headers),
1017
- body=typing.cast(
1018
- typing.Optional[typing.Any],
1019
- parse_obj_as(
1020
- type_=typing.Optional[typing.Any], # type: ignore
1021
- object_=_response.json(),
1022
- ),
1023
- ),
1024
- )
1025
- _response_json = _response.json()
1026
- except JSONDecodeError:
1027
- raise ApiError(
1028
- status_code=_response.status_code,
1029
- headers=dict(_response.headers),
1030
- body=_response.text,
1031
- )
1032
- raise ApiError(
1033
- status_code=_response.status_code,
1034
- headers=dict(_response.headers),
1035
- body=_response_json,
1036
- )
1037
-
1038
- async def update(
1039
- self,
1040
- organization_id: str,
1041
- project_id: str,
1042
- tag_id: str,
1043
- *,
1044
- name: typing.Optional[str] = OMIT,
1045
- request_options: typing.Optional[RequestOptions] = None,
1046
- ) -> AsyncHttpResponse[TagsUpdateResponse]:
1047
- """
1048
- Parameters
1049
- ----------
1050
- organization_id : str
1051
-
1052
- project_id : str
1053
-
1054
- tag_id : str
1055
-
1056
- name : typing.Optional[str]
1057
- a string at most 100 character(s) long
1058
-
1059
- request_options : typing.Optional[RequestOptions]
1060
- Request-specific configuration.
1061
-
1062
- Returns
1063
- -------
1064
- AsyncHttpResponse[TagsUpdateResponse]
1065
- Success
1066
- """
1067
- _response = await self._client_wrapper.httpx_client.request(
1068
- f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/tags/{jsonable_encoder(tag_id)}",
1069
- method="PUT",
1070
- json={
1071
- "name": name,
1072
- },
1073
- headers={
1074
- "content-type": "application/json",
1075
- },
1076
- request_options=request_options,
1077
- omit=OMIT,
1078
- )
1079
- try:
1080
- if 200 <= _response.status_code < 300:
1081
- _data = typing.cast(
1082
- TagsUpdateResponse,
1083
- parse_obj_as(
1084
- type_=TagsUpdateResponse, # type: ignore
1085
- object_=_response.json(),
1086
- ),
1087
- )
1088
- return AsyncHttpResponse(response=_response, data=_data)
1089
- if _response.status_code == 400:
1090
- raise BadRequestError(
1091
- headers=dict(_response.headers),
1092
- body=typing.cast(
1093
- typing.Optional[typing.Any],
1094
- parse_obj_as(
1095
- type_=typing.Optional[typing.Any], # type: ignore
1096
- object_=_response.json(),
1097
- ),
1098
- ),
1099
- )
1100
- if _response.status_code == 403:
1101
- raise ForbiddenError(
1102
- headers=dict(_response.headers),
1103
- body=typing.cast(
1104
- PermissionDeniedError,
1105
- parse_obj_as(
1106
- type_=PermissionDeniedError, # type: ignore
1107
- object_=_response.json(),
1108
- ),
1109
- ),
1110
- )
1111
- if _response.status_code == 404:
1112
- raise NotFoundError(
1113
- headers=dict(_response.headers),
1114
- body=typing.cast(
1115
- NotFoundErrorBody,
1116
- parse_obj_as(
1117
- type_=NotFoundErrorBody, # type: ignore
1118
- object_=_response.json(),
1119
- ),
1120
- ),
1121
- )
1122
- if _response.status_code == 409:
1123
- raise ConflictError(
1124
- headers=dict(_response.headers),
1125
- body=typing.cast(
1126
- typing.Optional[typing.Any],
1127
- parse_obj_as(
1128
- type_=typing.Optional[typing.Any], # type: ignore
1129
- object_=_response.json(),
1130
- ),
1131
- ),
1132
- )
1133
- if _response.status_code == 429:
1134
- raise TooManyRequestsError(
1135
- headers=dict(_response.headers),
1136
- body=typing.cast(
1137
- RateLimitError,
1138
- parse_obj_as(
1139
- type_=RateLimitError, # type: ignore
1140
- object_=_response.json(),
1141
- ),
1142
- ),
1143
- )
1144
- if _response.status_code == 500:
1145
- raise InternalServerError(
1146
- headers=dict(_response.headers),
1147
- body=typing.cast(
1148
- typing.Optional[typing.Any],
1149
- parse_obj_as(
1150
- type_=typing.Optional[typing.Any], # type: ignore
1151
- object_=_response.json(),
1152
- ),
1153
- ),
1154
- )
1155
- if _response.status_code == 503:
1156
- raise ServiceUnavailableError(
1157
- headers=dict(_response.headers),
1158
- body=typing.cast(
1159
- typing.Optional[typing.Any],
1160
- parse_obj_as(
1161
- type_=typing.Optional[typing.Any], # type: ignore
1162
- object_=_response.json(),
1163
- ),
1164
- ),
1165
- )
1166
- _response_json = _response.json()
1167
- except JSONDecodeError:
1168
- raise ApiError(
1169
- status_code=_response.status_code,
1170
- headers=dict(_response.headers),
1171
- body=_response.text,
1172
- )
1173
- raise ApiError(
1174
- status_code=_response.status_code,
1175
- headers=dict(_response.headers),
1176
- body=_response_json,
1177
- )
1178
-
1179
- async def delete(
1180
- self,
1181
- organization_id: str,
1182
- project_id: str,
1183
- tag_id: str,
1184
- *,
1185
- request_options: typing.Optional[RequestOptions] = None,
1186
- ) -> AsyncHttpResponse[None]:
1187
- """
1188
- Parameters
1189
- ----------
1190
- organization_id : str
1191
-
1192
- project_id : str
1193
-
1194
- tag_id : str
1195
-
1196
- request_options : typing.Optional[RequestOptions]
1197
- Request-specific configuration.
1198
-
1199
- Returns
1200
- -------
1201
- AsyncHttpResponse[None]
1202
- """
1203
- _response = await self._client_wrapper.httpx_client.request(
1204
- f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/tags/{jsonable_encoder(tag_id)}",
1205
- method="DELETE",
1206
- request_options=request_options,
1207
- )
1208
- try:
1209
- if 200 <= _response.status_code < 300:
1210
- return AsyncHttpResponse(response=_response, data=None)
1211
- if _response.status_code == 400:
1212
- raise BadRequestError(
1213
- headers=dict(_response.headers),
1214
- body=typing.cast(
1215
- typing.Optional[typing.Any],
1216
- parse_obj_as(
1217
- type_=typing.Optional[typing.Any], # type: ignore
1218
- object_=_response.json(),
1219
- ),
1220
- ),
1221
- )
1222
- if _response.status_code == 403:
1223
- raise ForbiddenError(
1224
- headers=dict(_response.headers),
1225
- body=typing.cast(
1226
- PermissionDeniedError,
1227
- parse_obj_as(
1228
- type_=PermissionDeniedError, # type: ignore
1229
- object_=_response.json(),
1230
- ),
1231
- ),
1232
- )
1233
- if _response.status_code == 404:
1234
- raise NotFoundError(
1235
- headers=dict(_response.headers),
1236
- body=typing.cast(
1237
- NotFoundErrorBody,
1238
- parse_obj_as(
1239
- type_=NotFoundErrorBody, # type: ignore
1240
- object_=_response.json(),
1241
- ),
1242
- ),
1243
- )
1244
- if _response.status_code == 429:
1245
- raise TooManyRequestsError(
1246
- headers=dict(_response.headers),
1247
- body=typing.cast(
1248
- RateLimitError,
1249
- parse_obj_as(
1250
- type_=RateLimitError, # type: ignore
1251
- object_=_response.json(),
1252
- ),
1253
- ),
1254
- )
1255
- if _response.status_code == 500:
1256
- raise InternalServerError(
1257
- headers=dict(_response.headers),
1258
- body=typing.cast(
1259
- typing.Optional[typing.Any],
1260
- parse_obj_as(
1261
- type_=typing.Optional[typing.Any], # type: ignore
1262
- object_=_response.json(),
1263
- ),
1264
- ),
1265
- )
1266
- if _response.status_code == 503:
1267
- raise ServiceUnavailableError(
1268
- headers=dict(_response.headers),
1269
- body=typing.cast(
1270
- typing.Optional[typing.Any],
1271
- parse_obj_as(
1272
- type_=typing.Optional[typing.Any], # type: ignore
1273
- object_=_response.json(),
1274
- ),
1275
- ),
1276
- )
1277
- _response_json = _response.json()
1278
- except JSONDecodeError:
1279
- raise ApiError(
1280
- status_code=_response.status_code,
1281
- headers=dict(_response.headers),
1282
- body=_response.text,
1283
- )
1284
- raise ApiError(
1285
- status_code=_response.status_code,
1286
- headers=dict(_response.headers),
1287
- body=_response_json,
1288
- )