mirascope 1.22.4__py3-none-any.whl → 2.1.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 (812) hide show
  1. mirascope/__init__.py +5 -50
  2. mirascope/_stubs.py +384 -0
  3. mirascope/_utils.py +34 -0
  4. mirascope/api/__init__.py +14 -0
  5. mirascope/api/_generated/README.md +207 -0
  6. mirascope/api/_generated/__init__.py +444 -0
  7. mirascope/api/_generated/annotations/__init__.py +33 -0
  8. mirascope/api/_generated/annotations/client.py +506 -0
  9. mirascope/api/_generated/annotations/raw_client.py +1414 -0
  10. mirascope/api/_generated/annotations/types/__init__.py +31 -0
  11. mirascope/api/_generated/annotations/types/annotations_create_request_label.py +5 -0
  12. mirascope/api/_generated/annotations/types/annotations_create_response.py +48 -0
  13. mirascope/api/_generated/annotations/types/annotations_create_response_label.py +5 -0
  14. mirascope/api/_generated/annotations/types/annotations_get_response.py +48 -0
  15. mirascope/api/_generated/annotations/types/annotations_get_response_label.py +5 -0
  16. mirascope/api/_generated/annotations/types/annotations_list_request_label.py +5 -0
  17. mirascope/api/_generated/annotations/types/annotations_list_response.py +21 -0
  18. mirascope/api/_generated/annotations/types/annotations_list_response_annotations_item.py +50 -0
  19. mirascope/api/_generated/annotations/types/annotations_list_response_annotations_item_label.py +5 -0
  20. mirascope/api/_generated/annotations/types/annotations_update_request_label.py +5 -0
  21. mirascope/api/_generated/annotations/types/annotations_update_response.py +48 -0
  22. mirascope/api/_generated/annotations/types/annotations_update_response_label.py +5 -0
  23. mirascope/api/_generated/api_keys/__init__.py +17 -0
  24. mirascope/api/_generated/api_keys/client.py +530 -0
  25. mirascope/api/_generated/api_keys/raw_client.py +1236 -0
  26. mirascope/api/_generated/api_keys/types/__init__.py +15 -0
  27. mirascope/api/_generated/api_keys/types/api_keys_create_response.py +28 -0
  28. mirascope/api/_generated/api_keys/types/api_keys_get_response.py +27 -0
  29. mirascope/api/_generated/api_keys/types/api_keys_list_all_for_org_response_item.py +40 -0
  30. mirascope/api/_generated/api_keys/types/api_keys_list_response_item.py +27 -0
  31. mirascope/api/_generated/client.py +211 -0
  32. mirascope/api/_generated/core/__init__.py +52 -0
  33. mirascope/api/_generated/core/api_error.py +23 -0
  34. mirascope/api/_generated/core/client_wrapper.py +46 -0
  35. mirascope/api/_generated/core/datetime_utils.py +28 -0
  36. mirascope/api/_generated/core/file.py +67 -0
  37. mirascope/api/_generated/core/force_multipart.py +16 -0
  38. mirascope/api/_generated/core/http_client.py +543 -0
  39. mirascope/api/_generated/core/http_response.py +55 -0
  40. mirascope/api/_generated/core/jsonable_encoder.py +100 -0
  41. mirascope/api/_generated/core/pydantic_utilities.py +255 -0
  42. mirascope/api/_generated/core/query_encoder.py +58 -0
  43. mirascope/api/_generated/core/remove_none_from_dict.py +11 -0
  44. mirascope/api/_generated/core/request_options.py +35 -0
  45. mirascope/api/_generated/core/serialization.py +276 -0
  46. mirascope/api/_generated/docs/__init__.py +4 -0
  47. mirascope/api/_generated/docs/client.py +91 -0
  48. mirascope/api/_generated/docs/raw_client.py +178 -0
  49. mirascope/api/_generated/environment.py +9 -0
  50. mirascope/api/_generated/environments/__init__.py +23 -0
  51. mirascope/api/_generated/environments/client.py +649 -0
  52. mirascope/api/_generated/environments/raw_client.py +1567 -0
  53. mirascope/api/_generated/environments/types/__init__.py +25 -0
  54. mirascope/api/_generated/environments/types/environments_create_response.py +24 -0
  55. mirascope/api/_generated/environments/types/environments_get_analytics_response.py +60 -0
  56. mirascope/api/_generated/environments/types/environments_get_analytics_response_top_functions_item.py +24 -0
  57. mirascope/api/_generated/environments/types/environments_get_analytics_response_top_models_item.py +22 -0
  58. mirascope/api/_generated/environments/types/environments_get_response.py +24 -0
  59. mirascope/api/_generated/environments/types/environments_list_response_item.py +24 -0
  60. mirascope/api/_generated/environments/types/environments_update_response.py +24 -0
  61. mirascope/api/_generated/errors/__init__.py +25 -0
  62. mirascope/api/_generated/errors/bad_request_error.py +14 -0
  63. mirascope/api/_generated/errors/conflict_error.py +14 -0
  64. mirascope/api/_generated/errors/forbidden_error.py +11 -0
  65. mirascope/api/_generated/errors/internal_server_error.py +10 -0
  66. mirascope/api/_generated/errors/not_found_error.py +11 -0
  67. mirascope/api/_generated/errors/payment_required_error.py +15 -0
  68. mirascope/api/_generated/errors/service_unavailable_error.py +14 -0
  69. mirascope/api/_generated/errors/too_many_requests_error.py +15 -0
  70. mirascope/api/_generated/errors/unauthorized_error.py +11 -0
  71. mirascope/api/_generated/functions/__init__.py +39 -0
  72. mirascope/api/_generated/functions/client.py +647 -0
  73. mirascope/api/_generated/functions/raw_client.py +1890 -0
  74. mirascope/api/_generated/functions/types/__init__.py +53 -0
  75. mirascope/api/_generated/functions/types/functions_create_request_dependencies_value.py +20 -0
  76. mirascope/api/_generated/functions/types/functions_create_response.py +37 -0
  77. mirascope/api/_generated/functions/types/functions_create_response_dependencies_value.py +20 -0
  78. mirascope/api/_generated/functions/types/functions_find_by_hash_response.py +39 -0
  79. mirascope/api/_generated/functions/types/functions_find_by_hash_response_dependencies_value.py +20 -0
  80. mirascope/api/_generated/functions/types/functions_get_by_env_response.py +53 -0
  81. mirascope/api/_generated/functions/types/functions_get_by_env_response_dependencies_value.py +22 -0
  82. mirascope/api/_generated/functions/types/functions_get_response.py +37 -0
  83. mirascope/api/_generated/functions/types/functions_get_response_dependencies_value.py +20 -0
  84. mirascope/api/_generated/functions/types/functions_list_by_env_response.py +25 -0
  85. mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item.py +56 -0
  86. mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item_dependencies_value.py +22 -0
  87. mirascope/api/_generated/functions/types/functions_list_response.py +21 -0
  88. mirascope/api/_generated/functions/types/functions_list_response_functions_item.py +41 -0
  89. mirascope/api/_generated/functions/types/functions_list_response_functions_item_dependencies_value.py +20 -0
  90. mirascope/api/_generated/health/__init__.py +7 -0
  91. mirascope/api/_generated/health/client.py +92 -0
  92. mirascope/api/_generated/health/raw_client.py +175 -0
  93. mirascope/api/_generated/health/types/__init__.py +8 -0
  94. mirascope/api/_generated/health/types/health_check_response.py +22 -0
  95. mirascope/api/_generated/health/types/health_check_response_status.py +5 -0
  96. mirascope/api/_generated/organization_invitations/__init__.py +33 -0
  97. mirascope/api/_generated/organization_invitations/client.py +546 -0
  98. mirascope/api/_generated/organization_invitations/raw_client.py +1519 -0
  99. mirascope/api/_generated/organization_invitations/types/__init__.py +53 -0
  100. mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response.py +34 -0
  101. mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response_role.py +7 -0
  102. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_request_role.py +7 -0
  103. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response.py +48 -0
  104. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_role.py +7 -0
  105. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_status.py +7 -0
  106. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response.py +48 -0
  107. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_role.py +7 -0
  108. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_status.py +7 -0
  109. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item.py +48 -0
  110. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_role.py +7 -0
  111. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_status.py +7 -0
  112. mirascope/api/_generated/organization_memberships/__init__.py +19 -0
  113. mirascope/api/_generated/organization_memberships/client.py +302 -0
  114. mirascope/api/_generated/organization_memberships/raw_client.py +736 -0
  115. mirascope/api/_generated/organization_memberships/types/__init__.py +27 -0
  116. mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item.py +33 -0
  117. mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item_role.py +7 -0
  118. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_request_role.py +7 -0
  119. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response.py +31 -0
  120. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response_role.py +7 -0
  121. mirascope/api/_generated/organizations/__init__.py +51 -0
  122. mirascope/api/_generated/organizations/client.py +869 -0
  123. mirascope/api/_generated/organizations/raw_client.py +2593 -0
  124. mirascope/api/_generated/organizations/types/__init__.py +71 -0
  125. mirascope/api/_generated/organizations/types/organizations_create_payment_intent_response.py +24 -0
  126. mirascope/api/_generated/organizations/types/organizations_create_response.py +26 -0
  127. mirascope/api/_generated/organizations/types/organizations_create_response_role.py +5 -0
  128. mirascope/api/_generated/organizations/types/organizations_get_response.py +26 -0
  129. mirascope/api/_generated/organizations/types/organizations_get_response_role.py +5 -0
  130. mirascope/api/_generated/organizations/types/organizations_list_response_item.py +26 -0
  131. mirascope/api/_generated/organizations/types/organizations_list_response_item_role.py +5 -0
  132. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_request_target_plan.py +7 -0
  133. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response.py +47 -0
  134. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item.py +33 -0
  135. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item_resource.py +7 -0
  136. mirascope/api/_generated/organizations/types/organizations_router_balance_response.py +24 -0
  137. mirascope/api/_generated/organizations/types/organizations_subscription_response.py +53 -0
  138. mirascope/api/_generated/organizations/types/organizations_subscription_response_current_plan.py +7 -0
  139. mirascope/api/_generated/organizations/types/organizations_subscription_response_payment_method.py +26 -0
  140. mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change.py +34 -0
  141. mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change_target_plan.py +7 -0
  142. mirascope/api/_generated/organizations/types/organizations_update_response.py +26 -0
  143. mirascope/api/_generated/organizations/types/organizations_update_response_role.py +5 -0
  144. mirascope/api/_generated/organizations/types/organizations_update_subscription_request_target_plan.py +7 -0
  145. mirascope/api/_generated/organizations/types/organizations_update_subscription_response.py +35 -0
  146. mirascope/api/_generated/project_memberships/__init__.py +29 -0
  147. mirascope/api/_generated/project_memberships/client.py +528 -0
  148. mirascope/api/_generated/project_memberships/raw_client.py +1278 -0
  149. mirascope/api/_generated/project_memberships/types/__init__.py +33 -0
  150. mirascope/api/_generated/project_memberships/types/project_memberships_create_request_role.py +7 -0
  151. mirascope/api/_generated/project_memberships/types/project_memberships_create_response.py +35 -0
  152. mirascope/api/_generated/project_memberships/types/project_memberships_create_response_role.py +7 -0
  153. mirascope/api/_generated/project_memberships/types/project_memberships_get_response.py +33 -0
  154. mirascope/api/_generated/project_memberships/types/project_memberships_get_response_role.py +7 -0
  155. mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item.py +33 -0
  156. mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item_role.py +7 -0
  157. mirascope/api/_generated/project_memberships/types/project_memberships_update_request_role.py +7 -0
  158. mirascope/api/_generated/project_memberships/types/project_memberships_update_response.py +35 -0
  159. mirascope/api/_generated/project_memberships/types/project_memberships_update_response_role.py +7 -0
  160. mirascope/api/_generated/projects/__init__.py +7 -0
  161. mirascope/api/_generated/projects/client.py +428 -0
  162. mirascope/api/_generated/projects/raw_client.py +1302 -0
  163. mirascope/api/_generated/projects/types/__init__.py +10 -0
  164. mirascope/api/_generated/projects/types/projects_create_response.py +25 -0
  165. mirascope/api/_generated/projects/types/projects_get_response.py +25 -0
  166. mirascope/api/_generated/projects/types/projects_list_response_item.py +25 -0
  167. mirascope/api/_generated/projects/types/projects_update_response.py +25 -0
  168. mirascope/api/_generated/reference.md +4987 -0
  169. mirascope/api/_generated/tags/__init__.py +19 -0
  170. mirascope/api/_generated/tags/client.py +504 -0
  171. mirascope/api/_generated/tags/raw_client.py +1288 -0
  172. mirascope/api/_generated/tags/types/__init__.py +17 -0
  173. mirascope/api/_generated/tags/types/tags_create_response.py +41 -0
  174. mirascope/api/_generated/tags/types/tags_get_response.py +41 -0
  175. mirascope/api/_generated/tags/types/tags_list_response.py +23 -0
  176. mirascope/api/_generated/tags/types/tags_list_response_tags_item.py +41 -0
  177. mirascope/api/_generated/tags/types/tags_update_response.py +41 -0
  178. mirascope/api/_generated/token_cost/__init__.py +7 -0
  179. mirascope/api/_generated/token_cost/client.py +160 -0
  180. mirascope/api/_generated/token_cost/raw_client.py +264 -0
  181. mirascope/api/_generated/token_cost/types/__init__.py +8 -0
  182. mirascope/api/_generated/token_cost/types/token_cost_calculate_request_usage.py +54 -0
  183. mirascope/api/_generated/token_cost/types/token_cost_calculate_response.py +52 -0
  184. mirascope/api/_generated/traces/__init__.py +97 -0
  185. mirascope/api/_generated/traces/client.py +1103 -0
  186. mirascope/api/_generated/traces/raw_client.py +2322 -0
  187. mirascope/api/_generated/traces/types/__init__.py +155 -0
  188. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item.py +29 -0
  189. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource.py +27 -0
  190. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item.py +23 -0
  191. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value.py +38 -0
  192. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value_array_value.py +19 -0
  193. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value_kvlist_value.py +22 -0
  194. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value_kvlist_value_values_item.py +20 -0
  195. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item.py +29 -0
  196. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope.py +31 -0
  197. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item.py +23 -0
  198. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value.py +38 -0
  199. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value_array_value.py +19 -0
  200. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value_kvlist_value.py +22 -0
  201. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value_kvlist_value_values_item.py +22 -0
  202. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item.py +48 -0
  203. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item.py +23 -0
  204. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value.py +38 -0
  205. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value_array_value.py +19 -0
  206. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value_kvlist_value.py +24 -0
  207. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value_kvlist_value_values_item.py +22 -0
  208. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_status.py +20 -0
  209. mirascope/api/_generated/traces/types/traces_create_response.py +24 -0
  210. mirascope/api/_generated/traces/types/traces_create_response_partial_success.py +22 -0
  211. mirascope/api/_generated/traces/types/traces_get_analytics_summary_response.py +60 -0
  212. mirascope/api/_generated/traces/types/traces_get_analytics_summary_response_top_functions_item.py +24 -0
  213. mirascope/api/_generated/traces/types/traces_get_analytics_summary_response_top_models_item.py +22 -0
  214. mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response.py +33 -0
  215. mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response_spans_item.py +88 -0
  216. mirascope/api/_generated/traces/types/traces_get_trace_detail_response.py +33 -0
  217. mirascope/api/_generated/traces/types/traces_get_trace_detail_response_spans_item.py +88 -0
  218. mirascope/api/_generated/traces/types/traces_list_by_function_hash_response.py +25 -0
  219. mirascope/api/_generated/traces/types/traces_list_by_function_hash_response_traces_item.py +44 -0
  220. mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item.py +26 -0
  221. mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item_operator.py +7 -0
  222. mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_by.py +7 -0
  223. mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_order.py +7 -0
  224. mirascope/api/_generated/traces/types/traces_search_by_env_response.py +26 -0
  225. mirascope/api/_generated/traces/types/traces_search_by_env_response_spans_item.py +50 -0
  226. mirascope/api/_generated/traces/types/traces_search_request_attribute_filters_item.py +26 -0
  227. mirascope/api/_generated/traces/types/traces_search_request_attribute_filters_item_operator.py +7 -0
  228. mirascope/api/_generated/traces/types/traces_search_request_sort_by.py +7 -0
  229. mirascope/api/_generated/traces/types/traces_search_request_sort_order.py +5 -0
  230. mirascope/api/_generated/traces/types/traces_search_response.py +26 -0
  231. mirascope/api/_generated/traces/types/traces_search_response_spans_item.py +50 -0
  232. mirascope/api/_generated/types/__init__.py +85 -0
  233. mirascope/api/_generated/types/already_exists_error.py +22 -0
  234. mirascope/api/_generated/types/already_exists_error_tag.py +5 -0
  235. mirascope/api/_generated/types/bad_request_error_body.py +50 -0
  236. mirascope/api/_generated/types/click_house_error.py +22 -0
  237. mirascope/api/_generated/types/database_error.py +22 -0
  238. mirascope/api/_generated/types/database_error_tag.py +5 -0
  239. mirascope/api/_generated/types/date.py +3 -0
  240. mirascope/api/_generated/types/http_api_decode_error.py +27 -0
  241. mirascope/api/_generated/types/http_api_decode_error_tag.py +5 -0
  242. mirascope/api/_generated/types/immutable_resource_error.py +22 -0
  243. mirascope/api/_generated/types/internal_server_error_body.py +49 -0
  244. mirascope/api/_generated/types/issue.py +38 -0
  245. mirascope/api/_generated/types/issue_tag.py +10 -0
  246. mirascope/api/_generated/types/not_found_error_body.py +22 -0
  247. mirascope/api/_generated/types/not_found_error_tag.py +5 -0
  248. mirascope/api/_generated/types/number_from_string.py +3 -0
  249. mirascope/api/_generated/types/permission_denied_error.py +22 -0
  250. mirascope/api/_generated/types/permission_denied_error_tag.py +5 -0
  251. mirascope/api/_generated/types/plan_limit_exceeded_error.py +32 -0
  252. mirascope/api/_generated/types/plan_limit_exceeded_error_tag.py +7 -0
  253. mirascope/api/_generated/types/pricing_unavailable_error.py +23 -0
  254. mirascope/api/_generated/types/property_key.py +7 -0
  255. mirascope/api/_generated/types/property_key_key.py +25 -0
  256. mirascope/api/_generated/types/property_key_key_tag.py +5 -0
  257. mirascope/api/_generated/types/rate_limit_error.py +31 -0
  258. mirascope/api/_generated/types/rate_limit_error_tag.py +5 -0
  259. mirascope/api/_generated/types/service_unavailable_error_body.py +24 -0
  260. mirascope/api/_generated/types/service_unavailable_error_tag.py +7 -0
  261. mirascope/api/_generated/types/stripe_error.py +20 -0
  262. mirascope/api/_generated/types/subscription_past_due_error.py +31 -0
  263. mirascope/api/_generated/types/subscription_past_due_error_tag.py +7 -0
  264. mirascope/api/_generated/types/unauthorized_error_body.py +21 -0
  265. mirascope/api/_generated/types/unauthorized_error_tag.py +5 -0
  266. mirascope/api/client.py +255 -0
  267. mirascope/api/settings.py +99 -0
  268. mirascope/llm/__init__.py +309 -13
  269. mirascope/llm/calls/__init__.py +17 -0
  270. mirascope/llm/calls/calls.py +348 -0
  271. mirascope/llm/calls/decorator.py +268 -0
  272. mirascope/llm/content/__init__.py +71 -0
  273. mirascope/llm/content/audio.py +173 -0
  274. mirascope/llm/content/document.py +94 -0
  275. mirascope/llm/content/image.py +206 -0
  276. mirascope/llm/content/text.py +47 -0
  277. mirascope/llm/content/thought.py +58 -0
  278. mirascope/llm/content/tool_call.py +69 -0
  279. mirascope/llm/content/tool_output.py +43 -0
  280. mirascope/llm/context/__init__.py +6 -0
  281. mirascope/llm/context/_utils.py +41 -0
  282. mirascope/llm/context/context.py +24 -0
  283. mirascope/llm/exceptions.py +360 -0
  284. mirascope/llm/formatting/__init__.py +39 -0
  285. mirascope/llm/formatting/format.py +291 -0
  286. mirascope/llm/formatting/from_call_args.py +30 -0
  287. mirascope/llm/formatting/output_parser.py +178 -0
  288. mirascope/llm/formatting/partial.py +131 -0
  289. mirascope/llm/formatting/primitives.py +192 -0
  290. mirascope/llm/formatting/types.py +83 -0
  291. mirascope/llm/mcp/__init__.py +5 -0
  292. mirascope/llm/mcp/mcp_client.py +130 -0
  293. mirascope/llm/messages/__init__.py +35 -0
  294. mirascope/llm/messages/_utils.py +34 -0
  295. mirascope/llm/messages/message.py +190 -0
  296. mirascope/llm/models/__init__.py +21 -0
  297. mirascope/llm/models/models.py +1339 -0
  298. mirascope/llm/models/params.py +72 -0
  299. mirascope/llm/models/thinking_config.py +61 -0
  300. mirascope/llm/prompts/__init__.py +34 -0
  301. mirascope/llm/prompts/_utils.py +31 -0
  302. mirascope/llm/prompts/decorator.py +215 -0
  303. mirascope/llm/prompts/prompts.py +484 -0
  304. mirascope/llm/prompts/protocols.py +65 -0
  305. mirascope/llm/providers/__init__.py +65 -0
  306. mirascope/llm/providers/anthropic/__init__.py +11 -0
  307. mirascope/llm/providers/anthropic/_utils/__init__.py +27 -0
  308. mirascope/llm/providers/anthropic/_utils/beta_decode.py +297 -0
  309. mirascope/llm/providers/anthropic/_utils/beta_encode.py +272 -0
  310. mirascope/llm/providers/anthropic/_utils/decode.py +326 -0
  311. mirascope/llm/providers/anthropic/_utils/encode.py +431 -0
  312. mirascope/llm/providers/anthropic/_utils/errors.py +46 -0
  313. mirascope/llm/providers/anthropic/beta_provider.py +338 -0
  314. mirascope/llm/providers/anthropic/model_id.py +23 -0
  315. mirascope/llm/providers/anthropic/model_info.py +87 -0
  316. mirascope/llm/providers/anthropic/provider.py +440 -0
  317. mirascope/llm/providers/base/__init__.py +14 -0
  318. mirascope/llm/providers/base/_utils.py +248 -0
  319. mirascope/llm/providers/base/base_provider.py +1463 -0
  320. mirascope/llm/providers/base/kwargs.py +12 -0
  321. mirascope/llm/providers/google/__init__.py +6 -0
  322. mirascope/llm/providers/google/_utils/__init__.py +17 -0
  323. mirascope/llm/providers/google/_utils/decode.py +357 -0
  324. mirascope/llm/providers/google/_utils/encode.py +418 -0
  325. mirascope/llm/providers/google/_utils/errors.py +50 -0
  326. mirascope/llm/providers/google/message.py +7 -0
  327. mirascope/llm/providers/google/model_id.py +22 -0
  328. mirascope/llm/providers/google/model_info.py +63 -0
  329. mirascope/llm/providers/google/provider.py +456 -0
  330. mirascope/llm/providers/mirascope/__init__.py +5 -0
  331. mirascope/llm/providers/mirascope/_utils.py +73 -0
  332. mirascope/llm/providers/mirascope/provider.py +313 -0
  333. mirascope/llm/providers/mlx/__init__.py +9 -0
  334. mirascope/llm/providers/mlx/_utils.py +141 -0
  335. mirascope/llm/providers/mlx/encoding/__init__.py +8 -0
  336. mirascope/llm/providers/mlx/encoding/base.py +69 -0
  337. mirascope/llm/providers/mlx/encoding/transformers.py +146 -0
  338. mirascope/llm/providers/mlx/mlx.py +242 -0
  339. mirascope/llm/providers/mlx/model_id.py +17 -0
  340. mirascope/llm/providers/mlx/provider.py +416 -0
  341. mirascope/llm/providers/model_id.py +16 -0
  342. mirascope/llm/providers/ollama/__init__.py +7 -0
  343. mirascope/llm/providers/ollama/provider.py +71 -0
  344. mirascope/llm/providers/openai/__init__.py +15 -0
  345. mirascope/llm/providers/openai/_utils/__init__.py +5 -0
  346. mirascope/llm/providers/openai/_utils/errors.py +46 -0
  347. mirascope/llm/providers/openai/completions/__init__.py +7 -0
  348. mirascope/llm/providers/openai/completions/_utils/__init__.py +18 -0
  349. mirascope/llm/providers/openai/completions/_utils/decode.py +252 -0
  350. mirascope/llm/providers/openai/completions/_utils/encode.py +390 -0
  351. mirascope/llm/providers/openai/completions/_utils/feature_info.py +50 -0
  352. mirascope/llm/providers/openai/completions/base_provider.py +522 -0
  353. mirascope/llm/providers/openai/completions/provider.py +28 -0
  354. mirascope/llm/providers/openai/model_id.py +31 -0
  355. mirascope/llm/providers/openai/model_info.py +303 -0
  356. mirascope/llm/providers/openai/provider.py +405 -0
  357. mirascope/llm/providers/openai/responses/__init__.py +5 -0
  358. mirascope/llm/providers/openai/responses/_utils/__init__.py +15 -0
  359. mirascope/llm/providers/openai/responses/_utils/decode.py +289 -0
  360. mirascope/llm/providers/openai/responses/_utils/encode.py +399 -0
  361. mirascope/llm/providers/openai/responses/provider.py +472 -0
  362. mirascope/llm/providers/openrouter/__init__.py +5 -0
  363. mirascope/llm/providers/openrouter/provider.py +67 -0
  364. mirascope/llm/providers/provider_id.py +26 -0
  365. mirascope/llm/providers/provider_registry.py +305 -0
  366. mirascope/llm/providers/together/__init__.py +7 -0
  367. mirascope/llm/providers/together/provider.py +40 -0
  368. mirascope/llm/responses/__init__.py +66 -0
  369. mirascope/llm/responses/_utils.py +146 -0
  370. mirascope/llm/responses/base_response.py +103 -0
  371. mirascope/llm/responses/base_stream_response.py +824 -0
  372. mirascope/llm/responses/finish_reason.py +28 -0
  373. mirascope/llm/responses/response.py +362 -0
  374. mirascope/llm/responses/root_response.py +248 -0
  375. mirascope/llm/responses/stream_response.py +577 -0
  376. mirascope/llm/responses/streams.py +363 -0
  377. mirascope/llm/responses/usage.py +139 -0
  378. mirascope/llm/tools/__init__.py +71 -0
  379. mirascope/llm/tools/_utils.py +34 -0
  380. mirascope/llm/tools/decorator.py +184 -0
  381. mirascope/llm/tools/protocols.py +96 -0
  382. mirascope/llm/tools/provider_tools.py +18 -0
  383. mirascope/llm/tools/tool_schema.py +321 -0
  384. mirascope/llm/tools/toolkit.py +178 -0
  385. mirascope/llm/tools/tools.py +263 -0
  386. mirascope/llm/tools/types.py +112 -0
  387. mirascope/llm/tools/web_search_tool.py +32 -0
  388. mirascope/llm/types/__init__.py +22 -0
  389. mirascope/llm/types/dataclass.py +9 -0
  390. mirascope/llm/types/jsonable.py +44 -0
  391. mirascope/llm/types/type_vars.py +19 -0
  392. mirascope/ops/__init__.py +129 -0
  393. mirascope/ops/_internal/__init__.py +5 -0
  394. mirascope/ops/_internal/closure.py +1172 -0
  395. mirascope/ops/_internal/configuration.py +177 -0
  396. mirascope/ops/_internal/context.py +76 -0
  397. mirascope/ops/_internal/exporters/__init__.py +26 -0
  398. mirascope/ops/_internal/exporters/exporters.py +362 -0
  399. mirascope/ops/_internal/exporters/processors.py +104 -0
  400. mirascope/ops/_internal/exporters/types.py +165 -0
  401. mirascope/ops/_internal/exporters/utils.py +66 -0
  402. mirascope/ops/_internal/instrumentation/__init__.py +28 -0
  403. mirascope/ops/_internal/instrumentation/llm/__init__.py +8 -0
  404. mirascope/ops/_internal/instrumentation/llm/common.py +500 -0
  405. mirascope/ops/_internal/instrumentation/llm/cost.py +190 -0
  406. mirascope/ops/_internal/instrumentation/llm/encode.py +238 -0
  407. mirascope/ops/_internal/instrumentation/llm/gen_ai_types/__init__.py +38 -0
  408. mirascope/ops/_internal/instrumentation/llm/gen_ai_types/gen_ai_input_messages.py +31 -0
  409. mirascope/ops/_internal/instrumentation/llm/gen_ai_types/gen_ai_output_messages.py +38 -0
  410. mirascope/ops/_internal/instrumentation/llm/gen_ai_types/gen_ai_system_instructions.py +18 -0
  411. mirascope/ops/_internal/instrumentation/llm/gen_ai_types/shared.py +100 -0
  412. mirascope/ops/_internal/instrumentation/llm/llm.py +161 -0
  413. mirascope/ops/_internal/instrumentation/llm/model.py +1777 -0
  414. mirascope/ops/_internal/instrumentation/llm/response.py +521 -0
  415. mirascope/ops/_internal/instrumentation/llm/serialize.py +324 -0
  416. mirascope/ops/_internal/instrumentation/providers/__init__.py +29 -0
  417. mirascope/ops/_internal/instrumentation/providers/anthropic.py +78 -0
  418. mirascope/ops/_internal/instrumentation/providers/base.py +179 -0
  419. mirascope/ops/_internal/instrumentation/providers/google_genai.py +85 -0
  420. mirascope/ops/_internal/instrumentation/providers/openai.py +82 -0
  421. mirascope/ops/_internal/propagation.py +198 -0
  422. mirascope/ops/_internal/protocols.py +133 -0
  423. mirascope/ops/_internal/session.py +139 -0
  424. mirascope/ops/_internal/spans.py +232 -0
  425. mirascope/ops/_internal/traced_calls.py +389 -0
  426. mirascope/ops/_internal/traced_functions.py +528 -0
  427. mirascope/ops/_internal/tracing.py +353 -0
  428. mirascope/ops/_internal/types.py +13 -0
  429. mirascope/ops/_internal/utils.py +131 -0
  430. mirascope/ops/_internal/versioned_calls.py +512 -0
  431. mirascope/ops/_internal/versioned_functions.py +357 -0
  432. mirascope/ops/_internal/versioning.py +303 -0
  433. mirascope/ops/exceptions.py +21 -0
  434. mirascope-2.1.1.dist-info/METADATA +231 -0
  435. mirascope-2.1.1.dist-info/RECORD +437 -0
  436. mirascope-2.1.1.dist-info/WHEEL +4 -0
  437. mirascope-2.1.1.dist-info/licenses/LICENSE +21 -0
  438. mirascope/beta/__init__.py +0 -3
  439. mirascope/beta/openai/__init__.py +0 -17
  440. mirascope/beta/openai/realtime/__init__.py +0 -13
  441. mirascope/beta/openai/realtime/_utils/__init__.py +0 -3
  442. mirascope/beta/openai/realtime/_utils/_audio.py +0 -74
  443. mirascope/beta/openai/realtime/_utils/_protocols.py +0 -50
  444. mirascope/beta/openai/realtime/realtime.py +0 -500
  445. mirascope/beta/openai/realtime/recording.py +0 -98
  446. mirascope/beta/openai/realtime/tool.py +0 -113
  447. mirascope/beta/rag/__init__.py +0 -24
  448. mirascope/beta/rag/base/__init__.py +0 -22
  449. mirascope/beta/rag/base/chunkers/__init__.py +0 -2
  450. mirascope/beta/rag/base/chunkers/base_chunker.py +0 -37
  451. mirascope/beta/rag/base/chunkers/text_chunker.py +0 -33
  452. mirascope/beta/rag/base/config.py +0 -8
  453. mirascope/beta/rag/base/document.py +0 -11
  454. mirascope/beta/rag/base/embedders.py +0 -35
  455. mirascope/beta/rag/base/embedding_params.py +0 -18
  456. mirascope/beta/rag/base/embedding_response.py +0 -30
  457. mirascope/beta/rag/base/query_results.py +0 -7
  458. mirascope/beta/rag/base/vectorstore_params.py +0 -18
  459. mirascope/beta/rag/base/vectorstores.py +0 -37
  460. mirascope/beta/rag/chroma/__init__.py +0 -11
  461. mirascope/beta/rag/chroma/types.py +0 -57
  462. mirascope/beta/rag/chroma/vectorstores.py +0 -97
  463. mirascope/beta/rag/cohere/__init__.py +0 -11
  464. mirascope/beta/rag/cohere/embedders.py +0 -87
  465. mirascope/beta/rag/cohere/embedding_params.py +0 -29
  466. mirascope/beta/rag/cohere/embedding_response.py +0 -29
  467. mirascope/beta/rag/cohere/py.typed +0 -0
  468. mirascope/beta/rag/openai/__init__.py +0 -11
  469. mirascope/beta/rag/openai/embedders.py +0 -144
  470. mirascope/beta/rag/openai/embedding_params.py +0 -18
  471. mirascope/beta/rag/openai/embedding_response.py +0 -14
  472. mirascope/beta/rag/openai/py.typed +0 -0
  473. mirascope/beta/rag/pinecone/__init__.py +0 -19
  474. mirascope/beta/rag/pinecone/types.py +0 -143
  475. mirascope/beta/rag/pinecone/vectorstores.py +0 -148
  476. mirascope/beta/rag/weaviate/__init__.py +0 -6
  477. mirascope/beta/rag/weaviate/types.py +0 -92
  478. mirascope/beta/rag/weaviate/vectorstores.py +0 -103
  479. mirascope/core/__init__.py +0 -107
  480. mirascope/core/anthropic/__init__.py +0 -31
  481. mirascope/core/anthropic/_call.py +0 -67
  482. mirascope/core/anthropic/_call_kwargs.py +0 -13
  483. mirascope/core/anthropic/_utils/__init__.py +0 -16
  484. mirascope/core/anthropic/_utils/_convert_common_call_params.py +0 -25
  485. mirascope/core/anthropic/_utils/_convert_finish_reason_to_common_finish_reasons.py +0 -21
  486. mirascope/core/anthropic/_utils/_convert_message_params.py +0 -102
  487. mirascope/core/anthropic/_utils/_get_json_output.py +0 -31
  488. mirascope/core/anthropic/_utils/_handle_stream.py +0 -113
  489. mirascope/core/anthropic/_utils/_message_param_converter.py +0 -142
  490. mirascope/core/anthropic/_utils/_setup_call.py +0 -134
  491. mirascope/core/anthropic/call_params.py +0 -41
  492. mirascope/core/anthropic/call_response.py +0 -206
  493. mirascope/core/anthropic/call_response_chunk.py +0 -132
  494. mirascope/core/anthropic/dynamic_config.py +0 -40
  495. mirascope/core/anthropic/py.typed +0 -0
  496. mirascope/core/anthropic/stream.py +0 -147
  497. mirascope/core/anthropic/tool.py +0 -101
  498. mirascope/core/azure/__init__.py +0 -31
  499. mirascope/core/azure/_call.py +0 -67
  500. mirascope/core/azure/_call_kwargs.py +0 -13
  501. mirascope/core/azure/_utils/__init__.py +0 -14
  502. mirascope/core/azure/_utils/_convert_common_call_params.py +0 -26
  503. mirascope/core/azure/_utils/_convert_finish_reason_to_common_finish_reasons.py +0 -21
  504. mirascope/core/azure/_utils/_convert_message_params.py +0 -121
  505. mirascope/core/azure/_utils/_get_credential.py +0 -33
  506. mirascope/core/azure/_utils/_get_json_output.py +0 -27
  507. mirascope/core/azure/_utils/_handle_stream.py +0 -130
  508. mirascope/core/azure/_utils/_message_param_converter.py +0 -117
  509. mirascope/core/azure/_utils/_setup_call.py +0 -183
  510. mirascope/core/azure/call_params.py +0 -59
  511. mirascope/core/azure/call_response.py +0 -215
  512. mirascope/core/azure/call_response_chunk.py +0 -105
  513. mirascope/core/azure/dynamic_config.py +0 -30
  514. mirascope/core/azure/py.typed +0 -0
  515. mirascope/core/azure/stream.py +0 -147
  516. mirascope/core/azure/tool.py +0 -93
  517. mirascope/core/base/__init__.py +0 -84
  518. mirascope/core/base/_call_factory.py +0 -256
  519. mirascope/core/base/_create.py +0 -253
  520. mirascope/core/base/_extract.py +0 -175
  521. mirascope/core/base/_extract_with_tools.py +0 -189
  522. mirascope/core/base/_partial.py +0 -95
  523. mirascope/core/base/_utils/__init__.py +0 -92
  524. mirascope/core/base/_utils/_base_message_param_converter.py +0 -22
  525. mirascope/core/base/_utils/_base_type.py +0 -26
  526. mirascope/core/base/_utils/_convert_base_model_to_base_tool.py +0 -48
  527. mirascope/core/base/_utils/_convert_base_type_to_base_tool.py +0 -24
  528. mirascope/core/base/_utils/_convert_function_to_base_tool.py +0 -139
  529. mirascope/core/base/_utils/_convert_messages_to_message_params.py +0 -171
  530. mirascope/core/base/_utils/_convert_provider_finish_reason_to_finish_reason.py +0 -20
  531. mirascope/core/base/_utils/_default_tool_docstring.py +0 -6
  532. mirascope/core/base/_utils/_extract_tool_return.py +0 -42
  533. mirascope/core/base/_utils/_fn_is_async.py +0 -15
  534. mirascope/core/base/_utils/_format_template.py +0 -32
  535. mirascope/core/base/_utils/_get_audio_type.py +0 -18
  536. mirascope/core/base/_utils/_get_common_usage.py +0 -20
  537. mirascope/core/base/_utils/_get_create_fn_or_async_create_fn.py +0 -137
  538. mirascope/core/base/_utils/_get_document_type.py +0 -7
  539. mirascope/core/base/_utils/_get_dynamic_configuration.py +0 -69
  540. mirascope/core/base/_utils/_get_fields_from_call_args.py +0 -34
  541. mirascope/core/base/_utils/_get_fn_args.py +0 -23
  542. mirascope/core/base/_utils/_get_image_dimensions.py +0 -39
  543. mirascope/core/base/_utils/_get_image_type.py +0 -26
  544. mirascope/core/base/_utils/_get_metadata.py +0 -17
  545. mirascope/core/base/_utils/_get_possible_user_message_param.py +0 -21
  546. mirascope/core/base/_utils/_get_prompt_template.py +0 -28
  547. mirascope/core/base/_utils/_get_template_values.py +0 -51
  548. mirascope/core/base/_utils/_get_template_variables.py +0 -38
  549. mirascope/core/base/_utils/_get_unsupported_tool_config_keys.py +0 -10
  550. mirascope/core/base/_utils/_is_prompt_template.py +0 -24
  551. mirascope/core/base/_utils/_json_mode_content.py +0 -17
  552. mirascope/core/base/_utils/_messages_decorator.py +0 -121
  553. mirascope/core/base/_utils/_parse_content_template.py +0 -321
  554. mirascope/core/base/_utils/_parse_prompt_messages.py +0 -63
  555. mirascope/core/base/_utils/_pil_image_to_bytes.py +0 -13
  556. mirascope/core/base/_utils/_protocols.py +0 -901
  557. mirascope/core/base/_utils/_setup_call.py +0 -79
  558. mirascope/core/base/_utils/_setup_extract_tool.py +0 -30
  559. mirascope/core/base/call_kwargs.py +0 -13
  560. mirascope/core/base/call_params.py +0 -36
  561. mirascope/core/base/call_response.py +0 -340
  562. mirascope/core/base/call_response_chunk.py +0 -130
  563. mirascope/core/base/dynamic_config.py +0 -82
  564. mirascope/core/base/from_call_args.py +0 -30
  565. mirascope/core/base/merge_decorators.py +0 -59
  566. mirascope/core/base/message_param.py +0 -162
  567. mirascope/core/base/messages.py +0 -111
  568. mirascope/core/base/metadata.py +0 -13
  569. mirascope/core/base/prompt.py +0 -497
  570. mirascope/core/base/response_model_config_dict.py +0 -9
  571. mirascope/core/base/stream.py +0 -479
  572. mirascope/core/base/stream_config.py +0 -11
  573. mirascope/core/base/structured_stream.py +0 -296
  574. mirascope/core/base/tool.py +0 -205
  575. mirascope/core/base/toolkit.py +0 -176
  576. mirascope/core/base/types.py +0 -344
  577. mirascope/core/bedrock/__init__.py +0 -34
  578. mirascope/core/bedrock/_call.py +0 -68
  579. mirascope/core/bedrock/_call_kwargs.py +0 -12
  580. mirascope/core/bedrock/_types.py +0 -104
  581. mirascope/core/bedrock/_utils/__init__.py +0 -14
  582. mirascope/core/bedrock/_utils/_convert_common_call_params.py +0 -39
  583. mirascope/core/bedrock/_utils/_convert_finish_reason_to_common_finish_reasons.py +0 -23
  584. mirascope/core/bedrock/_utils/_convert_message_params.py +0 -111
  585. mirascope/core/bedrock/_utils/_get_json_output.py +0 -30
  586. mirascope/core/bedrock/_utils/_handle_stream.py +0 -104
  587. mirascope/core/bedrock/_utils/_message_param_converter.py +0 -171
  588. mirascope/core/bedrock/_utils/_setup_call.py +0 -258
  589. mirascope/core/bedrock/call_params.py +0 -38
  590. mirascope/core/bedrock/call_response.py +0 -249
  591. mirascope/core/bedrock/call_response_chunk.py +0 -111
  592. mirascope/core/bedrock/dynamic_config.py +0 -37
  593. mirascope/core/bedrock/py.typed +0 -0
  594. mirascope/core/bedrock/stream.py +0 -154
  595. mirascope/core/bedrock/tool.py +0 -96
  596. mirascope/core/cohere/__init__.py +0 -30
  597. mirascope/core/cohere/_call.py +0 -67
  598. mirascope/core/cohere/_call_kwargs.py +0 -11
  599. mirascope/core/cohere/_types.py +0 -20
  600. mirascope/core/cohere/_utils/__init__.py +0 -14
  601. mirascope/core/cohere/_utils/_convert_common_call_params.py +0 -26
  602. mirascope/core/cohere/_utils/_convert_finish_reason_to_common_finish_reasons.py +0 -24
  603. mirascope/core/cohere/_utils/_convert_message_params.py +0 -32
  604. mirascope/core/cohere/_utils/_get_json_output.py +0 -30
  605. mirascope/core/cohere/_utils/_handle_stream.py +0 -35
  606. mirascope/core/cohere/_utils/_message_param_converter.py +0 -54
  607. mirascope/core/cohere/_utils/_setup_call.py +0 -150
  608. mirascope/core/cohere/call_params.py +0 -62
  609. mirascope/core/cohere/call_response.py +0 -205
  610. mirascope/core/cohere/call_response_chunk.py +0 -125
  611. mirascope/core/cohere/dynamic_config.py +0 -32
  612. mirascope/core/cohere/py.typed +0 -0
  613. mirascope/core/cohere/stream.py +0 -113
  614. mirascope/core/cohere/tool.py +0 -93
  615. mirascope/core/costs/__init__.py +0 -5
  616. mirascope/core/costs/_anthropic_calculate_cost.py +0 -219
  617. mirascope/core/costs/_azure_calculate_cost.py +0 -11
  618. mirascope/core/costs/_bedrock_calculate_cost.py +0 -15
  619. mirascope/core/costs/_cohere_calculate_cost.py +0 -44
  620. mirascope/core/costs/_gemini_calculate_cost.py +0 -67
  621. mirascope/core/costs/_google_calculate_cost.py +0 -427
  622. mirascope/core/costs/_groq_calculate_cost.py +0 -156
  623. mirascope/core/costs/_litellm_calculate_cost.py +0 -11
  624. mirascope/core/costs/_mistral_calculate_cost.py +0 -64
  625. mirascope/core/costs/_openai_calculate_cost.py +0 -416
  626. mirascope/core/costs/_vertex_calculate_cost.py +0 -67
  627. mirascope/core/costs/_xai_calculate_cost.py +0 -104
  628. mirascope/core/costs/calculate_cost.py +0 -86
  629. mirascope/core/gemini/__init__.py +0 -40
  630. mirascope/core/gemini/_call.py +0 -67
  631. mirascope/core/gemini/_call_kwargs.py +0 -12
  632. mirascope/core/gemini/_utils/__init__.py +0 -14
  633. mirascope/core/gemini/_utils/_convert_common_call_params.py +0 -39
  634. mirascope/core/gemini/_utils/_convert_finish_reason_to_common_finish_reasons.py +0 -23
  635. mirascope/core/gemini/_utils/_convert_message_params.py +0 -156
  636. mirascope/core/gemini/_utils/_get_json_output.py +0 -35
  637. mirascope/core/gemini/_utils/_handle_stream.py +0 -33
  638. mirascope/core/gemini/_utils/_message_param_converter.py +0 -209
  639. mirascope/core/gemini/_utils/_setup_call.py +0 -149
  640. mirascope/core/gemini/call_params.py +0 -52
  641. mirascope/core/gemini/call_response.py +0 -216
  642. mirascope/core/gemini/call_response_chunk.py +0 -100
  643. mirascope/core/gemini/dynamic_config.py +0 -26
  644. mirascope/core/gemini/stream.py +0 -120
  645. mirascope/core/gemini/tool.py +0 -104
  646. mirascope/core/google/__init__.py +0 -29
  647. mirascope/core/google/_call.py +0 -67
  648. mirascope/core/google/_call_kwargs.py +0 -13
  649. mirascope/core/google/_utils/__init__.py +0 -14
  650. mirascope/core/google/_utils/_convert_common_call_params.py +0 -38
  651. mirascope/core/google/_utils/_convert_finish_reason_to_common_finish_reasons.py +0 -27
  652. mirascope/core/google/_utils/_convert_message_params.py +0 -206
  653. mirascope/core/google/_utils/_get_json_output.py +0 -37
  654. mirascope/core/google/_utils/_handle_stream.py +0 -35
  655. mirascope/core/google/_utils/_message_param_converter.py +0 -162
  656. mirascope/core/google/_utils/_setup_call.py +0 -201
  657. mirascope/core/google/_utils/_validate_media_type.py +0 -34
  658. mirascope/core/google/call_params.py +0 -22
  659. mirascope/core/google/call_response.py +0 -232
  660. mirascope/core/google/call_response_chunk.py +0 -110
  661. mirascope/core/google/dynamic_config.py +0 -26
  662. mirascope/core/google/stream.py +0 -143
  663. mirascope/core/google/tool.py +0 -146
  664. mirascope/core/groq/__init__.py +0 -30
  665. mirascope/core/groq/_call.py +0 -67
  666. mirascope/core/groq/_call_kwargs.py +0 -13
  667. mirascope/core/groq/_utils/__init__.py +0 -14
  668. mirascope/core/groq/_utils/_convert_common_call_params.py +0 -26
  669. mirascope/core/groq/_utils/_convert_message_params.py +0 -112
  670. mirascope/core/groq/_utils/_get_json_output.py +0 -27
  671. mirascope/core/groq/_utils/_handle_stream.py +0 -123
  672. mirascope/core/groq/_utils/_message_param_converter.py +0 -89
  673. mirascope/core/groq/_utils/_setup_call.py +0 -132
  674. mirascope/core/groq/call_params.py +0 -52
  675. mirascope/core/groq/call_response.py +0 -213
  676. mirascope/core/groq/call_response_chunk.py +0 -104
  677. mirascope/core/groq/dynamic_config.py +0 -29
  678. mirascope/core/groq/py.typed +0 -0
  679. mirascope/core/groq/stream.py +0 -135
  680. mirascope/core/groq/tool.py +0 -80
  681. mirascope/core/litellm/__init__.py +0 -28
  682. mirascope/core/litellm/_call.py +0 -67
  683. mirascope/core/litellm/_utils/__init__.py +0 -5
  684. mirascope/core/litellm/_utils/_setup_call.py +0 -109
  685. mirascope/core/litellm/call_params.py +0 -10
  686. mirascope/core/litellm/call_response.py +0 -24
  687. mirascope/core/litellm/call_response_chunk.py +0 -14
  688. mirascope/core/litellm/dynamic_config.py +0 -8
  689. mirascope/core/litellm/py.typed +0 -0
  690. mirascope/core/litellm/stream.py +0 -86
  691. mirascope/core/litellm/tool.py +0 -13
  692. mirascope/core/mistral/__init__.py +0 -36
  693. mirascope/core/mistral/_call.py +0 -65
  694. mirascope/core/mistral/_call_kwargs.py +0 -19
  695. mirascope/core/mistral/_utils/__init__.py +0 -14
  696. mirascope/core/mistral/_utils/_convert_common_call_params.py +0 -24
  697. mirascope/core/mistral/_utils/_convert_finish_reason_to_common_finish_reasons.py +0 -22
  698. mirascope/core/mistral/_utils/_convert_message_params.py +0 -122
  699. mirascope/core/mistral/_utils/_get_json_output.py +0 -34
  700. mirascope/core/mistral/_utils/_handle_stream.py +0 -139
  701. mirascope/core/mistral/_utils/_message_param_converter.py +0 -176
  702. mirascope/core/mistral/_utils/_setup_call.py +0 -154
  703. mirascope/core/mistral/call_params.py +0 -36
  704. mirascope/core/mistral/call_response.py +0 -205
  705. mirascope/core/mistral/call_response_chunk.py +0 -105
  706. mirascope/core/mistral/dynamic_config.py +0 -33
  707. mirascope/core/mistral/py.typed +0 -0
  708. mirascope/core/mistral/stream.py +0 -120
  709. mirascope/core/mistral/tool.py +0 -80
  710. mirascope/core/openai/__init__.py +0 -31
  711. mirascope/core/openai/_call.py +0 -67
  712. mirascope/core/openai/_call_kwargs.py +0 -13
  713. mirascope/core/openai/_utils/__init__.py +0 -14
  714. mirascope/core/openai/_utils/_convert_common_call_params.py +0 -26
  715. mirascope/core/openai/_utils/_convert_message_params.py +0 -146
  716. mirascope/core/openai/_utils/_get_json_output.py +0 -31
  717. mirascope/core/openai/_utils/_handle_stream.py +0 -138
  718. mirascope/core/openai/_utils/_message_param_converter.py +0 -105
  719. mirascope/core/openai/_utils/_setup_call.py +0 -155
  720. mirascope/core/openai/call_params.py +0 -91
  721. mirascope/core/openai/call_response.py +0 -273
  722. mirascope/core/openai/call_response_chunk.py +0 -139
  723. mirascope/core/openai/dynamic_config.py +0 -34
  724. mirascope/core/openai/py.typed +0 -0
  725. mirascope/core/openai/stream.py +0 -185
  726. mirascope/core/openai/tool.py +0 -101
  727. mirascope/core/py.typed +0 -0
  728. mirascope/core/vertex/__init__.py +0 -45
  729. mirascope/core/vertex/_call.py +0 -62
  730. mirascope/core/vertex/_call_kwargs.py +0 -12
  731. mirascope/core/vertex/_utils/__init__.py +0 -14
  732. mirascope/core/vertex/_utils/_convert_common_call_params.py +0 -37
  733. mirascope/core/vertex/_utils/_convert_finish_reason_to_common_finish_reasons.py +0 -23
  734. mirascope/core/vertex/_utils/_convert_message_params.py +0 -171
  735. mirascope/core/vertex/_utils/_get_json_output.py +0 -36
  736. mirascope/core/vertex/_utils/_handle_stream.py +0 -33
  737. mirascope/core/vertex/_utils/_message_param_converter.py +0 -133
  738. mirascope/core/vertex/_utils/_setup_call.py +0 -160
  739. mirascope/core/vertex/call_params.py +0 -24
  740. mirascope/core/vertex/call_response.py +0 -206
  741. mirascope/core/vertex/call_response_chunk.py +0 -99
  742. mirascope/core/vertex/dynamic_config.py +0 -28
  743. mirascope/core/vertex/stream.py +0 -119
  744. mirascope/core/vertex/tool.py +0 -101
  745. mirascope/core/xai/__init__.py +0 -28
  746. mirascope/core/xai/_call.py +0 -67
  747. mirascope/core/xai/_utils/__init__.py +0 -5
  748. mirascope/core/xai/_utils/_setup_call.py +0 -113
  749. mirascope/core/xai/call_params.py +0 -10
  750. mirascope/core/xai/call_response.py +0 -16
  751. mirascope/core/xai/call_response_chunk.py +0 -14
  752. mirascope/core/xai/dynamic_config.py +0 -8
  753. mirascope/core/xai/py.typed +0 -0
  754. mirascope/core/xai/stream.py +0 -57
  755. mirascope/core/xai/tool.py +0 -13
  756. mirascope/experimental/graphs/__init__.py +0 -5
  757. mirascope/experimental/graphs/finite_state_machine.py +0 -714
  758. mirascope/integrations/__init__.py +0 -16
  759. mirascope/integrations/_middleware_factory.py +0 -403
  760. mirascope/integrations/langfuse/__init__.py +0 -3
  761. mirascope/integrations/langfuse/_utils.py +0 -114
  762. mirascope/integrations/langfuse/_with_langfuse.py +0 -70
  763. mirascope/integrations/logfire/__init__.py +0 -3
  764. mirascope/integrations/logfire/_utils.py +0 -225
  765. mirascope/integrations/logfire/_with_logfire.py +0 -63
  766. mirascope/integrations/otel/__init__.py +0 -10
  767. mirascope/integrations/otel/_utils.py +0 -270
  768. mirascope/integrations/otel/_with_hyperdx.py +0 -60
  769. mirascope/integrations/otel/_with_otel.py +0 -59
  770. mirascope/integrations/tenacity.py +0 -14
  771. mirascope/llm/_call.py +0 -401
  772. mirascope/llm/_context.py +0 -384
  773. mirascope/llm/_override.py +0 -3639
  774. mirascope/llm/_protocols.py +0 -500
  775. mirascope/llm/_response_metaclass.py +0 -31
  776. mirascope/llm/call_response.py +0 -167
  777. mirascope/llm/call_response_chunk.py +0 -66
  778. mirascope/llm/stream.py +0 -162
  779. mirascope/llm/tool.py +0 -64
  780. mirascope/mcp/__init__.py +0 -7
  781. mirascope/mcp/_utils.py +0 -277
  782. mirascope/mcp/client.py +0 -167
  783. mirascope/mcp/server.py +0 -356
  784. mirascope/mcp/tools.py +0 -110
  785. mirascope/py.typed +0 -0
  786. mirascope/retries/__init__.py +0 -11
  787. mirascope/retries/fallback.py +0 -128
  788. mirascope/retries/tenacity.py +0 -50
  789. mirascope/tools/__init__.py +0 -37
  790. mirascope/tools/base.py +0 -98
  791. mirascope/tools/system/__init__.py +0 -0
  792. mirascope/tools/system/_docker_operation.py +0 -166
  793. mirascope/tools/system/_file_system.py +0 -267
  794. mirascope/tools/web/__init__.py +0 -0
  795. mirascope/tools/web/_duckduckgo.py +0 -111
  796. mirascope/tools/web/_httpx.py +0 -125
  797. mirascope/tools/web/_parse_url_content.py +0 -94
  798. mirascope/tools/web/_requests.py +0 -54
  799. mirascope/v0/__init__.py +0 -43
  800. mirascope/v0/anthropic.py +0 -54
  801. mirascope/v0/base/__init__.py +0 -12
  802. mirascope/v0/base/calls.py +0 -118
  803. mirascope/v0/base/extractors.py +0 -122
  804. mirascope/v0/base/ops_utils.py +0 -207
  805. mirascope/v0/base/prompts.py +0 -48
  806. mirascope/v0/base/types.py +0 -14
  807. mirascope/v0/base/utils.py +0 -21
  808. mirascope/v0/openai.py +0 -54
  809. mirascope-1.22.4.dist-info/METADATA +0 -169
  810. mirascope-1.22.4.dist-info/RECORD +0 -377
  811. mirascope-1.22.4.dist-info/WHEEL +0 -4
  812. mirascope-1.22.4.dist-info/licenses/LICENSE +0 -21
