mirascope 2.0.0a5__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 (349) hide show
  1. mirascope/__init__.py +10 -1
  2. mirascope/_stubs.py +363 -0
  3. mirascope/api/__init__.py +8 -0
  4. mirascope/api/_generated/__init__.py +285 -2
  5. mirascope/api/_generated/annotations/__init__.py +33 -0
  6. mirascope/api/_generated/annotations/client.py +506 -0
  7. mirascope/api/_generated/annotations/raw_client.py +1414 -0
  8. mirascope/api/_generated/annotations/types/__init__.py +31 -0
  9. mirascope/api/_generated/annotations/types/annotations_create_request_label.py +5 -0
  10. mirascope/api/_generated/annotations/types/annotations_create_response.py +48 -0
  11. mirascope/api/_generated/annotations/types/annotations_create_response_label.py +5 -0
  12. mirascope/api/_generated/annotations/types/annotations_get_response.py +48 -0
  13. mirascope/api/_generated/annotations/types/annotations_get_response_label.py +5 -0
  14. mirascope/api/_generated/annotations/types/annotations_list_request_label.py +5 -0
  15. mirascope/api/_generated/annotations/types/annotations_list_response.py +21 -0
  16. mirascope/api/_generated/annotations/types/annotations_list_response_annotations_item.py +50 -0
  17. mirascope/api/_generated/annotations/types/annotations_list_response_annotations_item_label.py +5 -0
  18. mirascope/api/_generated/annotations/types/annotations_update_request_label.py +5 -0
  19. mirascope/api/_generated/annotations/types/annotations_update_response.py +48 -0
  20. mirascope/api/_generated/annotations/types/annotations_update_response_label.py +5 -0
  21. mirascope/api/_generated/api_keys/__init__.py +12 -2
  22. mirascope/api/_generated/api_keys/client.py +77 -0
  23. mirascope/api/_generated/api_keys/raw_client.py +422 -39
  24. mirascope/api/_generated/api_keys/types/__init__.py +7 -1
  25. mirascope/api/_generated/api_keys/types/api_keys_create_response.py +4 -12
  26. mirascope/api/_generated/api_keys/types/api_keys_get_response.py +4 -12
  27. mirascope/api/_generated/api_keys/types/api_keys_list_all_for_org_response_item.py +40 -0
  28. mirascope/api/_generated/api_keys/types/api_keys_list_response_item.py +4 -12
  29. mirascope/api/_generated/client.py +42 -0
  30. mirascope/api/_generated/core/client_wrapper.py +2 -14
  31. mirascope/api/_generated/core/datetime_utils.py +1 -3
  32. mirascope/api/_generated/core/file.py +2 -5
  33. mirascope/api/_generated/core/http_client.py +36 -112
  34. mirascope/api/_generated/core/jsonable_encoder.py +1 -3
  35. mirascope/api/_generated/core/pydantic_utilities.py +19 -74
  36. mirascope/api/_generated/core/query_encoder.py +1 -3
  37. mirascope/api/_generated/core/serialization.py +4 -10
  38. mirascope/api/_generated/docs/client.py +2 -6
  39. mirascope/api/_generated/docs/raw_client.py +51 -5
  40. mirascope/api/_generated/environment.py +3 -3
  41. mirascope/api/_generated/environments/__init__.py +6 -0
  42. mirascope/api/_generated/environments/client.py +117 -0
  43. mirascope/api/_generated/environments/raw_client.py +530 -51
  44. mirascope/api/_generated/environments/types/__init__.py +10 -0
  45. mirascope/api/_generated/environments/types/environments_create_response.py +1 -3
  46. mirascope/api/_generated/environments/types/environments_get_analytics_response.py +60 -0
  47. mirascope/api/_generated/environments/types/environments_get_analytics_response_top_functions_item.py +24 -0
  48. mirascope/api/_generated/environments/types/environments_get_analytics_response_top_models_item.py +22 -0
  49. mirascope/api/_generated/environments/types/environments_get_response.py +1 -3
  50. mirascope/api/_generated/environments/types/environments_list_response_item.py +1 -3
  51. mirascope/api/_generated/environments/types/environments_update_response.py +1 -3
  52. mirascope/api/_generated/errors/__init__.py +8 -0
  53. mirascope/api/_generated/errors/bad_request_error.py +1 -2
  54. mirascope/api/_generated/errors/conflict_error.py +1 -2
  55. mirascope/api/_generated/errors/forbidden_error.py +1 -5
  56. mirascope/api/_generated/errors/internal_server_error.py +1 -6
  57. mirascope/api/_generated/errors/not_found_error.py +1 -5
  58. mirascope/api/_generated/errors/payment_required_error.py +15 -0
  59. mirascope/api/_generated/errors/service_unavailable_error.py +14 -0
  60. mirascope/api/_generated/errors/too_many_requests_error.py +15 -0
  61. mirascope/api/_generated/errors/unauthorized_error.py +11 -0
  62. mirascope/api/_generated/functions/__init__.py +39 -0
  63. mirascope/api/_generated/functions/client.py +647 -0
  64. mirascope/api/_generated/functions/raw_client.py +1890 -0
  65. mirascope/api/_generated/functions/types/__init__.py +53 -0
  66. mirascope/api/_generated/functions/types/functions_create_request_dependencies_value.py +20 -0
  67. mirascope/api/_generated/functions/types/functions_create_response.py +37 -0
  68. mirascope/api/_generated/functions/types/functions_create_response_dependencies_value.py +20 -0
  69. mirascope/api/_generated/functions/types/functions_find_by_hash_response.py +39 -0
  70. mirascope/api/_generated/functions/types/functions_find_by_hash_response_dependencies_value.py +20 -0
  71. mirascope/api/_generated/functions/types/functions_get_by_env_response.py +53 -0
  72. mirascope/api/_generated/functions/types/functions_get_by_env_response_dependencies_value.py +22 -0
  73. mirascope/api/_generated/functions/types/functions_get_response.py +37 -0
  74. mirascope/api/_generated/functions/types/functions_get_response_dependencies_value.py +20 -0
  75. mirascope/api/_generated/functions/types/functions_list_by_env_response.py +25 -0
  76. mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item.py +56 -0
  77. mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item_dependencies_value.py +22 -0
  78. mirascope/api/_generated/functions/types/functions_list_response.py +21 -0
  79. mirascope/api/_generated/functions/types/functions_list_response_functions_item.py +41 -0
  80. mirascope/api/_generated/functions/types/functions_list_response_functions_item_dependencies_value.py +20 -0
  81. mirascope/api/_generated/health/client.py +2 -6
  82. mirascope/api/_generated/health/raw_client.py +51 -5
  83. mirascope/api/_generated/health/types/health_check_response.py +1 -3
  84. mirascope/api/_generated/organization_invitations/__init__.py +33 -0
  85. mirascope/api/_generated/organization_invitations/client.py +546 -0
  86. mirascope/api/_generated/organization_invitations/raw_client.py +1519 -0
  87. mirascope/api/_generated/organization_invitations/types/__init__.py +53 -0
  88. mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response.py +34 -0
  89. mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response_role.py +7 -0
  90. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_request_role.py +7 -0
  91. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response.py +48 -0
  92. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_role.py +7 -0
  93. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_status.py +7 -0
  94. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response.py +48 -0
  95. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_role.py +7 -0
  96. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_status.py +7 -0
  97. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item.py +48 -0
  98. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_role.py +7 -0
  99. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_status.py +7 -0
  100. mirascope/api/_generated/organization_memberships/__init__.py +19 -0
  101. mirascope/api/_generated/organization_memberships/client.py +302 -0
  102. mirascope/api/_generated/organization_memberships/raw_client.py +736 -0
  103. mirascope/api/_generated/organization_memberships/types/__init__.py +27 -0
  104. mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item.py +33 -0
  105. mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item_role.py +7 -0
  106. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_request_role.py +7 -0
  107. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response.py +31 -0
  108. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response_role.py +7 -0
  109. mirascope/api/_generated/organizations/__init__.py +26 -0
  110. mirascope/api/_generated/organizations/client.py +465 -0
  111. mirascope/api/_generated/organizations/raw_client.py +1799 -108
  112. mirascope/api/_generated/organizations/types/__init__.py +48 -0
  113. mirascope/api/_generated/organizations/types/organizations_create_payment_intent_response.py +24 -0
  114. mirascope/api/_generated/organizations/types/organizations_create_response.py +4 -3
  115. mirascope/api/_generated/organizations/types/organizations_create_response_role.py +1 -3
  116. mirascope/api/_generated/organizations/types/organizations_get_response.py +4 -3
  117. mirascope/api/_generated/organizations/types/organizations_get_response_role.py +1 -3
  118. mirascope/api/_generated/organizations/types/organizations_list_response_item.py +4 -3
  119. mirascope/api/_generated/organizations/types/organizations_list_response_item_role.py +1 -3
  120. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_request_target_plan.py +7 -0
  121. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response.py +47 -0
  122. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item.py +33 -0
  123. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item_resource.py +7 -0
  124. mirascope/api/_generated/organizations/types/organizations_router_balance_response.py +24 -0
  125. mirascope/api/_generated/organizations/types/organizations_subscription_response.py +53 -0
  126. mirascope/api/_generated/organizations/types/organizations_subscription_response_current_plan.py +7 -0
  127. mirascope/api/_generated/organizations/types/organizations_subscription_response_payment_method.py +26 -0
  128. mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change.py +34 -0
  129. mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change_target_plan.py +7 -0
  130. mirascope/api/_generated/organizations/types/organizations_update_response.py +4 -3
  131. mirascope/api/_generated/organizations/types/organizations_update_response_role.py +1 -3
  132. mirascope/api/_generated/organizations/types/organizations_update_subscription_request_target_plan.py +7 -0
  133. mirascope/api/_generated/organizations/types/organizations_update_subscription_response.py +35 -0
  134. mirascope/api/_generated/project_memberships/__init__.py +25 -0
  135. mirascope/api/_generated/project_memberships/client.py +437 -0
  136. mirascope/api/_generated/project_memberships/raw_client.py +1039 -0
  137. mirascope/api/_generated/project_memberships/types/__init__.py +29 -0
  138. mirascope/api/_generated/project_memberships/types/project_memberships_create_request_role.py +7 -0
  139. mirascope/api/_generated/project_memberships/types/project_memberships_create_response.py +35 -0
  140. mirascope/api/_generated/project_memberships/types/project_memberships_create_response_role.py +7 -0
  141. mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item.py +33 -0
  142. mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item_role.py +7 -0
  143. mirascope/api/_generated/project_memberships/types/project_memberships_update_request_role.py +7 -0
  144. mirascope/api/_generated/project_memberships/types/project_memberships_update_response.py +35 -0
  145. mirascope/api/_generated/project_memberships/types/project_memberships_update_response_role.py +7 -0
  146. mirascope/api/_generated/projects/__init__.py +2 -12
  147. mirascope/api/_generated/projects/client.py +17 -71
  148. mirascope/api/_generated/projects/raw_client.py +295 -51
  149. mirascope/api/_generated/projects/types/__init__.py +1 -6
  150. mirascope/api/_generated/projects/types/projects_create_response.py +3 -9
  151. mirascope/api/_generated/projects/types/projects_get_response.py +3 -9
  152. mirascope/api/_generated/projects/types/projects_list_response_item.py +3 -9
  153. mirascope/api/_generated/projects/types/projects_update_response.py +3 -9
  154. mirascope/api/_generated/reference.md +3619 -182
  155. mirascope/api/_generated/tags/__init__.py +19 -0
  156. mirascope/api/_generated/tags/client.py +504 -0
  157. mirascope/api/_generated/tags/raw_client.py +1288 -0
  158. mirascope/api/_generated/tags/types/__init__.py +17 -0
  159. mirascope/api/_generated/tags/types/tags_create_response.py +41 -0
  160. mirascope/api/_generated/tags/types/tags_get_response.py +41 -0
  161. mirascope/api/_generated/tags/types/tags_list_response.py +23 -0
  162. mirascope/api/_generated/tags/types/tags_list_response_tags_item.py +41 -0
  163. mirascope/api/_generated/tags/types/tags_update_response.py +41 -0
  164. mirascope/api/_generated/token_cost/__init__.py +7 -0
  165. mirascope/api/_generated/token_cost/client.py +160 -0
  166. mirascope/api/_generated/token_cost/raw_client.py +264 -0
  167. mirascope/api/_generated/token_cost/types/__init__.py +8 -0
  168. mirascope/api/_generated/token_cost/types/token_cost_calculate_request_usage.py +54 -0
  169. mirascope/api/_generated/token_cost/types/token_cost_calculate_response.py +52 -0
  170. mirascope/api/_generated/traces/__init__.py +42 -0
  171. mirascope/api/_generated/traces/client.py +941 -0
  172. mirascope/api/_generated/traces/raw_client.py +2177 -23
  173. mirascope/api/_generated/traces/types/__init__.py +60 -0
  174. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item.py +4 -11
  175. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource.py +2 -6
  176. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item.py +1 -3
  177. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value.py +8 -24
  178. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value_array_value.py +2 -6
  179. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value_kvlist_value.py +3 -9
  180. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value_kvlist_value_values_item.py +2 -6
  181. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item.py +3 -9
  182. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope.py +4 -8
  183. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item.py +2 -6
  184. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value.py +8 -24
  185. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value_array_value.py +2 -6
  186. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value_kvlist_value.py +3 -9
  187. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value_kvlist_value_values_item.py +1 -3
  188. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item.py +6 -18
  189. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item.py +3 -9
  190. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value.py +8 -24
  191. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value_array_value.py +2 -6
  192. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value_kvlist_value.py +2 -6
  193. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value_kvlist_value_values_item.py +1 -3
  194. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_status.py +2 -6
  195. mirascope/api/_generated/traces/types/traces_create_response.py +2 -5
  196. mirascope/api/_generated/traces/types/traces_create_response_partial_success.py +3 -9
  197. mirascope/api/_generated/traces/types/traces_get_analytics_summary_response.py +60 -0
  198. mirascope/api/_generated/traces/types/traces_get_analytics_summary_response_top_functions_item.py +24 -0
  199. mirascope/api/_generated/traces/types/traces_get_analytics_summary_response_top_models_item.py +22 -0
  200. mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response.py +33 -0
  201. mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response_spans_item.py +88 -0
  202. mirascope/api/_generated/traces/types/traces_get_trace_detail_response.py +33 -0
  203. mirascope/api/_generated/traces/types/traces_get_trace_detail_response_spans_item.py +88 -0
  204. mirascope/api/_generated/traces/types/traces_list_by_function_hash_response.py +25 -0
  205. mirascope/api/_generated/traces/types/traces_list_by_function_hash_response_traces_item.py +44 -0
  206. mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item.py +26 -0
  207. mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item_operator.py +7 -0
  208. mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_by.py +7 -0
  209. mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_order.py +7 -0
  210. mirascope/api/_generated/traces/types/traces_search_by_env_response.py +26 -0
  211. mirascope/api/_generated/traces/types/traces_search_by_env_response_spans_item.py +50 -0
  212. mirascope/api/_generated/traces/types/traces_search_request_attribute_filters_item.py +26 -0
  213. mirascope/api/_generated/traces/types/traces_search_request_attribute_filters_item_operator.py +7 -0
  214. mirascope/api/_generated/traces/types/traces_search_request_sort_by.py +7 -0
  215. mirascope/api/_generated/traces/types/traces_search_request_sort_order.py +5 -0
  216. mirascope/api/_generated/traces/types/traces_search_response.py +26 -0
  217. mirascope/api/_generated/traces/types/traces_search_response_spans_item.py +50 -0
  218. mirascope/api/_generated/types/__init__.py +48 -0
  219. mirascope/api/_generated/types/already_exists_error.py +1 -3
  220. mirascope/api/_generated/types/bad_request_error_body.py +50 -0
  221. mirascope/api/_generated/types/click_house_error.py +22 -0
  222. mirascope/api/_generated/types/database_error.py +1 -3
  223. mirascope/api/_generated/types/date.py +3 -0
  224. mirascope/api/_generated/types/http_api_decode_error.py +1 -3
  225. mirascope/api/_generated/types/immutable_resource_error.py +22 -0
  226. mirascope/api/_generated/types/internal_server_error_body.py +49 -0
  227. mirascope/api/_generated/types/issue.py +1 -3
  228. mirascope/api/_generated/types/issue_tag.py +1 -8
  229. mirascope/api/_generated/types/not_found_error_body.py +1 -3
  230. mirascope/api/_generated/types/number_from_string.py +3 -0
  231. mirascope/api/_generated/types/permission_denied_error.py +1 -3
  232. mirascope/api/_generated/types/permission_denied_error_tag.py +1 -3
  233. mirascope/api/_generated/types/plan_limit_exceeded_error.py +32 -0
  234. mirascope/api/_generated/types/plan_limit_exceeded_error_tag.py +7 -0
  235. mirascope/api/_generated/types/pricing_unavailable_error.py +23 -0
  236. mirascope/api/_generated/types/property_key_key.py +1 -3
  237. mirascope/api/_generated/types/rate_limit_error.py +31 -0
  238. mirascope/api/_generated/types/rate_limit_error_tag.py +5 -0
  239. mirascope/api/_generated/types/service_unavailable_error_body.py +24 -0
  240. mirascope/api/_generated/types/service_unavailable_error_tag.py +7 -0
  241. mirascope/api/_generated/types/stripe_error.py +20 -0
  242. mirascope/api/_generated/types/subscription_past_due_error.py +31 -0
  243. mirascope/api/_generated/types/subscription_past_due_error_tag.py +7 -0
  244. mirascope/api/_generated/types/unauthorized_error_body.py +21 -0
  245. mirascope/api/_generated/types/unauthorized_error_tag.py +5 -0
  246. mirascope/api/settings.py +19 -1
  247. mirascope/llm/__init__.py +55 -8
  248. mirascope/llm/calls/__init__.py +2 -1
  249. mirascope/llm/calls/calls.py +3 -1
  250. mirascope/llm/calls/decorator.py +21 -7
  251. mirascope/llm/content/tool_call.py +6 -0
  252. mirascope/llm/content/tool_output.py +22 -5
  253. mirascope/llm/exceptions.py +284 -71
  254. mirascope/llm/formatting/__init__.py +19 -2
  255. mirascope/llm/formatting/format.py +219 -30
  256. mirascope/llm/formatting/output_parser.py +178 -0
  257. mirascope/llm/formatting/partial.py +80 -7
  258. mirascope/llm/formatting/primitives.py +192 -0
  259. mirascope/llm/formatting/types.py +21 -64
  260. mirascope/llm/mcp/__init__.py +2 -2
  261. mirascope/llm/mcp/mcp_client.py +130 -0
  262. mirascope/llm/messages/__init__.py +3 -0
  263. mirascope/llm/messages/_utils.py +34 -0
  264. mirascope/llm/models/__init__.py +5 -0
  265. mirascope/llm/models/models.py +137 -69
  266. mirascope/llm/{providers/base → models}/params.py +16 -37
  267. mirascope/llm/models/thinking_config.py +61 -0
  268. mirascope/llm/prompts/_utils.py +0 -32
  269. mirascope/llm/prompts/decorator.py +16 -5
  270. mirascope/llm/prompts/prompts.py +131 -68
  271. mirascope/llm/providers/__init__.py +18 -2
  272. mirascope/llm/providers/anthropic/__init__.py +3 -21
  273. mirascope/llm/providers/anthropic/_utils/__init__.py +2 -0
  274. mirascope/llm/providers/anthropic/_utils/beta_decode.py +22 -11
  275. mirascope/llm/providers/anthropic/_utils/beta_encode.py +75 -25
  276. mirascope/llm/providers/anthropic/_utils/decode.py +22 -11
  277. mirascope/llm/providers/anthropic/_utils/encode.py +82 -20
  278. mirascope/llm/providers/anthropic/_utils/errors.py +2 -2
  279. mirascope/llm/providers/anthropic/beta_provider.py +64 -18
  280. mirascope/llm/providers/anthropic/provider.py +91 -33
  281. mirascope/llm/providers/base/__init__.py +0 -2
  282. mirascope/llm/providers/base/_utils.py +55 -11
  283. mirascope/llm/providers/base/base_provider.py +116 -37
  284. mirascope/llm/providers/google/__init__.py +2 -17
  285. mirascope/llm/providers/google/_utils/__init__.py +2 -0
  286. mirascope/llm/providers/google/_utils/decode.py +37 -15
  287. mirascope/llm/providers/google/_utils/encode.py +127 -19
  288. mirascope/llm/providers/google/_utils/errors.py +3 -2
  289. mirascope/llm/providers/google/model_info.py +1 -0
  290. mirascope/llm/providers/google/provider.py +68 -19
  291. mirascope/llm/providers/mirascope/__init__.py +5 -0
  292. mirascope/llm/providers/mirascope/_utils.py +73 -0
  293. mirascope/llm/providers/mirascope/provider.py +349 -0
  294. mirascope/llm/providers/mlx/__init__.py +2 -17
  295. mirascope/llm/providers/mlx/_utils.py +8 -3
  296. mirascope/llm/providers/mlx/encoding/base.py +5 -2
  297. mirascope/llm/providers/mlx/encoding/transformers.py +5 -2
  298. mirascope/llm/providers/mlx/mlx.py +23 -6
  299. mirascope/llm/providers/mlx/provider.py +42 -13
  300. mirascope/llm/providers/ollama/__init__.py +1 -13
  301. mirascope/llm/providers/openai/_utils/errors.py +2 -2
  302. mirascope/llm/providers/openai/completions/__init__.py +2 -20
  303. mirascope/llm/providers/openai/completions/_utils/decode.py +14 -3
  304. mirascope/llm/providers/openai/completions/_utils/encode.py +35 -28
  305. mirascope/llm/providers/openai/completions/base_provider.py +40 -11
  306. mirascope/llm/providers/openai/provider.py +40 -10
  307. mirascope/llm/providers/openai/responses/__init__.py +1 -17
  308. mirascope/llm/providers/openai/responses/_utils/__init__.py +2 -0
  309. mirascope/llm/providers/openai/responses/_utils/decode.py +21 -8
  310. mirascope/llm/providers/openai/responses/_utils/encode.py +59 -19
  311. mirascope/llm/providers/openai/responses/provider.py +56 -18
  312. mirascope/llm/providers/provider_id.py +1 -0
  313. mirascope/llm/providers/provider_registry.py +96 -19
  314. mirascope/llm/providers/together/__init__.py +1 -13
  315. mirascope/llm/responses/__init__.py +6 -1
  316. mirascope/llm/responses/_utils.py +102 -12
  317. mirascope/llm/responses/base_response.py +5 -2
  318. mirascope/llm/responses/base_stream_response.py +139 -45
  319. mirascope/llm/responses/response.py +2 -1
  320. mirascope/llm/responses/root_response.py +89 -17
  321. mirascope/llm/responses/stream_response.py +6 -9
  322. mirascope/llm/tools/decorator.py +17 -8
  323. mirascope/llm/tools/tool_schema.py +43 -10
  324. mirascope/llm/tools/toolkit.py +35 -27
  325. mirascope/llm/tools/tools.py +123 -30
  326. mirascope/ops/__init__.py +64 -109
  327. mirascope/ops/_internal/configuration.py +82 -31
  328. mirascope/ops/_internal/exporters/exporters.py +64 -11
  329. mirascope/ops/_internal/instrumentation/llm/common.py +530 -0
  330. mirascope/ops/_internal/instrumentation/llm/cost.py +190 -0
  331. mirascope/ops/_internal/instrumentation/llm/encode.py +1 -1
  332. mirascope/ops/_internal/instrumentation/llm/llm.py +116 -1243
  333. mirascope/ops/_internal/instrumentation/llm/model.py +1798 -0
  334. mirascope/ops/_internal/instrumentation/llm/response.py +521 -0
  335. mirascope/ops/_internal/instrumentation/llm/serialize.py +300 -0
  336. mirascope/ops/_internal/protocols.py +83 -1
  337. mirascope/ops/_internal/traced_calls.py +4 -0
  338. mirascope/ops/_internal/traced_functions.py +141 -12
  339. mirascope/ops/_internal/tracing.py +78 -1
  340. mirascope/ops/_internal/utils.py +52 -4
  341. mirascope/ops/_internal/versioned_functions.py +54 -43
  342. {mirascope-2.0.0a5.dist-info → mirascope-2.0.1.dist-info}/METADATA +14 -13
  343. mirascope-2.0.1.dist-info/RECORD +423 -0
  344. {mirascope-2.0.0a5.dist-info → mirascope-2.0.1.dist-info}/licenses/LICENSE +1 -1
  345. mirascope/llm/formatting/_utils.py +0 -78
  346. mirascope/llm/mcp/client.py +0 -118
  347. mirascope/llm/providers/_missing_import_stubs.py +0 -49
  348. mirascope-2.0.0a5.dist-info/RECORD +0 -265
  349. {mirascope-2.0.0a5.dist-info → mirascope-2.0.1.dist-info}/WHEEL +0 -0
@@ -0,0 +1,1288 @@
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
+ )