aeri-python 4.0.0__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 (391) hide show
  1. aeri/__init__.py +72 -0
  2. aeri/_client/_validation.py +204 -0
  3. aeri/_client/attributes.py +188 -0
  4. aeri/_client/client.py +3761 -0
  5. aeri/_client/constants.py +65 -0
  6. aeri/_client/datasets.py +302 -0
  7. aeri/_client/environment_variables.py +158 -0
  8. aeri/_client/get_client.py +149 -0
  9. aeri/_client/observe.py +661 -0
  10. aeri/_client/propagation.py +475 -0
  11. aeri/_client/resource_manager.py +510 -0
  12. aeri/_client/span.py +1519 -0
  13. aeri/_client/span_filter.py +76 -0
  14. aeri/_client/span_processor.py +206 -0
  15. aeri/_client/utils.py +132 -0
  16. aeri/_task_manager/media_manager.py +331 -0
  17. aeri/_task_manager/media_upload_consumer.py +44 -0
  18. aeri/_task_manager/media_upload_queue.py +12 -0
  19. aeri/_task_manager/score_ingestion_consumer.py +208 -0
  20. aeri/_task_manager/task_manager.py +475 -0
  21. aeri/_utils/__init__.py +19 -0
  22. aeri/_utils/environment.py +34 -0
  23. aeri/_utils/error_logging.py +47 -0
  24. aeri/_utils/parse_error.py +99 -0
  25. aeri/_utils/prompt_cache.py +188 -0
  26. aeri/_utils/request.py +137 -0
  27. aeri/_utils/serializer.py +205 -0
  28. aeri/api/.fern/metadata.json +14 -0
  29. aeri/api/__init__.py +836 -0
  30. aeri/api/annotation_queues/__init__.py +82 -0
  31. aeri/api/annotation_queues/client.py +1111 -0
  32. aeri/api/annotation_queues/raw_client.py +2288 -0
  33. aeri/api/annotation_queues/types/__init__.py +84 -0
  34. aeri/api/annotation_queues/types/annotation_queue.py +28 -0
  35. aeri/api/annotation_queues/types/annotation_queue_assignment_request.py +16 -0
  36. aeri/api/annotation_queues/types/annotation_queue_item.py +34 -0
  37. aeri/api/annotation_queues/types/annotation_queue_object_type.py +26 -0
  38. aeri/api/annotation_queues/types/annotation_queue_status.py +22 -0
  39. aeri/api/annotation_queues/types/create_annotation_queue_assignment_response.py +18 -0
  40. aeri/api/annotation_queues/types/create_annotation_queue_item_request.py +25 -0
  41. aeri/api/annotation_queues/types/create_annotation_queue_request.py +20 -0
  42. aeri/api/annotation_queues/types/delete_annotation_queue_assignment_response.py +14 -0
  43. aeri/api/annotation_queues/types/delete_annotation_queue_item_response.py +15 -0
  44. aeri/api/annotation_queues/types/paginated_annotation_queue_items.py +17 -0
  45. aeri/api/annotation_queues/types/paginated_annotation_queues.py +17 -0
  46. aeri/api/annotation_queues/types/update_annotation_queue_item_request.py +15 -0
  47. aeri/api/blob_storage_integrations/__init__.py +73 -0
  48. aeri/api/blob_storage_integrations/client.py +550 -0
  49. aeri/api/blob_storage_integrations/raw_client.py +976 -0
  50. aeri/api/blob_storage_integrations/types/__init__.py +77 -0
  51. aeri/api/blob_storage_integrations/types/blob_storage_export_frequency.py +26 -0
  52. aeri/api/blob_storage_integrations/types/blob_storage_export_mode.py +26 -0
  53. aeri/api/blob_storage_integrations/types/blob_storage_integration_deletion_response.py +14 -0
  54. aeri/api/blob_storage_integrations/types/blob_storage_integration_file_type.py +26 -0
  55. aeri/api/blob_storage_integrations/types/blob_storage_integration_response.py +64 -0
  56. aeri/api/blob_storage_integrations/types/blob_storage_integration_status_response.py +50 -0
  57. aeri/api/blob_storage_integrations/types/blob_storage_integration_type.py +26 -0
  58. aeri/api/blob_storage_integrations/types/blob_storage_integrations_response.py +15 -0
  59. aeri/api/blob_storage_integrations/types/blob_storage_sync_status.py +47 -0
  60. aeri/api/blob_storage_integrations/types/create_blob_storage_integration_request.py +91 -0
  61. aeri/api/client.py +679 -0
  62. aeri/api/comments/__init__.py +44 -0
  63. aeri/api/comments/client.py +407 -0
  64. aeri/api/comments/raw_client.py +750 -0
  65. aeri/api/comments/types/__init__.py +46 -0
  66. aeri/api/comments/types/create_comment_request.py +47 -0
  67. aeri/api/comments/types/create_comment_response.py +17 -0
  68. aeri/api/comments/types/get_comments_response.py +17 -0
  69. aeri/api/commons/__init__.py +210 -0
  70. aeri/api/commons/errors/__init__.py +56 -0
  71. aeri/api/commons/errors/access_denied_error.py +12 -0
  72. aeri/api/commons/errors/error.py +12 -0
  73. aeri/api/commons/errors/method_not_allowed_error.py +12 -0
  74. aeri/api/commons/errors/not_found_error.py +12 -0
  75. aeri/api/commons/errors/unauthorized_error.py +12 -0
  76. aeri/api/commons/types/__init__.py +190 -0
  77. aeri/api/commons/types/base_score.py +90 -0
  78. aeri/api/commons/types/base_score_v1.py +70 -0
  79. aeri/api/commons/types/boolean_score.py +26 -0
  80. aeri/api/commons/types/boolean_score_v1.py +26 -0
  81. aeri/api/commons/types/categorical_score.py +26 -0
  82. aeri/api/commons/types/categorical_score_v1.py +26 -0
  83. aeri/api/commons/types/comment.py +36 -0
  84. aeri/api/commons/types/comment_object_type.py +30 -0
  85. aeri/api/commons/types/config_category.py +15 -0
  86. aeri/api/commons/types/correction_score.py +26 -0
  87. aeri/api/commons/types/create_score_value.py +5 -0
  88. aeri/api/commons/types/dataset.py +49 -0
  89. aeri/api/commons/types/dataset_item.py +58 -0
  90. aeri/api/commons/types/dataset_run.py +63 -0
  91. aeri/api/commons/types/dataset_run_item.py +40 -0
  92. aeri/api/commons/types/dataset_run_with_items.py +19 -0
  93. aeri/api/commons/types/dataset_status.py +22 -0
  94. aeri/api/commons/types/map_value.py +11 -0
  95. aeri/api/commons/types/model.py +125 -0
  96. aeri/api/commons/types/model_price.py +14 -0
  97. aeri/api/commons/types/model_usage_unit.py +42 -0
  98. aeri/api/commons/types/numeric_score.py +17 -0
  99. aeri/api/commons/types/numeric_score_v1.py +17 -0
  100. aeri/api/commons/types/observation.py +142 -0
  101. aeri/api/commons/types/observation_level.py +30 -0
  102. aeri/api/commons/types/observation_v2.py +235 -0
  103. aeri/api/commons/types/observations_view.py +89 -0
  104. aeri/api/commons/types/pricing_tier.py +91 -0
  105. aeri/api/commons/types/pricing_tier_condition.py +68 -0
  106. aeri/api/commons/types/pricing_tier_input.py +76 -0
  107. aeri/api/commons/types/pricing_tier_operator.py +42 -0
  108. aeri/api/commons/types/score.py +201 -0
  109. aeri/api/commons/types/score_config.py +66 -0
  110. aeri/api/commons/types/score_config_data_type.py +26 -0
  111. aeri/api/commons/types/score_data_type.py +30 -0
  112. aeri/api/commons/types/score_source.py +26 -0
  113. aeri/api/commons/types/score_v1.py +131 -0
  114. aeri/api/commons/types/session.py +25 -0
  115. aeri/api/commons/types/session_with_traces.py +15 -0
  116. aeri/api/commons/types/trace.py +84 -0
  117. aeri/api/commons/types/trace_with_details.py +43 -0
  118. aeri/api/commons/types/trace_with_full_details.py +45 -0
  119. aeri/api/commons/types/usage.py +59 -0
  120. aeri/api/core/__init__.py +111 -0
  121. aeri/api/core/api_error.py +23 -0
  122. aeri/api/core/client_wrapper.py +141 -0
  123. aeri/api/core/datetime_utils.py +30 -0
  124. aeri/api/core/enum.py +20 -0
  125. aeri/api/core/file.py +70 -0
  126. aeri/api/core/force_multipart.py +18 -0
  127. aeri/api/core/http_client.py +711 -0
  128. aeri/api/core/http_response.py +55 -0
  129. aeri/api/core/http_sse/__init__.py +48 -0
  130. aeri/api/core/http_sse/_api.py +114 -0
  131. aeri/api/core/http_sse/_decoders.py +66 -0
  132. aeri/api/core/http_sse/_exceptions.py +7 -0
  133. aeri/api/core/http_sse/_models.py +17 -0
  134. aeri/api/core/jsonable_encoder.py +102 -0
  135. aeri/api/core/pydantic_utilities.py +310 -0
  136. aeri/api/core/query_encoder.py +60 -0
  137. aeri/api/core/remove_none_from_dict.py +11 -0
  138. aeri/api/core/request_options.py +35 -0
  139. aeri/api/core/serialization.py +282 -0
  140. aeri/api/dataset_items/__init__.py +52 -0
  141. aeri/api/dataset_items/client.py +499 -0
  142. aeri/api/dataset_items/raw_client.py +973 -0
  143. aeri/api/dataset_items/types/__init__.py +50 -0
  144. aeri/api/dataset_items/types/create_dataset_item_request.py +37 -0
  145. aeri/api/dataset_items/types/delete_dataset_item_response.py +17 -0
  146. aeri/api/dataset_items/types/paginated_dataset_items.py +17 -0
  147. aeri/api/dataset_run_items/__init__.py +43 -0
  148. aeri/api/dataset_run_items/client.py +323 -0
  149. aeri/api/dataset_run_items/raw_client.py +547 -0
  150. aeri/api/dataset_run_items/types/__init__.py +44 -0
  151. aeri/api/dataset_run_items/types/create_dataset_run_item_request.py +51 -0
  152. aeri/api/dataset_run_items/types/paginated_dataset_run_items.py +17 -0
  153. aeri/api/datasets/__init__.py +55 -0
  154. aeri/api/datasets/client.py +661 -0
  155. aeri/api/datasets/raw_client.py +1368 -0
  156. aeri/api/datasets/types/__init__.py +53 -0
  157. aeri/api/datasets/types/create_dataset_request.py +31 -0
  158. aeri/api/datasets/types/delete_dataset_run_response.py +14 -0
  159. aeri/api/datasets/types/paginated_dataset_runs.py +17 -0
  160. aeri/api/datasets/types/paginated_datasets.py +17 -0
  161. aeri/api/health/__init__.py +44 -0
  162. aeri/api/health/client.py +112 -0
  163. aeri/api/health/errors/__init__.py +42 -0
  164. aeri/api/health/errors/service_unavailable_error.py +13 -0
  165. aeri/api/health/raw_client.py +227 -0
  166. aeri/api/health/types/__init__.py +40 -0
  167. aeri/api/health/types/health_response.py +30 -0
  168. aeri/api/ingestion/__init__.py +169 -0
  169. aeri/api/ingestion/client.py +221 -0
  170. aeri/api/ingestion/raw_client.py +293 -0
  171. aeri/api/ingestion/types/__init__.py +169 -0
  172. aeri/api/ingestion/types/base_event.py +27 -0
  173. aeri/api/ingestion/types/create_event_body.py +14 -0
  174. aeri/api/ingestion/types/create_event_event.py +15 -0
  175. aeri/api/ingestion/types/create_generation_body.py +40 -0
  176. aeri/api/ingestion/types/create_generation_event.py +15 -0
  177. aeri/api/ingestion/types/create_observation_event.py +15 -0
  178. aeri/api/ingestion/types/create_span_body.py +19 -0
  179. aeri/api/ingestion/types/create_span_event.py +15 -0
  180. aeri/api/ingestion/types/ingestion_error.py +17 -0
  181. aeri/api/ingestion/types/ingestion_event.py +155 -0
  182. aeri/api/ingestion/types/ingestion_response.py +17 -0
  183. aeri/api/ingestion/types/ingestion_success.py +15 -0
  184. aeri/api/ingestion/types/ingestion_usage.py +8 -0
  185. aeri/api/ingestion/types/observation_body.py +53 -0
  186. aeri/api/ingestion/types/observation_type.py +54 -0
  187. aeri/api/ingestion/types/open_ai_completion_usage_schema.py +26 -0
  188. aeri/api/ingestion/types/open_ai_response_usage_schema.py +24 -0
  189. aeri/api/ingestion/types/open_ai_usage.py +28 -0
  190. aeri/api/ingestion/types/optional_observation_body.py +36 -0
  191. aeri/api/ingestion/types/score_body.py +75 -0
  192. aeri/api/ingestion/types/score_event.py +15 -0
  193. aeri/api/ingestion/types/sdk_log_body.py +14 -0
  194. aeri/api/ingestion/types/sdk_log_event.py +15 -0
  195. aeri/api/ingestion/types/trace_body.py +36 -0
  196. aeri/api/ingestion/types/trace_event.py +15 -0
  197. aeri/api/ingestion/types/update_event_body.py +14 -0
  198. aeri/api/ingestion/types/update_generation_body.py +40 -0
  199. aeri/api/ingestion/types/update_generation_event.py +15 -0
  200. aeri/api/ingestion/types/update_observation_event.py +15 -0
  201. aeri/api/ingestion/types/update_span_body.py +19 -0
  202. aeri/api/ingestion/types/update_span_event.py +15 -0
  203. aeri/api/ingestion/types/usage_details.py +10 -0
  204. aeri/api/legacy/__init__.py +61 -0
  205. aeri/api/legacy/client.py +105 -0
  206. aeri/api/legacy/metrics_v1/__init__.py +40 -0
  207. aeri/api/legacy/metrics_v1/client.py +214 -0
  208. aeri/api/legacy/metrics_v1/raw_client.py +322 -0
  209. aeri/api/legacy/metrics_v1/types/__init__.py +40 -0
  210. aeri/api/legacy/metrics_v1/types/metrics_response.py +19 -0
  211. aeri/api/legacy/observations_v1/__init__.py +43 -0
  212. aeri/api/legacy/observations_v1/client.py +523 -0
  213. aeri/api/legacy/observations_v1/raw_client.py +759 -0
  214. aeri/api/legacy/observations_v1/types/__init__.py +44 -0
  215. aeri/api/legacy/observations_v1/types/observations.py +17 -0
  216. aeri/api/legacy/observations_v1/types/observations_views.py +17 -0
  217. aeri/api/legacy/raw_client.py +13 -0
  218. aeri/api/legacy/score_v1/__init__.py +43 -0
  219. aeri/api/legacy/score_v1/client.py +329 -0
  220. aeri/api/legacy/score_v1/raw_client.py +545 -0
  221. aeri/api/legacy/score_v1/types/__init__.py +44 -0
  222. aeri/api/legacy/score_v1/types/create_score_request.py +75 -0
  223. aeri/api/legacy/score_v1/types/create_score_response.py +17 -0
  224. aeri/api/llm_connections/__init__.py +55 -0
  225. aeri/api/llm_connections/client.py +311 -0
  226. aeri/api/llm_connections/raw_client.py +541 -0
  227. aeri/api/llm_connections/types/__init__.py +53 -0
  228. aeri/api/llm_connections/types/llm_adapter.py +38 -0
  229. aeri/api/llm_connections/types/llm_connection.py +77 -0
  230. aeri/api/llm_connections/types/paginated_llm_connections.py +17 -0
  231. aeri/api/llm_connections/types/upsert_llm_connection_request.py +69 -0
  232. aeri/api/media/__init__.py +58 -0
  233. aeri/api/media/client.py +427 -0
  234. aeri/api/media/raw_client.py +739 -0
  235. aeri/api/media/types/__init__.py +56 -0
  236. aeri/api/media/types/get_media_response.py +55 -0
  237. aeri/api/media/types/get_media_upload_url_request.py +51 -0
  238. aeri/api/media/types/get_media_upload_url_response.py +28 -0
  239. aeri/api/media/types/media_content_type.py +232 -0
  240. aeri/api/media/types/patch_media_body.py +43 -0
  241. aeri/api/metrics/__init__.py +40 -0
  242. aeri/api/metrics/client.py +422 -0
  243. aeri/api/metrics/raw_client.py +530 -0
  244. aeri/api/metrics/types/__init__.py +40 -0
  245. aeri/api/metrics/types/metrics_v2response.py +19 -0
  246. aeri/api/models/__init__.py +43 -0
  247. aeri/api/models/client.py +523 -0
  248. aeri/api/models/raw_client.py +993 -0
  249. aeri/api/models/types/__init__.py +44 -0
  250. aeri/api/models/types/create_model_request.py +103 -0
  251. aeri/api/models/types/paginated_models.py +17 -0
  252. aeri/api/observations/__init__.py +43 -0
  253. aeri/api/observations/client.py +522 -0
  254. aeri/api/observations/raw_client.py +641 -0
  255. aeri/api/observations/types/__init__.py +44 -0
  256. aeri/api/observations/types/observations_v2meta.py +21 -0
  257. aeri/api/observations/types/observations_v2response.py +28 -0
  258. aeri/api/opentelemetry/__init__.py +67 -0
  259. aeri/api/opentelemetry/client.py +276 -0
  260. aeri/api/opentelemetry/raw_client.py +291 -0
  261. aeri/api/opentelemetry/types/__init__.py +65 -0
  262. aeri/api/opentelemetry/types/otel_attribute.py +27 -0
  263. aeri/api/opentelemetry/types/otel_attribute_value.py +46 -0
  264. aeri/api/opentelemetry/types/otel_resource.py +24 -0
  265. aeri/api/opentelemetry/types/otel_resource_span.py +32 -0
  266. aeri/api/opentelemetry/types/otel_scope.py +34 -0
  267. aeri/api/opentelemetry/types/otel_scope_span.py +28 -0
  268. aeri/api/opentelemetry/types/otel_span.py +76 -0
  269. aeri/api/opentelemetry/types/otel_trace_response.py +16 -0
  270. aeri/api/organizations/__init__.py +73 -0
  271. aeri/api/organizations/client.py +756 -0
  272. aeri/api/organizations/raw_client.py +1707 -0
  273. aeri/api/organizations/types/__init__.py +71 -0
  274. aeri/api/organizations/types/delete_membership_request.py +16 -0
  275. aeri/api/organizations/types/membership_deletion_response.py +17 -0
  276. aeri/api/organizations/types/membership_request.py +18 -0
  277. aeri/api/organizations/types/membership_response.py +20 -0
  278. aeri/api/organizations/types/membership_role.py +30 -0
  279. aeri/api/organizations/types/memberships_response.py +15 -0
  280. aeri/api/organizations/types/organization_api_key.py +31 -0
  281. aeri/api/organizations/types/organization_api_keys_response.py +19 -0
  282. aeri/api/organizations/types/organization_project.py +25 -0
  283. aeri/api/organizations/types/organization_projects_response.py +15 -0
  284. aeri/api/projects/__init__.py +67 -0
  285. aeri/api/projects/client.py +760 -0
  286. aeri/api/projects/raw_client.py +1577 -0
  287. aeri/api/projects/types/__init__.py +65 -0
  288. aeri/api/projects/types/api_key_deletion_response.py +18 -0
  289. aeri/api/projects/types/api_key_list.py +23 -0
  290. aeri/api/projects/types/api_key_response.py +30 -0
  291. aeri/api/projects/types/api_key_summary.py +35 -0
  292. aeri/api/projects/types/organization.py +22 -0
  293. aeri/api/projects/types/project.py +34 -0
  294. aeri/api/projects/types/project_deletion_response.py +15 -0
  295. aeri/api/projects/types/projects.py +15 -0
  296. aeri/api/prompt_version/__init__.py +4 -0
  297. aeri/api/prompt_version/client.py +157 -0
  298. aeri/api/prompt_version/raw_client.py +264 -0
  299. aeri/api/prompts/__init__.py +100 -0
  300. aeri/api/prompts/client.py +550 -0
  301. aeri/api/prompts/raw_client.py +987 -0
  302. aeri/api/prompts/types/__init__.py +96 -0
  303. aeri/api/prompts/types/base_prompt.py +42 -0
  304. aeri/api/prompts/types/chat_message.py +17 -0
  305. aeri/api/prompts/types/chat_message_type.py +15 -0
  306. aeri/api/prompts/types/chat_message_with_placeholders.py +8 -0
  307. aeri/api/prompts/types/chat_prompt.py +15 -0
  308. aeri/api/prompts/types/create_chat_prompt_request.py +37 -0
  309. aeri/api/prompts/types/create_chat_prompt_type.py +15 -0
  310. aeri/api/prompts/types/create_prompt_request.py +8 -0
  311. aeri/api/prompts/types/create_text_prompt_request.py +36 -0
  312. aeri/api/prompts/types/create_text_prompt_type.py +15 -0
  313. aeri/api/prompts/types/placeholder_message.py +16 -0
  314. aeri/api/prompts/types/placeholder_message_type.py +15 -0
  315. aeri/api/prompts/types/prompt.py +58 -0
  316. aeri/api/prompts/types/prompt_meta.py +35 -0
  317. aeri/api/prompts/types/prompt_meta_list_response.py +17 -0
  318. aeri/api/prompts/types/prompt_type.py +20 -0
  319. aeri/api/prompts/types/text_prompt.py +14 -0
  320. aeri/api/scim/__init__.py +94 -0
  321. aeri/api/scim/client.py +686 -0
  322. aeri/api/scim/raw_client.py +1528 -0
  323. aeri/api/scim/types/__init__.py +92 -0
  324. aeri/api/scim/types/authentication_scheme.py +20 -0
  325. aeri/api/scim/types/bulk_config.py +22 -0
  326. aeri/api/scim/types/empty_response.py +16 -0
  327. aeri/api/scim/types/filter_config.py +17 -0
  328. aeri/api/scim/types/resource_meta.py +17 -0
  329. aeri/api/scim/types/resource_type.py +27 -0
  330. aeri/api/scim/types/resource_types_response.py +21 -0
  331. aeri/api/scim/types/schema_extension.py +17 -0
  332. aeri/api/scim/types/schema_resource.py +19 -0
  333. aeri/api/scim/types/schemas_response.py +21 -0
  334. aeri/api/scim/types/scim_email.py +16 -0
  335. aeri/api/scim/types/scim_feature_support.py +14 -0
  336. aeri/api/scim/types/scim_name.py +14 -0
  337. aeri/api/scim/types/scim_user.py +24 -0
  338. aeri/api/scim/types/scim_users_list_response.py +25 -0
  339. aeri/api/scim/types/service_provider_config.py +36 -0
  340. aeri/api/scim/types/user_meta.py +20 -0
  341. aeri/api/score_configs/__init__.py +44 -0
  342. aeri/api/score_configs/client.py +526 -0
  343. aeri/api/score_configs/raw_client.py +1012 -0
  344. aeri/api/score_configs/types/__init__.py +46 -0
  345. aeri/api/score_configs/types/create_score_config_request.py +46 -0
  346. aeri/api/score_configs/types/score_configs.py +17 -0
  347. aeri/api/score_configs/types/update_score_config_request.py +53 -0
  348. aeri/api/scores/__init__.py +76 -0
  349. aeri/api/scores/client.py +420 -0
  350. aeri/api/scores/raw_client.py +656 -0
  351. aeri/api/scores/types/__init__.py +76 -0
  352. aeri/api/scores/types/get_scores_response.py +17 -0
  353. aeri/api/scores/types/get_scores_response_data.py +211 -0
  354. aeri/api/scores/types/get_scores_response_data_boolean.py +15 -0
  355. aeri/api/scores/types/get_scores_response_data_categorical.py +15 -0
  356. aeri/api/scores/types/get_scores_response_data_correction.py +15 -0
  357. aeri/api/scores/types/get_scores_response_data_numeric.py +15 -0
  358. aeri/api/scores/types/get_scores_response_trace_data.py +38 -0
  359. aeri/api/sessions/__init__.py +40 -0
  360. aeri/api/sessions/client.py +262 -0
  361. aeri/api/sessions/raw_client.py +500 -0
  362. aeri/api/sessions/types/__init__.py +40 -0
  363. aeri/api/sessions/types/paginated_sessions.py +17 -0
  364. aeri/api/trace/__init__.py +44 -0
  365. aeri/api/trace/client.py +728 -0
  366. aeri/api/trace/raw_client.py +1208 -0
  367. aeri/api/trace/types/__init__.py +46 -0
  368. aeri/api/trace/types/delete_trace_response.py +14 -0
  369. aeri/api/trace/types/sort.py +14 -0
  370. aeri/api/trace/types/traces.py +17 -0
  371. aeri/api/utils/__init__.py +44 -0
  372. aeri/api/utils/pagination/__init__.py +40 -0
  373. aeri/api/utils/pagination/types/__init__.py +40 -0
  374. aeri/api/utils/pagination/types/meta_response.py +38 -0
  375. aeri/batch_evaluation.py +1643 -0
  376. aeri/experiment.py +1044 -0
  377. aeri/langchain/CallbackHandler.py +1377 -0
  378. aeri/langchain/__init__.py +5 -0
  379. aeri/langchain/utils.py +212 -0
  380. aeri/logger.py +28 -0
  381. aeri/media.py +352 -0
  382. aeri/model.py +477 -0
  383. aeri/openai.py +1124 -0
  384. aeri/py.typed +0 -0
  385. aeri/span_filter.py +17 -0
  386. aeri/types.py +79 -0
  387. aeri/version.py +3 -0
  388. aeri_python-4.0.0.dist-info/METADATA +51 -0
  389. aeri_python-4.0.0.dist-info/RECORD +391 -0
  390. aeri_python-4.0.0.dist-info/WHEEL +4 -0
  391. aeri_python-4.0.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,993 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import datetime as dt
