agentinsight-sdk 0.1.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 (394) hide show
  1. agentinsight/__init__.py +118 -0
  2. agentinsight/_client/attributes.py +250 -0
  3. agentinsight/_client/client.py +3864 -0
  4. agentinsight/_client/config.py +31 -0
  5. agentinsight/_client/constants.py +65 -0
  6. agentinsight/_client/datasets.py +302 -0
  7. agentinsight/_client/environment_variables.py +160 -0
  8. agentinsight/_client/exceptions.py +22 -0
  9. agentinsight/_client/get_client.py +146 -0
  10. agentinsight/_client/observe.py +759 -0
  11. agentinsight/_client/propagation.py +513 -0
  12. agentinsight/_client/resource_manager.py +503 -0
  13. agentinsight/_client/span.py +1551 -0
  14. agentinsight/_client/span_filter.py +81 -0
  15. agentinsight/_client/span_processor.py +210 -0
  16. agentinsight/_client/utils.py +134 -0
  17. agentinsight/_task_manager/media_manager.py +346 -0
  18. agentinsight/_task_manager/media_upload_consumer.py +44 -0
  19. agentinsight/_task_manager/media_upload_queue.py +12 -0
  20. agentinsight/_task_manager/score_ingestion_consumer.py +189 -0
  21. agentinsight/_utils/__init__.py +19 -0
  22. agentinsight/_utils/environment.py +34 -0
  23. agentinsight/_utils/error_logging.py +47 -0
  24. agentinsight/_utils/parse_error.py +99 -0
  25. agentinsight/_utils/prompt_cache.py +231 -0
  26. agentinsight/_utils/request.py +138 -0
  27. agentinsight/_utils/serializer.py +205 -0
  28. agentinsight/_version.py +13 -0
  29. agentinsight/api/.fern/metadata.json +14 -0
  30. agentinsight/api/__init__.py +854 -0
  31. agentinsight/api/annotation_queues/__init__.py +82 -0
  32. agentinsight/api/annotation_queues/client.py +1111 -0
  33. agentinsight/api/annotation_queues/raw_client.py +2288 -0
  34. agentinsight/api/annotation_queues/types/__init__.py +84 -0
  35. agentinsight/api/annotation_queues/types/annotation_queue.py +28 -0
  36. agentinsight/api/annotation_queues/types/annotation_queue_assignment_request.py +16 -0
  37. agentinsight/api/annotation_queues/types/annotation_queue_item.py +34 -0
  38. agentinsight/api/annotation_queues/types/annotation_queue_object_type.py +26 -0
  39. agentinsight/api/annotation_queues/types/annotation_queue_status.py +22 -0
  40. agentinsight/api/annotation_queues/types/create_annotation_queue_assignment_response.py +18 -0
  41. agentinsight/api/annotation_queues/types/create_annotation_queue_item_request.py +25 -0
  42. agentinsight/api/annotation_queues/types/create_annotation_queue_request.py +20 -0
  43. agentinsight/api/annotation_queues/types/delete_annotation_queue_assignment_response.py +14 -0
  44. agentinsight/api/annotation_queues/types/delete_annotation_queue_item_response.py +15 -0
  45. agentinsight/api/annotation_queues/types/paginated_annotation_queue_items.py +17 -0
  46. agentinsight/api/annotation_queues/types/paginated_annotation_queues.py +17 -0
  47. agentinsight/api/annotation_queues/types/update_annotation_queue_item_request.py +15 -0
  48. agentinsight/api/blob_storage_integrations/__init__.py +73 -0
  49. agentinsight/api/blob_storage_integrations/client.py +560 -0
  50. agentinsight/api/blob_storage_integrations/raw_client.py +986 -0
  51. agentinsight/api/blob_storage_integrations/types/__init__.py +77 -0
  52. agentinsight/api/blob_storage_integrations/types/blob_storage_export_frequency.py +26 -0
  53. agentinsight/api/blob_storage_integrations/types/blob_storage_export_mode.py +26 -0
  54. agentinsight/api/blob_storage_integrations/types/blob_storage_integration_deletion_response.py +14 -0
  55. agentinsight/api/blob_storage_integrations/types/blob_storage_integration_file_type.py +26 -0
  56. agentinsight/api/blob_storage_integrations/types/blob_storage_integration_response.py +65 -0
  57. agentinsight/api/blob_storage_integrations/types/blob_storage_integration_status_response.py +50 -0
  58. agentinsight/api/blob_storage_integrations/types/blob_storage_integration_type.py +26 -0
  59. agentinsight/api/blob_storage_integrations/types/blob_storage_integrations_response.py +15 -0
  60. agentinsight/api/blob_storage_integrations/types/blob_storage_sync_status.py +47 -0
  61. agentinsight/api/blob_storage_integrations/types/create_blob_storage_integration_request.py +96 -0
  62. agentinsight/api/client.py +679 -0
  63. agentinsight/api/comments/__init__.py +44 -0
  64. agentinsight/api/comments/client.py +407 -0
  65. agentinsight/api/comments/raw_client.py +750 -0
  66. agentinsight/api/comments/types/__init__.py +46 -0
  67. agentinsight/api/comments/types/create_comment_request.py +47 -0
  68. agentinsight/api/comments/types/create_comment_response.py +17 -0
  69. agentinsight/api/comments/types/get_comments_response.py +17 -0
  70. agentinsight/api/commons/__init__.py +222 -0
  71. agentinsight/api/commons/errors/__init__.py +56 -0
  72. agentinsight/api/commons/errors/access_denied_error.py +12 -0
  73. agentinsight/api/commons/errors/error.py +12 -0
  74. agentinsight/api/commons/errors/method_not_allowed_error.py +12 -0
  75. agentinsight/api/commons/errors/not_found_error.py +12 -0
  76. agentinsight/api/commons/errors/unauthorized_error.py +12 -0
  77. agentinsight/api/commons/types/__init__.py +207 -0
  78. agentinsight/api/commons/types/base_score.py +90 -0
  79. agentinsight/api/commons/types/base_score_v1.py +70 -0
  80. agentinsight/api/commons/types/boolean_score.py +26 -0
  81. agentinsight/api/commons/types/boolean_score_v1.py +26 -0
  82. agentinsight/api/commons/types/categorical_score.py +26 -0
  83. agentinsight/api/commons/types/categorical_score_v1.py +26 -0
  84. agentinsight/api/commons/types/comment.py +36 -0
  85. agentinsight/api/commons/types/comment_object_type.py +30 -0
  86. agentinsight/api/commons/types/config_category.py +15 -0
  87. agentinsight/api/commons/types/correction_score.py +26 -0
  88. agentinsight/api/commons/types/create_score_value.py +5 -0
  89. agentinsight/api/commons/types/dataset.py +49 -0
  90. agentinsight/api/commons/types/dataset_item.py +58 -0
  91. agentinsight/api/commons/types/dataset_run.py +63 -0
  92. agentinsight/api/commons/types/dataset_run_item.py +40 -0
  93. agentinsight/api/commons/types/dataset_run_with_items.py +19 -0
  94. agentinsight/api/commons/types/dataset_status.py +22 -0
  95. agentinsight/api/commons/types/map_value.py +11 -0
  96. agentinsight/api/commons/types/model.py +125 -0
  97. agentinsight/api/commons/types/model_price.py +14 -0
  98. agentinsight/api/commons/types/model_usage_unit.py +42 -0
  99. agentinsight/api/commons/types/numeric_score.py +17 -0
  100. agentinsight/api/commons/types/numeric_score_v1.py +17 -0
  101. agentinsight/api/commons/types/observation.py +142 -0
  102. agentinsight/api/commons/types/observation_level.py +30 -0
  103. agentinsight/api/commons/types/observation_v2.py +235 -0
  104. agentinsight/api/commons/types/observations_view.py +89 -0
  105. agentinsight/api/commons/types/pricing_tier.py +91 -0
  106. agentinsight/api/commons/types/pricing_tier_condition.py +68 -0
  107. agentinsight/api/commons/types/pricing_tier_input.py +76 -0
  108. agentinsight/api/commons/types/pricing_tier_operator.py +42 -0
  109. agentinsight/api/commons/types/score.py +248 -0
  110. agentinsight/api/commons/types/score_config.py +66 -0
  111. agentinsight/api/commons/types/score_config_data_type.py +30 -0
  112. agentinsight/api/commons/types/score_data_type.py +34 -0
  113. agentinsight/api/commons/types/score_source.py +26 -0
  114. agentinsight/api/commons/types/score_v1.py +168 -0
  115. agentinsight/api/commons/types/session.py +25 -0
  116. agentinsight/api/commons/types/session_with_traces.py +15 -0
  117. agentinsight/api/commons/types/text_score.py +21 -0
  118. agentinsight/api/commons/types/text_score_v1.py +21 -0
  119. agentinsight/api/commons/types/trace.py +84 -0
  120. agentinsight/api/commons/types/trace_with_details.py +43 -0
  121. agentinsight/api/commons/types/trace_with_full_details.py +45 -0
  122. agentinsight/api/commons/types/usage.py +59 -0
  123. agentinsight/api/core/__init__.py +111 -0
  124. agentinsight/api/core/api_error.py +23 -0
  125. agentinsight/api/core/client_wrapper.py +141 -0
  126. agentinsight/api/core/datetime_utils.py +30 -0
  127. agentinsight/api/core/enum.py +20 -0
  128. agentinsight/api/core/file.py +70 -0
  129. agentinsight/api/core/force_multipart.py +18 -0
  130. agentinsight/api/core/http_client.py +711 -0
  131. agentinsight/api/core/http_response.py +55 -0
  132. agentinsight/api/core/http_sse/__init__.py +48 -0
  133. agentinsight/api/core/http_sse/_api.py +114 -0
  134. agentinsight/api/core/http_sse/_decoders.py +66 -0
  135. agentinsight/api/core/http_sse/_exceptions.py +7 -0
  136. agentinsight/api/core/http_sse/_models.py +17 -0
  137. agentinsight/api/core/jsonable_encoder.py +102 -0
  138. agentinsight/api/core/pydantic_utilities.py +310 -0
  139. agentinsight/api/core/query_encoder.py +60 -0
  140. agentinsight/api/core/remove_none_from_dict.py +11 -0
  141. agentinsight/api/core/request_options.py +35 -0
  142. agentinsight/api/core/serialization.py +282 -0
  143. agentinsight/api/dataset_items/__init__.py +52 -0
  144. agentinsight/api/dataset_items/client.py +499 -0
  145. agentinsight/api/dataset_items/raw_client.py +973 -0
  146. agentinsight/api/dataset_items/types/__init__.py +50 -0
  147. agentinsight/api/dataset_items/types/create_dataset_item_request.py +37 -0
  148. agentinsight/api/dataset_items/types/delete_dataset_item_response.py +17 -0
  149. agentinsight/api/dataset_items/types/paginated_dataset_items.py +17 -0
  150. agentinsight/api/dataset_run_items/__init__.py +43 -0
  151. agentinsight/api/dataset_run_items/client.py +333 -0
  152. agentinsight/api/dataset_run_items/raw_client.py +557 -0
  153. agentinsight/api/dataset_run_items/types/__init__.py +44 -0
  154. agentinsight/api/dataset_run_items/types/create_dataset_run_item_request.py +58 -0
  155. agentinsight/api/dataset_run_items/types/paginated_dataset_run_items.py +17 -0
  156. agentinsight/api/datasets/__init__.py +55 -0
  157. agentinsight/api/datasets/client.py +661 -0
  158. agentinsight/api/datasets/raw_client.py +1368 -0
  159. agentinsight/api/datasets/types/__init__.py +53 -0
  160. agentinsight/api/datasets/types/create_dataset_request.py +31 -0
  161. agentinsight/api/datasets/types/delete_dataset_run_response.py +14 -0
  162. agentinsight/api/datasets/types/paginated_dataset_runs.py +17 -0
  163. agentinsight/api/datasets/types/paginated_datasets.py +17 -0
  164. agentinsight/api/health/__init__.py +44 -0
  165. agentinsight/api/health/client.py +112 -0
  166. agentinsight/api/health/errors/__init__.py +42 -0
  167. agentinsight/api/health/errors/service_unavailable_error.py +13 -0
  168. agentinsight/api/health/raw_client.py +227 -0
  169. agentinsight/api/health/types/__init__.py +40 -0
  170. agentinsight/api/health/types/health_response.py +30 -0
  171. agentinsight/api/ingestion/__init__.py +169 -0
  172. agentinsight/api/ingestion/client.py +221 -0
  173. agentinsight/api/ingestion/raw_client.py +293 -0
  174. agentinsight/api/ingestion/types/__init__.py +169 -0
  175. agentinsight/api/ingestion/types/base_event.py +27 -0
  176. agentinsight/api/ingestion/types/create_event_body.py +14 -0
  177. agentinsight/api/ingestion/types/create_event_event.py +15 -0
  178. agentinsight/api/ingestion/types/create_generation_body.py +40 -0
  179. agentinsight/api/ingestion/types/create_generation_event.py +15 -0
  180. agentinsight/api/ingestion/types/create_observation_event.py +15 -0
  181. agentinsight/api/ingestion/types/create_span_body.py +19 -0
  182. agentinsight/api/ingestion/types/create_span_event.py +15 -0
  183. agentinsight/api/ingestion/types/ingestion_error.py +17 -0
  184. agentinsight/api/ingestion/types/ingestion_event.py +155 -0
  185. agentinsight/api/ingestion/types/ingestion_response.py +17 -0
  186. agentinsight/api/ingestion/types/ingestion_success.py +15 -0
  187. agentinsight/api/ingestion/types/ingestion_usage.py +8 -0
  188. agentinsight/api/ingestion/types/observation_body.py +53 -0
  189. agentinsight/api/ingestion/types/observation_type.py +54 -0
  190. agentinsight/api/ingestion/types/open_ai_completion_usage_schema.py +26 -0
  191. agentinsight/api/ingestion/types/open_ai_response_usage_schema.py +24 -0
  192. agentinsight/api/ingestion/types/open_ai_usage.py +28 -0
  193. agentinsight/api/ingestion/types/optional_observation_body.py +36 -0
  194. agentinsight/api/ingestion/types/score_body.py +75 -0
  195. agentinsight/api/ingestion/types/score_event.py +15 -0
  196. agentinsight/api/ingestion/types/sdk_log_body.py +14 -0
  197. agentinsight/api/ingestion/types/sdk_log_event.py +15 -0
  198. agentinsight/api/ingestion/types/trace_body.py +36 -0
  199. agentinsight/api/ingestion/types/trace_event.py +15 -0
  200. agentinsight/api/ingestion/types/update_event_body.py +14 -0
  201. agentinsight/api/ingestion/types/update_generation_body.py +40 -0
  202. agentinsight/api/ingestion/types/update_generation_event.py +15 -0
  203. agentinsight/api/ingestion/types/update_observation_event.py +15 -0
  204. agentinsight/api/ingestion/types/update_span_body.py +19 -0
  205. agentinsight/api/ingestion/types/update_span_event.py +15 -0
  206. agentinsight/api/ingestion/types/usage_details.py +10 -0
  207. agentinsight/api/legacy/__init__.py +61 -0
  208. agentinsight/api/legacy/client.py +105 -0
  209. agentinsight/api/legacy/metrics_v1/__init__.py +40 -0
  210. agentinsight/api/legacy/metrics_v1/client.py +214 -0
  211. agentinsight/api/legacy/metrics_v1/raw_client.py +322 -0
  212. agentinsight/api/legacy/metrics_v1/types/__init__.py +40 -0
  213. agentinsight/api/legacy/metrics_v1/types/metrics_response.py +19 -0
  214. agentinsight/api/legacy/observations_v1/__init__.py +43 -0
  215. agentinsight/api/legacy/observations_v1/client.py +523 -0
  216. agentinsight/api/legacy/observations_v1/raw_client.py +759 -0
  217. agentinsight/api/legacy/observations_v1/types/__init__.py +44 -0
  218. agentinsight/api/legacy/observations_v1/types/observations.py +17 -0
  219. agentinsight/api/legacy/observations_v1/types/observations_views.py +17 -0
  220. agentinsight/api/legacy/raw_client.py +13 -0
  221. agentinsight/api/legacy/score_v1/__init__.py +43 -0
  222. agentinsight/api/legacy/score_v1/client.py +329 -0
  223. agentinsight/api/legacy/score_v1/raw_client.py +545 -0
  224. agentinsight/api/legacy/score_v1/types/__init__.py +44 -0
  225. agentinsight/api/legacy/score_v1/types/create_score_request.py +75 -0
  226. agentinsight/api/legacy/score_v1/types/create_score_response.py +17 -0
  227. agentinsight/api/llm_connections/__init__.py +55 -0
  228. agentinsight/api/llm_connections/client.py +311 -0
  229. agentinsight/api/llm_connections/raw_client.py +541 -0
  230. agentinsight/api/llm_connections/types/__init__.py +53 -0
  231. agentinsight/api/llm_connections/types/llm_adapter.py +38 -0
  232. agentinsight/api/llm_connections/types/llm_connection.py +77 -0
  233. agentinsight/api/llm_connections/types/paginated_llm_connections.py +17 -0
  234. agentinsight/api/llm_connections/types/upsert_llm_connection_request.py +69 -0
  235. agentinsight/api/media/__init__.py +58 -0
  236. agentinsight/api/media/client.py +427 -0
  237. agentinsight/api/media/raw_client.py +739 -0
  238. agentinsight/api/media/types/__init__.py +56 -0
  239. agentinsight/api/media/types/get_media_response.py +55 -0
  240. agentinsight/api/media/types/get_media_upload_url_request.py +51 -0
  241. agentinsight/api/media/types/get_media_upload_url_response.py +28 -0
  242. agentinsight/api/media/types/media_content_type.py +232 -0
  243. agentinsight/api/media/types/patch_media_body.py +43 -0
  244. agentinsight/api/metrics/__init__.py +40 -0
  245. agentinsight/api/metrics/client.py +422 -0
  246. agentinsight/api/metrics/raw_client.py +530 -0
  247. agentinsight/api/metrics/types/__init__.py +40 -0
  248. agentinsight/api/metrics/types/metrics_v2response.py +19 -0
  249. agentinsight/api/models/__init__.py +43 -0
  250. agentinsight/api/models/client.py +523 -0
  251. agentinsight/api/models/raw_client.py +993 -0
  252. agentinsight/api/models/types/__init__.py +44 -0
  253. agentinsight/api/models/types/create_model_request.py +103 -0
  254. agentinsight/api/models/types/paginated_models.py +17 -0
  255. agentinsight/api/observations/__init__.py +43 -0
  256. agentinsight/api/observations/client.py +522 -0
  257. agentinsight/api/observations/raw_client.py +641 -0
  258. agentinsight/api/observations/types/__init__.py +44 -0
  259. agentinsight/api/observations/types/observations_v2meta.py +21 -0
  260. agentinsight/api/observations/types/observations_v2response.py +28 -0
  261. agentinsight/api/opentelemetry/__init__.py +67 -0
  262. agentinsight/api/opentelemetry/client.py +276 -0
  263. agentinsight/api/opentelemetry/raw_client.py +291 -0
  264. agentinsight/api/opentelemetry/types/__init__.py +65 -0
  265. agentinsight/api/opentelemetry/types/otel_attribute.py +27 -0
  266. agentinsight/api/opentelemetry/types/otel_attribute_value.py +46 -0
  267. agentinsight/api/opentelemetry/types/otel_resource.py +24 -0
  268. agentinsight/api/opentelemetry/types/otel_resource_span.py +32 -0
  269. agentinsight/api/opentelemetry/types/otel_scope.py +34 -0
  270. agentinsight/api/opentelemetry/types/otel_scope_span.py +28 -0
  271. agentinsight/api/opentelemetry/types/otel_span.py +76 -0
  272. agentinsight/api/opentelemetry/types/otel_trace_response.py +16 -0
  273. agentinsight/api/organizations/__init__.py +73 -0
  274. agentinsight/api/organizations/client.py +756 -0
  275. agentinsight/api/organizations/raw_client.py +1707 -0
  276. agentinsight/api/organizations/types/__init__.py +71 -0
  277. agentinsight/api/organizations/types/delete_membership_request.py +16 -0
  278. agentinsight/api/organizations/types/membership_deletion_response.py +17 -0
  279. agentinsight/api/organizations/types/membership_request.py +18 -0
  280. agentinsight/api/organizations/types/membership_response.py +20 -0
  281. agentinsight/api/organizations/types/membership_role.py +30 -0
  282. agentinsight/api/organizations/types/memberships_response.py +15 -0
  283. agentinsight/api/organizations/types/organization_api_key.py +31 -0
  284. agentinsight/api/organizations/types/organization_api_keys_response.py +19 -0
  285. agentinsight/api/organizations/types/organization_project.py +25 -0
  286. agentinsight/api/organizations/types/organization_projects_response.py +15 -0
  287. agentinsight/api/projects/__init__.py +67 -0
  288. agentinsight/api/projects/client.py +760 -0
  289. agentinsight/api/projects/raw_client.py +1577 -0
  290. agentinsight/api/projects/types/__init__.py +65 -0
  291. agentinsight/api/projects/types/api_key_deletion_response.py +18 -0
  292. agentinsight/api/projects/types/api_key_list.py +23 -0
  293. agentinsight/api/projects/types/api_key_response.py +30 -0
  294. agentinsight/api/projects/types/api_key_summary.py +35 -0
  295. agentinsight/api/projects/types/organization.py +22 -0
  296. agentinsight/api/projects/types/project.py +34 -0
  297. agentinsight/api/projects/types/project_deletion_response.py +15 -0
  298. agentinsight/api/projects/types/projects.py +15 -0
  299. agentinsight/api/prompt_version/__init__.py +4 -0
  300. agentinsight/api/prompt_version/client.py +157 -0
  301. agentinsight/api/prompt_version/raw_client.py +264 -0
  302. agentinsight/api/prompts/__init__.py +100 -0
  303. agentinsight/api/prompts/client.py +550 -0
  304. agentinsight/api/prompts/raw_client.py +987 -0
  305. agentinsight/api/prompts/types/__init__.py +96 -0
  306. agentinsight/api/prompts/types/base_prompt.py +42 -0
  307. agentinsight/api/prompts/types/chat_message.py +17 -0
  308. agentinsight/api/prompts/types/chat_message_type.py +15 -0
  309. agentinsight/api/prompts/types/chat_message_with_placeholders.py +8 -0
  310. agentinsight/api/prompts/types/chat_prompt.py +15 -0
  311. agentinsight/api/prompts/types/create_chat_prompt_request.py +37 -0
  312. agentinsight/api/prompts/types/create_chat_prompt_type.py +15 -0
  313. agentinsight/api/prompts/types/create_prompt_request.py +8 -0
  314. agentinsight/api/prompts/types/create_text_prompt_request.py +36 -0
  315. agentinsight/api/prompts/types/create_text_prompt_type.py +15 -0
  316. agentinsight/api/prompts/types/placeholder_message.py +16 -0
  317. agentinsight/api/prompts/types/placeholder_message_type.py +15 -0
  318. agentinsight/api/prompts/types/prompt.py +58 -0
  319. agentinsight/api/prompts/types/prompt_meta.py +35 -0
  320. agentinsight/api/prompts/types/prompt_meta_list_response.py +17 -0
  321. agentinsight/api/prompts/types/prompt_type.py +20 -0
  322. agentinsight/api/prompts/types/text_prompt.py +14 -0
  323. agentinsight/api/scim/__init__.py +94 -0
  324. agentinsight/api/scim/client.py +686 -0
  325. agentinsight/api/scim/raw_client.py +1528 -0
  326. agentinsight/api/scim/types/__init__.py +92 -0
  327. agentinsight/api/scim/types/authentication_scheme.py +20 -0
  328. agentinsight/api/scim/types/bulk_config.py +22 -0
  329. agentinsight/api/scim/types/empty_response.py +16 -0
  330. agentinsight/api/scim/types/filter_config.py +17 -0
  331. agentinsight/api/scim/types/resource_meta.py +17 -0
  332. agentinsight/api/scim/types/resource_type.py +27 -0
  333. agentinsight/api/scim/types/resource_types_response.py +21 -0
  334. agentinsight/api/scim/types/schema_extension.py +17 -0
  335. agentinsight/api/scim/types/schema_resource.py +19 -0
  336. agentinsight/api/scim/types/schemas_response.py +21 -0
  337. agentinsight/api/scim/types/scim_email.py +16 -0
  338. agentinsight/api/scim/types/scim_feature_support.py +14 -0
  339. agentinsight/api/scim/types/scim_name.py +14 -0
  340. agentinsight/api/scim/types/scim_user.py +24 -0
  341. agentinsight/api/scim/types/scim_users_list_response.py +25 -0
  342. agentinsight/api/scim/types/service_provider_config.py +36 -0
  343. agentinsight/api/scim/types/user_meta.py +20 -0
  344. agentinsight/api/score_configs/__init__.py +44 -0
  345. agentinsight/api/score_configs/client.py +526 -0
  346. agentinsight/api/score_configs/raw_client.py +1012 -0
  347. agentinsight/api/score_configs/types/__init__.py +46 -0
  348. agentinsight/api/score_configs/types/create_score_config_request.py +46 -0
  349. agentinsight/api/score_configs/types/score_configs.py +17 -0
  350. agentinsight/api/score_configs/types/update_score_config_request.py +53 -0
  351. agentinsight/api/scores/__init__.py +82 -0
  352. agentinsight/api/scores/client.py +420 -0
  353. agentinsight/api/scores/raw_client.py +656 -0
  354. agentinsight/api/scores/types/__init__.py +82 -0
  355. agentinsight/api/scores/types/get_scores_response.py +17 -0
  356. agentinsight/api/scores/types/get_scores_response_data.py +258 -0
  357. agentinsight/api/scores/types/get_scores_response_data_boolean.py +15 -0
  358. agentinsight/api/scores/types/get_scores_response_data_categorical.py +15 -0
  359. agentinsight/api/scores/types/get_scores_response_data_correction.py +15 -0
  360. agentinsight/api/scores/types/get_scores_response_data_numeric.py +15 -0
  361. agentinsight/api/scores/types/get_scores_response_data_text.py +15 -0
  362. agentinsight/api/scores/types/get_scores_response_trace_data.py +38 -0
  363. agentinsight/api/sessions/__init__.py +40 -0
  364. agentinsight/api/sessions/client.py +262 -0
  365. agentinsight/api/sessions/raw_client.py +500 -0
  366. agentinsight/api/sessions/types/__init__.py +40 -0
  367. agentinsight/api/sessions/types/paginated_sessions.py +17 -0
  368. agentinsight/api/trace/__init__.py +44 -0
  369. agentinsight/api/trace/client.py +744 -0
  370. agentinsight/api/trace/raw_client.py +1228 -0
  371. agentinsight/api/trace/types/__init__.py +46 -0
  372. agentinsight/api/trace/types/delete_trace_response.py +14 -0
  373. agentinsight/api/trace/types/sort.py +14 -0
  374. agentinsight/api/trace/types/traces.py +17 -0
  375. agentinsight/api/utils/__init__.py +44 -0
  376. agentinsight/api/utils/pagination/__init__.py +40 -0
  377. agentinsight/api/utils/pagination/types/__init__.py +40 -0
  378. agentinsight/api/utils/pagination/types/meta_response.py +38 -0
  379. agentinsight/batch_evaluation.py +1643 -0
  380. agentinsight/experiment.py +1207 -0
  381. agentinsight/langchain/CallbackHandler.py +1791 -0
  382. agentinsight/langchain/__init__.py +5 -0
  383. agentinsight/langchain/utils.py +212 -0
  384. agentinsight/logger.py +28 -0
  385. agentinsight/media.py +352 -0
  386. agentinsight/model.py +479 -0
  387. agentinsight/openai.py +1390 -0
  388. agentinsight/py.typed +0 -0
  389. agentinsight/span_filter.py +19 -0
  390. agentinsight/types.py +83 -0
  391. agentinsight_sdk-0.1.0.dist-info/METADATA +820 -0
  392. agentinsight_sdk-0.1.0.dist-info/RECORD +394 -0
  393. agentinsight_sdk-0.1.0.dist-info/WHEEL +4 -0
  394. agentinsight_sdk-0.1.0.dist-info/licenses/LICENSE +22 -0
