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