azure-ai-evaluation 1.0.0b2__py3-none-any.whl → 1.13.3__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.

Potentially problematic release.


This version of azure-ai-evaluation might be problematic. Click here for more details.

Files changed (299) hide show
  1. azure/ai/evaluation/__init__.py +100 -5
  2. azure/ai/evaluation/{_evaluators/_chat → _aoai}/__init__.py +3 -2
  3. azure/ai/evaluation/_aoai/aoai_grader.py +140 -0
  4. azure/ai/evaluation/_aoai/label_grader.py +68 -0
  5. azure/ai/evaluation/_aoai/python_grader.py +86 -0
  6. azure/ai/evaluation/_aoai/score_model_grader.py +94 -0
  7. azure/ai/evaluation/_aoai/string_check_grader.py +66 -0
  8. azure/ai/evaluation/_aoai/text_similarity_grader.py +80 -0
  9. azure/ai/evaluation/_azure/__init__.py +3 -0
  10. azure/ai/evaluation/_azure/_clients.py +204 -0
  11. azure/ai/evaluation/_azure/_envs.py +207 -0
  12. azure/ai/evaluation/_azure/_models.py +227 -0
  13. azure/ai/evaluation/_azure/_token_manager.py +129 -0
  14. azure/ai/evaluation/_common/__init__.py +9 -1
  15. azure/ai/evaluation/{simulator/_helpers → _common}/_experimental.py +24 -9
  16. azure/ai/evaluation/_common/constants.py +131 -2
  17. azure/ai/evaluation/_common/evaluation_onedp_client.py +169 -0
  18. azure/ai/evaluation/_common/math.py +89 -0
  19. azure/ai/evaluation/_common/onedp/__init__.py +32 -0
  20. azure/ai/evaluation/_common/onedp/_client.py +166 -0
  21. azure/ai/evaluation/_common/onedp/_configuration.py +72 -0
  22. azure/ai/evaluation/_common/onedp/_model_base.py +1232 -0
  23. azure/ai/evaluation/_common/onedp/_patch.py +21 -0
  24. azure/ai/evaluation/_common/onedp/_serialization.py +2032 -0
  25. azure/ai/evaluation/_common/onedp/_types.py +21 -0
  26. azure/ai/evaluation/_common/onedp/_utils/__init__.py +6 -0
  27. azure/ai/evaluation/_common/onedp/_utils/model_base.py +1232 -0
  28. azure/ai/evaluation/_common/onedp/_utils/serialization.py +2032 -0
  29. azure/ai/evaluation/_common/onedp/_validation.py +66 -0
  30. azure/ai/evaluation/_common/onedp/_vendor.py +50 -0
  31. azure/ai/evaluation/_common/onedp/_version.py +9 -0
  32. azure/ai/evaluation/_common/onedp/aio/__init__.py +29 -0
  33. azure/ai/evaluation/_common/onedp/aio/_client.py +168 -0
  34. azure/ai/evaluation/_common/onedp/aio/_configuration.py +72 -0
  35. azure/ai/evaluation/_common/onedp/aio/_patch.py +21 -0
  36. azure/ai/evaluation/_common/onedp/aio/operations/__init__.py +49 -0
  37. azure/ai/evaluation/_common/onedp/aio/operations/_operations.py +7143 -0
  38. azure/ai/evaluation/_common/onedp/aio/operations/_patch.py +21 -0
  39. azure/ai/evaluation/_common/onedp/models/__init__.py +358 -0
  40. azure/ai/evaluation/_common/onedp/models/_enums.py +447 -0
  41. azure/ai/evaluation/_common/onedp/models/_models.py +5963 -0
  42. azure/ai/evaluation/_common/onedp/models/_patch.py +21 -0
  43. azure/ai/evaluation/_common/onedp/operations/__init__.py +49 -0
  44. azure/ai/evaluation/_common/onedp/operations/_operations.py +8951 -0
  45. azure/ai/evaluation/_common/onedp/operations/_patch.py +21 -0
  46. azure/ai/evaluation/_common/onedp/py.typed +1 -0
  47. azure/ai/evaluation/_common/onedp/servicepatterns/__init__.py +1 -0
  48. azure/ai/evaluation/_common/onedp/servicepatterns/aio/__init__.py +1 -0
  49. azure/ai/evaluation/_common/onedp/servicepatterns/aio/operations/__init__.py +25 -0
  50. azure/ai/evaluation/_common/onedp/servicepatterns/aio/operations/_operations.py +34 -0
  51. azure/ai/evaluation/_common/onedp/servicepatterns/aio/operations/_patch.py +20 -0
  52. azure/ai/evaluation/_common/onedp/servicepatterns/buildingblocks/__init__.py +1 -0
  53. azure/ai/evaluation/_common/onedp/servicepatterns/buildingblocks/aio/__init__.py +1 -0
  54. azure/ai/evaluation/_common/onedp/servicepatterns/buildingblocks/aio/operations/__init__.py +22 -0
  55. azure/ai/evaluation/_common/onedp/servicepatterns/buildingblocks/aio/operations/_operations.py +29 -0
  56. azure/ai/evaluation/_common/onedp/servicepatterns/buildingblocks/aio/operations/_patch.py +20 -0
  57. azure/ai/evaluation/_common/onedp/servicepatterns/buildingblocks/operations/__init__.py +22 -0
  58. azure/ai/evaluation/_common/onedp/servicepatterns/buildingblocks/operations/_operations.py +29 -0
  59. azure/ai/evaluation/_common/onedp/servicepatterns/buildingblocks/operations/_patch.py +20 -0
  60. azure/ai/evaluation/_common/onedp/servicepatterns/operations/__init__.py +25 -0
  61. azure/ai/evaluation/_common/onedp/servicepatterns/operations/_operations.py +34 -0
  62. azure/ai/evaluation/_common/onedp/servicepatterns/operations/_patch.py +20 -0
  63. azure/ai/evaluation/_common/rai_service.py +831 -142
  64. azure/ai/evaluation/_common/raiclient/__init__.py +34 -0
  65. azure/ai/evaluation/_common/raiclient/_client.py +128 -0
  66. azure/ai/evaluation/_common/raiclient/_configuration.py +87 -0
  67. azure/ai/evaluation/_common/raiclient/_model_base.py +1235 -0
  68. azure/ai/evaluation/_common/raiclient/_patch.py +20 -0
  69. azure/ai/evaluation/_common/raiclient/_serialization.py +2050 -0
  70. azure/ai/evaluation/_common/raiclient/_version.py +9 -0
  71. azure/ai/evaluation/_common/raiclient/aio/__init__.py +29 -0
  72. azure/ai/evaluation/_common/raiclient/aio/_client.py +130 -0
  73. azure/ai/evaluation/_common/raiclient/aio/_configuration.py +87 -0
  74. azure/ai/evaluation/_common/raiclient/aio/_patch.py +20 -0
  75. azure/ai/evaluation/_common/raiclient/aio/operations/__init__.py +25 -0
  76. azure/ai/evaluation/_common/raiclient/aio/operations/_operations.py +981 -0
  77. azure/ai/evaluation/_common/raiclient/aio/operations/_patch.py +20 -0
  78. azure/ai/evaluation/_common/raiclient/models/__init__.py +60 -0
  79. azure/ai/evaluation/_common/raiclient/models/_enums.py +18 -0
  80. azure/ai/evaluation/_common/raiclient/models/_models.py +651 -0
  81. azure/ai/evaluation/_common/raiclient/models/_patch.py +20 -0
  82. azure/ai/evaluation/_common/raiclient/operations/__init__.py +25 -0
  83. azure/ai/evaluation/_common/raiclient/operations/_operations.py +1238 -0
  84. azure/ai/evaluation/_common/raiclient/operations/_patch.py +20 -0
  85. azure/ai/evaluation/_common/raiclient/py.typed +1 -0
  86. azure/ai/evaluation/_common/utils.py +870 -34
  87. azure/ai/evaluation/_constants.py +167 -6
  88. azure/ai/evaluation/_converters/__init__.py +3 -0
  89. azure/ai/evaluation/_converters/_ai_services.py +899 -0
  90. azure/ai/evaluation/_converters/_models.py +467 -0
  91. azure/ai/evaluation/_converters/_sk_services.py +495 -0
  92. azure/ai/evaluation/_eval_mapping.py +83 -0
  93. azure/ai/evaluation/_evaluate/_batch_run/__init__.py +17 -0
  94. azure/ai/evaluation/_evaluate/_batch_run/_run_submitter_client.py +176 -0
  95. azure/ai/evaluation/_evaluate/_batch_run/batch_clients.py +82 -0
  96. azure/ai/evaluation/_evaluate/{_batch_run_client → _batch_run}/code_client.py +47 -25
  97. azure/ai/evaluation/_evaluate/{_batch_run_client/batch_run_context.py → _batch_run/eval_run_context.py} +42 -13
  98. azure/ai/evaluation/_evaluate/_batch_run/proxy_client.py +124 -0
  99. azure/ai/evaluation/_evaluate/_batch_run/target_run_context.py +62 -0
  100. azure/ai/evaluation/_evaluate/_eval_run.py +102 -59
  101. azure/ai/evaluation/_evaluate/_evaluate.py +2134 -311
  102. azure/ai/evaluation/_evaluate/_evaluate_aoai.py +992 -0
  103. azure/ai/evaluation/_evaluate/_telemetry/__init__.py +14 -99
  104. azure/ai/evaluation/_evaluate/_utils.py +289 -40
  105. azure/ai/evaluation/_evaluator_definition.py +76 -0
  106. azure/ai/evaluation/_evaluators/_bleu/_bleu.py +93 -42
  107. azure/ai/evaluation/_evaluators/_code_vulnerability/__init__.py +5 -0
  108. azure/ai/evaluation/_evaluators/_code_vulnerability/_code_vulnerability.py +119 -0
  109. azure/ai/evaluation/_evaluators/_coherence/_coherence.py +117 -91
  110. azure/ai/evaluation/_evaluators/_coherence/coherence.prompty +76 -39
  111. azure/ai/evaluation/_evaluators/_common/__init__.py +15 -0
  112. azure/ai/evaluation/_evaluators/_common/_base_eval.py +742 -0
  113. azure/ai/evaluation/_evaluators/_common/_base_multi_eval.py +63 -0
  114. azure/ai/evaluation/_evaluators/_common/_base_prompty_eval.py +345 -0
  115. azure/ai/evaluation/_evaluators/_common/_base_rai_svc_eval.py +198 -0
  116. azure/ai/evaluation/_evaluators/_common/_conversation_aggregators.py +49 -0
  117. azure/ai/evaluation/_evaluators/_content_safety/__init__.py +0 -4
  118. azure/ai/evaluation/_evaluators/_content_safety/_content_safety.py +144 -86
  119. azure/ai/evaluation/_evaluators/_content_safety/_hate_unfairness.py +138 -57
  120. azure/ai/evaluation/_evaluators/_content_safety/_self_harm.py +123 -55
  121. azure/ai/evaluation/_evaluators/_content_safety/_sexual.py +133 -54
  122. azure/ai/evaluation/_evaluators/_content_safety/_violence.py +134 -54
  123. azure/ai/evaluation/_evaluators/_document_retrieval/__init__.py +7 -0
  124. azure/ai/evaluation/_evaluators/_document_retrieval/_document_retrieval.py +442 -0
  125. azure/ai/evaluation/_evaluators/_eci/_eci.py +49 -56
  126. azure/ai/evaluation/_evaluators/_f1_score/_f1_score.py +102 -60
  127. azure/ai/evaluation/_evaluators/_fluency/_fluency.py +115 -92
  128. azure/ai/evaluation/_evaluators/_fluency/fluency.prompty +66 -41
  129. azure/ai/evaluation/_evaluators/_gleu/_gleu.py +90 -37
  130. azure/ai/evaluation/_evaluators/_groundedness/_groundedness.py +318 -82
  131. azure/ai/evaluation/_evaluators/_groundedness/groundedness_with_query.prompty +114 -0
  132. azure/ai/evaluation/_evaluators/_groundedness/groundedness_without_query.prompty +104 -0
  133. azure/ai/evaluation/{_evaluate/_batch_run_client → _evaluators/_intent_resolution}/__init__.py +3 -4
  134. azure/ai/evaluation/_evaluators/_intent_resolution/_intent_resolution.py +196 -0
  135. azure/ai/evaluation/_evaluators/_intent_resolution/intent_resolution.prompty +275 -0
  136. azure/ai/evaluation/_evaluators/_meteor/_meteor.py +107 -61
  137. azure/ai/evaluation/_evaluators/_protected_material/_protected_material.py +104 -77
  138. azure/ai/evaluation/_evaluators/_qa/_qa.py +115 -63
  139. azure/ai/evaluation/_evaluators/_relevance/_relevance.py +182 -98
  140. azure/ai/evaluation/_evaluators/_relevance/relevance.prompty +178 -49
  141. azure/ai/evaluation/_evaluators/_response_completeness/__init__.py +7 -0
  142. azure/ai/evaluation/_evaluators/_response_completeness/_response_completeness.py +202 -0
  143. azure/ai/evaluation/_evaluators/_response_completeness/response_completeness.prompty +84 -0
  144. azure/ai/evaluation/_evaluators/{_chat/retrieval → _retrieval}/__init__.py +2 -2
  145. azure/ai/evaluation/_evaluators/_retrieval/_retrieval.py +148 -0
  146. azure/ai/evaluation/_evaluators/_retrieval/retrieval.prompty +93 -0
  147. azure/ai/evaluation/_evaluators/_rouge/_rouge.py +189 -50
  148. azure/ai/evaluation/_evaluators/_service_groundedness/__init__.py +9 -0
  149. azure/ai/evaluation/_evaluators/_service_groundedness/_service_groundedness.py +179 -0
  150. azure/ai/evaluation/_evaluators/_similarity/_similarity.py +102 -91
  151. azure/ai/evaluation/_evaluators/_similarity/similarity.prompty +0 -5
  152. azure/ai/evaluation/_evaluators/_task_adherence/__init__.py +7 -0
  153. azure/ai/evaluation/_evaluators/_task_adherence/_task_adherence.py +226 -0
  154. azure/ai/evaluation/_evaluators/_task_adherence/task_adherence.prompty +101 -0
  155. azure/ai/evaluation/_evaluators/_task_completion/__init__.py +7 -0
  156. azure/ai/evaluation/_evaluators/_task_completion/_task_completion.py +177 -0
  157. azure/ai/evaluation/_evaluators/_task_completion/task_completion.prompty +220 -0
  158. azure/ai/evaluation/_evaluators/_task_navigation_efficiency/__init__.py +7 -0
  159. azure/ai/evaluation/_evaluators/_task_navigation_efficiency/_task_navigation_efficiency.py +384 -0
  160. azure/ai/evaluation/_evaluators/_tool_call_accuracy/__init__.py +9 -0
  161. azure/ai/evaluation/_evaluators/_tool_call_accuracy/_tool_call_accuracy.py +298 -0
  162. azure/ai/evaluation/_evaluators/_tool_call_accuracy/tool_call_accuracy.prompty +166 -0
  163. azure/ai/evaluation/_evaluators/_tool_input_accuracy/__init__.py +9 -0
  164. azure/ai/evaluation/_evaluators/_tool_input_accuracy/_tool_input_accuracy.py +263 -0
  165. azure/ai/evaluation/_evaluators/_tool_input_accuracy/tool_input_accuracy.prompty +76 -0
  166. azure/ai/evaluation/_evaluators/_tool_output_utilization/__init__.py +7 -0
  167. azure/ai/evaluation/_evaluators/_tool_output_utilization/_tool_output_utilization.py +225 -0
  168. azure/ai/evaluation/_evaluators/_tool_output_utilization/tool_output_utilization.prompty +221 -0
  169. azure/ai/evaluation/_evaluators/_tool_selection/__init__.py +9 -0
  170. azure/ai/evaluation/_evaluators/_tool_selection/_tool_selection.py +266 -0
  171. azure/ai/evaluation/_evaluators/_tool_selection/tool_selection.prompty +104 -0
  172. azure/ai/evaluation/_evaluators/_tool_success/__init__.py +7 -0
  173. azure/ai/evaluation/_evaluators/_tool_success/_tool_success.py +301 -0
  174. azure/ai/evaluation/_evaluators/_tool_success/tool_success.prompty +321 -0
  175. azure/ai/evaluation/_evaluators/_ungrounded_attributes/__init__.py +5 -0
  176. azure/ai/evaluation/_evaluators/_ungrounded_attributes/_ungrounded_attributes.py +102 -0
  177. azure/ai/evaluation/_evaluators/_xpia/xpia.py +109 -107
  178. azure/ai/evaluation/_exceptions.py +51 -7
  179. azure/ai/evaluation/_http_utils.py +210 -137
  180. azure/ai/evaluation/_legacy/__init__.py +3 -0
  181. azure/ai/evaluation/_legacy/_adapters/__init__.py +7 -0
  182. azure/ai/evaluation/_legacy/_adapters/_check.py +17 -0
  183. azure/ai/evaluation/_legacy/_adapters/_configuration.py +45 -0
  184. azure/ai/evaluation/_legacy/_adapters/_constants.py +10 -0
  185. azure/ai/evaluation/_legacy/_adapters/_errors.py +29 -0
  186. azure/ai/evaluation/_legacy/_adapters/_flows.py +28 -0
  187. azure/ai/evaluation/_legacy/_adapters/_service.py +16 -0
  188. azure/ai/evaluation/_legacy/_adapters/client.py +51 -0
  189. azure/ai/evaluation/_legacy/_adapters/entities.py +26 -0
  190. azure/ai/evaluation/_legacy/_adapters/tracing.py +28 -0
  191. azure/ai/evaluation/_legacy/_adapters/types.py +15 -0
  192. azure/ai/evaluation/_legacy/_adapters/utils.py +31 -0
  193. azure/ai/evaluation/_legacy/_batch_engine/__init__.py +9 -0
  194. azure/ai/evaluation/_legacy/_batch_engine/_config.py +48 -0
  195. azure/ai/evaluation/_legacy/_batch_engine/_engine.py +477 -0
  196. azure/ai/evaluation/_legacy/_batch_engine/_exceptions.py +88 -0
  197. azure/ai/evaluation/_legacy/_batch_engine/_openai_injector.py +132 -0
  198. azure/ai/evaluation/_legacy/_batch_engine/_result.py +107 -0
  199. azure/ai/evaluation/_legacy/_batch_engine/_run.py +127 -0
  200. azure/ai/evaluation/_legacy/_batch_engine/_run_storage.py +128 -0
  201. azure/ai/evaluation/_legacy/_batch_engine/_run_submitter.py +262 -0
  202. azure/ai/evaluation/_legacy/_batch_engine/_status.py +25 -0
  203. azure/ai/evaluation/_legacy/_batch_engine/_trace.py +97 -0
  204. azure/ai/evaluation/_legacy/_batch_engine/_utils.py +97 -0
  205. azure/ai/evaluation/_legacy/_batch_engine/_utils_deprecated.py +131 -0
  206. azure/ai/evaluation/_legacy/_common/__init__.py +3 -0
  207. azure/ai/evaluation/_legacy/_common/_async_token_provider.py +117 -0
  208. azure/ai/evaluation/_legacy/_common/_logging.py +292 -0
  209. azure/ai/evaluation/_legacy/_common/_thread_pool_executor_with_context.py +17 -0
  210. azure/ai/evaluation/_legacy/prompty/__init__.py +36 -0
  211. azure/ai/evaluation/_legacy/prompty/_connection.py +119 -0
  212. azure/ai/evaluation/_legacy/prompty/_exceptions.py +139 -0
  213. azure/ai/evaluation/_legacy/prompty/_prompty.py +430 -0
  214. azure/ai/evaluation/_legacy/prompty/_utils.py +663 -0
  215. azure/ai/evaluation/_legacy/prompty/_yaml_utils.py +99 -0
  216. azure/ai/evaluation/_model_configurations.py +130 -8
  217. azure/ai/evaluation/_safety_evaluation/__init__.py +3 -0
  218. azure/ai/evaluation/_safety_evaluation/_generated_rai_client.py +0 -0
  219. azure/ai/evaluation/_safety_evaluation/_safety_evaluation.py +917 -0
  220. azure/ai/evaluation/_user_agent.py +32 -1
  221. azure/ai/evaluation/_vendor/__init__.py +3 -0
  222. azure/ai/evaluation/_vendor/rouge_score/__init__.py +14 -0
  223. azure/ai/evaluation/_vendor/rouge_score/rouge_scorer.py +324 -0
  224. azure/ai/evaluation/_vendor/rouge_score/scoring.py +59 -0
  225. azure/ai/evaluation/_vendor/rouge_score/tokenize.py +59 -0
  226. azure/ai/evaluation/_vendor/rouge_score/tokenizers.py +53 -0
  227. azure/ai/evaluation/_version.py +2 -1
  228. azure/ai/evaluation/red_team/__init__.py +22 -0
  229. azure/ai/evaluation/red_team/_agent/__init__.py +3 -0
  230. azure/ai/evaluation/red_team/_agent/_agent_functions.py +261 -0
  231. azure/ai/evaluation/red_team/_agent/_agent_tools.py +461 -0
  232. azure/ai/evaluation/red_team/_agent/_agent_utils.py +89 -0
  233. azure/ai/evaluation/red_team/_agent/_semantic_kernel_plugin.py +228 -0
  234. azure/ai/evaluation/red_team/_attack_objective_generator.py +268 -0
  235. azure/ai/evaluation/red_team/_attack_strategy.py +49 -0
  236. azure/ai/evaluation/red_team/_callback_chat_target.py +115 -0
  237. azure/ai/evaluation/red_team/_default_converter.py +21 -0
  238. azure/ai/evaluation/red_team/_evaluation_processor.py +505 -0
  239. azure/ai/evaluation/red_team/_mlflow_integration.py +430 -0
  240. azure/ai/evaluation/red_team/_orchestrator_manager.py +803 -0
  241. azure/ai/evaluation/red_team/_red_team.py +1717 -0
  242. azure/ai/evaluation/red_team/_red_team_result.py +661 -0
  243. azure/ai/evaluation/red_team/_result_processor.py +1708 -0
  244. azure/ai/evaluation/red_team/_utils/__init__.py +37 -0
  245. azure/ai/evaluation/red_team/_utils/_rai_service_eval_chat_target.py +128 -0
  246. azure/ai/evaluation/red_team/_utils/_rai_service_target.py +601 -0
  247. azure/ai/evaluation/red_team/_utils/_rai_service_true_false_scorer.py +114 -0
  248. azure/ai/evaluation/red_team/_utils/constants.py +72 -0
  249. azure/ai/evaluation/red_team/_utils/exception_utils.py +345 -0
  250. azure/ai/evaluation/red_team/_utils/file_utils.py +266 -0
  251. azure/ai/evaluation/red_team/_utils/formatting_utils.py +365 -0
  252. azure/ai/evaluation/red_team/_utils/logging_utils.py +139 -0
  253. azure/ai/evaluation/red_team/_utils/metric_mapping.py +73 -0
  254. azure/ai/evaluation/red_team/_utils/objective_utils.py +46 -0
  255. azure/ai/evaluation/red_team/_utils/progress_utils.py +252 -0
  256. azure/ai/evaluation/red_team/_utils/retry_utils.py +218 -0
  257. azure/ai/evaluation/red_team/_utils/strategy_utils.py +218 -0
  258. azure/ai/evaluation/simulator/__init__.py +2 -1
  259. azure/ai/evaluation/simulator/_adversarial_scenario.py +26 -1
  260. azure/ai/evaluation/simulator/_adversarial_simulator.py +270 -144
  261. azure/ai/evaluation/simulator/_constants.py +12 -1
  262. azure/ai/evaluation/simulator/_conversation/__init__.py +151 -23
  263. azure/ai/evaluation/simulator/_conversation/_conversation.py +10 -6
  264. azure/ai/evaluation/simulator/_conversation/constants.py +1 -1
  265. azure/ai/evaluation/simulator/_data_sources/__init__.py +3 -0
  266. azure/ai/evaluation/simulator/_data_sources/grounding.json +1150 -0
  267. azure/ai/evaluation/simulator/_direct_attack_simulator.py +54 -75
  268. azure/ai/evaluation/simulator/_helpers/__init__.py +1 -2
  269. azure/ai/evaluation/simulator/_helpers/_language_suffix_mapping.py +1 -0
  270. azure/ai/evaluation/simulator/_helpers/_simulator_data_classes.py +26 -5
  271. azure/ai/evaluation/simulator/_indirect_attack_simulator.py +145 -104
  272. azure/ai/evaluation/simulator/_model_tools/__init__.py +2 -1
  273. azure/ai/evaluation/simulator/_model_tools/_generated_rai_client.py +225 -0
  274. azure/ai/evaluation/simulator/_model_tools/_identity_manager.py +80 -30
  275. azure/ai/evaluation/simulator/_model_tools/_proxy_completion_model.py +117 -45
  276. azure/ai/evaluation/simulator/_model_tools/_rai_client.py +109 -7
  277. azure/ai/evaluation/simulator/_model_tools/_template_handler.py +97 -33
  278. azure/ai/evaluation/simulator/_model_tools/models.py +30 -27
  279. azure/ai/evaluation/simulator/_prompty/task_query_response.prompty +6 -10
  280. azure/ai/evaluation/simulator/_prompty/task_simulate.prompty +6 -5
  281. azure/ai/evaluation/simulator/_simulator.py +302 -208
  282. azure/ai/evaluation/simulator/_utils.py +31 -13
  283. azure_ai_evaluation-1.13.3.dist-info/METADATA +939 -0
  284. azure_ai_evaluation-1.13.3.dist-info/RECORD +305 -0
  285. {azure_ai_evaluation-1.0.0b2.dist-info → azure_ai_evaluation-1.13.3.dist-info}/WHEEL +1 -1
  286. azure_ai_evaluation-1.13.3.dist-info/licenses/NOTICE.txt +70 -0
  287. azure/ai/evaluation/_evaluate/_batch_run_client/proxy_client.py +0 -71
  288. azure/ai/evaluation/_evaluators/_chat/_chat.py +0 -357
  289. azure/ai/evaluation/_evaluators/_chat/retrieval/_retrieval.py +0 -157
  290. azure/ai/evaluation/_evaluators/_chat/retrieval/retrieval.prompty +0 -48
  291. azure/ai/evaluation/_evaluators/_content_safety/_content_safety_base.py +0 -65
  292. azure/ai/evaluation/_evaluators/_content_safety/_content_safety_chat.py +0 -301
  293. azure/ai/evaluation/_evaluators/_groundedness/groundedness.prompty +0 -54
  294. azure/ai/evaluation/_evaluators/_protected_materials/__init__.py +0 -5
  295. azure/ai/evaluation/_evaluators/_protected_materials/_protected_materials.py +0 -104
  296. azure/ai/evaluation/simulator/_tracing.py +0 -89
  297. azure_ai_evaluation-1.0.0b2.dist-info/METADATA +0 -449
  298. azure_ai_evaluation-1.0.0b2.dist-info/RECORD +0 -99
  299. {azure_ai_evaluation-1.0.0b2.dist-info → azure_ai_evaluation-1.13.3.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,169 @@
1
+ # ---------------------------------------------------------
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # ---------------------------------------------------------
4
+
5
+ import logging
6
+ from typing import Union, Any, Dict
7
+ from azure.core.credentials import AzureKeyCredential, TokenCredential
8
+ from azure.ai.evaluation._common.onedp import ProjectsClient as RestEvaluationServiceClient
9
+ from azure.ai.evaluation._common.onedp.models import (
10
+ PendingUploadRequest,
11
+ PendingUploadType,
12
+ EvaluationResult,
13
+ ResultType,
14
+ AssetCredentialRequest,
15
+ EvaluationUpload,
16
+ InputDataset,
17
+ RedTeamUpload,
18
+ )
19
+ from azure.storage.blob import ContainerClient
20
+ from .utils import upload
21
+
22
+ LOGGER = logging.getLogger(__name__)
23
+
24
+
25
+ class EvaluationServiceOneDPClient:
26
+
27
+ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
28
+ self.rest_client = RestEvaluationServiceClient(
29
+ endpoint=endpoint,
30
+ credential=credential,
31
+ **kwargs,
32
+ )
33
+
34
+ def create_evaluation_result(
35
+ self,
36
+ *,
37
+ name: str,
38
+ path: str,
39
+ version=1,
40
+ metrics: Dict[str, int] = None,
41
+ result_type: ResultType = ResultType.EVALUATION,
42
+ **kwargs,
43
+ ) -> EvaluationResult:
44
+ """Create and upload evaluation results to Azure evaluation service.
45
+
46
+ This method uploads evaluation results from a local path to Azure Blob Storage
47
+ and registers them with the evaluation service. The process involves:
48
+ 1. Starting a pending upload with the evaluation service
49
+ 2. Getting a SAS token for the blob container
50
+ 3. Uploading the local evaluation results to the blob container
51
+ 4. Creating a version record for the evaluation results
52
+
53
+ :param name: The name to identify the evaluation results
54
+ :type name: str
55
+ :param path: The local path to the evaluation results file or directory
56
+ :type path: str
57
+ :param version: The version number for the evaluation results, defaults to 1
58
+ :type version: int, optional
59
+ :param metrics: Metrics to be added to evaluation result
60
+ :type metrics: Dict[str, int], optional
61
+ :param result_type: Evaluation Result Type to create
62
+ :type result_type: ResultType, optional
63
+ :param kwargs: Additional keyword arguments to pass to the underlying API calls
64
+ :return: The response from creating the evaluation result version
65
+ :rtype: EvaluationResult
66
+ :raises: Various exceptions from the underlying API calls or upload process
67
+ """
68
+
69
+ LOGGER.debug(
70
+ f"Creating evaluation result for {name} with version {version} type {result_type} from path {path}"
71
+ )
72
+ start_pending_upload_response = self.rest_client.evaluation_results.start_pending_upload(
73
+ name=name,
74
+ version=str(version),
75
+ body=PendingUploadRequest(pending_upload_type=PendingUploadType.TEMPORARY_BLOB_REFERENCE),
76
+ **kwargs,
77
+ )
78
+
79
+ LOGGER.debug(f"Uploading {path} to {start_pending_upload_response.blob_reference_for_consumption.blob_uri}")
80
+ with ContainerClient.from_container_url(
81
+ start_pending_upload_response.blob_reference_for_consumption.credential.sas_uri
82
+ ) as container_client:
83
+ upload(path=path, container_client=container_client, logger=LOGGER)
84
+
85
+ LOGGER.debug(f"Creating evaluation result version for {name} with version {version}")
86
+ create_version_response = self.rest_client.evaluation_results.create_or_update_version(
87
+ evaluation_result=EvaluationResult(
88
+ blob_uri=start_pending_upload_response.blob_reference_for_consumption.blob_uri,
89
+ result_type=result_type,
90
+ name=name,
91
+ version=str(version),
92
+ metrics=metrics,
93
+ ),
94
+ name=name,
95
+ version=str(version),
96
+ **kwargs,
97
+ )
98
+
99
+ return create_version_response
100
+
101
+ def start_evaluation_run(self, *, evaluation: EvaluationUpload, **kwargs) -> EvaluationUpload:
102
+ """Start a new evaluation run in the Azure evaluation service.
103
+
104
+ This method creates a new evaluation run with the provided configuration details.
105
+
106
+ :param evaluation: The evaluation configuration to upload
107
+ :type evaluation: EvaluationUpload
108
+ :param kwargs: Additional keyword arguments to pass to the underlying API calls
109
+ :return: The created evaluation run object
110
+ :rtype: EvaluationUpload
111
+ :raises: Various exceptions from the underlying API calls
112
+ """
113
+ upload_run_response = self.rest_client.evaluations.upload_run(evaluation=evaluation, **kwargs)
114
+
115
+ return upload_run_response
116
+
117
+ def update_evaluation_run(self, *, name: str, evaluation: EvaluationUpload, **kwargs) -> EvaluationUpload:
118
+ """Update an existing evaluation run in the Azure evaluation service.
119
+
120
+ This method updates an evaluation run with new information such as status changes,
121
+ result references, or other metadata.
122
+
123
+ :param name: The identifier of the evaluation run to update
124
+ :type name: str
125
+ :param evaluation: The updated evaluation configuration
126
+ :type evaluation: EvaluationUpload
127
+ :param kwargs: Additional keyword arguments to pass to the underlying API calls
128
+ :return: The updated evaluation run object
129
+ :rtype: EvaluationUpload
130
+ :raises: Various exceptions from the underlying API calls
131
+ """
132
+ update_run_response = self.rest_client.evaluations.upload_update_run(name=name, evaluation=evaluation, **kwargs)
133
+
134
+ return update_run_response
135
+
136
+ def start_red_team_run(self, *, red_team: RedTeamUpload, **kwargs):
137
+ """Start a new red team run in the Azure evaluation service.
138
+
139
+ This method creates a new red team run with the provided configuration details.
140
+
141
+ :param red_team: The red team configuration to upload
142
+ :type red_team: ~azure.ai.evaluation._common.onedp.models.RedTeamUpload
143
+ :param kwargs: Additional keyword arguments to pass to the underlying API calls
144
+ :return: The created red team run object
145
+ :rtype: ~azure.ai.evaluation._common.onedp.models.RedTeamUpload
146
+ :raises: Various exceptions from the underlying API calls
147
+ """
148
+ upload_run_response = self.rest_client.red_teams.upload_run(redteam=red_team, **kwargs)
149
+
150
+ return upload_run_response
151
+
152
+ def update_red_team_run(self, *, name: str, red_team: RedTeamUpload, **kwargs):
153
+ """Update an existing red team run in the Azure evaluation service.
154
+
155
+ This method updates a red team run with new information such as status changes,
156
+ result references, or other metadata.
157
+
158
+ :param name: The identifier of the red team run to update
159
+ :type name: str
160
+ :param red_team: The updated red team configuration
161
+ :type red_team: ~azure.ai.evaluation._common.onedp.models.RedTeamUpload
162
+ :param kwargs: Additional keyword arguments to pass to the underlying API calls
163
+ :return: The updated red team run object
164
+ :rtype: ~azure.ai.evaluation._common.onedp.models.RedTeamUpload
165
+ :raises: Various exceptions from the underlying API calls
166
+ """
167
+ update_run_response = self.rest_client.red_teams.upload_update_run(name=name, redteam=red_team, **kwargs)
168
+
169
+ return update_run_response
@@ -0,0 +1,89 @@
1
+ # ---------------------------------------------------------
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # ---------------------------------------------------------
4
+
5
+ import math
6
+ from typing import List, Callable, Any
7
+
8
+ from azure.ai.evaluation._exceptions import EvaluationException, ErrorBlame, ErrorCategory, ErrorTarget
9
+
10
+
11
+ def list_sum(lst: List[float]) -> float:
12
+ """Given a list of floats, return the sum of the values.
13
+
14
+ :param lst: A list of floats.
15
+ :type lst: List[float]
16
+ :return: The sum of the values in the list.
17
+ :rtype: float
18
+ """
19
+
20
+ return sum(lst)
21
+
22
+
23
+ def list_mean(lst: List[float]) -> float:
24
+ """Given a list of floats, calculate the mean of the values.
25
+
26
+ :param lst: A list of floats.
27
+ :type lst: List[float]
28
+ :return: The mean of the values in the list.
29
+ :rtype: float
30
+ """
31
+
32
+ return list_sum(lst) / len(lst)
33
+
34
+
35
+ def list_mean_nan_safe(lst: List[float]) -> float:
36
+ """Given a list of floats, remove all nan or None values, then calculate the mean of the remaining values.
37
+
38
+ :param lst: A list of floats.
39
+ :type lst: List[float]
40
+ :return: The mean of the values in the list.
41
+ :rtype: float
42
+ """
43
+
44
+ msg = "All score values are NaN. The mean cannot be calculated."
45
+ if all(math.isnan(l) for l in lst):
46
+ raise EvaluationException(
47
+ message=msg,
48
+ internal_message=msg,
49
+ blame=ErrorBlame.USER_ERROR,
50
+ category=ErrorCategory.INVALID_VALUE,
51
+ target=ErrorTarget.CONVERSATION,
52
+ )
53
+ return list_mean([l for l in lst if not is_none_or_nan(l)])
54
+
55
+
56
+ def apply_transform_nan_safe(lst: List[float], transform_fn: Callable[[float], Any]) -> List[Any]:
57
+ """Given a list of floats, remove all nan values, then apply the inputted transform function
58
+ to the remaining values, and return the resulting list of outputted values.
59
+
60
+ :param lst: A list of floats.
61
+ :type lst: List[float]
62
+ :param transform_fn: A function that produces something when applied to a float.
63
+ :type transform_fn: Callable[[float], Any]
64
+ :return: A list of the transformed values.
65
+ :rtype: List[Any]
66
+ """
67
+
68
+ msg = "All score values are NaN. The mean cannot be calculated."
69
+ if all(math.isnan(l) for l in lst):
70
+ raise EvaluationException(
71
+ message=msg,
72
+ internal_message=msg,
73
+ blame=ErrorBlame.USER_ERROR,
74
+ category=ErrorCategory.INVALID_VALUE,
75
+ target=ErrorTarget.CONVERSATION,
76
+ )
77
+ return [transform_fn(l) for l in lst if not is_none_or_nan(l)]
78
+
79
+
80
+ def is_none_or_nan(val: float) -> bool:
81
+ """math.isnan raises an error if None is inputted. This is a more robust wrapper.
82
+
83
+ :param val: The value to check.
84
+ :type val: float
85
+ :return: Whether the value is None or NaN.
86
+ :rtype: bool
87
+ """
88
+
89
+ return val is None or math.isnan(val)
@@ -0,0 +1,32 @@
1
+ # coding=utf-8
2
+ # --------------------------------------------------------------------------
3
+ # Copyright (c) Microsoft Corporation. All rights reserved.
4
+ # Licensed under the MIT License. See License.txt in the project root for license information.
5
+ # Code generated by Microsoft (R) Python Code Generator.
6
+ # Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
+ # --------------------------------------------------------------------------
8
+ # pylint: disable=wrong-import-position
9
+
10
+ from typing import TYPE_CHECKING
11
+
12
+ if TYPE_CHECKING:
13
+ from ._patch import * # pylint: disable=unused-wildcard-import
14
+
15
+ from ._client import ProjectsClient # type: ignore
16
+ from ._version import VERSION
17
+
18
+ __version__ = VERSION
19
+
20
+ try:
21
+ from ._patch import __all__ as _patch_all
22
+ from ._patch import *
23
+ except ImportError:
24
+ _patch_all = []
25
+ from ._patch import patch_sdk as _patch_sdk
26
+
27
+ __all__ = [
28
+ "ProjectsClient",
29
+ ]
30
+ __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
31
+
32
+ _patch_sdk()
@@ -0,0 +1,166 @@
1
+ # coding=utf-8
2
+ # --------------------------------------------------------------------------
3
+ # Copyright (c) Microsoft Corporation. All rights reserved.
4
+ # Licensed under the MIT License. See License.txt in the project root for license information.
5
+ # Code generated by Microsoft (R) Python Code Generator.
6
+ # Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
+ # --------------------------------------------------------------------------
8
+
9
+ from copy import deepcopy
10
+ from typing import Any, TYPE_CHECKING
11
+ from typing_extensions import Self
12
+
13
+ from azure.core import PipelineClient
14
+ from azure.core.pipeline import policies
15
+ from azure.core.rest import HttpRequest, HttpResponse
16
+
17
+ from ._configuration import ProjectsClientConfiguration
18
+ from ._utils.serialization import Deserializer, Serializer
19
+ from .operations import (
20
+ ConnectionsOperations,
21
+ DatasetsOperations,
22
+ DeploymentsOperations,
23
+ EvaluationResultsOperations,
24
+ EvaluationRulesOperations,
25
+ EvaluationTaxonomiesOperations,
26
+ EvaluationsOperations,
27
+ EvaluatorsOperations,
28
+ IndexesOperations,
29
+ InsightsOperations,
30
+ RedTeamsOperations,
31
+ SchedulesOperations,
32
+ SyncEvalsOperations,
33
+ )
34
+
35
+ if TYPE_CHECKING:
36
+ from azure.core.credentials import TokenCredential
37
+
38
+
39
+ class ProjectsClient: # pylint: disable=too-many-instance-attributes
40
+ """ProjectsClient.
41
+
42
+ :ivar connections: ConnectionsOperations operations
43
+ :vartype connections: azure.ai.projects.operations.ConnectionsOperations
44
+ :ivar sync_evals: SyncEvalsOperations operations
45
+ :vartype sync_evals: azure.ai.projects.operations.SyncEvalsOperations
46
+ :ivar evaluations: EvaluationsOperations operations
47
+ :vartype evaluations: azure.ai.projects.operations.EvaluationsOperations
48
+ :ivar evaluators: EvaluatorsOperations operations
49
+ :vartype evaluators: azure.ai.projects.operations.EvaluatorsOperations
50
+ :ivar datasets: DatasetsOperations operations
51
+ :vartype datasets: azure.ai.projects.operations.DatasetsOperations
52
+ :ivar indexes: IndexesOperations operations
53
+ :vartype indexes: azure.ai.projects.operations.IndexesOperations
54
+ :ivar insights: InsightsOperations operations
55
+ :vartype insights: azure.ai.projects.operations.InsightsOperations
56
+ :ivar deployments: DeploymentsOperations operations
57
+ :vartype deployments: azure.ai.projects.operations.DeploymentsOperations
58
+ :ivar red_teams: RedTeamsOperations operations
59
+ :vartype red_teams: azure.ai.projects.operations.RedTeamsOperations
60
+ :ivar evaluation_taxonomies: EvaluationTaxonomiesOperations operations
61
+ :vartype evaluation_taxonomies: azure.ai.projects.operations.EvaluationTaxonomiesOperations
62
+ :ivar schedules: SchedulesOperations operations
63
+ :vartype schedules: azure.ai.projects.operations.SchedulesOperations
64
+ :ivar evaluation_results: EvaluationResultsOperations operations
65
+ :vartype evaluation_results: azure.ai.projects.operations.EvaluationResultsOperations
66
+ :ivar evaluation_rules: EvaluationRulesOperations operations
67
+ :vartype evaluation_rules: azure.ai.projects.operations.EvaluationRulesOperations
68
+ :param endpoint: Project endpoint. In the form
69
+ "`https://your-ai-services-account-name.services.ai.azure.com/api/projects/_project
70
+ <https://your-ai-services-account-name.services.ai.azure.com/api/projects/_project>`_"
71
+ if your Foundry Hub has only one Project, or to use the default Project in your Hub. Or in the
72
+ form
73
+ "`https://your-ai-services-account-name.services.ai.azure.com/api/projects/your-project-name
74
+ <https://your-ai-services-account-name.services.ai.azure.com/api/projects/your-project-name>`_"
75
+ if you want to explicitly
76
+ specify the Foundry Project name. Required.
77
+ :type endpoint: str
78
+ :param credential: Credential used to authenticate requests to the service. Required.
79
+ :type credential: ~azure.core.credentials.TokenCredential
80
+ :keyword api_version: The API version to use for this operation. Default value is
81
+ "2025-11-15-preview". Note that overriding this default value may result in unsupported
82
+ behavior.
83
+ :paramtype api_version: str
84
+ """
85
+
86
+ def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None:
87
+ _endpoint = "{endpoint}"
88
+ self._config = ProjectsClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
89
+
90
+ _policies = kwargs.pop("policies", None)
91
+ if _policies is None:
92
+ _policies = [
93
+ policies.RequestIdPolicy(**kwargs),
94
+ self._config.headers_policy,
95
+ self._config.user_agent_policy,
96
+ self._config.proxy_policy,
97
+ policies.ContentDecodePolicy(**kwargs),
98
+ self._config.redirect_policy,
99
+ self._config.retry_policy,
100
+ self._config.authentication_policy,
101
+ self._config.custom_hook_policy,
102
+ self._config.logging_policy,
103
+ policies.DistributedTracingPolicy(**kwargs),
104
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
105
+ self._config.http_logging_policy,
106
+ ]
107
+ self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
108
+
109
+ self._serialize = Serializer()
110
+ self._deserialize = Deserializer()
111
+ self._serialize.client_side_validation = False
112
+ self.connections = ConnectionsOperations(self._client, self._config, self._serialize, self._deserialize)
113
+ self.sync_evals = SyncEvalsOperations(self._client, self._config, self._serialize, self._deserialize)
114
+ self.evaluations = EvaluationsOperations(self._client, self._config, self._serialize, self._deserialize)
115
+ self.evaluators = EvaluatorsOperations(self._client, self._config, self._serialize, self._deserialize)
116
+ self.datasets = DatasetsOperations(self._client, self._config, self._serialize, self._deserialize)
117
+ self.indexes = IndexesOperations(self._client, self._config, self._serialize, self._deserialize)
118
+ self.insights = InsightsOperations(self._client, self._config, self._serialize, self._deserialize)
119
+ self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize)
120
+ self.red_teams = RedTeamsOperations(self._client, self._config, self._serialize, self._deserialize)
121
+ self.evaluation_taxonomies = EvaluationTaxonomiesOperations(
122
+ self._client, self._config, self._serialize, self._deserialize
123
+ )
124
+ self.schedules = SchedulesOperations(self._client, self._config, self._serialize, self._deserialize)
125
+ self.evaluation_results = EvaluationResultsOperations(
126
+ self._client, self._config, self._serialize, self._deserialize
127
+ )
128
+ self.evaluation_rules = EvaluationRulesOperations(
129
+ self._client, self._config, self._serialize, self._deserialize
130
+ )
131
+
132
+ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
133
+ """Runs the network request through the client's chained policies.
134
+
135
+ >>> from azure.core.rest import HttpRequest
136
+ >>> request = HttpRequest("GET", "https://www.example.org/")
137
+ <HttpRequest [GET], url: 'https://www.example.org/'>
138
+ >>> response = client.send_request(request)
139
+ <HttpResponse: 200 OK>
140
+
141
+ For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
142
+
143
+ :param request: The network request you want to make. Required.
144
+ :type request: ~azure.core.rest.HttpRequest
145
+ :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
146
+ :return: The response of your network call. Does not do error handling on your response.
147
+ :rtype: ~azure.core.rest.HttpResponse
148
+ """
149
+
150
+ request_copy = deepcopy(request)
151
+ path_format_arguments = {
152
+ "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
153
+ }
154
+
155
+ request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
156
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
157
+
158
+ def close(self) -> None:
159
+ self._client.close()
160
+
161
+ def __enter__(self) -> Self:
162
+ self._client.__enter__()
163
+ return self
164
+
165
+ def __exit__(self, *exc_details: Any) -> None:
166
+ self._client.__exit__(*exc_details)
@@ -0,0 +1,72 @@
1
+ # coding=utf-8
2
+ # --------------------------------------------------------------------------
3
+ # Copyright (c) Microsoft Corporation. All rights reserved.
4
+ # Licensed under the MIT License. See License.txt in the project root for license information.
5
+ # Code generated by Microsoft (R) Python Code Generator.
6
+ # Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
+ # --------------------------------------------------------------------------
8
+
9
+ from typing import Any, TYPE_CHECKING
10
+
11
+ from azure.core.pipeline import policies
12
+
13
+ from ._version import VERSION
14
+
15
+ if TYPE_CHECKING:
16
+ from azure.core.credentials import TokenCredential
17
+
18
+
19
+ class ProjectsClientConfiguration: # pylint: disable=too-many-instance-attributes
20
+ """Configuration for ProjectsClient.
21
+
22
+ Note that all parameters used to create this instance are saved as instance
23
+ attributes.
24
+
25
+ :param endpoint: Project endpoint. In the form
26
+ "`https://your-ai-services-account-name.services.ai.azure.com/api/projects/_project
27
+ <https://your-ai-services-account-name.services.ai.azure.com/api/projects/_project>`_"
28
+ if your Foundry Hub has only one Project, or to use the default Project in your Hub. Or in the
29
+ form
30
+ "`https://your-ai-services-account-name.services.ai.azure.com/api/projects/your-project-name
31
+ <https://your-ai-services-account-name.services.ai.azure.com/api/projects/your-project-name>`_"
32
+ if you want to explicitly
33
+ specify the Foundry Project name. Required.
34
+ :type endpoint: str
35
+ :param credential: Credential used to authenticate requests to the service. Required.
36
+ :type credential: ~azure.core.credentials.TokenCredential
37
+ :keyword api_version: The API version to use for this operation. Default value is
38
+ "2025-11-15-preview". Note that overriding this default value may result in unsupported
39
+ behavior.
40
+ :paramtype api_version: str
41
+ """
42
+
43
+ def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None:
44
+ api_version: str = kwargs.pop("api_version", "2025-11-15-preview")
45
+
46
+ if endpoint is None:
47
+ raise ValueError("Parameter 'endpoint' must not be None.")
48
+ if credential is None:
49
+ raise ValueError("Parameter 'credential' must not be None.")
50
+
51
+ self.endpoint = endpoint
52
+ self.credential = credential
53
+ self.api_version = api_version
54
+ self.credential_scopes = kwargs.pop("credential_scopes", ["https://ai.azure.com/.default"])
55
+ kwargs.setdefault("sdk_moniker", "ai-projects/{}".format(VERSION))
56
+ self.polling_interval = kwargs.get("polling_interval", 30)
57
+ self._configure(**kwargs)
58
+
59
+ def _configure(self, **kwargs: Any) -> None:
60
+ self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
61
+ self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
62
+ self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
63
+ self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
64
+ self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs)
65
+ self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
66
+ self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
67
+ self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
68
+ self.authentication_policy = kwargs.get("authentication_policy")
69
+ if self.credential and not self.authentication_policy:
70
+ self.authentication_policy = policies.BearerTokenCredentialPolicy(
71
+ self.credential, *self.credential_scopes, **kwargs
72
+ )