ants-platform 3.3.4__tar.gz

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 (299) hide show
  1. ants_platform-3.3.4/LICENSE +21 -0
  2. ants_platform-3.3.4/PKG-INFO +49 -0
  3. ants_platform-3.3.4/README.md +18 -0
  4. ants_platform-3.3.4/ants_platform/__init__.py +39 -0
  5. ants_platform-3.3.4/ants_platform/_client/attributes.py +191 -0
  6. ants_platform-3.3.4/ants_platform/_client/client.py +3008 -0
  7. ants_platform-3.3.4/ants_platform/_client/constants.py +63 -0
  8. ants_platform-3.3.4/ants_platform/_client/datasets.py +183 -0
  9. ants_platform-3.3.4/ants_platform/_client/environment_variables.py +140 -0
  10. ants_platform-3.3.4/ants_platform/_client/get_client.py +134 -0
  11. ants_platform-3.3.4/ants_platform/_client/observe.py +530 -0
  12. ants_platform-3.3.4/ants_platform/_client/resource_manager.py +448 -0
  13. ants_platform-3.3.4/ants_platform/_client/span.py +1752 -0
  14. ants_platform-3.3.4/ants_platform/_client/span_processor.py +154 -0
  15. ants_platform-3.3.4/ants_platform/_client/utils.py +60 -0
  16. ants_platform-3.3.4/ants_platform/_task_manager/media_manager.py +310 -0
  17. ants_platform-3.3.4/ants_platform/_task_manager/media_upload_consumer.py +44 -0
  18. ants_platform-3.3.4/ants_platform/_task_manager/media_upload_queue.py +12 -0
  19. ants_platform-3.3.4/ants_platform/_task_manager/score_ingestion_consumer.py +180 -0
  20. ants_platform-3.3.4/ants_platform/_utils/__init__.py +22 -0
  21. ants_platform-3.3.4/ants_platform/_utils/environment.py +34 -0
  22. ants_platform-3.3.4/ants_platform/_utils/error_logging.py +48 -0
  23. ants_platform-3.3.4/ants_platform/_utils/parse_error.py +101 -0
  24. ants_platform-3.3.4/ants_platform/_utils/prompt_cache.py +191 -0
  25. ants_platform-3.3.4/ants_platform/_utils/request.py +140 -0
  26. ants_platform-3.3.4/ants_platform/_utils/serializer.py +190 -0
  27. ants_platform-3.3.4/ants_platform/api/README.md +150 -0
  28. ants_platform-3.3.4/ants_platform/api/__init__.py +445 -0
  29. ants_platform-3.3.4/ants_platform/api/client.py +248 -0
  30. ants_platform-3.3.4/ants_platform/api/core/__init__.py +30 -0
  31. ants_platform-3.3.4/ants_platform/api/core/api_error.py +17 -0
  32. ants_platform-3.3.4/ants_platform/api/core/client_wrapper.py +120 -0
  33. ants_platform-3.3.4/ants_platform/api/core/datetime_utils.py +30 -0
  34. ants_platform-3.3.4/ants_platform/api/core/file.py +43 -0
  35. ants_platform-3.3.4/ants_platform/api/core/http_client.py +550 -0
  36. ants_platform-3.3.4/ants_platform/api/core/jsonable_encoder.py +108 -0
  37. ants_platform-3.3.4/ants_platform/api/core/pydantic_utilities.py +28 -0
  38. ants_platform-3.3.4/ants_platform/api/core/query_encoder.py +39 -0
  39. ants_platform-3.3.4/ants_platform/api/core/remove_none_from_dict.py +11 -0
  40. ants_platform-3.3.4/ants_platform/api/core/request_options.py +32 -0
  41. ants_platform-3.3.4/ants_platform/api/reference.md +6503 -0
  42. ants_platform-3.3.4/ants_platform/api/resources/__init__.py +459 -0
  43. ants_platform-3.3.4/ants_platform/api/resources/annotation_queues/__init__.py +33 -0
  44. ants_platform-3.3.4/ants_platform/api/resources/annotation_queues/client.py +1642 -0
  45. ants_platform-3.3.4/ants_platform/api/resources/annotation_queues/types/__init__.py +35 -0
  46. ants_platform-3.3.4/ants_platform/api/resources/annotation_queues/types/annotation_queue.py +49 -0
  47. ants_platform-3.3.4/ants_platform/api/resources/annotation_queues/types/annotation_queue_assignment_request.py +44 -0
  48. ants_platform-3.3.4/ants_platform/api/resources/annotation_queues/types/annotation_queue_item.py +55 -0
  49. ants_platform-3.3.4/ants_platform/api/resources/annotation_queues/types/annotation_queue_object_type.py +21 -0
  50. ants_platform-3.3.4/ants_platform/api/resources/annotation_queues/types/annotation_queue_status.py +21 -0
  51. ants_platform-3.3.4/ants_platform/api/resources/annotation_queues/types/create_annotation_queue_assignment_response.py +46 -0
  52. ants_platform-3.3.4/ants_platform/api/resources/annotation_queues/types/create_annotation_queue_item_request.py +51 -0
  53. ants_platform-3.3.4/ants_platform/api/resources/annotation_queues/types/create_annotation_queue_request.py +46 -0
  54. ants_platform-3.3.4/ants_platform/api/resources/annotation_queues/types/delete_annotation_queue_assignment_response.py +42 -0
  55. ants_platform-3.3.4/ants_platform/api/resources/annotation_queues/types/delete_annotation_queue_item_response.py +43 -0
  56. ants_platform-3.3.4/ants_platform/api/resources/annotation_queues/types/paginated_annotation_queue_items.py +45 -0
  57. ants_platform-3.3.4/ants_platform/api/resources/annotation_queues/types/paginated_annotation_queues.py +45 -0
  58. ants_platform-3.3.4/ants_platform/api/resources/annotation_queues/types/update_annotation_queue_item_request.py +43 -0
  59. ants_platform-3.3.4/ants_platform/api/resources/comments/__init__.py +5 -0
  60. ants_platform-3.3.4/ants_platform/api/resources/comments/client.py +520 -0
  61. ants_platform-3.3.4/ants_platform/api/resources/comments/types/__init__.py +7 -0
  62. ants_platform-3.3.4/ants_platform/api/resources/comments/types/create_comment_request.py +69 -0
  63. ants_platform-3.3.4/ants_platform/api/resources/comments/types/create_comment_response.py +45 -0
  64. ants_platform-3.3.4/ants_platform/api/resources/comments/types/get_comments_response.py +45 -0
  65. ants_platform-3.3.4/ants_platform/api/resources/commons/__init__.py +103 -0
  66. ants_platform-3.3.4/ants_platform/api/resources/commons/errors/__init__.py +15 -0
  67. ants_platform-3.3.4/ants_platform/api/resources/commons/errors/access_denied_error.py +10 -0
  68. ants_platform-3.3.4/ants_platform/api/resources/commons/errors/error.py +10 -0
  69. ants_platform-3.3.4/ants_platform/api/resources/commons/errors/method_not_allowed_error.py +10 -0
  70. ants_platform-3.3.4/ants_platform/api/resources/commons/errors/not_found_error.py +10 -0
  71. ants_platform-3.3.4/ants_platform/api/resources/commons/errors/unauthorized_error.py +10 -0
  72. ants_platform-3.3.4/ants_platform/api/resources/commons/types/__init__.py +83 -0
  73. ants_platform-3.3.4/ants_platform/api/resources/commons/types/base_score.py +79 -0
  74. ants_platform-3.3.4/ants_platform/api/resources/commons/types/base_score_v_1.py +73 -0
  75. ants_platform-3.3.4/ants_platform/api/resources/commons/types/boolean_score.py +53 -0
  76. ants_platform-3.3.4/ants_platform/api/resources/commons/types/boolean_score_v_1.py +53 -0
  77. ants_platform-3.3.4/ants_platform/api/resources/commons/types/categorical_score.py +53 -0
  78. ants_platform-3.3.4/ants_platform/api/resources/commons/types/categorical_score_v_1.py +53 -0
  79. ants_platform-3.3.4/ants_platform/api/resources/commons/types/comment.py +54 -0
  80. ants_platform-3.3.4/ants_platform/api/resources/commons/types/comment_object_type.py +29 -0
  81. ants_platform-3.3.4/ants_platform/api/resources/commons/types/config_category.py +43 -0
  82. ants_platform-3.3.4/ants_platform/api/resources/commons/types/create_score_value.py +5 -0
  83. ants_platform-3.3.4/ants_platform/api/resources/commons/types/dataset.py +50 -0
  84. ants_platform-3.3.4/ants_platform/api/resources/commons/types/dataset_item.py +61 -0
  85. ants_platform-3.3.4/ants_platform/api/resources/commons/types/dataset_run.py +82 -0
  86. ants_platform-3.3.4/ants_platform/api/resources/commons/types/dataset_run_item.py +53 -0
  87. ants_platform-3.3.4/ants_platform/api/resources/commons/types/dataset_run_with_items.py +48 -0
  88. ants_platform-3.3.4/ants_platform/api/resources/commons/types/dataset_status.py +21 -0
  89. ants_platform-3.3.4/ants_platform/api/resources/commons/types/map_value.py +10 -0
  90. ants_platform-3.3.4/ants_platform/api/resources/commons/types/model.py +112 -0
  91. ants_platform-3.3.4/ants_platform/api/resources/commons/types/model_price.py +42 -0
  92. ants_platform-3.3.4/ants_platform/api/resources/commons/types/model_usage_unit.py +41 -0
  93. ants_platform-3.3.4/ants_platform/api/resources/commons/types/numeric_score.py +48 -0
  94. ants_platform-3.3.4/ants_platform/api/resources/commons/types/numeric_score_v_1.py +48 -0
  95. ants_platform-3.3.4/ants_platform/api/resources/commons/types/observation.py +164 -0
  96. ants_platform-3.3.4/ants_platform/api/resources/commons/types/observation_level.py +29 -0
  97. ants_platform-3.3.4/ants_platform/api/resources/commons/types/observations_view.py +116 -0
  98. ants_platform-3.3.4/ants_platform/api/resources/commons/types/score.py +207 -0
  99. ants_platform-3.3.4/ants_platform/api/resources/commons/types/score_config.py +82 -0
  100. ants_platform-3.3.4/ants_platform/api/resources/commons/types/score_data_type.py +25 -0
  101. ants_platform-3.3.4/ants_platform/api/resources/commons/types/score_source.py +25 -0
  102. ants_platform-3.3.4/ants_platform/api/resources/commons/types/score_v_1.py +189 -0
  103. ants_platform-3.3.4/ants_platform/api/resources/commons/types/session.py +50 -0
  104. ants_platform-3.3.4/ants_platform/api/resources/commons/types/session_with_traces.py +46 -0
  105. ants_platform-3.3.4/ants_platform/api/resources/commons/types/trace.py +109 -0
  106. ants_platform-3.3.4/ants_platform/api/resources/commons/types/trace_with_details.py +68 -0
  107. ants_platform-3.3.4/ants_platform/api/resources/commons/types/trace_with_full_details.py +70 -0
  108. ants_platform-3.3.4/ants_platform/api/resources/commons/types/usage.py +84 -0
  109. ants_platform-3.3.4/ants_platform/api/resources/dataset_items/__init__.py +13 -0
  110. ants_platform-3.3.4/ants_platform/api/resources/dataset_items/client.py +640 -0
  111. ants_platform-3.3.4/ants_platform/api/resources/dataset_items/types/__init__.py +11 -0
  112. ants_platform-3.3.4/ants_platform/api/resources/dataset_items/types/create_dataset_item_request.py +65 -0
  113. ants_platform-3.3.4/ants_platform/api/resources/dataset_items/types/delete_dataset_item_response.py +45 -0
  114. ants_platform-3.3.4/ants_platform/api/resources/dataset_items/types/paginated_dataset_items.py +45 -0
  115. ants_platform-3.3.4/ants_platform/api/resources/dataset_run_items/__init__.py +5 -0
  116. ants_platform-3.3.4/ants_platform/api/resources/dataset_run_items/client.py +366 -0
  117. ants_platform-3.3.4/ants_platform/api/resources/dataset_run_items/types/__init__.py +6 -0
  118. ants_platform-3.3.4/ants_platform/api/resources/dataset_run_items/types/create_dataset_run_item_request.py +64 -0
  119. ants_platform-3.3.4/ants_platform/api/resources/dataset_run_items/types/paginated_dataset_run_items.py +45 -0
  120. ants_platform-3.3.4/ants_platform/api/resources/datasets/__init__.py +15 -0
  121. ants_platform-3.3.4/ants_platform/api/resources/datasets/client.py +942 -0
  122. ants_platform-3.3.4/ants_platform/api/resources/datasets/types/__init__.py +13 -0
  123. ants_platform-3.3.4/ants_platform/api/resources/datasets/types/create_dataset_request.py +44 -0
  124. ants_platform-3.3.4/ants_platform/api/resources/datasets/types/delete_dataset_run_response.py +42 -0
  125. ants_platform-3.3.4/ants_platform/api/resources/datasets/types/paginated_dataset_runs.py +45 -0
  126. ants_platform-3.3.4/ants_platform/api/resources/datasets/types/paginated_datasets.py +45 -0
  127. ants_platform-3.3.4/ants_platform/api/resources/health/__init__.py +6 -0
  128. ants_platform-3.3.4/ants_platform/api/resources/health/client.py +154 -0
  129. ants_platform-3.3.4/ants_platform/api/resources/health/errors/__init__.py +5 -0
  130. ants_platform-3.3.4/ants_platform/api/resources/health/errors/service_unavailable_error.py +8 -0
  131. ants_platform-3.3.4/ants_platform/api/resources/health/types/__init__.py +5 -0
  132. ants_platform-3.3.4/ants_platform/api/resources/health/types/health_response.py +58 -0
  133. ants_platform-3.3.4/ants_platform/api/resources/ingestion/__init__.py +91 -0
  134. ants_platform-3.3.4/ants_platform/api/resources/ingestion/client.py +260 -0
  135. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/__init__.py +91 -0
  136. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/base_event.py +55 -0
  137. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/create_event_body.py +45 -0
  138. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/create_event_event.py +46 -0
  139. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/create_generation_body.py +67 -0
  140. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/create_generation_event.py +46 -0
  141. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/create_observation_event.py +46 -0
  142. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/create_span_body.py +47 -0
  143. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/create_span_event.py +46 -0
  144. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/ingestion_error.py +45 -0
  145. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/ingestion_event.py +422 -0
  146. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/ingestion_response.py +45 -0
  147. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/ingestion_success.py +43 -0
  148. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/ingestion_usage.py +8 -0
  149. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/observation_body.py +77 -0
  150. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/observation_type.py +53 -0
  151. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/open_ai_completion_usage_schema.py +54 -0
  152. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/open_ai_response_usage_schema.py +52 -0
  153. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/open_ai_usage.py +56 -0
  154. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/optional_observation_body.py +61 -0
  155. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/score_body.py +88 -0
  156. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/score_event.py +46 -0
  157. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/sdk_log_body.py +42 -0
  158. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/sdk_log_event.py +46 -0
  159. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/trace_body.py +61 -0
  160. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/trace_event.py +46 -0
  161. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/update_event_body.py +45 -0
  162. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/update_generation_body.py +67 -0
  163. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/update_generation_event.py +46 -0
  164. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/update_observation_event.py +46 -0
  165. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/update_span_body.py +47 -0
  166. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/update_span_event.py +46 -0
  167. ants_platform-3.3.4/ants_platform/api/resources/ingestion/types/usage_details.py +10 -0
  168. ants_platform-3.3.4/ants_platform/api/resources/llm_connections/__init__.py +15 -0
  169. ants_platform-3.3.4/ants_platform/api/resources/llm_connections/client.py +340 -0
  170. ants_platform-3.3.4/ants_platform/api/resources/llm_connections/types/__init__.py +13 -0
  171. ants_platform-3.3.4/ants_platform/api/resources/llm_connections/types/llm_adapter.py +37 -0
  172. ants_platform-3.3.4/ants_platform/api/resources/llm_connections/types/llm_connection.py +85 -0
  173. ants_platform-3.3.4/ants_platform/api/resources/llm_connections/types/paginated_llm_connections.py +45 -0
  174. ants_platform-3.3.4/ants_platform/api/resources/llm_connections/types/upsert_llm_connection_request.py +88 -0
  175. ants_platform-3.3.4/ants_platform/api/resources/media/__init__.py +17 -0
  176. ants_platform-3.3.4/ants_platform/api/resources/media/client.py +505 -0
  177. ants_platform-3.3.4/ants_platform/api/resources/media/types/__init__.py +15 -0
  178. ants_platform-3.3.4/ants_platform/api/resources/media/types/get_media_response.py +72 -0
  179. ants_platform-3.3.4/ants_platform/api/resources/media/types/get_media_upload_url_request.py +71 -0
  180. ants_platform-3.3.4/ants_platform/api/resources/media/types/get_media_upload_url_response.py +54 -0
  181. ants_platform-3.3.4/ants_platform/api/resources/media/types/media_content_type.py +133 -0
  182. ants_platform-3.3.4/ants_platform/api/resources/media/types/patch_media_body.py +66 -0
  183. ants_platform-3.3.4/ants_platform/api/resources/metrics/__init__.py +5 -0
  184. ants_platform-3.3.4/ants_platform/api/resources/metrics/client.py +245 -0
  185. ants_platform-3.3.4/ants_platform/api/resources/metrics/types/__init__.py +5 -0
  186. ants_platform-3.3.4/ants_platform/api/resources/metrics/types/metrics_response.py +47 -0
  187. ants_platform-3.3.4/ants_platform/api/resources/models/__init__.py +5 -0
  188. ants_platform-3.3.4/ants_platform/api/resources/models/client.py +607 -0
  189. ants_platform-3.3.4/ants_platform/api/resources/models/types/__init__.py +6 -0
  190. ants_platform-3.3.4/ants_platform/api/resources/models/types/create_model_request.py +100 -0
  191. ants_platform-3.3.4/ants_platform/api/resources/models/types/paginated_models.py +45 -0
  192. ants_platform-3.3.4/ants_platform/api/resources/observations/__init__.py +5 -0
  193. ants_platform-3.3.4/ants_platform/api/resources/observations/client.py +428 -0
  194. ants_platform-3.3.4/ants_platform/api/resources/observations/types/__init__.py +6 -0
  195. ants_platform-3.3.4/ants_platform/api/resources/observations/types/observations.py +45 -0
  196. ants_platform-3.3.4/ants_platform/api/resources/observations/types/observations_views.py +45 -0
  197. ants_platform-3.3.4/ants_platform/api/resources/organizations/__init__.py +19 -0
  198. ants_platform-3.3.4/ants_platform/api/resources/organizations/client.py +750 -0
  199. ants_platform-3.3.4/ants_platform/api/resources/organizations/types/__init__.py +17 -0
  200. ants_platform-3.3.4/ants_platform/api/resources/organizations/types/membership_request.py +46 -0
  201. ants_platform-3.3.4/ants_platform/api/resources/organizations/types/membership_response.py +48 -0
  202. ants_platform-3.3.4/ants_platform/api/resources/organizations/types/membership_role.py +29 -0
  203. ants_platform-3.3.4/ants_platform/api/resources/organizations/types/memberships_response.py +43 -0
  204. ants_platform-3.3.4/ants_platform/api/resources/organizations/types/organization_project.py +48 -0
  205. ants_platform-3.3.4/ants_platform/api/resources/organizations/types/organization_projects_response.py +43 -0
  206. ants_platform-3.3.4/ants_platform/api/resources/projects/__init__.py +21 -0
  207. ants_platform-3.3.4/ants_platform/api/resources/projects/client.py +1090 -0
  208. ants_platform-3.3.4/ants_platform/api/resources/projects/types/__init__.py +19 -0
  209. ants_platform-3.3.4/ants_platform/api/resources/projects/types/api_key_deletion_response.py +46 -0
  210. ants_platform-3.3.4/ants_platform/api/resources/projects/types/api_key_list.py +49 -0
  211. ants_platform-3.3.4/ants_platform/api/resources/projects/types/api_key_response.py +53 -0
  212. ants_platform-3.3.4/ants_platform/api/resources/projects/types/api_key_summary.py +58 -0
  213. ants_platform-3.3.4/ants_platform/api/resources/projects/types/project.py +56 -0
  214. ants_platform-3.3.4/ants_platform/api/resources/projects/types/project_deletion_response.py +43 -0
  215. ants_platform-3.3.4/ants_platform/api/resources/projects/types/projects.py +43 -0
  216. ants_platform-3.3.4/ants_platform/api/resources/prompt_version/__init__.py +2 -0
  217. ants_platform-3.3.4/ants_platform/api/resources/prompt_version/client.py +197 -0
  218. ants_platform-3.3.4/ants_platform/api/resources/prompts/__init__.py +43 -0
  219. ants_platform-3.3.4/ants_platform/api/resources/prompts/client.py +585 -0
  220. ants_platform-3.3.4/ants_platform/api/resources/prompts/types/__init__.py +43 -0
  221. ants_platform-3.3.4/ants_platform/api/resources/prompts/types/base_prompt.py +69 -0
  222. ants_platform-3.3.4/ants_platform/api/resources/prompts/types/chat_message.py +43 -0
  223. ants_platform-3.3.4/ants_platform/api/resources/prompts/types/chat_message_with_placeholders.py +87 -0
  224. ants_platform-3.3.4/ants_platform/api/resources/prompts/types/chat_prompt.py +46 -0
  225. ants_platform-3.3.4/ants_platform/api/resources/prompts/types/create_chat_prompt_request.py +63 -0
  226. ants_platform-3.3.4/ants_platform/api/resources/prompts/types/create_prompt_request.py +103 -0
  227. ants_platform-3.3.4/ants_platform/api/resources/prompts/types/create_text_prompt_request.py +62 -0
  228. ants_platform-3.3.4/ants_platform/api/resources/prompts/types/placeholder_message.py +42 -0
  229. ants_platform-3.3.4/ants_platform/api/resources/prompts/types/prompt.py +111 -0
  230. ants_platform-3.3.4/ants_platform/api/resources/prompts/types/prompt_meta.py +52 -0
  231. ants_platform-3.3.4/ants_platform/api/resources/prompts/types/prompt_meta_list_response.py +45 -0
  232. ants_platform-3.3.4/ants_platform/api/resources/prompts/types/text_prompt.py +45 -0
  233. ants_platform-3.3.4/ants_platform/api/resources/scim/__init__.py +41 -0
  234. ants_platform-3.3.4/ants_platform/api/resources/scim/client.py +1042 -0
  235. ants_platform-3.3.4/ants_platform/api/resources/scim/types/__init__.py +39 -0
  236. ants_platform-3.3.4/ants_platform/api/resources/scim/types/authentication_scheme.py +48 -0
  237. ants_platform-3.3.4/ants_platform/api/resources/scim/types/bulk_config.py +46 -0
  238. ants_platform-3.3.4/ants_platform/api/resources/scim/types/empty_response.py +44 -0
  239. ants_platform-3.3.4/ants_platform/api/resources/scim/types/filter_config.py +45 -0
  240. ants_platform-3.3.4/ants_platform/api/resources/scim/types/resource_meta.py +45 -0
  241. ants_platform-3.3.4/ants_platform/api/resources/scim/types/resource_type.py +55 -0
  242. ants_platform-3.3.4/ants_platform/api/resources/scim/types/resource_types_response.py +47 -0
  243. ants_platform-3.3.4/ants_platform/api/resources/scim/types/schema_extension.py +45 -0
  244. ants_platform-3.3.4/ants_platform/api/resources/scim/types/schema_resource.py +47 -0
  245. ants_platform-3.3.4/ants_platform/api/resources/scim/types/schemas_response.py +47 -0
  246. ants_platform-3.3.4/ants_platform/api/resources/scim/types/scim_email.py +44 -0
  247. ants_platform-3.3.4/ants_platform/api/resources/scim/types/scim_feature_support.py +42 -0
  248. ants_platform-3.3.4/ants_platform/api/resources/scim/types/scim_name.py +42 -0
  249. ants_platform-3.3.4/ants_platform/api/resources/scim/types/scim_user.py +52 -0
  250. ants_platform-3.3.4/ants_platform/api/resources/scim/types/scim_users_list_response.py +49 -0
  251. ants_platform-3.3.4/ants_platform/api/resources/scim/types/service_provider_config.py +60 -0
  252. ants_platform-3.3.4/ants_platform/api/resources/scim/types/user_meta.py +48 -0
  253. ants_platform-3.3.4/ants_platform/api/resources/score/__init__.py +5 -0
  254. ants_platform-3.3.4/ants_platform/api/resources/score/client.py +322 -0
  255. ants_platform-3.3.4/ants_platform/api/resources/score/types/__init__.py +6 -0
  256. ants_platform-3.3.4/ants_platform/api/resources/score/types/create_score_request.py +92 -0
  257. ants_platform-3.3.4/ants_platform/api/resources/score/types/create_score_response.py +45 -0
  258. ants_platform-3.3.4/ants_platform/api/resources/score_configs/__init__.py +5 -0
  259. ants_platform-3.3.4/ants_platform/api/resources/score_configs/client.py +473 -0
  260. ants_platform-3.3.4/ants_platform/api/resources/score_configs/types/__init__.py +6 -0
  261. ants_platform-3.3.4/ants_platform/api/resources/score_configs/types/create_score_config_request.py +72 -0
  262. ants_platform-3.3.4/ants_platform/api/resources/score_configs/types/score_configs.py +45 -0
  263. ants_platform-3.3.4/ants_platform/api/resources/score_v_2/__init__.py +25 -0
  264. ants_platform-3.3.4/ants_platform/api/resources/score_v_2/client.py +463 -0
  265. ants_platform-3.3.4/ants_platform/api/resources/score_v_2/types/__init__.py +25 -0
  266. ants_platform-3.3.4/ants_platform/api/resources/score_v_2/types/get_scores_response.py +45 -0
  267. ants_platform-3.3.4/ants_platform/api/resources/score_v_2/types/get_scores_response_data.py +215 -0
  268. ants_platform-3.3.4/ants_platform/api/resources/score_v_2/types/get_scores_response_data_boolean.py +46 -0
  269. ants_platform-3.3.4/ants_platform/api/resources/score_v_2/types/get_scores_response_data_categorical.py +46 -0
  270. ants_platform-3.3.4/ants_platform/api/resources/score_v_2/types/get_scores_response_data_numeric.py +46 -0
  271. ants_platform-3.3.4/ants_platform/api/resources/score_v_2/types/get_scores_response_trace_data.py +57 -0
  272. ants_platform-3.3.4/ants_platform/api/resources/sessions/__init__.py +5 -0
  273. ants_platform-3.3.4/ants_platform/api/resources/sessions/client.py +367 -0
  274. ants_platform-3.3.4/ants_platform/api/resources/sessions/types/__init__.py +5 -0
  275. ants_platform-3.3.4/ants_platform/api/resources/sessions/types/paginated_sessions.py +45 -0
  276. ants_platform-3.3.4/ants_platform/api/resources/trace/__init__.py +5 -0
  277. ants_platform-3.3.4/ants_platform/api/resources/trace/client.py +725 -0
  278. ants_platform-3.3.4/ants_platform/api/resources/trace/types/__init__.py +7 -0
  279. ants_platform-3.3.4/ants_platform/api/resources/trace/types/delete_trace_response.py +42 -0
  280. ants_platform-3.3.4/ants_platform/api/resources/trace/types/sort.py +42 -0
  281. ants_platform-3.3.4/ants_platform/api/resources/trace/types/traces.py +45 -0
  282. ants_platform-3.3.4/ants_platform/api/resources/utils/__init__.py +5 -0
  283. ants_platform-3.3.4/ants_platform/api/resources/utils/resources/__init__.py +6 -0
  284. ants_platform-3.3.4/ants_platform/api/resources/utils/resources/pagination/__init__.py +5 -0
  285. ants_platform-3.3.4/ants_platform/api/resources/utils/resources/pagination/types/__init__.py +5 -0
  286. ants_platform-3.3.4/ants_platform/api/resources/utils/resources/pagination/types/meta_response.py +62 -0
  287. ants_platform-3.3.4/ants_platform/api/tests/utils/test_http_client.py +59 -0
  288. ants_platform-3.3.4/ants_platform/api/tests/utils/test_query_encoding.py +19 -0
  289. ants_platform-3.3.4/ants_platform/langchain/CallbackHandler.py +1253 -0
  290. ants_platform-3.3.4/ants_platform/langchain/__init__.py +5 -0
  291. ants_platform-3.3.4/ants_platform/langchain/utils.py +212 -0
  292. ants_platform-3.3.4/ants_platform/logger.py +28 -0
  293. ants_platform-3.3.4/ants_platform/media.py +342 -0
  294. ants_platform-3.3.4/ants_platform/model.py +494 -0
  295. ants_platform-3.3.4/ants_platform/openai.py +1057 -0
  296. ants_platform-3.3.4/ants_platform/py.typed +0 -0
  297. ants_platform-3.3.4/ants_platform/types.py +86 -0
  298. ants_platform-3.3.4/ants_platform/version.py +3 -0
  299. ants_platform-3.3.4/pyproject.toml +109 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Finto Technologies
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,49 @@
1
+ Metadata-Version: 2.3
2
+ Name: ants-platform
3
+ Version: 3.3.4
4
+ Summary: A client library for accessing ants-platform
5
+ License: MIT
6
+ Author: ants-platform
7
+ Author-email: developers@ants-platform.com
8
+ Requires-Python: >=3.9,<4.0
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Provides-Extra: langchain
17
+ Provides-Extra: openai
18
+ Requires-Dist: backoff (>=1.10.0)
19
+ Requires-Dist: httpx (>=0.15.4,<1.0)
20
+ Requires-Dist: langchain (>=0.0.309) ; extra == "langchain"
21
+ Requires-Dist: openai (>=0.27.8) ; extra == "openai"
22
+ Requires-Dist: opentelemetry-api (>=1.33.1,<2.0.0)
23
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http (>=1.33.1,<2.0.0)
24
+ Requires-Dist: opentelemetry-sdk (>=1.33.1,<2.0.0)
25
+ Requires-Dist: packaging (>=23.2,<26.0)
26
+ Requires-Dist: pydantic (>=1.10.7,<3.0)
27
+ Requires-Dist: requests (>=2,<3)
28
+ Requires-Dist: wrapt (>=1.14,<2.0)
29
+ Description-Content-Type: text/markdown
30
+
31
+ # Ants Platform Python SDK
32
+
33
+ [![MIT License](https://img.shields.io/badge/License-MIT-red.svg?style=flat-square)](https://opensource.org/licenses/MIT)
34
+ [![MIT License](https://img.shields.io/badge/License-MIT-red.svg?style=flat-square)](https://opensource.org/licenses/MIT)
35
+ [![PyPI Version](https://img.shields.io/pypi/v/ants-platform.svg?style=flat-square&label=pypi+ants-platform)](https://pypi.python.org/pypi/ants-platform)
36
+
37
+ ## Installation
38
+
39
+ > [!IMPORTANT]
40
+ > This is the Ants Platform Python SDK, a custom observability platform built on top of modern LLM infrastructure.
41
+
42
+ ```
43
+ pip install ants-platform
44
+ ```
45
+
46
+ ## Docs
47
+
48
+ Please see our docs for detailed information on this SDK.
49
+
@@ -0,0 +1,18 @@
1
+ # Ants Platform Python SDK
2
+
3
+ [![MIT License](https://img.shields.io/badge/License-MIT-red.svg?style=flat-square)](https://opensource.org/licenses/MIT)
4
+ [![MIT License](https://img.shields.io/badge/License-MIT-red.svg?style=flat-square)](https://opensource.org/licenses/MIT)
5
+ [![PyPI Version](https://img.shields.io/pypi/v/ants-platform.svg?style=flat-square&label=pypi+ants-platform)](https://pypi.python.org/pypi/ants-platform)
6
+
7
+ ## Installation
8
+
9
+ > [!IMPORTANT]
10
+ > This is the Ants Platform Python SDK, a custom observability platform built on top of modern LLM infrastructure.
11
+
12
+ ```
13
+ pip install ants-platform
14
+ ```
15
+
16
+ ## Docs
17
+
18
+ Please see our docs for detailed information on this SDK.
@@ -0,0 +1,39 @@
1
+ """.. include:: ../README.md"""
2
+
3
+ from ._client import client as _client_module
4
+ from ._client.attributes import LangfuseOtelSpanAttributes
5
+ from ._client.constants import ObservationTypeLiteral
6
+ from ._client.get_client import get_client
7
+ from ._client.observe import observe
8
+ from ._client.span import (
9
+ LangfuseEvent,
10
+ LangfuseGeneration,
11
+ LangfuseSpan,
12
+ LangfuseAgent,
13
+ LangfuseTool,
14
+ LangfuseChain,
15
+ LangfuseEmbedding,
16
+ LangfuseEvaluator,
17
+ LangfuseRetriever,
18
+ LangfuseGuardrail,
19
+ )
20
+
21
+ Langfuse = _client_module.Langfuse
22
+
23
+ __all__ = [
24
+ "Langfuse",
25
+ "get_client",
26
+ "observe",
27
+ "ObservationTypeLiteral",
28
+ "LangfuseSpan",
29
+ "LangfuseGeneration",
30
+ "LangfuseEvent",
31
+ "LangfuseOtelSpanAttributes",
32
+ "LangfuseAgent",
33
+ "LangfuseTool",
34
+ "LangfuseChain",
35
+ "LangfuseEmbedding",
36
+ "LangfuseEvaluator",
37
+ "LangfuseRetriever",
38
+ "LangfuseGuardrail",
39
+ ]
@@ -0,0 +1,191 @@
1
+ """Span attribute management for Langfuse OpenTelemetry integration.
2
+
3
+ This module defines constants and functions for managing OpenTelemetry span attributes
4
+ used by Langfuse. It provides a structured approach to creating and manipulating
5
+ attributes for different span types (trace, span, generation) while ensuring consistency.
6
+
7
+ The module includes:
8
+ - Attribute name constants organized by category
9
+ - Functions to create attribute dictionaries for different entity types
10
+ - Utilities for serializing and processing attribute values
11
+ """
12
+
13
+ import json
14
+ from datetime import datetime
15
+ from typing import Any, Dict, List, Literal, Optional, Union
16
+
17
+ from ants_platform._client.constants import (
18
+ ObservationTypeGenerationLike,
19
+ ObservationTypeSpanLike,
20
+ )
21
+
22
+ from ants_platform._utils.serializer import EventSerializer
23
+ from ants_platform.model import PromptClient
24
+ from ants_platform.types import MapValue, SpanLevel
25
+
26
+
27
+ class LangfuseOtelSpanAttributes:
28
+ # Langfuse-Trace attributes
29
+ TRACE_NAME = "ants_platform.trace.name"
30
+ TRACE_USER_ID = "user.id"
31
+ TRACE_SESSION_ID = "session.id"
32
+ TRACE_TAGS = "ants_platform.trace.tags"
33
+ TRACE_PUBLIC = "ants_platform.trace.public"
34
+ TRACE_METADATA = "ants_platform.trace.metadata"
35
+ TRACE_INPUT = "ants_platform.trace.input"
36
+ TRACE_OUTPUT = "ants_platform.trace.output"
37
+
38
+ # Langfuse-observation attributes
39
+ OBSERVATION_TYPE = "ants_platform.observation.type"
40
+ OBSERVATION_METADATA = "ants_platform.observation.metadata"
41
+ OBSERVATION_LEVEL = "ants_platform.observation.level"
42
+ OBSERVATION_STATUS_MESSAGE = "ants_platform.observation.status_message"
43
+ OBSERVATION_INPUT = "ants_platform.observation.input"
44
+ OBSERVATION_OUTPUT = "ants_platform.observation.output"
45
+
46
+ # Langfuse-observation of type Generation attributes
47
+ OBSERVATION_COMPLETION_START_TIME = "ants_platform.observation.completion_start_time"
48
+ OBSERVATION_MODEL = "ants_platform.observation.model.name"
49
+ OBSERVATION_MODEL_PARAMETERS = "ants_platform.observation.model.parameters"
50
+ OBSERVATION_USAGE_DETAILS = "ants_platform.observation.usage_details"
51
+ OBSERVATION_COST_DETAILS = "ants_platform.observation.cost_details"
52
+ OBSERVATION_PROMPT_NAME = "ants_platform.observation.prompt.name"
53
+ OBSERVATION_PROMPT_VERSION = "ants_platform.observation.prompt.version"
54
+
55
+ # General
56
+ ENVIRONMENT = "ants_platform.environment"
57
+ RELEASE = "ants_platform.release"
58
+ VERSION = "ants_platform.version"
59
+
60
+ # Internal
61
+ AS_ROOT = "ants_platform.internal.as_root"
62
+
63
+
64
+ def create_trace_attributes(
65
+ *,
66
+ name: Optional[str] = None,
67
+ user_id: Optional[str] = None,
68
+ session_id: Optional[str] = None,
69
+ version: Optional[str] = None,
70
+ release: Optional[str] = None,
71
+ input: Optional[Any] = None,
72
+ output: Optional[Any] = None,
73
+ metadata: Optional[Any] = None,
74
+ tags: Optional[List[str]] = None,
75
+ public: Optional[bool] = None,
76
+ ) -> dict:
77
+ attributes = {
78
+ LangfuseOtelSpanAttributes.TRACE_NAME: name,
79
+ LangfuseOtelSpanAttributes.TRACE_USER_ID: user_id,
80
+ LangfuseOtelSpanAttributes.TRACE_SESSION_ID: session_id,
81
+ LangfuseOtelSpanAttributes.VERSION: version,
82
+ LangfuseOtelSpanAttributes.RELEASE: release,
83
+ LangfuseOtelSpanAttributes.TRACE_INPUT: _serialize(input),
84
+ LangfuseOtelSpanAttributes.TRACE_OUTPUT: _serialize(output),
85
+ LangfuseOtelSpanAttributes.TRACE_TAGS: tags,
86
+ LangfuseOtelSpanAttributes.TRACE_PUBLIC: public,
87
+ **_flatten_and_serialize_metadata(metadata, "trace"),
88
+ }
89
+
90
+ return {k: v for k, v in attributes.items() if v is not None}
91
+
92
+
93
+ def create_span_attributes(
94
+ *,
95
+ metadata: Optional[Any] = None,
96
+ input: Optional[Any] = None,
97
+ output: Optional[Any] = None,
98
+ level: Optional[SpanLevel] = None,
99
+ status_message: Optional[str] = None,
100
+ version: Optional[str] = None,
101
+ observation_type: Optional[
102
+ Union[ObservationTypeSpanLike, Literal["event"]]
103
+ ] = "span",
104
+ ) -> dict:
105
+ attributes = {
106
+ LangfuseOtelSpanAttributes.OBSERVATION_TYPE: observation_type,
107
+ LangfuseOtelSpanAttributes.OBSERVATION_LEVEL: level,
108
+ LangfuseOtelSpanAttributes.OBSERVATION_STATUS_MESSAGE: status_message,
109
+ LangfuseOtelSpanAttributes.VERSION: version,
110
+ LangfuseOtelSpanAttributes.OBSERVATION_INPUT: _serialize(input),
111
+ LangfuseOtelSpanAttributes.OBSERVATION_OUTPUT: _serialize(output),
112
+ **_flatten_and_serialize_metadata(metadata, "observation"),
113
+ }
114
+
115
+ return {k: v for k, v in attributes.items() if v is not None}
116
+
117
+
118
+ def create_generation_attributes(
119
+ *,
120
+ name: Optional[str] = None,
121
+ completion_start_time: Optional[datetime] = None,
122
+ metadata: Optional[Any] = None,
123
+ level: Optional[SpanLevel] = None,
124
+ status_message: Optional[str] = None,
125
+ version: Optional[str] = None,
126
+ model: Optional[str] = None,
127
+ model_parameters: Optional[Dict[str, MapValue]] = None,
128
+ input: Optional[Any] = None,
129
+ output: Optional[Any] = None,
130
+ usage_details: Optional[Dict[str, int]] = None,
131
+ cost_details: Optional[Dict[str, float]] = None,
132
+ prompt: Optional[PromptClient] = None,
133
+ observation_type: Optional[ObservationTypeGenerationLike] = "generation",
134
+ ) -> dict:
135
+ attributes = {
136
+ LangfuseOtelSpanAttributes.OBSERVATION_TYPE: observation_type,
137
+ LangfuseOtelSpanAttributes.OBSERVATION_LEVEL: level,
138
+ LangfuseOtelSpanAttributes.OBSERVATION_STATUS_MESSAGE: status_message,
139
+ LangfuseOtelSpanAttributes.VERSION: version,
140
+ LangfuseOtelSpanAttributes.OBSERVATION_INPUT: _serialize(input),
141
+ LangfuseOtelSpanAttributes.OBSERVATION_OUTPUT: _serialize(output),
142
+ LangfuseOtelSpanAttributes.OBSERVATION_MODEL: model,
143
+ LangfuseOtelSpanAttributes.OBSERVATION_PROMPT_NAME: prompt.name
144
+ if prompt and not prompt.is_fallback
145
+ else None,
146
+ LangfuseOtelSpanAttributes.OBSERVATION_PROMPT_VERSION: prompt.version
147
+ if prompt and not prompt.is_fallback
148
+ else None,
149
+ LangfuseOtelSpanAttributes.OBSERVATION_USAGE_DETAILS: _serialize(usage_details),
150
+ LangfuseOtelSpanAttributes.OBSERVATION_COST_DETAILS: _serialize(cost_details),
151
+ LangfuseOtelSpanAttributes.OBSERVATION_COMPLETION_START_TIME: _serialize(
152
+ completion_start_time
153
+ ),
154
+ LangfuseOtelSpanAttributes.OBSERVATION_MODEL_PARAMETERS: _serialize(
155
+ model_parameters
156
+ ),
157
+ **_flatten_and_serialize_metadata(metadata, "observation"),
158
+ }
159
+
160
+ return {k: v for k, v in attributes.items() if v is not None}
161
+
162
+
163
+ def _serialize(obj: Any) -> Optional[str]:
164
+ if obj is None or isinstance(obj, str):
165
+ return obj
166
+
167
+ return json.dumps(obj, cls=EventSerializer)
168
+
169
+
170
+ def _flatten_and_serialize_metadata(
171
+ metadata: Any, type: Literal["observation", "trace"]
172
+ ) -> dict:
173
+ prefix = (
174
+ LangfuseOtelSpanAttributes.OBSERVATION_METADATA
175
+ if type == "observation"
176
+ else LangfuseOtelSpanAttributes.TRACE_METADATA
177
+ )
178
+
179
+ metadata_attributes: Dict[str, Union[str, int, None]] = {}
180
+
181
+ if not isinstance(metadata, dict):
182
+ metadata_attributes[prefix] = _serialize(metadata)
183
+ else:
184
+ for key, value in metadata.items():
185
+ metadata_attributes[f"{prefix}.{key}"] = (
186
+ value
187
+ if isinstance(value, str) or isinstance(value, int)
188
+ else _serialize(value)
189
+ )
190
+
191
+ return metadata_attributes