@@ -0,0 +1,118 @@
1
+ """.. include:: ../README.md"""
2
+
3
+ from typing import Any, Optional
4
+
5
+ from agentinsight.batch_evaluation import (
6
+ BatchEvaluationResult,
7
+ BatchEvaluationResumeToken,
8
+ CompositeEvaluatorFunction,
9
+ EvaluatorInputs,
10
+ EvaluatorStats,
11
+ MapperFunction,
12
+ )
13
+ from agentinsight.experiment import Evaluation, RegressionError, RunnerContext
14
+
15
+ from ._client import client as _client_module
16
+ from ._client.attributes import AgentInsightOtelSpanAttributes
17
+ from ._client.client import Serializable
18
+ from ._client.config import AgentInsightConfig
19
+ from ._client.constants import ObservationTypeLiteral
20
+ from ._client.exceptions import (
21
+ AgentInsightAuthenticationError,
22
+ AgentInsightConfigurationError,
23
+ AgentInsightConnectionError,
24
+ AgentInsightError,
25
+ AgentInsightSerializationError,
26
+ AgentInsightTimeoutError,
27
+ )
28
+ from ._client.get_client import get_client
29
+ from ._client.observe import observe
30
+ from ._client.propagation import propagate_attributes
31
+ from ._client.span import (
32
+ AgentInsightAgent,
33
+ AgentInsightChain,
34
+ AgentInsightEmbedding,
35
+ AgentInsightEvaluator,
36
+ AgentInsightEvent,
37
+ AgentInsightGeneration,
38
+ AgentInsightGuardrail,
39
+ AgentInsightRetriever,
40
+ AgentInsightSpan,
41
+ AgentInsightTool,
42
+ )
43
+ from ._version import __version__
44
+ from .span_filter import (
45
+ KNOWN_LLM_INSTRUMENTATION_SCOPE_PREFIXES,
46
+ is_agentinsight_span,
47
+ is_default_export_span,
48
+ is_genai_span,
49
+ is_known_llm_instrumentor,
50
+ is_langfuse_span,
51
+ )
52
+
53
+ AgentInsight = _client_module.AgentInsight
54
+ AgentInsightClient = _client_module.AgentInsightClient
55
+
56
+ _default_client: Optional[AgentInsight] = None
57
+
58
+
59
+ def init(
60
+ *,
61
+ public_key: Optional[str] = None,
62
+ secret_key: Optional[str] = None,
63
+ base_url: Optional[str] = None,
64
+ **kwargs: Any,
65
+ ) -> AgentInsight:
66
+ global _default_client
67
+ _default_client = AgentInsight(
68
+ public_key=public_key, secret_key=secret_key, base_url=base_url, **kwargs
69
+ )
70
+ return _default_client
71
+
72
+
73
+ __all__ = [
74
+ "AgentInsight",
75
+ "AgentInsightClient",
76
+ "AgentInsightConfig",
77
+ "init",
78
+ "get_client",
79
+ "observe",
80
+ "propagate_attributes",
81
+ "ObservationTypeLiteral",
82
+ "AgentInsightSpan",
83
+ "AgentInsightGeneration",
84
+ "AgentInsightEvent",
85
+ "AgentInsightOtelSpanAttributes",
86
+ "Serializable",
87
+ "AgentInsightAgent",
88
+ "AgentInsightTool",
89
+ "AgentInsightChain",
90
+ "AgentInsightEmbedding",
91
+ "AgentInsightEvaluator",
92
+ "AgentInsightRetriever",
93
+ "AgentInsightGuardrail",
94
+ "AgentInsightError",
95
+ "AgentInsightAuthenticationError",
96
+ "AgentInsightConnectionError",
97
+ "AgentInsightSerializationError",
98
+ "AgentInsightConfigurationError",
99
+ "AgentInsightTimeoutError",
100
+ "Evaluation",
101
+ "EvaluatorInputs",
102
+ "MapperFunction",
103
+ "CompositeEvaluatorFunction",
104
+ "EvaluatorStats",
105
+ "BatchEvaluationResumeToken",
106
+ "BatchEvaluationResult",
107
+ "RunnerContext",
108
+ "RegressionError",
109
+ "__version__",
110
+ "is_default_export_span",
111
+ "is_langfuse_span",
112
+ "is_agentinsight_span",
113
+ "is_genai_span",
114
+ "is_known_llm_instrumentor",
115
+ "KNOWN_LLM_INSTRUMENTATION_SCOPE_PREFIXES",
116
+ "experiment",
117
+ "api",
118
+ ]
@@ -0,0 +1,250 @@
1
+ """Span attribute management for AgentInsight OpenTelemetry integration.
2
+
3
+ This module defines constants and functions for managing OpenTelemetry span attributes
4
+ used by AgentInsight. 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, Literal, Optional, Union
16
+
17
+ from agentinsight._client.constants import (
18
+ ObservationTypeGenerationLike,
19
+ ObservationTypeSpanLike,
20
+ )
21
+ from agentinsight._utils.serializer import EventSerializer
22
+ from agentinsight.api import MapValue
23
+ from agentinsight.model import PromptClient
24
+ from agentinsight.types import SpanLevel
25
+
26
+
27
+ class AgentInsightOtelSpanAttributes:
28
+ TRACE_NAME = "langfuse.trace.name"
29
+ TRACE_NAME_NEW = "agentinsight.trace.name"
30
+ TRACE_USER_ID = "user.id"
31
+ TRACE_USER_ID_NEW = "agentinsight.user.id"
32
+ TRACE_SESSION_ID = "session.id"
33
+ TRACE_SESSION_ID_NEW = "agentinsight.session.id"
34
+ TRACE_TAGS = "langfuse.trace.tags"
35
+ TRACE_TAGS_NEW = "agentinsight.trace.tags"
36
+ TRACE_PUBLIC = "langfuse.trace.public"
37
+ TRACE_PUBLIC_NEW = "agentinsight.trace.public"
38
+ TRACE_METADATA = "langfuse.trace.metadata"
39
+ TRACE_METADATA_NEW = "agentinsight.trace.metadata"
40
+ TRACE_INPUT = "langfuse.trace.input"
41
+ TRACE_INPUT_NEW = "agentinsight.trace.input"
42
+ TRACE_OUTPUT = "langfuse.trace.output"
43
+ TRACE_OUTPUT_NEW = "agentinsight.trace.output"
44
+
45
+ OBSERVATION_TYPE = "langfuse.observation.type"
46
+ OBSERVATION_TYPE_NEW = "agentinsight.observation.type"
47
+ OBSERVATION_METADATA = "langfuse.observation.metadata"
48
+ OBSERVATION_METADATA_NEW = "agentinsight.observation.metadata"
49
+ OBSERVATION_LEVEL = "langfuse.observation.level"
50
+ OBSERVATION_LEVEL_NEW = "agentinsight.observation.level"
51
+ OBSERVATION_STATUS_MESSAGE = "langfuse.observation.status_message"
52
+ OBSERVATION_STATUS_MESSAGE_NEW = "agentinsight.observation.status_message"
53
+ OBSERVATION_INPUT = "langfuse.observation.input"
54
+ OBSERVATION_INPUT_NEW = "agentinsight.observation.input"
55
+ OBSERVATION_OUTPUT = "langfuse.observation.output"
56
+ OBSERVATION_OUTPUT_NEW = "agentinsight.observation.output"
57
+
58
+ OBSERVATION_COMPLETION_START_TIME = "langfuse.observation.completion_start_time"
59
+ OBSERVATION_COMPLETION_START_TIME_NEW = (
60
+ "agentinsight.observation.completion_start_time"
61
+ )
62
+ OBSERVATION_MODEL = "langfuse.observation.model.name"
63
+ OBSERVATION_MODEL_NEW = "agentinsight.observation.model.name"
64
+ OBSERVATION_MODEL_PARAMETERS = "langfuse.observation.model.parameters"
65
+ OBSERVATION_MODEL_PARAMETERS_NEW = "agentinsight.observation.model.parameters"
66
+ OBSERVATION_USAGE_DETAILS = "langfuse.observation.usage_details"
67
+ OBSERVATION_USAGE_DETAILS_NEW = "agentinsight.observation.usage_details"
68
+ OBSERVATION_COST_DETAILS = "langfuse.observation.cost_details"
69
+ OBSERVATION_COST_DETAILS_NEW = "agentinsight.observation.cost_details"
70
+ OBSERVATION_PROMPT_NAME = "langfuse.observation.prompt.name"
71
+ OBSERVATION_PROMPT_NAME_NEW = "agentinsight.observation.prompt.name"
72
+ OBSERVATION_PROMPT_VERSION = "langfuse.observation.prompt.version"
73
+ OBSERVATION_PROMPT_VERSION_NEW = "agentinsight.observation.prompt.version"
74
+
75
+ ENVIRONMENT = "langfuse.environment"
76
+ ENVIRONMENT_NEW = "agentinsight.environment"
77
+ RELEASE = "langfuse.release"
78
+ RELEASE_NEW = "agentinsight.release"
79
+ VERSION = "langfuse.version"
80
+ VERSION_NEW = "agentinsight.version"
81
+
82
+ AS_ROOT = "langfuse.internal.as_root"
83
+ AS_ROOT_NEW = "agentinsight.internal.as_root"
84
+
85
+ EXPERIMENT_ID = "langfuse.experiment.id"
86
+ EXPERIMENT_ID_NEW = "agentinsight.experiment.id"
87
+ EXPERIMENT_NAME = "langfuse.experiment.name"
88
+ EXPERIMENT_NAME_NEW = "agentinsight.experiment.name"
89
+ EXPERIMENT_DESCRIPTION = "langfuse.experiment.description"
90
+ EXPERIMENT_DESCRIPTION_NEW = "agentinsight.experiment.description"
91
+ EXPERIMENT_METADATA = "langfuse.experiment.metadata"
92
+ EXPERIMENT_METADATA_NEW = "agentinsight.experiment.metadata"
93
+ EXPERIMENT_DATASET_ID = "langfuse.experiment.dataset.id"
94
+ EXPERIMENT_DATASET_ID_NEW = "agentinsight.experiment.dataset.id"
95
+ EXPERIMENT_ITEM_ID = "langfuse.experiment.item.id"
96
+ EXPERIMENT_ITEM_ID_NEW = "agentinsight.experiment.item.id"
97
+ EXPERIMENT_ITEM_EXPECTED_OUTPUT = "langfuse.experiment.item.expected_output"
98
+ EXPERIMENT_ITEM_EXPECTED_OUTPUT_NEW = "agentinsight.experiment.item.expected_output"
99
+ EXPERIMENT_ITEM_METADATA = "langfuse.experiment.item.metadata"
100
+ EXPERIMENT_ITEM_METADATA_NEW = "agentinsight.experiment.item.metadata"
101
+ EXPERIMENT_ITEM_ROOT_OBSERVATION_ID = "langfuse.experiment.item.root_observation_id"
102
+ EXPERIMENT_ITEM_ROOT_OBSERVATION_ID_NEW = (
103
+ "agentinsight.experiment.item.root_observation_id"
104
+ )
105
+
106
+
107
+ def create_trace_attributes(
108
+ *,
109
+ input: Optional[Any] = None,
110
+ output: Optional[Any] = None,
111
+ public: Optional[bool] = None,
112
+ ) -> dict:
113
+ attributes = {
114
+ AgentInsightOtelSpanAttributes.TRACE_INPUT: _serialize(input),
115
+ AgentInsightOtelSpanAttributes.TRACE_OUTPUT: _serialize(output),
116
+ AgentInsightOtelSpanAttributes.TRACE_PUBLIC: public,
117
+ }
118
+
119
+ return {k: v for k, v in attributes.items() if v is not None}
120
+
121
+
122
+ def create_span_attributes(
123
+ *,
124
+ metadata: Optional[Any] = None,
125
+ input: Optional[Any] = None,
126
+ output: Optional[Any] = None,
127
+ level: Optional[SpanLevel] = None,
128
+ status_message: Optional[str] = None,
129
+ version: Optional[str] = None,
130
+ observation_type: Optional[
131
+ Union[ObservationTypeSpanLike, Literal["event"]]
132
+ ] = "span",
133
+ ) -> dict:
134
+ attributes = {
135
+ AgentInsightOtelSpanAttributes.OBSERVATION_TYPE: observation_type,
136
+ AgentInsightOtelSpanAttributes.OBSERVATION_LEVEL: level,
137
+ AgentInsightOtelSpanAttributes.OBSERVATION_STATUS_MESSAGE: status_message,
138
+ AgentInsightOtelSpanAttributes.VERSION: version,
139
+ AgentInsightOtelSpanAttributes.OBSERVATION_INPUT: _serialize(input),
140
+ AgentInsightOtelSpanAttributes.OBSERVATION_OUTPUT: _serialize(output),
141
+ **_flatten_and_serialize_metadata(metadata, "observation"),
142
+ }
143
+
144
+ return {k: v for k, v in attributes.items() if v is not None}
145
+
146
+
147
+ def create_generation_attributes(
148
+ *,
149
+ name: Optional[str] = None,
150
+ completion_start_time: Optional[datetime] = None,
151
+ metadata: Optional[Any] = None,
152
+ level: Optional[SpanLevel] = None,
153
+ status_message: Optional[str] = None,
154
+ version: Optional[str] = None,
155
+ model: Optional[str] = None,
156
+ model_parameters: Optional[Dict[str, MapValue]] = None,
157
+ input: Optional[Any] = None,
158
+ output: Optional[Any] = None,
159
+ usage_details: Optional[Dict[str, int]] = None,
160
+ cost_details: Optional[Dict[str, float]] = None,
161
+ prompt: Optional[PromptClient] = None,
162
+ observation_type: Optional[ObservationTypeGenerationLike] = "generation",
163
+ ) -> dict:
164
+ attributes = {
165
+ AgentInsightOtelSpanAttributes.OBSERVATION_TYPE: observation_type,
166
+ AgentInsightOtelSpanAttributes.OBSERVATION_LEVEL: level,
167
+ AgentInsightOtelSpanAttributes.OBSERVATION_STATUS_MESSAGE: status_message,
168
+ AgentInsightOtelSpanAttributes.VERSION: version,
169
+ AgentInsightOtelSpanAttributes.OBSERVATION_INPUT: _serialize(input),
170
+ AgentInsightOtelSpanAttributes.OBSERVATION_OUTPUT: _serialize(output),
171
+ AgentInsightOtelSpanAttributes.OBSERVATION_MODEL: model,
172
+ AgentInsightOtelSpanAttributes.OBSERVATION_PROMPT_NAME: prompt.name
173
+ if prompt and not prompt.is_fallback
174
+ else None,
175
+ AgentInsightOtelSpanAttributes.OBSERVATION_PROMPT_VERSION: prompt.version
176
+ if prompt and not prompt.is_fallback
177
+ else None,
178
+ AgentInsightOtelSpanAttributes.OBSERVATION_USAGE_DETAILS: _serialize(
179
+ usage_details
180
+ ),
181
+ AgentInsightOtelSpanAttributes.OBSERVATION_COST_DETAILS: _serialize(
182
+ cost_details
183
+ ),
184
+ AgentInsightOtelSpanAttributes.OBSERVATION_COMPLETION_START_TIME: _serialize(
185
+ completion_start_time
186
+ ),
187
+ AgentInsightOtelSpanAttributes.OBSERVATION_MODEL_PARAMETERS: _serialize(
188
+ model_parameters
189
+ ),
190
+ **_flatten_and_serialize_metadata(metadata, "observation"),
191
+ }
192
+
193
+ return {k: v for k, v in attributes.items() if v is not None}
194
+
195
+
196
+ def _serialize(obj: Any) -> Optional[str]:
197
+ if obj is None or isinstance(obj, str):
198
+ return obj
199
+
200
+ return json.dumps(obj, cls=EventSerializer)
201
+
202
+
203
+ def _flatten_and_serialize_metadata_values(
204
+ metadata: Optional[Dict[str, Any]],
205
+ ) -> Optional[Dict[str, str]]:
206
+ if metadata is None:
207
+ return None
208
+
209
+ flattened_metadata: Dict[str, str] = {}
210
+
211
+ def flatten_value(path: str, value: Any) -> None:
212
+ if isinstance(value, dict):
213
+ for nested_key, nested_value in value.items():
214
+ flatten_value(f"{path}.{nested_key}", nested_value)
215
+
216
+ return
217
+
218
+ serialized_value = _serialize(value)
219
+
220
+ if serialized_value is not None:
221
+ flattened_metadata[path] = serialized_value
222
+
223
+ for key, value in metadata.items():
224
+ flatten_value(str(key), value)
225
+
226
+ return flattened_metadata
227
+
228
+
229
+ def _flatten_and_serialize_metadata(
230
+ metadata: Any, type: Literal["observation", "trace"]
231
+ ) -> dict:
232
+ prefix = (
233
+ AgentInsightOtelSpanAttributes.OBSERVATION_METADATA
234
+ if type == "observation"
235
+ else AgentInsightOtelSpanAttributes.TRACE_METADATA
236
+ )
237
+
238
+ metadata_attributes: Dict[str, Union[str, int, None]] = {}
239
+
240
+ if not isinstance(metadata, dict):
241
+ metadata_attributes[prefix] = _serialize(metadata)
242
+ else:
243
+ for key, value in metadata.items():
244
+ metadata_attributes[f"{prefix}.{key}"] = (
245
+ value
246
+ if isinstance(value, str) or isinstance(value, int)
247
+ else _serialize(value)
248
+ )
249
+
250
+ return metadata_attributes