@@ -0,0 +1,1567 @@
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.environments_create_response import EnvironmentsCreateResponse
23
+ from .types.environments_get_analytics_response import EnvironmentsGetAnalyticsResponse
24
+ from .types.environments_get_response import EnvironmentsGetResponse
25
+ from .types.environments_list_response_item import EnvironmentsListResponseItem
26
+ from .types.environments_update_response import EnvironmentsUpdateResponse
27
+
28
+ # this is used as the default value for optional parameters
29
+ OMIT = typing.cast(typing.Any, ...)
30
+
31
+
32
+ class RawEnvironmentsClient:
33
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
34
+ self._client_wrapper = client_wrapper
35
+
36
+ def list(
37
+ self,
38
+ organization_id: str,
39
+ project_id: str,
40
+ *,
41
+ request_options: typing.Optional[RequestOptions] = None,
42
+ ) -> HttpResponse[typing.List[EnvironmentsListResponseItem]]:
43
+ """
44
+ Parameters
45
+ ----------
46
+ organization_id : str
47
+
48
+ project_id : str
49
+
50
+ request_options : typing.Optional[RequestOptions]
51
+ Request-specific configuration.
52
+
53
+ Returns
54
+ -------
55
+ HttpResponse[typing.List[EnvironmentsListResponseItem]]
56
+ Success
57
+ """
58
+ _response = self._client_wrapper.httpx_client.request(
59
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments",
60
+ method="GET",
61
+ request_options=request_options,
62
+ )
63
+ try:
64
+ if 200 <= _response.status_code < 300:
65
+ _data = typing.cast(
66
+ typing.List[EnvironmentsListResponseItem],
67
+ parse_obj_as(
68
+ type_=typing.List[EnvironmentsListResponseItem], # type: ignore
69
+ object_=_response.json(),
70
+ ),
71
+ )
72
+ return HttpResponse(response=_response, data=_data)
73
+ if _response.status_code == 400:
74
+ raise BadRequestError(
75
+ headers=dict(_response.headers),
76
+ body=typing.cast(
77
+ typing.Optional[typing.Any],
78
+ parse_obj_as(
79
+ type_=typing.Optional[typing.Any], # type: ignore
80
+ object_=_response.json(),
81
+ ),
82
+ ),
83
+ )
84
+ if _response.status_code == 403:
85
+ raise ForbiddenError(
86
+ headers=dict(_response.headers),
87
+ body=typing.cast(
88
+ PermissionDeniedError,
89
+ parse_obj_as(
90
+ type_=PermissionDeniedError, # type: ignore
91
+ object_=_response.json(),
92
+ ),
93
+ ),
94
+ )
95
+ if _response.status_code == 404:
96
+ raise NotFoundError(
97
+ headers=dict(_response.headers),
98
+ body=typing.cast(
99
+ NotFoundErrorBody,
100
+ parse_obj_as(
101
+ type_=NotFoundErrorBody, # type: ignore
102
+ object_=_response.json(),
103
+ ),
104
+ ),
105
+ )
106
+ if _response.status_code == 429:
107
+ raise TooManyRequestsError(
108
+ headers=dict(_response.headers),
109
+ body=typing.cast(
110
+ RateLimitError,
111
+ parse_obj_as(
112
+ type_=RateLimitError, # type: ignore
113
+ object_=_response.json(),
114
+ ),
115
+ ),
116
+ )
117
+ if _response.status_code == 500:
118
+ raise InternalServerError(
119
+ headers=dict(_response.headers),
120
+ body=typing.cast(
121
+ typing.Optional[typing.Any],
122
+ parse_obj_as(
123
+ type_=typing.Optional[typing.Any], # type: ignore
124
+ object_=_response.json(),
125
+ ),
126
+ ),
127
+ )
128
+ if _response.status_code == 503:
129
+ raise ServiceUnavailableError(
130
+ headers=dict(_response.headers),
131
+ body=typing.cast(
132
+ typing.Optional[typing.Any],
133
+ parse_obj_as(
134
+ type_=typing.Optional[typing.Any], # type: ignore
135
+ object_=_response.json(),
136
+ ),
137
+ ),
138
+ )
139
+ _response_json = _response.json()
140
+ except JSONDecodeError:
141
+ raise ApiError(
142
+ status_code=_response.status_code,
143
+ headers=dict(_response.headers),
144
+ body=_response.text,
145
+ )
146
+ raise ApiError(
147
+ status_code=_response.status_code,
148
+ headers=dict(_response.headers),
149
+ body=_response_json,
150
+ )
151
+
152
+ def create(
153
+ self,
154
+ organization_id: str,
155
+ project_id: str,
156
+ *,
157
+ name: str,
158
+ slug: str,
159
+ request_options: typing.Optional[RequestOptions] = None,
160
+ ) -> HttpResponse[EnvironmentsCreateResponse]:
161
+ """
162
+ Parameters
163
+ ----------
164
+ organization_id : str
165
+
166
+ project_id : str
167
+
168
+ name : str
169
+ a string at most 100 character(s) long
170
+
171
+ slug : str
172
+ a string matching the pattern ^[a-z0-9][a-z0-9_-]*[a-z0-9]$
173
+
174
+ request_options : typing.Optional[RequestOptions]
175
+ Request-specific configuration.
176
+
177
+ Returns
178
+ -------
179
+ HttpResponse[EnvironmentsCreateResponse]
180
+ Success
181
+ """
182
+ _response = self._client_wrapper.httpx_client.request(
183
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments",
184
+ method="POST",
185
+ json={
186
+ "name": name,
187
+ "slug": slug,
188
+ },
189
+ headers={
190
+ "content-type": "application/json",
191
+ },
192
+ request_options=request_options,
193
+ omit=OMIT,
194
+ )
195
+ try:
196
+ if 200 <= _response.status_code < 300:
197
+ _data = typing.cast(
198
+ EnvironmentsCreateResponse,
199
+ parse_obj_as(
200
+ type_=EnvironmentsCreateResponse, # type: ignore
201
+ object_=_response.json(),
202
+ ),
203
+ )
204
+ return HttpResponse(response=_response, data=_data)
205
+ if _response.status_code == 400:
206
+ raise BadRequestError(
207
+ headers=dict(_response.headers),
208
+ body=typing.cast(
209
+ typing.Optional[typing.Any],
210
+ parse_obj_as(
211
+ type_=typing.Optional[typing.Any], # type: ignore
212
+ object_=_response.json(),
213
+ ),
214
+ ),
215
+ )
216
+ if _response.status_code == 403:
217
+ raise ForbiddenError(
218
+ headers=dict(_response.headers),
219
+ body=typing.cast(
220
+ PermissionDeniedError,
221
+ parse_obj_as(
222
+ type_=PermissionDeniedError, # type: ignore
223
+ object_=_response.json(),
224
+ ),
225
+ ),
226
+ )
227
+ if _response.status_code == 404:
228
+ raise NotFoundError(
229
+ headers=dict(_response.headers),
230
+ body=typing.cast(
231
+ NotFoundErrorBody,
232
+ parse_obj_as(
233
+ type_=NotFoundErrorBody, # type: ignore
234
+ object_=_response.json(),
235
+ ),
236
+ ),
237
+ )
238
+ if _response.status_code == 409:
239
+ raise ConflictError(
240
+ headers=dict(_response.headers),
241
+ body=typing.cast(
242
+ typing.Optional[typing.Any],
243
+ parse_obj_as(
244
+ type_=typing.Optional[typing.Any], # type: ignore
245
+ object_=_response.json(),
246
+ ),
247
+ ),
248
+ )
249
+ if _response.status_code == 429:
250
+ raise TooManyRequestsError(
251
+ headers=dict(_response.headers),
252
+ body=typing.cast(
253
+ RateLimitError,
254
+ parse_obj_as(
255
+ type_=RateLimitError, # type: ignore
256
+ object_=_response.json(),
257
+ ),
258
+ ),
259
+ )
260
+ if _response.status_code == 500:
261
+ raise InternalServerError(
262
+ headers=dict(_response.headers),
263
+ body=typing.cast(
264
+ typing.Optional[typing.Any],
265
+ parse_obj_as(
266
+ type_=typing.Optional[typing.Any], # type: ignore
267
+ object_=_response.json(),
268
+ ),
269
+ ),
270
+ )
271
+ if _response.status_code == 503:
272
+ raise ServiceUnavailableError(
273
+ headers=dict(_response.headers),
274
+ body=typing.cast(
275
+ typing.Optional[typing.Any],
276
+ parse_obj_as(
277
+ type_=typing.Optional[typing.Any], # type: ignore
278
+ object_=_response.json(),
279
+ ),
280
+ ),
281
+ )
282
+ _response_json = _response.json()
283
+ except JSONDecodeError:
284
+ raise ApiError(
285
+ status_code=_response.status_code,
286
+ headers=dict(_response.headers),
287
+ body=_response.text,
288
+ )
289
+ raise ApiError(
290
+ status_code=_response.status_code,
291
+ headers=dict(_response.headers),
292
+ body=_response_json,
293
+ )
294
+
295
+ def get(
296
+ self,
297
+ organization_id: str,
298
+ project_id: str,
299
+ environment_id: str,
300
+ *,
301
+ request_options: typing.Optional[RequestOptions] = None,
302
+ ) -> HttpResponse[EnvironmentsGetResponse]:
303
+ """
304
+ Parameters
305
+ ----------
306
+ organization_id : str
307
+
308
+ project_id : str
309
+
310
+ environment_id : str
311
+
312
+ request_options : typing.Optional[RequestOptions]
313
+ Request-specific configuration.
314
+
315
+ Returns
316
+ -------
317
+ HttpResponse[EnvironmentsGetResponse]
318
+ Success
319
+ """
320
+ _response = self._client_wrapper.httpx_client.request(
321
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments/{jsonable_encoder(environment_id)}",
322
+ method="GET",
323
+ request_options=request_options,
324
+ )
325
+ try:
326
+ if 200 <= _response.status_code < 300:
327
+ _data = typing.cast(
328
+ EnvironmentsGetResponse,
329
+ parse_obj_as(
330
+ type_=EnvironmentsGetResponse, # type: ignore
331
+ object_=_response.json(),
332
+ ),
333
+ )
334
+ return HttpResponse(response=_response, data=_data)
335
+ if _response.status_code == 400:
336
+ raise BadRequestError(
337
+ headers=dict(_response.headers),
338
+ body=typing.cast(
339
+ typing.Optional[typing.Any],
340
+ parse_obj_as(
341
+ type_=typing.Optional[typing.Any], # type: ignore
342
+ object_=_response.json(),
343
+ ),
344
+ ),
345
+ )
346
+ if _response.status_code == 403:
347
+ raise ForbiddenError(
348
+ headers=dict(_response.headers),
349
+ body=typing.cast(
350
+ PermissionDeniedError,
351
+ parse_obj_as(
352
+ type_=PermissionDeniedError, # type: ignore
353
+ object_=_response.json(),
354
+ ),
355
+ ),
356
+ )
357
+ if _response.status_code == 404:
358
+ raise NotFoundError(
359
+ headers=dict(_response.headers),
360
+ body=typing.cast(
361
+ NotFoundErrorBody,
362
+ parse_obj_as(
363
+ type_=NotFoundErrorBody, # type: ignore
364
+ object_=_response.json(),
365
+ ),
366
+ ),
367
+ )
368
+ if _response.status_code == 429:
369
+ raise TooManyRequestsError(
370
+ headers=dict(_response.headers),
371
+ body=typing.cast(
372
+ RateLimitError,
373
+ parse_obj_as(
374
+ type_=RateLimitError, # type: ignore
375
+ object_=_response.json(),
376
+ ),
377
+ ),
378
+ )
379
+ if _response.status_code == 500:
380
+ raise InternalServerError(
381
+ headers=dict(_response.headers),
382
+ body=typing.cast(
383
+ typing.Optional[typing.Any],
384
+ parse_obj_as(
385
+ type_=typing.Optional[typing.Any], # type: ignore
386
+ object_=_response.json(),
387
+ ),
388
+ ),
389
+ )
390
+ if _response.status_code == 503:
391
+ raise ServiceUnavailableError(
392
+ headers=dict(_response.headers),
393
+ body=typing.cast(
394
+ typing.Optional[typing.Any],
395
+ parse_obj_as(
396
+ type_=typing.Optional[typing.Any], # type: ignore
397
+ object_=_response.json(),
398
+ ),
399
+ ),
400
+ )
401
+ _response_json = _response.json()
402
+ except JSONDecodeError:
403
+ raise ApiError(
404
+ status_code=_response.status_code,
405
+ headers=dict(_response.headers),
406
+ body=_response.text,
407
+ )
408
+ raise ApiError(
409
+ status_code=_response.status_code,
410
+ headers=dict(_response.headers),
411
+ body=_response_json,
412
+ )
413
+
414
+ def update(
415
+ self,
416
+ organization_id: str,
417
+ project_id: str,
418
+ environment_id: str,
419
+ *,
420
+ name: typing.Optional[str] = OMIT,
421
+ slug: typing.Optional[str] = OMIT,
422
+ request_options: typing.Optional[RequestOptions] = None,
423
+ ) -> HttpResponse[EnvironmentsUpdateResponse]:
424
+ """
425
+ Parameters
426
+ ----------
427
+ organization_id : str
428
+
429
+ project_id : str
430
+
431
+ environment_id : str
432
+
433
+ name : typing.Optional[str]
434
+ a string at most 100 character(s) long
435
+
436
+ slug : typing.Optional[str]
437
+ a string matching the pattern ^[a-z0-9][a-z0-9_-]*[a-z0-9]$
438
+
439
+ request_options : typing.Optional[RequestOptions]
440
+ Request-specific configuration.
441
+
442
+ Returns
443
+ -------
444
+ HttpResponse[EnvironmentsUpdateResponse]
445
+ Success
446
+ """
447
+ _response = self._client_wrapper.httpx_client.request(
448
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments/{jsonable_encoder(environment_id)}",
449
+ method="PUT",
450
+ json={
451
+ "name": name,
452
+ "slug": slug,
453
+ },
454
+ headers={
455
+ "content-type": "application/json",
456
+ },
457
+ request_options=request_options,
458
+ omit=OMIT,
459
+ )
460
+ try:
461
+ if 200 <= _response.status_code < 300:
462
+ _data = typing.cast(
463
+ EnvironmentsUpdateResponse,
464
+ parse_obj_as(
465
+ type_=EnvironmentsUpdateResponse, # type: ignore
466
+ object_=_response.json(),
467
+ ),
468
+ )
469
+ return HttpResponse(response=_response, data=_data)
470
+ if _response.status_code == 400:
471
+ raise BadRequestError(
472
+ headers=dict(_response.headers),
473
+ body=typing.cast(
474
+ typing.Optional[typing.Any],
475
+ parse_obj_as(
476
+ type_=typing.Optional[typing.Any], # type: ignore
477
+ object_=_response.json(),
478
+ ),
479
+ ),
480
+ )
481
+ if _response.status_code == 403:
482
+ raise ForbiddenError(
483
+ headers=dict(_response.headers),
484
+ body=typing.cast(
485
+ PermissionDeniedError,
486
+ parse_obj_as(
487
+ type_=PermissionDeniedError, # type: ignore
488
+ object_=_response.json(),
489
+ ),
490
+ ),
491
+ )
492
+ if _response.status_code == 404:
493
+ raise NotFoundError(
494
+ headers=dict(_response.headers),
495
+ body=typing.cast(
496
+ NotFoundErrorBody,
497
+ parse_obj_as(
498
+ type_=NotFoundErrorBody, # type: ignore
499
+ object_=_response.json(),
500
+ ),
501
+ ),
502
+ )
503
+ if _response.status_code == 409:
504
+ raise ConflictError(
505
+ headers=dict(_response.headers),
506
+ body=typing.cast(
507
+ typing.Optional[typing.Any],
508
+ parse_obj_as(
509
+ type_=typing.Optional[typing.Any], # type: ignore
510
+ object_=_response.json(),
511
+ ),
512
+ ),
513
+ )
514
+ if _response.status_code == 429:
515
+ raise TooManyRequestsError(
516
+ headers=dict(_response.headers),
517
+ body=typing.cast(
518
+ RateLimitError,
519
+ parse_obj_as(
520
+ type_=RateLimitError, # type: ignore
521
+ object_=_response.json(),
522
+ ),
523
+ ),
524
+ )
525
+ if _response.status_code == 500:
526
+ raise InternalServerError(
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
+ if _response.status_code == 503:
537
+ raise ServiceUnavailableError(
538
+ headers=dict(_response.headers),
539
+ body=typing.cast(
540
+ typing.Optional[typing.Any],
541
+ parse_obj_as(
542
+ type_=typing.Optional[typing.Any], # type: ignore
543
+ object_=_response.json(),
544
+ ),
545
+ ),
546
+ )
547
+ _response_json = _response.json()
548
+ except JSONDecodeError:
549
+ raise ApiError(
550
+ status_code=_response.status_code,
551
+ headers=dict(_response.headers),
552
+ body=_response.text,
553
+ )
554
+ raise ApiError(
555
+ status_code=_response.status_code,
556
+ headers=dict(_response.headers),
557
+ body=_response_json,
558
+ )
559
+
560
+ def delete(
561
+ self,
562
+ organization_id: str,
563
+ project_id: str,
564
+ environment_id: str,
565
+ *,
566
+ request_options: typing.Optional[RequestOptions] = None,
567
+ ) -> HttpResponse[None]:
568
+ """
569
+ Parameters
570
+ ----------
571
+ organization_id : str
572
+
573
+ project_id : str
574
+
575
+ environment_id : str
576
+
577
+ request_options : typing.Optional[RequestOptions]
578
+ Request-specific configuration.
579
+
580
+ Returns
581
+ -------
582
+ HttpResponse[None]
583
+ """
584
+ _response = self._client_wrapper.httpx_client.request(
585
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments/{jsonable_encoder(environment_id)}",
586
+ method="DELETE",
587
+ request_options=request_options,
588
+ )
589
+ try:
590
+ if 200 <= _response.status_code < 300:
591
+ return HttpResponse(response=_response, data=None)
592
+ if _response.status_code == 400:
593
+ raise BadRequestError(
594
+ headers=dict(_response.headers),
595
+ body=typing.cast(
596
+ typing.Optional[typing.Any],
597
+ parse_obj_as(
598
+ type_=typing.Optional[typing.Any], # type: ignore
599
+ object_=_response.json(),
600
+ ),
601
+ ),
602
+ )
603
+ if _response.status_code == 403:
604
+ raise ForbiddenError(
605
+ headers=dict(_response.headers),
606
+ body=typing.cast(
607
+ PermissionDeniedError,
608
+ parse_obj_as(
609
+ type_=PermissionDeniedError, # type: ignore
610
+ object_=_response.json(),
611
+ ),
612
+ ),
613
+ )
614
+ if _response.status_code == 404:
615
+ raise NotFoundError(
616
+ headers=dict(_response.headers),
617
+ body=typing.cast(
618
+ NotFoundErrorBody,
619
+ parse_obj_as(
620
+ type_=NotFoundErrorBody, # type: ignore
621
+ object_=_response.json(),
622
+ ),
623
+ ),
624
+ )
625
+ if _response.status_code == 429:
626
+ raise TooManyRequestsError(
627
+ headers=dict(_response.headers),
628
+ body=typing.cast(
629
+ RateLimitError,
630
+ parse_obj_as(
631
+ type_=RateLimitError, # type: ignore
632
+ object_=_response.json(),
633
+ ),
634
+ ),
635
+ )
636
+ if _response.status_code == 500:
637
+ raise InternalServerError(
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
+ if _response.status_code == 503:
648
+ raise ServiceUnavailableError(
649
+ headers=dict(_response.headers),
650
+ body=typing.cast(
651
+ typing.Optional[typing.Any],
652
+ parse_obj_as(
653
+ type_=typing.Optional[typing.Any], # type: ignore
654
+ object_=_response.json(),
655
+ ),
656
+ ),
657
+ )
658
+ _response_json = _response.json()
659
+ except JSONDecodeError:
660
+ raise ApiError(
661
+ status_code=_response.status_code,
662
+ headers=dict(_response.headers),
663
+ body=_response.text,
664
+ )
665
+ raise ApiError(
666
+ status_code=_response.status_code,
667
+ headers=dict(_response.headers),
668
+ body=_response_json,
669
+ )
670
+
671
+ def getanalytics(
672
+ self,
673
+ organization_id: str,
674
+ project_id: str,
675
+ environment_id: str,
676
+ *,
677
+ start_time: str,
678
+ end_time: str,
679
+ request_options: typing.Optional[RequestOptions] = None,
680
+ ) -> HttpResponse[EnvironmentsGetAnalyticsResponse]:
681
+ """
682
+ Parameters
683
+ ----------
684
+ organization_id : str
685
+
686
+ project_id : str
687
+
688
+ environment_id : str
689
+
690
+ start_time : str
691
+
692
+ end_time : str
693
+
694
+ request_options : typing.Optional[RequestOptions]
695
+ Request-specific configuration.
696
+
697
+ Returns
698
+ -------
699
+ HttpResponse[EnvironmentsGetAnalyticsResponse]
700
+ Success
701
+ """
702
+ _response = self._client_wrapper.httpx_client.request(
703
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments/{jsonable_encoder(environment_id)}/analytics",
704
+ method="GET",
705
+ params={
706
+ "startTime": start_time,
707
+ "endTime": end_time,
708
+ },
709
+ request_options=request_options,
710
+ )
711
+ try:
712
+ if 200 <= _response.status_code < 300:
713
+ _data = typing.cast(
714
+ EnvironmentsGetAnalyticsResponse,
715
+ parse_obj_as(
716
+ type_=EnvironmentsGetAnalyticsResponse, # type: ignore
717
+ object_=_response.json(),
718
+ ),
719
+ )
720
+ return HttpResponse(response=_response, data=_data)
721
+ if _response.status_code == 400:
722
+ raise BadRequestError(
723
+ headers=dict(_response.headers),
724
+ body=typing.cast(
725
+ typing.Optional[typing.Any],
726
+ parse_obj_as(
727
+ type_=typing.Optional[typing.Any], # type: ignore
728
+ object_=_response.json(),
729
+ ),
730
+ ),
731
+ )
732
+ if _response.status_code == 403:
733
+ raise ForbiddenError(
734
+ headers=dict(_response.headers),
735
+ body=typing.cast(
736
+ PermissionDeniedError,
737
+ parse_obj_as(
738
+ type_=PermissionDeniedError, # type: ignore
739
+ object_=_response.json(),
740
+ ),
741
+ ),
742
+ )
743
+ if _response.status_code == 404:
744
+ raise NotFoundError(
745
+ headers=dict(_response.headers),
746
+ body=typing.cast(
747
+ NotFoundErrorBody,
748
+ parse_obj_as(
749
+ type_=NotFoundErrorBody, # type: ignore
750
+ object_=_response.json(),
751
+ ),
752
+ ),
753
+ )
754
+ if _response.status_code == 429:
755
+ raise TooManyRequestsError(
756
+ headers=dict(_response.headers),
757
+ body=typing.cast(
758
+ RateLimitError,
759
+ parse_obj_as(
760
+ type_=RateLimitError, # type: ignore
761
+ object_=_response.json(),
762
+ ),
763
+ ),
764
+ )
765
+ if _response.status_code == 500:
766
+ raise InternalServerError(
767
+ headers=dict(_response.headers),
768
+ body=typing.cast(
769
+ typing.Optional[typing.Any],
770
+ parse_obj_as(
771
+ type_=typing.Optional[typing.Any], # type: ignore
772
+ object_=_response.json(),
773
+ ),
774
+ ),
775
+ )
776
+ if _response.status_code == 503:
777
+ raise ServiceUnavailableError(
778
+ headers=dict(_response.headers),
779
+ body=typing.cast(
780
+ typing.Optional[typing.Any],
781
+ parse_obj_as(
782
+ type_=typing.Optional[typing.Any], # type: ignore
783
+ object_=_response.json(),
784
+ ),
785
+ ),
786
+ )
787
+ _response_json = _response.json()
788
+ except JSONDecodeError:
789
+ raise ApiError(
790
+ status_code=_response.status_code,
791
+ headers=dict(_response.headers),
792
+ body=_response.text,
793
+ )
794
+ raise ApiError(
795
+ status_code=_response.status_code,
796
+ headers=dict(_response.headers),
797
+ body=_response_json,
798
+ )
799
+
800
+
801
+ class AsyncRawEnvironmentsClient:
802
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
803
+ self._client_wrapper = client_wrapper
804
+
805
+ async def list(
806
+ self,
807
+ organization_id: str,
808
+ project_id: str,
809
+ *,
810
+ request_options: typing.Optional[RequestOptions] = None,
811
+ ) -> AsyncHttpResponse[typing.List[EnvironmentsListResponseItem]]:
812
+ """
813
+ Parameters
814
+ ----------
815
+ organization_id : str
816
+
817
+ project_id : str
818
+
819
+ request_options : typing.Optional[RequestOptions]
820
+ Request-specific configuration.
821
+
822
+ Returns
823
+ -------
824
+ AsyncHttpResponse[typing.List[EnvironmentsListResponseItem]]
825
+ Success
826
+ """
827
+ _response = await self._client_wrapper.httpx_client.request(
828
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments",
829
+ method="GET",
830
+ request_options=request_options,
831
+ )
832
+ try:
833
+ if 200 <= _response.status_code < 300:
834
+ _data = typing.cast(
835
+ typing.List[EnvironmentsListResponseItem],
836
+ parse_obj_as(
837
+ type_=typing.List[EnvironmentsListResponseItem], # type: ignore
838
+ object_=_response.json(),
839
+ ),
840
+ )
841
+ return AsyncHttpResponse(response=_response, data=_data)
842
+ if _response.status_code == 400:
843
+ raise BadRequestError(
844
+ headers=dict(_response.headers),
845
+ body=typing.cast(
846
+ typing.Optional[typing.Any],
847
+ parse_obj_as(
848
+ type_=typing.Optional[typing.Any], # type: ignore
849
+ object_=_response.json(),
850
+ ),
851
+ ),
852
+ )
853
+ if _response.status_code == 403:
854
+ raise ForbiddenError(
855
+ headers=dict(_response.headers),
856
+ body=typing.cast(
857
+ PermissionDeniedError,
858
+ parse_obj_as(
859
+ type_=PermissionDeniedError, # type: ignore
860
+ object_=_response.json(),
861
+ ),
862
+ ),
863
+ )
864
+ if _response.status_code == 404:
865
+ raise NotFoundError(
866
+ headers=dict(_response.headers),
867
+ body=typing.cast(
868
+ NotFoundErrorBody,
869
+ parse_obj_as(
870
+ type_=NotFoundErrorBody, # type: ignore
871
+ object_=_response.json(),
872
+ ),
873
+ ),
874
+ )
875
+ if _response.status_code == 429:
876
+ raise TooManyRequestsError(
877
+ headers=dict(_response.headers),
878
+ body=typing.cast(
879
+ RateLimitError,
880
+ parse_obj_as(
881
+ type_=RateLimitError, # type: ignore
882
+ object_=_response.json(),
883
+ ),
884
+ ),
885
+ )
886
+ if _response.status_code == 500:
887
+ raise InternalServerError(
888
+ headers=dict(_response.headers),
889
+ body=typing.cast(
890
+ typing.Optional[typing.Any],
891
+ parse_obj_as(
892
+ type_=typing.Optional[typing.Any], # type: ignore
893
+ object_=_response.json(),
894
+ ),
895
+ ),
896
+ )
897
+ if _response.status_code == 503:
898
+ raise ServiceUnavailableError(
899
+ headers=dict(_response.headers),
900
+ body=typing.cast(
901
+ typing.Optional[typing.Any],
902
+ parse_obj_as(
903
+ type_=typing.Optional[typing.Any], # type: ignore
904
+ object_=_response.json(),
905
+ ),
906
+ ),
907
+ )
908
+ _response_json = _response.json()
909
+ except JSONDecodeError:
910
+ raise ApiError(
911
+ status_code=_response.status_code,
912
+ headers=dict(_response.headers),
913
+ body=_response.text,
914
+ )
915
+ raise ApiError(
916
+ status_code=_response.status_code,
917
+ headers=dict(_response.headers),
918
+ body=_response_json,
919
+ )
920
+
921
+ async def create(
922
+ self,
923
+ organization_id: str,
924
+ project_id: str,
925
+ *,
926
+ name: str,
927
+ slug: str,
928
+ request_options: typing.Optional[RequestOptions] = None,
929
+ ) -> AsyncHttpResponse[EnvironmentsCreateResponse]:
930
+ """
931
+ Parameters
932
+ ----------
933
+ organization_id : str
934
+
935
+ project_id : str
936
+
937
+ name : str
938
+ a string at most 100 character(s) long
939
+
940
+ slug : str
941
+ a string matching the pattern ^[a-z0-9][a-z0-9_-]*[a-z0-9]$
942
+
943
+ request_options : typing.Optional[RequestOptions]
944
+ Request-specific configuration.
945
+
946
+ Returns
947
+ -------
948
+ AsyncHttpResponse[EnvironmentsCreateResponse]
949
+ Success
950
+ """
951
+ _response = await self._client_wrapper.httpx_client.request(
952
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments",
953
+ method="POST",
954
+ json={
955
+ "name": name,
956
+ "slug": slug,
957
+ },
958
+ headers={
959
+ "content-type": "application/json",
960
+ },
961
+ request_options=request_options,
962
+ omit=OMIT,
963
+ )
964
+ try:
965
+ if 200 <= _response.status_code < 300:
966
+ _data = typing.cast(
967
+ EnvironmentsCreateResponse,
968
+ parse_obj_as(
969
+ type_=EnvironmentsCreateResponse, # type: ignore
970
+ object_=_response.json(),
971
+ ),
972
+ )
973
+ return AsyncHttpResponse(response=_response, data=_data)
974
+ if _response.status_code == 400:
975
+ raise BadRequestError(
976
+ headers=dict(_response.headers),
977
+ body=typing.cast(
978
+ typing.Optional[typing.Any],
979
+ parse_obj_as(
980
+ type_=typing.Optional[typing.Any], # type: ignore
981
+ object_=_response.json(),
982
+ ),
983
+ ),
984
+ )
985
+ if _response.status_code == 403:
986
+ raise ForbiddenError(
987
+ headers=dict(_response.headers),
988
+ body=typing.cast(
989
+ PermissionDeniedError,
990
+ parse_obj_as(
991
+ type_=PermissionDeniedError, # type: ignore
992
+ object_=_response.json(),
993
+ ),
994
+ ),
995
+ )
996
+ if _response.status_code == 404:
997
+ raise NotFoundError(
998
+ headers=dict(_response.headers),
999
+ body=typing.cast(
1000
+ NotFoundErrorBody,
1001
+ parse_obj_as(
1002
+ type_=NotFoundErrorBody, # type: ignore
1003
+ object_=_response.json(),
1004
+ ),
1005
+ ),
1006
+ )
1007
+ if _response.status_code == 409:
1008
+ raise ConflictError(
1009
+ headers=dict(_response.headers),
1010
+ body=typing.cast(
1011
+ typing.Optional[typing.Any],
1012
+ parse_obj_as(
1013
+ type_=typing.Optional[typing.Any], # type: ignore
1014
+ object_=_response.json(),
1015
+ ),
1016
+ ),
1017
+ )
1018
+ if _response.status_code == 429:
1019
+ raise TooManyRequestsError(
1020
+ headers=dict(_response.headers),
1021
+ body=typing.cast(
1022
+ RateLimitError,
1023
+ parse_obj_as(
1024
+ type_=RateLimitError, # type: ignore
1025
+ object_=_response.json(),
1026
+ ),
1027
+ ),
1028
+ )
1029
+ if _response.status_code == 500:
1030
+ raise InternalServerError(
1031
+ headers=dict(_response.headers),
1032
+ body=typing.cast(
1033
+ typing.Optional[typing.Any],
1034
+ parse_obj_as(
1035
+ type_=typing.Optional[typing.Any], # type: ignore
1036
+ object_=_response.json(),
1037
+ ),
1038
+ ),
1039
+ )
1040
+ if _response.status_code == 503:
1041
+ raise ServiceUnavailableError(
1042
+ headers=dict(_response.headers),
1043
+ body=typing.cast(
1044
+ typing.Optional[typing.Any],
1045
+ parse_obj_as(
1046
+ type_=typing.Optional[typing.Any], # type: ignore
1047
+ object_=_response.json(),
1048
+ ),
1049
+ ),
1050
+ )
1051
+ _response_json = _response.json()
1052
+ except JSONDecodeError:
1053
+ raise ApiError(
1054
+ status_code=_response.status_code,
1055
+ headers=dict(_response.headers),
1056
+ body=_response.text,
1057
+ )
1058
+ raise ApiError(
1059
+ status_code=_response.status_code,
1060
+ headers=dict(_response.headers),
1061
+ body=_response_json,
1062
+ )
1063
+
1064
+ async def get(
1065
+ self,
1066
+ organization_id: str,
1067
+ project_id: str,
1068
+ environment_id: str,
1069
+ *,
1070
+ request_options: typing.Optional[RequestOptions] = None,
1071
+ ) -> AsyncHttpResponse[EnvironmentsGetResponse]:
1072
+ """
1073
+ Parameters
1074
+ ----------
1075
+ organization_id : str
1076
+
1077
+ project_id : str
1078
+
1079
+ environment_id : str
1080
+
1081
+ request_options : typing.Optional[RequestOptions]
1082
+ Request-specific configuration.
1083
+
1084
+ Returns
1085
+ -------
1086
+ AsyncHttpResponse[EnvironmentsGetResponse]
1087
+ Success
1088
+ """
1089
+ _response = await self._client_wrapper.httpx_client.request(
1090
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments/{jsonable_encoder(environment_id)}",
1091
+ method="GET",
1092
+ request_options=request_options,
1093
+ )
1094
+ try:
1095
+ if 200 <= _response.status_code < 300:
1096
+ _data = typing.cast(
1097
+ EnvironmentsGetResponse,
1098
+ parse_obj_as(
1099
+ type_=EnvironmentsGetResponse, # type: ignore
1100
+ object_=_response.json(),
1101
+ ),
1102
+ )
1103
+ return AsyncHttpResponse(response=_response, data=_data)
1104
+ if _response.status_code == 400:
1105
+ raise BadRequestError(
1106
+ headers=dict(_response.headers),
1107
+ body=typing.cast(
1108
+ typing.Optional[typing.Any],
1109
+ parse_obj_as(
1110
+ type_=typing.Optional[typing.Any], # type: ignore
1111
+ object_=_response.json(),
1112
+ ),
1113
+ ),
1114
+ )
1115
+ if _response.status_code == 403:
1116
+ raise ForbiddenError(
1117
+ headers=dict(_response.headers),
1118
+ body=typing.cast(
1119
+ PermissionDeniedError,
1120
+ parse_obj_as(
1121
+ type_=PermissionDeniedError, # type: ignore
1122
+ object_=_response.json(),
1123
+ ),
1124
+ ),
1125
+ )
1126
+ if _response.status_code == 404:
1127
+ raise NotFoundError(
1128
+ headers=dict(_response.headers),
1129
+ body=typing.cast(
1130
+ NotFoundErrorBody,
1131
+ parse_obj_as(
1132
+ type_=NotFoundErrorBody, # type: ignore
1133
+ object_=_response.json(),
1134
+ ),
1135
+ ),
1136
+ )
1137
+ if _response.status_code == 429:
1138
+ raise TooManyRequestsError(
1139
+ headers=dict(_response.headers),
1140
+ body=typing.cast(
1141
+ RateLimitError,
1142
+ parse_obj_as(
1143
+ type_=RateLimitError, # type: ignore
1144
+ object_=_response.json(),
1145
+ ),
1146
+ ),
1147
+ )
1148
+ if _response.status_code == 500:
1149
+ raise InternalServerError(
1150
+ headers=dict(_response.headers),
1151
+ body=typing.cast(
1152
+ typing.Optional[typing.Any],
1153
+ parse_obj_as(
1154
+ type_=typing.Optional[typing.Any], # type: ignore
1155
+ object_=_response.json(),
1156
+ ),
1157
+ ),
1158
+ )
1159
+ if _response.status_code == 503:
1160
+ raise ServiceUnavailableError(
1161
+ headers=dict(_response.headers),
1162
+ body=typing.cast(
1163
+ typing.Optional[typing.Any],
1164
+ parse_obj_as(
1165
+ type_=typing.Optional[typing.Any], # type: ignore
1166
+ object_=_response.json(),
1167
+ ),
1168
+ ),
1169
+ )
1170
+ _response_json = _response.json()
1171
+ except JSONDecodeError:
1172
+ raise ApiError(
1173
+ status_code=_response.status_code,
1174
+ headers=dict(_response.headers),
1175
+ body=_response.text,
1176
+ )
1177
+ raise ApiError(
1178
+ status_code=_response.status_code,
1179
+ headers=dict(_response.headers),
1180
+ body=_response_json,
1181
+ )
1182
+
1183
+ async def update(
1184
+ self,
1185
+ organization_id: str,
1186
+ project_id: str,
1187
+ environment_id: str,
1188
+ *,
1189
+ name: typing.Optional[str] = OMIT,
1190
+ slug: typing.Optional[str] = OMIT,
1191
+ request_options: typing.Optional[RequestOptions] = None,
1192
+ ) -> AsyncHttpResponse[EnvironmentsUpdateResponse]:
1193
+ """
1194
+ Parameters
1195
+ ----------
1196
+ organization_id : str
1197
+
1198
+ project_id : str
1199
+
1200
+ environment_id : str
1201
+
1202
+ name : typing.Optional[str]
1203
+ a string at most 100 character(s) long
1204
+
1205
+ slug : typing.Optional[str]
1206
+ a string matching the pattern ^[a-z0-9][a-z0-9_-]*[a-z0-9]$
1207
+
1208
+ request_options : typing.Optional[RequestOptions]
1209
+ Request-specific configuration.
1210
+
1211
+ Returns
1212
+ -------
1213
+ AsyncHttpResponse[EnvironmentsUpdateResponse]
1214
+ Success
1215
+ """
1216
+ _response = await self._client_wrapper.httpx_client.request(
1217
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments/{jsonable_encoder(environment_id)}",
1218
+ method="PUT",
1219
+ json={
1220
+ "name": name,
1221
+ "slug": slug,
1222
+ },
1223
+ headers={
1224
+ "content-type": "application/json",
1225
+ },
1226
+ request_options=request_options,
1227
+ omit=OMIT,
1228
+ )
1229
+ try:
1230
+ if 200 <= _response.status_code < 300:
1231
+ _data = typing.cast(
1232
+ EnvironmentsUpdateResponse,
1233
+ parse_obj_as(
1234
+ type_=EnvironmentsUpdateResponse, # type: ignore
1235
+ object_=_response.json(),
1236
+ ),
1237
+ )
1238
+ return AsyncHttpResponse(response=_response, data=_data)
1239
+ if _response.status_code == 400:
1240
+ raise BadRequestError(
1241
+ headers=dict(_response.headers),
1242
+ body=typing.cast(
1243
+ typing.Optional[typing.Any],
1244
+ parse_obj_as(
1245
+ type_=typing.Optional[typing.Any], # type: ignore
1246
+ object_=_response.json(),
1247
+ ),
1248
+ ),
1249
+ )
1250
+ if _response.status_code == 403:
1251
+ raise ForbiddenError(
1252
+ headers=dict(_response.headers),
1253
+ body=typing.cast(
1254
+ PermissionDeniedError,
1255
+ parse_obj_as(
1256
+ type_=PermissionDeniedError, # type: ignore
1257
+ object_=_response.json(),
1258
+ ),
1259
+ ),
1260
+ )
1261
+ if _response.status_code == 404:
1262
+ raise NotFoundError(
1263
+ headers=dict(_response.headers),
1264
+ body=typing.cast(
1265
+ NotFoundErrorBody,
1266
+ parse_obj_as(
1267
+ type_=NotFoundErrorBody, # type: ignore
1268
+ object_=_response.json(),
1269
+ ),
1270
+ ),
1271
+ )
1272
+ if _response.status_code == 409:
1273
+ raise ConflictError(
1274
+ headers=dict(_response.headers),
1275
+ body=typing.cast(
1276
+ typing.Optional[typing.Any],
1277
+ parse_obj_as(
1278
+ type_=typing.Optional[typing.Any], # type: ignore
1279
+ object_=_response.json(),
1280
+ ),
1281
+ ),
1282
+ )
1283
+ if _response.status_code == 429:
1284
+ raise TooManyRequestsError(
1285
+ headers=dict(_response.headers),
1286
+ body=typing.cast(
1287
+ RateLimitError,
1288
+ parse_obj_as(
1289
+ type_=RateLimitError, # type: ignore
1290
+ object_=_response.json(),
1291
+ ),
1292
+ ),
1293
+ )
1294
+ if _response.status_code == 500:
1295
+ raise InternalServerError(
1296
+ headers=dict(_response.headers),
1297
+ body=typing.cast(
1298
+ typing.Optional[typing.Any],
1299
+ parse_obj_as(
1300
+ type_=typing.Optional[typing.Any], # type: ignore
1301
+ object_=_response.json(),
1302
+ ),
1303
+ ),
1304
+ )
1305
+ if _response.status_code == 503:
1306
+ raise ServiceUnavailableError(
1307
+ headers=dict(_response.headers),
1308
+ body=typing.cast(
1309
+ typing.Optional[typing.Any],
1310
+ parse_obj_as(
1311
+ type_=typing.Optional[typing.Any], # type: ignore
1312
+ object_=_response.json(),
1313
+ ),
1314
+ ),
1315
+ )
1316
+ _response_json = _response.json()
1317
+ except JSONDecodeError:
1318
+ raise ApiError(
1319
+ status_code=_response.status_code,
1320
+ headers=dict(_response.headers),
1321
+ body=_response.text,
1322
+ )
1323
+ raise ApiError(
1324
+ status_code=_response.status_code,
1325
+ headers=dict(_response.headers),
1326
+ body=_response_json,
1327
+ )
1328
+
1329
+ async def delete(
1330
+ self,
1331
+ organization_id: str,
1332
+ project_id: str,
1333
+ environment_id: str,
1334
+ *,
1335
+ request_options: typing.Optional[RequestOptions] = None,
1336
+ ) -> AsyncHttpResponse[None]:
1337
+ """
1338
+ Parameters
1339
+ ----------
1340
+ organization_id : str
1341
+
1342
+ project_id : str
1343
+
1344
+ environment_id : str
1345
+
1346
+ request_options : typing.Optional[RequestOptions]
1347
+ Request-specific configuration.
1348
+
1349
+ Returns
1350
+ -------
1351
+ AsyncHttpResponse[None]
1352
+ """
1353
+ _response = await self._client_wrapper.httpx_client.request(
1354
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments/{jsonable_encoder(environment_id)}",
1355
+ method="DELETE",
1356
+ request_options=request_options,
1357
+ )
1358
+ try:
1359
+ if 200 <= _response.status_code < 300:
1360
+ return AsyncHttpResponse(response=_response, data=None)
1361
+ if _response.status_code == 400:
1362
+ raise BadRequestError(
1363
+ headers=dict(_response.headers),
1364
+ body=typing.cast(
1365
+ typing.Optional[typing.Any],
1366
+ parse_obj_as(
1367
+ type_=typing.Optional[typing.Any], # type: ignore
1368
+ object_=_response.json(),
1369
+ ),
1370
+ ),
1371
+ )
1372
+ if _response.status_code == 403:
1373
+ raise ForbiddenError(
1374
+ headers=dict(_response.headers),
1375
+ body=typing.cast(
1376
+ PermissionDeniedError,
1377
+ parse_obj_as(
1378
+ type_=PermissionDeniedError, # type: ignore
1379
+ object_=_response.json(),
1380
+ ),
1381
+ ),
1382
+ )
1383
+ if _response.status_code == 404:
1384
+ raise NotFoundError(
1385
+ headers=dict(_response.headers),
1386
+ body=typing.cast(
1387
+ NotFoundErrorBody,
1388
+ parse_obj_as(
1389
+ type_=NotFoundErrorBody, # type: ignore
1390
+ object_=_response.json(),
1391
+ ),
1392
+ ),
1393
+ )
1394
+ if _response.status_code == 429:
1395
+ raise TooManyRequestsError(
1396
+ headers=dict(_response.headers),
1397
+ body=typing.cast(
1398
+ RateLimitError,
1399
+ parse_obj_as(
1400
+ type_=RateLimitError, # type: ignore
1401
+ object_=_response.json(),
1402
+ ),
1403
+ ),
1404
+ )
1405
+ if _response.status_code == 500:
1406
+ raise InternalServerError(
1407
+ headers=dict(_response.headers),
1408
+ body=typing.cast(
1409
+ typing.Optional[typing.Any],
1410
+ parse_obj_as(
1411
+ type_=typing.Optional[typing.Any], # type: ignore
1412
+ object_=_response.json(),
1413
+ ),
1414
+ ),
1415
+ )
1416
+ if _response.status_code == 503:
1417
+ raise ServiceUnavailableError(
1418
+ headers=dict(_response.headers),
1419
+ body=typing.cast(
1420
+ typing.Optional[typing.Any],
1421
+ parse_obj_as(
1422
+ type_=typing.Optional[typing.Any], # type: ignore
1423
+ object_=_response.json(),
1424
+ ),
1425
+ ),
1426
+ )
1427
+ _response_json = _response.json()
1428
+ except JSONDecodeError:
1429
+ raise ApiError(
1430
+ status_code=_response.status_code,
1431
+ headers=dict(_response.headers),
1432
+ body=_response.text,
1433
+ )
1434
+ raise ApiError(
1435
+ status_code=_response.status_code,
1436
+ headers=dict(_response.headers),
1437
+ body=_response_json,
1438
+ )
1439
+
1440
+ async def getanalytics(
1441
+ self,
1442
+ organization_id: str,
1443
+ project_id: str,
1444
+ environment_id: str,
1445
+ *,
1446
+ start_time: str,
1447
+ end_time: str,
1448
+ request_options: typing.Optional[RequestOptions] = None,
1449
+ ) -> AsyncHttpResponse[EnvironmentsGetAnalyticsResponse]:
1450
+ """
1451
+ Parameters
1452
+ ----------
1453
+ organization_id : str
1454
+
1455
+ project_id : str
1456
+
1457
+ environment_id : str
1458
+
1459
+ start_time : str
1460
+
1461
+ end_time : str
1462
+
1463
+ request_options : typing.Optional[RequestOptions]
1464
+ Request-specific configuration.
1465
+
1466
+ Returns
1467
+ -------
1468
+ AsyncHttpResponse[EnvironmentsGetAnalyticsResponse]
1469
+ Success
1470
+ """
1471
+ _response = await self._client_wrapper.httpx_client.request(
1472
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments/{jsonable_encoder(environment_id)}/analytics",
1473
+ method="GET",
1474
+ params={
1475
+ "startTime": start_time,
1476
+ "endTime": end_time,
1477
+ },
1478
+ request_options=request_options,
1479
+ )
1480
+ try:
1481
+ if 200 <= _response.status_code < 300:
1482
+ _data = typing.cast(
1483
+ EnvironmentsGetAnalyticsResponse,
1484
+ parse_obj_as(
1485
+ type_=EnvironmentsGetAnalyticsResponse, # type: ignore
1486
+ object_=_response.json(),
1487
+ ),
1488
+ )
1489
+ return AsyncHttpResponse(response=_response, data=_data)
1490
+ if _response.status_code == 400:
1491
+ raise BadRequestError(
1492
+ headers=dict(_response.headers),
1493
+ body=typing.cast(
1494
+ typing.Optional[typing.Any],
1495
+ parse_obj_as(
1496
+ type_=typing.Optional[typing.Any], # type: ignore
1497
+ object_=_response.json(),
1498
+ ),
1499
+ ),
1500
+ )
1501
+ if _response.status_code == 403:
1502
+ raise ForbiddenError(
1503
+ headers=dict(_response.headers),
1504
+ body=typing.cast(
1505
+ PermissionDeniedError,
1506
+ parse_obj_as(
1507
+ type_=PermissionDeniedError, # type: ignore
1508
+ object_=_response.json(),
1509
+ ),
1510
+ ),
1511
+ )
1512
+ if _response.status_code == 404:
1513
+ raise NotFoundError(
1514
+ headers=dict(_response.headers),
1515
+ body=typing.cast(
1516
+ NotFoundErrorBody,
1517
+ parse_obj_as(
1518
+ type_=NotFoundErrorBody, # type: ignore
1519
+ object_=_response.json(),
1520
+ ),
1521
+ ),
1522
+ )
1523
+ if _response.status_code == 429:
1524
+ raise TooManyRequestsError(
1525
+ headers=dict(_response.headers),
1526
+ body=typing.cast(
1527
+ RateLimitError,
1528
+ parse_obj_as(
1529
+ type_=RateLimitError, # type: ignore
1530
+ object_=_response.json(),
1531
+ ),
1532
+ ),
1533
+ )
1534
+ if _response.status_code == 500:
1535
+ raise InternalServerError(
1536
+ headers=dict(_response.headers),
1537
+ body=typing.cast(
1538
+ typing.Optional[typing.Any],
1539
+ parse_obj_as(
1540
+ type_=typing.Optional[typing.Any], # type: ignore
1541
+ object_=_response.json(),
1542
+ ),
1543
+ ),
1544
+ )
1545
+ if _response.status_code == 503:
1546
+ raise ServiceUnavailableError(
1547
+ headers=dict(_response.headers),
1548
+ body=typing.cast(
1549
+ typing.Optional[typing.Any],
1550
+ parse_obj_as(
1551
+ type_=typing.Optional[typing.Any], # type: ignore
1552
+ object_=_response.json(),
1553
+ ),
1554
+ ),
1555
+ )
1556
+ _response_json = _response.json()
1557
+ except JSONDecodeError:
1558
+ raise ApiError(
1559
+ status_code=_response.status_code,
1560
+ headers=dict(_response.headers),
1561
+ body=_response.text,
1562
+ )
1563
+ raise ApiError(
1564
+ status_code=_response.status_code,
1565
+ headers=dict(_response.headers),
1566
+ body=_response_json,
1567
+ )