4
+ import typing
5
+ from json.decoder import JSONDecodeError
6
+
7
+ from ..commons.errors.access_denied_error import AccessDeniedError
8
+ from ..commons.errors.error import Error
9
+ from ..commons.errors.method_not_allowed_error import MethodNotAllowedError
10
+ from ..commons.errors.not_found_error import NotFoundError
11
+ from ..commons.errors.unauthorized_error import UnauthorizedError
12
+ from ..commons.types.model import Model
13
+ from ..commons.types.model_usage_unit import ModelUsageUnit
14
+ from ..commons.types.pricing_tier_input import PricingTierInput
15
+ from ..core.api_error import ApiError
16
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
17
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
18
+ from ..core.jsonable_encoder import jsonable_encoder
19
+ from ..core.pydantic_utilities import parse_obj_as
20
+ from ..core.request_options import RequestOptions
21
+ from ..core.serialization import convert_and_respect_annotation_metadata
22
+ from .types.paginated_models import PaginatedModels
23
+
24
+ # this is used as the default value for optional parameters
25
+ OMIT = typing.cast(typing.Any, ...)
26
+
27
+
28
+ class RawModelsClient:
29
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
30
+ self._client_wrapper = client_wrapper
31
+
32
+ def create(
33
+ self,
34
+ *,
35
+ model_name: str,
36
+ match_pattern: str,
37
+ start_date: typing.Optional[dt.datetime] = OMIT,
38
+ unit: typing.Optional[ModelUsageUnit] = OMIT,
39
+ input_price: typing.Optional[float] = OMIT,
40
+ output_price: typing.Optional[float] = OMIT,
41
+ total_price: typing.Optional[float] = OMIT,
42
+ pricing_tiers: typing.Optional[typing.Sequence[PricingTierInput]] = OMIT,
43
+ tokenizer_id: typing.Optional[str] = OMIT,
44
+ tokenizer_config: typing.Optional[typing.Any] = OMIT,
45
+ request_options: typing.Optional[RequestOptions] = None,
46
+ ) -> HttpResponse[Model]:
47
+ """
48
+ Create a model
49
+
50
+ Parameters
51
+ ----------
52
+ model_name : str
53
+ Name of the model definition. If multiple with the same name exist, they are applied in the following order: (1) custom over built-in, (2) newest according to startTime where model.startTime<observation.startTime
54
+
55
+ match_pattern : str
56
+ Regex pattern which matches this model definition to generation.model. Useful in case of fine-tuned models. If you want to exact match, use `(?i)^modelname$`
57
+
58
+ start_date : typing.Optional[dt.datetime]
59
+ Apply only to generations which are newer than this ISO date.
60
+
61
+ unit : typing.Optional[ModelUsageUnit]
62
+ Unit used by this model.
63
+
64
+ input_price : typing.Optional[float]
65
+ Deprecated. Use 'pricingTiers' instead. Price (USD) per input unit. Creates a default tier if pricingTiers not provided.
66
+
67
+ output_price : typing.Optional[float]
68
+ Deprecated. Use 'pricingTiers' instead. Price (USD) per output unit. Creates a default tier if pricingTiers not provided.
69
+
70
+ total_price : typing.Optional[float]
71
+ Deprecated. Use 'pricingTiers' instead. Price (USD) per total units. Cannot be set if input or output price is set. Creates a default tier if pricingTiers not provided.
72
+
73
+ pricing_tiers : typing.Optional[typing.Sequence[PricingTierInput]]
74
+ Optional. Array of pricing tiers for this model.
75
+
76
+ Use pricing tiers for all models - both those with threshold-based pricing variations and those with simple flat pricing:
77
+
78
+ - For models with standard flat pricing: Create a single default tier with your prices
79
+ (e.g., one tier with isDefault=true, priority=0, conditions=[], and your standard prices)
80
+
81
+ - For models with threshold-based pricing: Create a default tier plus additional conditional tiers
82
+ (e.g., default tier for standard usage + high-volume tier for usage above certain thresholds)
83
+
84
+ Requirements:
85
+ - Cannot be provided with flat prices (inputPrice/outputPrice/totalPrice) - use one approach or the other
86
+ - Must include exactly one default tier with isDefault=true, priority=0, and conditions=[]
87
+ - All tier names and priorities must be unique within the model
88
+ - Each tier must define at least one price
89
+
90
+ If omitted, you must provide flat prices instead (inputPrice/outputPrice/totalPrice),
91
+ which will automatically create a single default tier named "Standard".
92
+
93
+ tokenizer_id : typing.Optional[str]
94
+ Optional. Tokenizer to be applied to observations which match to this model. See docs for more details.
95
+
96
+ tokenizer_config : typing.Optional[typing.Any]
97
+ Optional. Configuration for the selected tokenizer. Needs to be JSON. See docs for more details.
98
+
99
+ request_options : typing.Optional[RequestOptions]
100
+ Request-specific configuration.
101
+
102
+ Returns
103
+ -------
104
+ HttpResponse[Model]
105
+ """
106
+ _response = self._client_wrapper.httpx_client.request(
107
+ "api/public/models",
108
+ method="POST",
109
+ json={
110
+ "modelName": model_name,
111
+ "matchPattern": match_pattern,
112
+ "startDate": start_date,
113
+ "unit": unit,
114
+ "inputPrice": input_price,
115
+ "outputPrice": output_price,
116
+ "totalPrice": total_price,
117
+ "pricingTiers": convert_and_respect_annotation_metadata(
118
+ object_=pricing_tiers,
119
+ annotation=typing.Sequence[PricingTierInput],
120
+ direction="write",
121
+ ),
122
+ "tokenizerId": tokenizer_id,
123
+ "tokenizerConfig": tokenizer_config,
124
+ },
125
+ request_options=request_options,
126
+ omit=OMIT,
127
+ )
128
+ try:
129
+ if 200 <= _response.status_code < 300:
130
+ _data = typing.cast(
131
+ Model,
132
+ parse_obj_as(
133
+ type_=Model, # type: ignore
134
+ object_=_response.json(),
135
+ ),
136
+ )
137
+ return HttpResponse(response=_response, data=_data)
138
+ if _response.status_code == 400:
139
+ raise Error(
140
+ headers=dict(_response.headers),
141
+ body=typing.cast(
142
+ typing.Any,
143
+ parse_obj_as(
144
+ type_=typing.Any, # type: ignore
145
+ object_=_response.json(),
146
+ ),
147
+ ),
148
+ )
149
+ if _response.status_code == 401:
150
+ raise UnauthorizedError(
151
+ headers=dict(_response.headers),
152
+ body=typing.cast(
153
+ typing.Any,
154
+ parse_obj_as(
155
+ type_=typing.Any, # type: ignore
156
+ object_=_response.json(),
157
+ ),
158
+ ),
159
+ )
160
+ if _response.status_code == 403:
161
+ raise AccessDeniedError(
162
+ headers=dict(_response.headers),
163
+ body=typing.cast(
164
+ typing.Any,
165
+ parse_obj_as(
166
+ type_=typing.Any, # type: ignore
167
+ object_=_response.json(),
168
+ ),
169
+ ),
170
+ )
171
+ if _response.status_code == 405:
172
+ raise MethodNotAllowedError(
173
+ headers=dict(_response.headers),
174
+ body=typing.cast(
175
+ typing.Any,
176
+ parse_obj_as(
177
+ type_=typing.Any, # type: ignore
178
+ object_=_response.json(),
179
+ ),
180
+ ),
181
+ )
182
+ if _response.status_code == 404:
183
+ raise NotFoundError(
184
+ headers=dict(_response.headers),
185
+ body=typing.cast(
186
+ typing.Any,
187
+ parse_obj_as(
188
+ type_=typing.Any, # type: ignore
189
+ object_=_response.json(),
190
+ ),
191
+ ),
192
+ )
193
+ _response_json = _response.json()
194
+ except JSONDecodeError:
195
+ raise ApiError(
196
+ status_code=_response.status_code,
197
+ headers=dict(_response.headers),
198
+ body=_response.text,
199
+ )
200
+ raise ApiError(
201
+ status_code=_response.status_code,
202
+ headers=dict(_response.headers),
203
+ body=_response_json,
204
+ )
205
+
206
+ def list(
207
+ self,
208
+ *,
209
+ page: typing.Optional[int] = None,
210
+ limit: typing.Optional[int] = None,
211
+ request_options: typing.Optional[RequestOptions] = None,
212
+ ) -> HttpResponse[PaginatedModels]:
213
+ """
214
+ Get all models
215
+
216
+ Parameters
217
+ ----------
218
+ page : typing.Optional[int]
219
+ page number, starts at 1
220
+
221
+ limit : typing.Optional[int]
222
+ limit of items per page
223
+
224
+ request_options : typing.Optional[RequestOptions]
225
+ Request-specific configuration.
226
+
227
+ Returns
228
+ -------
229
+ HttpResponse[PaginatedModels]
230
+ """
231
+ _response = self._client_wrapper.httpx_client.request(
232
+ "api/public/models",
233
+ method="GET",
234
+ params={
235
+ "page": page,
236
+ "limit": limit,
237
+ },
238
+ request_options=request_options,
239
+ )
240
+ try:
241
+ if 200 <= _response.status_code < 300:
242
+ _data = typing.cast(
243
+ PaginatedModels,
244
+ parse_obj_as(
245
+ type_=PaginatedModels, # type: ignore
246
+ object_=_response.json(),
247
+ ),
248
+ )
249
+ return HttpResponse(response=_response, data=_data)
250
+ if _response.status_code == 400:
251
+ raise Error(
252
+ headers=dict(_response.headers),
253
+ body=typing.cast(
254
+ typing.Any,
255
+ parse_obj_as(
256
+ type_=typing.Any, # type: ignore
257
+ object_=_response.json(),
258
+ ),
259
+ ),
260
+ )
261
+ if _response.status_code == 401:
262
+ raise UnauthorizedError(
263
+ headers=dict(_response.headers),
264
+ body=typing.cast(
265
+ typing.Any,
266
+ parse_obj_as(
267
+ type_=typing.Any, # type: ignore
268
+ object_=_response.json(),
269
+ ),
270
+ ),
271
+ )
272
+ if _response.status_code == 403:
273
+ raise AccessDeniedError(
274
+ headers=dict(_response.headers),
275
+ body=typing.cast(
276
+ typing.Any,
277
+ parse_obj_as(
278
+ type_=typing.Any, # type: ignore
279
+ object_=_response.json(),
280
+ ),
281
+ ),
282
+ )
283
+ if _response.status_code == 405:
284
+ raise MethodNotAllowedError(
285
+ headers=dict(_response.headers),
286
+ body=typing.cast(
287
+ typing.Any,
288
+ parse_obj_as(
289
+ type_=typing.Any, # type: ignore
290
+ object_=_response.json(),
291
+ ),
292
+ ),
293
+ )
294
+ if _response.status_code == 404:
295
+ raise NotFoundError(
296
+ headers=dict(_response.headers),
297
+ body=typing.cast(
298
+ typing.Any,
299
+ parse_obj_as(
300
+ type_=typing.Any, # type: ignore
301
+ object_=_response.json(),
302
+ ),
303
+ ),
304
+ )
305
+ _response_json = _response.json()
306
+ except JSONDecodeError:
307
+ raise ApiError(
308
+ status_code=_response.status_code,
309
+ headers=dict(_response.headers),
310
+ body=_response.text,
311
+ )
312
+ raise ApiError(
313
+ status_code=_response.status_code,
314
+ headers=dict(_response.headers),
315
+ body=_response_json,
316
+ )
317
+
318
+ def get(
319
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
320
+ ) -> HttpResponse[Model]:
321
+ """
322
+ Get a model
323
+
324
+ Parameters
325
+ ----------
326
+ id : str
327
+
328
+ request_options : typing.Optional[RequestOptions]
329
+ Request-specific configuration.
330
+
331
+ Returns
332
+ -------
333
+ HttpResponse[Model]
334
+ """
335
+ _response = self._client_wrapper.httpx_client.request(
336
+ f"api/public/models/{jsonable_encoder(id)}",
337
+ method="GET",
338
+ request_options=request_options,
339
+ )
340
+ try:
341
+ if 200 <= _response.status_code < 300:
342
+ _data = typing.cast(
343
+ Model,
344
+ parse_obj_as(
345
+ type_=Model, # type: ignore
346
+ object_=_response.json(),
347
+ ),
348
+ )
349
+ return HttpResponse(response=_response, data=_data)
350
+ if _response.status_code == 400:
351
+ raise Error(
352
+ headers=dict(_response.headers),
353
+ body=typing.cast(
354
+ typing.Any,
355
+ parse_obj_as(
356
+ type_=typing.Any, # type: ignore
357
+ object_=_response.json(),
358
+ ),
359
+ ),
360
+ )
361
+ if _response.status_code == 401:
362
+ raise UnauthorizedError(
363
+ headers=dict(_response.headers),
364
+ body=typing.cast(
365
+ typing.Any,
366
+ parse_obj_as(
367
+ type_=typing.Any, # type: ignore
368
+ object_=_response.json(),
369
+ ),
370
+ ),
371
+ )
372
+ if _response.status_code == 403:
373
+ raise AccessDeniedError(
374
+ headers=dict(_response.headers),
375
+ body=typing.cast(
376
+ typing.Any,
377
+ parse_obj_as(
378
+ type_=typing.Any, # type: ignore
379
+ object_=_response.json(),
380
+ ),
381
+ ),
382
+ )
383
+ if _response.status_code == 405:
384
+ raise MethodNotAllowedError(
385
+ headers=dict(_response.headers),
386
+ body=typing.cast(
387
+ typing.Any,
388
+ parse_obj_as(
389
+ type_=typing.Any, # type: ignore
390
+ object_=_response.json(),
391
+ ),
392
+ ),
393
+ )
394
+ if _response.status_code == 404:
395
+ raise NotFoundError(
396
+ headers=dict(_response.headers),
397
+ body=typing.cast(
398
+ typing.Any,
399
+ parse_obj_as(
400
+ type_=typing.Any, # type: ignore
401
+ object_=_response.json(),
402
+ ),
403
+ ),
404
+ )
405
+ _response_json = _response.json()
406
+ except JSONDecodeError:
407
+ raise ApiError(
408
+ status_code=_response.status_code,
409
+ headers=dict(_response.headers),
410
+ body=_response.text,
411
+ )
412
+ raise ApiError(
413
+ status_code=_response.status_code,
414
+ headers=dict(_response.headers),
415
+ body=_response_json,
416
+ )
417
+
418
+ def delete(
419
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
420
+ ) -> HttpResponse[None]:
421
+ """
422
+ Delete a model. Cannot delete models managed by Aeri. You can create your own definition with the same modelName to override the definition though.
423
+
424
+ Parameters
425
+ ----------
426
+ id : str
427
+
428
+ request_options : typing.Optional[RequestOptions]
429
+ Request-specific configuration.
430
+
431
+ Returns
432
+ -------
433
+ HttpResponse[None]
434
+ """
435
+ _response = self._client_wrapper.httpx_client.request(
436
+ f"api/public/models/{jsonable_encoder(id)}",
437
+ method="DELETE",
438
+ request_options=request_options,
439
+ )
440
+ try:
441
+ if 200 <= _response.status_code < 300:
442
+ return HttpResponse(response=_response, data=None)
443
+ if _response.status_code == 400:
444
+ raise Error(
445
+ headers=dict(_response.headers),
446
+ body=typing.cast(
447
+ typing.Any,
448
+ parse_obj_as(
449
+ type_=typing.Any, # type: ignore
450
+ object_=_response.json(),
451
+ ),
452
+ ),
453
+ )
454
+ if _response.status_code == 401:
455
+ raise UnauthorizedError(
456
+ headers=dict(_response.headers),
457
+ body=typing.cast(
458
+ typing.Any,
459
+ parse_obj_as(
460
+ type_=typing.Any, # type: ignore
461
+ object_=_response.json(),
462
+ ),
463
+ ),
464
+ )
465
+ if _response.status_code == 403:
466
+ raise AccessDeniedError(
467
+ headers=dict(_response.headers),
468
+ body=typing.cast(
469
+ typing.Any,
470
+ parse_obj_as(
471
+ type_=typing.Any, # type: ignore
472
+ object_=_response.json(),
473
+ ),
474
+ ),
475
+ )
476
+ if _response.status_code == 405:
477
+ raise MethodNotAllowedError(
478
+ headers=dict(_response.headers),
479
+ body=typing.cast(
480
+ typing.Any,
481
+ parse_obj_as(
482
+ type_=typing.Any, # type: ignore
483
+ object_=_response.json(),
484
+ ),
485
+ ),
486
+ )
487
+ if _response.status_code == 404:
488
+ raise NotFoundError(
489
+ headers=dict(_response.headers),
490
+ body=typing.cast(
491
+ typing.Any,
492
+ parse_obj_as(
493
+ type_=typing.Any, # type: ignore
494
+ object_=_response.json(),
495
+ ),
496
+ ),
497
+ )
498
+ _response_json = _response.json()
499
+ except JSONDecodeError:
500
+ raise ApiError(
501
+ status_code=_response.status_code,
502
+ headers=dict(_response.headers),
503
+ body=_response.text,
504
+ )
505
+ raise ApiError(
506
+ status_code=_response.status_code,
507
+ headers=dict(_response.headers),
508
+ body=_response_json,
509
+ )
510
+
511
+
512
+ class AsyncRawModelsClient:
513
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
514
+ self._client_wrapper = client_wrapper
515
+
516
+ async def create(
517
+ self,
518
+ *,
519
+ model_name: str,
520
+ match_pattern: str,
521
+ start_date: typing.Optional[dt.datetime] = OMIT,
522
+ unit: typing.Optional[ModelUsageUnit] = OMIT,
523
+ input_price: typing.Optional[float] = OMIT,
524
+ output_price: typing.Optional[float] = OMIT,
525
+ total_price: typing.Optional[float] = OMIT,
526
+ pricing_tiers: typing.Optional[typing.Sequence[PricingTierInput]] = OMIT,
527
+ tokenizer_id: typing.Optional[str] = OMIT,
528
+ tokenizer_config: typing.Optional[typing.Any] = OMIT,
529
+ request_options: typing.Optional[RequestOptions] = None,
530
+ ) -> AsyncHttpResponse[Model]:
531
+ """
532
+ Create a model
533
+
534
+ Parameters
535
+ ----------
536
+ model_name : str
537
+ Name of the model definition. If multiple with the same name exist, they are applied in the following order: (1) custom over built-in, (2) newest according to startTime where model.startTime<observation.startTime
538
+
539
+ match_pattern : str
540
+ Regex pattern which matches this model definition to generation.model. Useful in case of fine-tuned models. If you want to exact match, use `(?i)^modelname$`
541
+
542
+ start_date : typing.Optional[dt.datetime]
543
+ Apply only to generations which are newer than this ISO date.
544
+
545
+ unit : typing.Optional[ModelUsageUnit]
546
+ Unit used by this model.
547
+
548
+ input_price : typing.Optional[float]
549
+ Deprecated. Use 'pricingTiers' instead. Price (USD) per input unit. Creates a default tier if pricingTiers not provided.
550
+
551
+ output_price : typing.Optional[float]
552
+ Deprecated. Use 'pricingTiers' instead. Price (USD) per output unit. Creates a default tier if pricingTiers not provided.
553
+
554
+ total_price : typing.Optional[float]
555
+ Deprecated. Use 'pricingTiers' instead. Price (USD) per total units. Cannot be set if input or output price is set. Creates a default tier if pricingTiers not provided.
556
+
557
+ pricing_tiers : typing.Optional[typing.Sequence[PricingTierInput]]
558
+ Optional. Array of pricing tiers for this model.
559
+
560
+ Use pricing tiers for all models - both those with threshold-based pricing variations and those with simple flat pricing:
561
+
562
+ - For models with standard flat pricing: Create a single default tier with your prices
563
+ (e.g., one tier with isDefault=true, priority=0, conditions=[], and your standard prices)
564
+
565
+ - For models with threshold-based pricing: Create a default tier plus additional conditional tiers
566
+ (e.g., default tier for standard usage + high-volume tier for usage above certain thresholds)
567
+
568
+ Requirements:
569
+ - Cannot be provided with flat prices (inputPrice/outputPrice/totalPrice) - use one approach or the other
570
+ - Must include exactly one default tier with isDefault=true, priority=0, and conditions=[]
571
+ - All tier names and priorities must be unique within the model
572
+ - Each tier must define at least one price
573
+
574
+ If omitted, you must provide flat prices instead (inputPrice/outputPrice/totalPrice),
575
+ which will automatically create a single default tier named "Standard".
576
+
577
+ tokenizer_id : typing.Optional[str]
578
+ Optional. Tokenizer to be applied to observations which match to this model. See docs for more details.
579
+
580
+ tokenizer_config : typing.Optional[typing.Any]
581
+ Optional. Configuration for the selected tokenizer. Needs to be JSON. See docs for more details.
582
+
583
+ request_options : typing.Optional[RequestOptions]
584
+ Request-specific configuration.
585
+
586
+ Returns
587
+ -------
588
+ AsyncHttpResponse[Model]
589
+ """
590
+ _response = await self._client_wrapper.httpx_client.request(
591
+ "api/public/models",
592
+ method="POST",
593
+ json={
594
+ "modelName": model_name,
595
+ "matchPattern": match_pattern,
596
+ "startDate": start_date,
597
+ "unit": unit,
598
+ "inputPrice": input_price,
599
+ "outputPrice": output_price,
600
+ "totalPrice": total_price,
601
+ "pricingTiers": convert_and_respect_annotation_metadata(
602
+ object_=pricing_tiers,
603
+ annotation=typing.Sequence[PricingTierInput],
604
+ direction="write",
605
+ ),
606
+ "tokenizerId": tokenizer_id,
607
+ "tokenizerConfig": tokenizer_config,
608
+ },
609
+ request_options=request_options,
610
+ omit=OMIT,
611
+ )
612
+ try:
613
+ if 200 <= _response.status_code < 300:
614
+ _data = typing.cast(
615
+ Model,
616
+ parse_obj_as(
617
+ type_=Model, # type: ignore
618
+ object_=_response.json(),
619
+ ),
620
+ )
621
+ return AsyncHttpResponse(response=_response, data=_data)
622
+ if _response.status_code == 400:
623
+ raise Error(
624
+ headers=dict(_response.headers),
625
+ body=typing.cast(
626
+ typing.Any,
627
+ parse_obj_as(
628
+ type_=typing.Any, # type: ignore
629
+ object_=_response.json(),
630
+ ),
631
+ ),
632
+ )
633
+ if _response.status_code == 401:
634
+ raise UnauthorizedError(
635
+ headers=dict(_response.headers),
636
+ body=typing.cast(
637
+ typing.Any,
638
+ parse_obj_as(
639
+ type_=typing.Any, # type: ignore
640
+ object_=_response.json(),
641
+ ),
642
+ ),
643
+ )
644
+ if _response.status_code == 403:
645
+ raise AccessDeniedError(
646
+ headers=dict(_response.headers),
647
+ body=typing.cast(
648
+ typing.Any,
649
+ parse_obj_as(
650
+ type_=typing.Any, # type: ignore
651
+ object_=_response.json(),
652
+ ),
653
+ ),
654
+ )
655
+ if _response.status_code == 405:
656
+ raise MethodNotAllowedError(
657
+ headers=dict(_response.headers),
658
+ body=typing.cast(
659
+ typing.Any,
660
+ parse_obj_as(
661
+ type_=typing.Any, # type: ignore
662
+ object_=_response.json(),
663
+ ),
664
+ ),
665
+ )
666
+ if _response.status_code == 404:
667
+ raise NotFoundError(
668
+ headers=dict(_response.headers),
669
+ body=typing.cast(
670
+ typing.Any,
671
+ parse_obj_as(
672
+ type_=typing.Any, # type: ignore
673
+ object_=_response.json(),
674
+ ),
675
+ ),
676
+ )
677
+ _response_json = _response.json()
678
+ except JSONDecodeError:
679
+ raise ApiError(
680
+ status_code=_response.status_code,
681
+ headers=dict(_response.headers),
682
+ body=_response.text,
683
+ )
684
+ raise ApiError(
685
+ status_code=_response.status_code,
686
+ headers=dict(_response.headers),
687
+ body=_response_json,
688
+ )
689
+
690
+ async def list(
691
+ self,
692
+ *,
693
+ page: typing.Optional[int] = None,
694
+ limit: typing.Optional[int] = None,
695
+ request_options: typing.Optional[RequestOptions] = None,
696
+ ) -> AsyncHttpResponse[PaginatedModels]:
697
+ """
698
+ Get all models
699
+
700
+ Parameters
701
+ ----------
702
+ page : typing.Optional[int]
703
+ page number, starts at 1
704
+
705
+ limit : typing.Optional[int]
706
+ limit of items per page
707
+
708
+ request_options : typing.Optional[RequestOptions]
709
+ Request-specific configuration.
710
+
711
+ Returns
712
+ -------
713
+ AsyncHttpResponse[PaginatedModels]
714
+ """
715
+ _response = await self._client_wrapper.httpx_client.request(
716
+ "api/public/models",
717
+ method="GET",
718
+ params={
719
+ "page": page,
720
+ "limit": limit,
721
+ },
722
+ request_options=request_options,
723
+ )
724
+ try:
725
+ if 200 <= _response.status_code < 300:
726
+ _data = typing.cast(
727
+ PaginatedModels,
728
+ parse_obj_as(
729
+ type_=PaginatedModels, # type: ignore
730
+ object_=_response.json(),
731
+ ),
732
+ )
733
+ return AsyncHttpResponse(response=_response, data=_data)
734
+ if _response.status_code == 400:
735
+ raise Error(
736
+ headers=dict(_response.headers),
737
+ body=typing.cast(
738
+ typing.Any,
739
+ parse_obj_as(
740
+ type_=typing.Any, # type: ignore
741
+ object_=_response.json(),
742
+ ),
743
+ ),
744
+ )
745
+ if _response.status_code == 401:
746
+ raise UnauthorizedError(
747
+ headers=dict(_response.headers),
748
+ body=typing.cast(
749
+ typing.Any,
750
+ parse_obj_as(
751
+ type_=typing.Any, # type: ignore
752
+ object_=_response.json(),
753
+ ),
754
+ ),
755
+ )
756
+ if _response.status_code == 403:
757
+ raise AccessDeniedError(
758
+ headers=dict(_response.headers),
759
+ body=typing.cast(
760
+ typing.Any,
761
+ parse_obj_as(
762
+ type_=typing.Any, # type: ignore
763
+ object_=_response.json(),
764
+ ),
765
+ ),
766
+ )
767
+ if _response.status_code == 405:
768
+ raise MethodNotAllowedError(
769
+ headers=dict(_response.headers),
770
+ body=typing.cast(
771
+ typing.Any,
772
+ parse_obj_as(
773
+ type_=typing.Any, # type: ignore
774
+ object_=_response.json(),
775
+ ),
776
+ ),
777
+ )
778
+ if _response.status_code == 404:
779
+ raise NotFoundError(
780
+ headers=dict(_response.headers),
781
+ body=typing.cast(
782
+ typing.Any,
783
+ parse_obj_as(
784
+ type_=typing.Any, # type: ignore
785
+ object_=_response.json(),
786
+ ),
787
+ ),
788
+ )
789
+ _response_json = _response.json()
790
+ except JSONDecodeError:
791
+ raise ApiError(
792
+ status_code=_response.status_code,
793
+ headers=dict(_response.headers),
794
+ body=_response.text,
795
+ )
796
+ raise ApiError(
797
+ status_code=_response.status_code,
798
+ headers=dict(_response.headers),
799
+ body=_response_json,
800
+ )
801
+
802
+ async def get(
803
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
804
+ ) -> AsyncHttpResponse[Model]:
805
+ """
806
+ Get a model
807
+
808
+ Parameters
809
+ ----------
810
+ id : str
811
+
812
+ request_options : typing.Optional[RequestOptions]
813
+ Request-specific configuration.
814
+
815
+ Returns
816
+ -------
817
+ AsyncHttpResponse[Model]
818
+ """
819
+ _response = await self._client_wrapper.httpx_client.request(
820
+ f"api/public/models/{jsonable_encoder(id)}",
821
+ method="GET",
822
+ request_options=request_options,
823
+ )
824
+ try:
825
+ if 200 <= _response.status_code < 300:
826
+ _data = typing.cast(
827
+ Model,
828
+ parse_obj_as(
829
+ type_=Model, # type: ignore
830
+ object_=_response.json(),
831
+ ),
832
+ )
833
+ return AsyncHttpResponse(response=_response, data=_data)
834
+ if _response.status_code == 400:
835
+ raise Error(
836
+ headers=dict(_response.headers),
837
+ body=typing.cast(
838
+ typing.Any,
839
+ parse_obj_as(
840
+ type_=typing.Any, # type: ignore
841
+ object_=_response.json(),
842
+ ),
843
+ ),
844
+ )
845
+ if _response.status_code == 401:
846
+ raise UnauthorizedError(
847
+ headers=dict(_response.headers),
848
+ body=typing.cast(
849
+ typing.Any,
850
+ parse_obj_as(
851
+ type_=typing.Any, # type: ignore
852
+ object_=_response.json(),
853
+ ),
854
+ ),
855
+ )
856
+ if _response.status_code == 403:
857
+ raise AccessDeniedError(
858
+ headers=dict(_response.headers),
859
+ body=typing.cast(
860
+ typing.Any,
861
+ parse_obj_as(
862
+ type_=typing.Any, # type: ignore
863
+ object_=_response.json(),
864
+ ),
865
+ ),
866
+ )
867
+ if _response.status_code == 405:
868
+ raise MethodNotAllowedError(
869
+ headers=dict(_response.headers),
870
+ body=typing.cast(
871
+ typing.Any,
872
+ parse_obj_as(
873
+ type_=typing.Any, # type: ignore
874
+ object_=_response.json(),
875
+ ),
876
+ ),
877
+ )
878
+ if _response.status_code == 404:
879
+ raise NotFoundError(
880
+ headers=dict(_response.headers),
881
+ body=typing.cast(
882
+ typing.Any,
883
+ parse_obj_as(
884
+ type_=typing.Any, # type: ignore
885
+ object_=_response.json(),
886
+ ),
887
+ ),
888
+ )
889
+ _response_json = _response.json()
890
+ except JSONDecodeError:
891
+ raise ApiError(
892
+ status_code=_response.status_code,
893
+ headers=dict(_response.headers),
894
+ body=_response.text,
895
+ )
896
+ raise ApiError(
897
+ status_code=_response.status_code,
898
+ headers=dict(_response.headers),
899
+ body=_response_json,
900
+ )
901
+
902
+ async def delete(
903
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
904
+ ) -> AsyncHttpResponse[None]:
905
+ """
906
+ Delete a model. Cannot delete models managed by Aeri. You can create your own definition with the same modelName to override the definition though.
907
+
908
+ Parameters
909
+ ----------
910
+ id : str
911
+
912
+ request_options : typing.Optional[RequestOptions]
913
+ Request-specific configuration.
914
+
915
+ Returns
916
+ -------
917
+ AsyncHttpResponse[None]
918
+ """
919
+ _response = await self._client_wrapper.httpx_client.request(
920
+ f"api/public/models/{jsonable_encoder(id)}",
921
+ method="DELETE",
922
+ request_options=request_options,
923
+ )
924
+ try:
925
+ if 200 <= _response.status_code < 300:
926
+ return AsyncHttpResponse(response=_response, data=None)
927
+ if _response.status_code == 400:
928
+ raise Error(
929
+ headers=dict(_response.headers),
930
+ body=typing.cast(
931
+ typing.Any,
932
+ parse_obj_as(
933
+ type_=typing.Any, # type: ignore
934
+ object_=_response.json(),
935
+ ),
936
+ ),
937
+ )
938
+ if _response.status_code == 401:
939
+ raise UnauthorizedError(
940
+ headers=dict(_response.headers),
941
+ body=typing.cast(
942
+ typing.Any,
943
+ parse_obj_as(
944
+ type_=typing.Any, # type: ignore
945
+ object_=_response.json(),
946
+ ),
947
+ ),
948
+ )
949
+ if _response.status_code == 403:
950
+ raise AccessDeniedError(
951
+ headers=dict(_response.headers),
952
+ body=typing.cast(
953
+ typing.Any,
954
+ parse_obj_as(
955
+ type_=typing.Any, # type: ignore
956
+ object_=_response.json(),
957
+ ),
958
+ ),
959
+ )
960
+ if _response.status_code == 405:
961
+ raise MethodNotAllowedError(
962
+ headers=dict(_response.headers),
963
+ body=typing.cast(
964
+ typing.Any,
965
+ parse_obj_as(
966
+ type_=typing.Any, # type: ignore
967
+ object_=_response.json(),
968
+ ),
969
+ ),
970
+ )
971
+ if _response.status_code == 404:
972
+ raise NotFoundError(
973
+ headers=dict(_response.headers),
974
+ body=typing.cast(
975
+ typing.Any,
976
+ parse_obj_as(
977
+ type_=typing.Any, # type: ignore
978
+ object_=_response.json(),
979
+ ),
980
+ ),
981
+ )
982
+ _response_json = _response.json()
983
+ except JSONDecodeError:
984
+ raise ApiError(
985
+ status_code=_response.status_code,
986
+ headers=dict(_response.headers),
987
+ body=_response.text,
988
+ )
989
+ raise ApiError(
990
+ status_code=_response.status_code,
991
+ headers=dict(_response.headers),
992
+ body=_response_json,
993
+ )