diff --git a/sdk/ai/azure-ai-projects/CHANGELOG.md b/sdk/ai/azure-ai-projects/CHANGELOG.md index 0a9b847d4dec..db5d24cc27fa 100644 --- a/sdk/ai/azure-ai-projects/CHANGELOG.md +++ b/sdk/ai/azure-ai-projects/CHANGELOG.md @@ -6,15 +6,22 @@ * New Agent tool `FabricIQPreviewTool`. * New Agent tool `ToolboxSearchPreviewTool`. -* New optional string properties `description` and `name` added to Agent tools which did not have them before. -* New `.beta.datasets` sub-client with data generation job operations: `create_generation_job`, `get_generation_job`, `list_generation_jobs`, `cancel_generation_job`, `delete_generation_job`. -* New evaluator generation job operations on `.beta.evaluators`: `create_generation_job`, `get_generation_job`, `list_generation_jobs`, `cancel_generation_job`, `delete_generation_job`. +* Toolboxes operations promoted from beta to GA: access via `project_client.toolboxes` (was `project_client.beta.toolboxes`). * New methods on `.beta.agents` sub-client for code-based hosted agents: `update_agent_from_code()`, `create_agent_version_from_code()`, `download_agent_version_code()`, `download_agent_code()`. +* New agent optimization operations on `.beta.agents`: `create_optimization_job`, `get_optimization_job`, `list_optimization_jobs`, `cancel_optimization_job`, `list_optimization_candidates`. +* New evaluator suite operations on `.beta.evaluators`: `create_evaluation_suite`, `list_evaluation_suite_versions`, `get_evaluation_suite`, `delete_evaluation_suite`, `create_generation_suite_job`, `get_generation_suite_job`, `list_generation_suite_jobs`, `cancel_generation_suite_job`. +* New evaluator generation job operations on `.beta.evaluators`: `create_generation_job`, `get_generation_job`, `list_generation_jobs`, `cancel_generation_job`, `delete_generation_job`. +* New `.beta.models` sub-client with model weights management operations: `list_versions`, `list`, `get`, `delete`, `create_version`, `upload_file`, `get_pending_upload`. +* New `.beta.routines` sub-client with routine management operations: `create_or_update`, `get`, `enable`, `disable`, `list`, `delete`, `dispatch_async`. +* New individual memory operations on `.beta.memory_stores`: `get_memory`, `delete_memory`. +* New `.beta.datasets` sub-client with data generation job operations: `create_generation_job`, `get_generation_job`, `list_generation_jobs`, `cancel_generation_job`, `delete_generation_job`. * New read-only property `content_hash` on `CodeConfiguration`, returning the SHA-256 hex digest of the uploaded code zip. +* New optional string properties `description` and `name` added to Agent tools which did not have them before. ### Breaking Changes Breaking changes in beta methods: +* `.beta.toolboxes` sub-client removed (promoted to GA as `project_client.toolboxes`). * Required keyword `isolation_key` removed from `.beta.agents.create_session()` and `.beta.agents.delete_session()` methods. * Argument `body` in methods `.beta.evaluation_taxonomies.create()` and `.beta.evaluation_taxonomies.update()` renamed to `taxonomy`. * Argument `body` in method `.beta.skills.create_from_package()` renamed to `content`. @@ -27,8 +34,8 @@ Breaking changes in beta classes: * Renamed class `SessionDirectoryListResponse` to `SessionDirectoryListResult`. * Renamed class `SessionFileWriteResponse` to `SessionFileWriteResult`. * Renamed class `SkillObject` to `SkillDetails`. -* Removed class `FabricIQPreviewToolParameters`. -* Removed class `WorkIQPreviewToolParameters`. +* Renamed class `Target` to `EvaluationTarget`. +* Renamed class `TargetConfig` to `RedTeamTargetConfig`. ### Bugs Fixed @@ -36,6 +43,7 @@ Breaking changes in beta classes: ### Sample updates +* Updated Toolbox samples to use GA `project_client.toolboxes` instead of `project_client.beta.toolboxes`. * Added Hosted Agent creation samples `sample_create_hosted_agent.py` and `sample_create_hosted_agent_async.py`, demonstrating hosted agent version creation and retrieval with `AIProjectClient`. * Added Hosted Agent code-upload samples `sample_create_hosted_agent_from_code.py` and `sample_create_hosted_agent_from_code_async.py`, demonstrating uploading a code package (zip) as a new hosted agent version. * The Hosted Agent creation sample also demonstrates assigning the hosted agent managed identity the Azure AI User RBAC role on the backing Azure AI account. diff --git a/sdk/ai/azure-ai-projects/apiview-properties.json b/sdk/ai/azure-ai-projects/apiview-properties.json index 354cbc4b7d65..4bd5df45d166 100644 --- a/sdk/ai/azure-ai-projects/apiview-properties.json +++ b/sdk/ai/azure-ai-projects/apiview-properties.json @@ -3,6 +3,9 @@ "CrossLanguageDefinitionId": { "azure.ai.projects.models.Tool": "OpenAI.Tool", "azure.ai.projects.models.A2APreviewTool": "Azure.AI.Projects.A2APreviewTool", + "azure.ai.projects.models.OutputItem": "OpenAI.OutputItem", + "azure.ai.projects.models.A2AToolCall": "Azure.AI.Projects.A2AToolCall", + "azure.ai.projects.models.A2AToolCallOutput": "Azure.AI.Projects.A2AToolCallOutput", "azure.ai.projects.models.AgentBlueprintReference": "Azure.AI.Projects.AgentBlueprintReference", "azure.ai.projects.models.AgentCard": "Azure.AI.Projects.AgentCard", "azure.ai.projects.models.AgentCardSkill": "Azure.AI.Projects.AgentCardSkill", @@ -16,77 +19,111 @@ "azure.ai.projects.models.AgentDetails": "Azure.AI.Projects.AgentObject", "azure.ai.projects.models.AgentEndpointAuthorizationScheme": "Azure.AI.Projects.AgentEndpointAuthorizationScheme", "azure.ai.projects.models.AgentEndpointConfig": "Azure.AI.Projects.AgentEndpointConfig", + "azure.ai.projects.models.EvaluationSuiteJobSource": "Azure.AI.Projects.EvaluationSuiteJobSource", + "azure.ai.projects.models.AgentEvaluationSuiteJobSource": "Azure.AI.Projects.AgentEvaluationSuiteJobSource", "azure.ai.projects.models.EvaluatorGenerationJobSource": "Azure.AI.Projects.EvaluatorGenerationJobSource", "azure.ai.projects.models.AgentEvaluatorGenerationJobSource": "Azure.AI.Projects.AgentEvaluatorGenerationJobSource", "azure.ai.projects.models.BaseCredentials": "Azure.AI.Projects.BaseCredentials", "azure.ai.projects.models.AgenticIdentityPreviewCredentials": "Azure.AI.Projects.AgenticIdentityPreviewCredentials", "azure.ai.projects.models.AgentIdentity": "Azure.AI.Projects.AgentIdentity", "azure.ai.projects.models.AgentObjectVersions": "Azure.AI.Projects.AgentObject.versions.anonymous", + "azure.ai.projects.models.AgentReference": "Azure.AI.Projects.AgentReference", "azure.ai.projects.models.AgentSessionResource": "Azure.AI.Projects.AgentSessionResource", + "azure.ai.projects.models.AgentsPagedResultOptimizationCandidate": "Azure.AI.Projects.AgentsPagedResult", "azure.ai.projects.models.EvaluationTaxonomyInput": "Azure.AI.Projects.EvaluationTaxonomyInput", "azure.ai.projects.models.AgentTaxonomyInput": "Azure.AI.Projects.AgentTaxonomyInput", "azure.ai.projects.models.AgentVersionDetails": "Azure.AI.Projects.AgentVersionObject", "azure.ai.projects.models.AISearchIndexResource": "Azure.AI.Projects.AISearchIndexResource", + "azure.ai.projects.models.Annotation": "OpenAI.Annotation", "azure.ai.projects.models.ApiError": "OpenAI.Error", "azure.ai.projects.models.ApiErrorResponse": "Azure.AI.Projects.ApiErrorResponse", "azure.ai.projects.models.ApiKeyCredentials": "Azure.AI.Projects.ApiKeyCredentials", + "azure.ai.projects.models.ApplyPatchFileOperation": "OpenAI.ApplyPatchFileOperation", + "azure.ai.projects.models.ApplyPatchCreateFileOperation": "OpenAI.ApplyPatchCreateFileOperation", + "azure.ai.projects.models.ApplyPatchDeleteFileOperation": "OpenAI.ApplyPatchDeleteFileOperation", "azure.ai.projects.models.ApplyPatchToolParam": "OpenAI.ApplyPatchToolParam", + "azure.ai.projects.models.ApplyPatchUpdateFileOperation": "OpenAI.ApplyPatchUpdateFileOperation", "azure.ai.projects.models.ApproximateLocation": "OpenAI.ApproximateLocation", + "azure.ai.projects.models.ArtifactProfile": "Azure.AI.Projects.ArtifactProfile", "azure.ai.projects.models.AutoCodeInterpreterToolParam": "OpenAI.AutoCodeInterpreterToolParam", - "azure.ai.projects.models.Target": "Azure.AI.Projects.Target", + "azure.ai.projects.models.EvaluationTarget": "Azure.AI.Projects.Target", "azure.ai.projects.models.AzureAIAgentTarget": "Azure.AI.Projects.AzureAIAgentTarget", "azure.ai.projects.models.AzureAIModelTarget": "Azure.AI.Projects.AzureAIModelTarget", "azure.ai.projects.models.Index": "Azure.AI.Projects.Index", "azure.ai.projects.models.AzureAISearchIndex": "Azure.AI.Projects.AzureAISearchIndex", "azure.ai.projects.models.AzureAISearchTool": "Azure.AI.Projects.AzureAISearchTool", + "azure.ai.projects.models.AzureAISearchToolCall": "Azure.AI.Projects.AzureAISearchToolCall", + "azure.ai.projects.models.AzureAISearchToolCallOutput": "Azure.AI.Projects.AzureAISearchToolCallOutput", "azure.ai.projects.models.AzureAISearchToolResource": "Azure.AI.Projects.AzureAISearchToolResource", "azure.ai.projects.models.AzureFunctionBinding": "Azure.AI.Projects.AzureFunctionBinding", "azure.ai.projects.models.AzureFunctionDefinition": "Azure.AI.Projects.AzureFunctionDefinition", "azure.ai.projects.models.AzureFunctionDefinitionFunction": "Azure.AI.Projects.AzureFunctionDefinition.function.anonymous", "azure.ai.projects.models.AzureFunctionStorageQueue": "Azure.AI.Projects.AzureFunctionStorageQueue", "azure.ai.projects.models.AzureFunctionTool": "Azure.AI.Projects.AzureFunctionTool", - "azure.ai.projects.models.TargetConfig": "Azure.AI.Projects.TargetConfig", + "azure.ai.projects.models.AzureFunctionToolCall": "Azure.AI.Projects.AzureFunctionToolCall", + "azure.ai.projects.models.AzureFunctionToolCallOutput": "Azure.AI.Projects.AzureFunctionToolCallOutput", + "azure.ai.projects.models.RedTeamTargetConfig": "Azure.AI.Projects.RedTeamTargetConfig", "azure.ai.projects.models.AzureOpenAIModelConfiguration": "Azure.AI.Projects.AzureOpenAIModelConfiguration", "azure.ai.projects.models.BingCustomSearchConfiguration": "Azure.AI.Projects.BingCustomSearchConfiguration", "azure.ai.projects.models.BingCustomSearchPreviewTool": "Azure.AI.Projects.BingCustomSearchPreviewTool", + "azure.ai.projects.models.BingCustomSearchToolCall": "Azure.AI.Projects.BingCustomSearchToolCall", + "azure.ai.projects.models.BingCustomSearchToolCallOutput": "Azure.AI.Projects.BingCustomSearchToolCallOutput", "azure.ai.projects.models.BingCustomSearchToolParameters": "Azure.AI.Projects.BingCustomSearchToolParameters", "azure.ai.projects.models.BingGroundingSearchConfiguration": "Azure.AI.Projects.BingGroundingSearchConfiguration", "azure.ai.projects.models.BingGroundingSearchToolParameters": "Azure.AI.Projects.BingGroundingSearchToolParameters", "azure.ai.projects.models.BingGroundingTool": "Azure.AI.Projects.BingGroundingTool", + "azure.ai.projects.models.BingGroundingToolCall": "Azure.AI.Projects.BingGroundingToolCall", + "azure.ai.projects.models.BingGroundingToolCallOutput": "Azure.AI.Projects.BingGroundingToolCallOutput", "azure.ai.projects.models.BlobReference": "Azure.AI.Projects.BlobReference", "azure.ai.projects.models.BlobReferenceSasCredential": "Azure.AI.Projects.SasCredential", "azure.ai.projects.models.BotServiceAuthorizationScheme": "Azure.AI.Projects.BotServiceAuthorizationScheme", "azure.ai.projects.models.BotServiceRbacAuthorizationScheme": "Azure.AI.Projects.BotServiceRbacAuthorizationScheme", "azure.ai.projects.models.BrowserAutomationPreviewTool": "Azure.AI.Projects.BrowserAutomationPreviewTool", + "azure.ai.projects.models.BrowserAutomationToolCall": "Azure.AI.Projects.BrowserAutomationToolCall", + "azure.ai.projects.models.BrowserAutomationToolCallOutput": "Azure.AI.Projects.BrowserAutomationToolCallOutput", "azure.ai.projects.models.BrowserAutomationToolConnectionParameters": "Azure.AI.Projects.BrowserAutomationToolConnectionParameters", "azure.ai.projects.models.BrowserAutomationToolParameters": "Azure.AI.Projects.BrowserAutomationToolParameters", + "azure.ai.projects.models.CandidateDeployConfig": "Azure.AI.Projects.CandidateDeployConfig", + "azure.ai.projects.models.CandidateResults": "Azure.AI.Projects.CandidateResults", "azure.ai.projects.models.CaptureStructuredOutputsTool": "Azure.AI.Projects.CaptureStructuredOutputsTool", "azure.ai.projects.models.ChartCoordinate": "Azure.AI.Projects.ChartCoordinate", "azure.ai.projects.models.MemoryItem": "Azure.AI.Projects.MemoryItem", "azure.ai.projects.models.ChatSummaryMemoryItem": "Azure.AI.Projects.ChatSummaryMemoryItem", + "azure.ai.projects.models.ComputerAction": "OpenAI.ComputerAction", + "azure.ai.projects.models.ClickParam": "OpenAI.ClickParam", "azure.ai.projects.models.ClusterInsightResult": "Azure.AI.Projects.ClusterInsightResult", "azure.ai.projects.models.ClusterTokenUsage": "Azure.AI.Projects.ClusterTokenUsage", "azure.ai.projects.models.EvaluatorDefinition": "Azure.AI.Projects.EvaluatorDefinition", "azure.ai.projects.models.CodeBasedEvaluatorDefinition": "Azure.AI.Projects.CodeBasedEvaluatorDefinition", "azure.ai.projects.models.CodeConfiguration": "Azure.AI.Projects.CodeConfiguration", + "azure.ai.projects.models.CodeInterpreterOutputImage": "OpenAI.CodeInterpreterOutputImage", + "azure.ai.projects.models.CodeInterpreterOutputLogs": "OpenAI.CodeInterpreterOutputLogs", "azure.ai.projects.models.CodeInterpreterTool": "OpenAI.CodeInterpreterTool", "azure.ai.projects.models.ComparisonFilter": "OpenAI.ComparisonFilter", "azure.ai.projects.models.CompoundFilter": "OpenAI.CompoundFilter", + "azure.ai.projects.models.ComputerCallSafetyCheckParam": "OpenAI.ComputerCallSafetyCheckParam", "azure.ai.projects.models.ComputerUsePreviewTool": "OpenAI.ComputerUsePreviewTool", "azure.ai.projects.models.Connection": "Azure.AI.Projects.Connection", "azure.ai.projects.models.FunctionShellToolParamEnvironment": "OpenAI.FunctionShellToolParamEnvironment", "azure.ai.projects.models.ContainerAutoParam": "OpenAI.ContainerAutoParam", "azure.ai.projects.models.ContainerConfiguration": "Azure.AI.Projects.ContainerConfiguration", + "azure.ai.projects.models.ContainerFileCitationBody": "OpenAI.ContainerFileCitationBody", "azure.ai.projects.models.ContainerNetworkPolicyParam": "OpenAI.ContainerNetworkPolicyParam", "azure.ai.projects.models.ContainerNetworkPolicyAllowlistParam": "OpenAI.ContainerNetworkPolicyAllowlistParam", "azure.ai.projects.models.ContainerNetworkPolicyDisabledParam": "OpenAI.ContainerNetworkPolicyDisabledParam", "azure.ai.projects.models.ContainerNetworkPolicyDomainSecretParam": "OpenAI.ContainerNetworkPolicyDomainSecretParam", + "azure.ai.projects.models.FunctionShellCallEnvironment": "OpenAI.FunctionShellCallEnvironment", + "azure.ai.projects.models.ContainerReferenceResource": "OpenAI.ContainerReferenceResource", "azure.ai.projects.models.ContainerSkill": "OpenAI.ContainerSkill", "azure.ai.projects.models.EvaluationRuleAction": "Azure.AI.Projects.EvaluationRuleAction", "azure.ai.projects.models.ContinuousEvaluationRuleAction": "Azure.AI.Projects.ContinuousEvaluationRuleAction", + "azure.ai.projects.models.CoordParam": "OpenAI.CoordParam", "azure.ai.projects.models.CosmosDBIndex": "Azure.AI.Projects.CosmosDBIndex", "azure.ai.projects.models.CreateAgentVersionFromCodeContent": "Azure.AI.Projects.CreateAgentVersionFromCodeContent", "azure.ai.projects.models.CreateAgentVersionFromCodeMetadata": "Azure.AI.Projects.CreateAgentVersionFromCodeMetadata", + "azure.ai.projects.models.CreateAsyncResponse": "Azure.AI.Projects.createAsync.Response.anonymous", + "azure.ai.projects.models.CreateEvalCompletionsRunDataSourceInputMessagesItemReference": "OpenAI.CreateEvalCompletionsRunDataSourceInputMessagesItemReference", + "azure.ai.projects.models.CreateEvalResponsesRunDataSourceInputMessagesTemplate": "OpenAI.CreateEvalResponsesRunDataSourceInputMessagesTemplate", "azure.ai.projects.models.Trigger": "Azure.AI.Projects.Trigger", "azure.ai.projects.models.CronTrigger": "Azure.AI.Projects.CronTrigger", "azure.ai.projects.models.CustomCredential": "Azure.AI.Projects.CustomCredential", @@ -100,29 +137,52 @@ "azure.ai.projects.models.DataGenerationJobInputs": "Azure.AI.Projects.DataGenerationJobInputs", "azure.ai.projects.models.DataGenerationJobOptions": "Azure.AI.Projects.DataGenerationJobOptions", "azure.ai.projects.models.DataGenerationJobOutput": "Azure.AI.Projects.DataGenerationJobOutput", + "azure.ai.projects.models.DataGenerationJobOutputOptions": "Azure.AI.Projects.DataGenerationJobOutputOptions", "azure.ai.projects.models.DataGenerationJobResult": "Azure.AI.Projects.DataGenerationJobResult", "azure.ai.projects.models.DataGenerationModelOptions": "Azure.AI.Projects.DataGenerationModelOptions", "azure.ai.projects.models.DataGenerationTokenUsage": "Azure.AI.Projects.DataGenerationTokenUsage", "azure.ai.projects.models.DatasetCredential": "Azure.AI.Projects.AssetCredentialResponse", "azure.ai.projects.models.DatasetDataGenerationJobOutput": "Azure.AI.Projects.DatasetDataGenerationJobOutput", "azure.ai.projects.models.DatasetDataGenerationJobSource": "Azure.AI.Projects.DatasetDataGenerationJobSource", + "azure.ai.projects.models.DatasetEvaluationSuiteJobSource": "Azure.AI.Projects.DatasetEvaluationSuiteJobSource", "azure.ai.projects.models.DatasetEvaluatorGenerationJobSource": "Azure.AI.Projects.DatasetEvaluatorGenerationJobSource", + "azure.ai.projects.models.DatasetItem": "Azure.AI.Projects.DatasetItem", + "azure.ai.projects.models.DatasetRef": "Azure.AI.Projects.DatasetRef", "azure.ai.projects.models.DatasetReference": "Azure.AI.Projects.DatasetReference", "azure.ai.projects.models.DatasetVersion": "Azure.AI.Projects.DatasetVersion", "azure.ai.projects.models.DeleteAgentResponse": "Azure.AI.Projects.DeleteAgentResponse", "azure.ai.projects.models.DeleteAgentVersionResponse": "Azure.AI.Projects.DeleteAgentVersionResponse", + "azure.ai.projects.models.DeleteMemoryResponse": "Azure.AI.Projects.DeleteMemoryResponse", "azure.ai.projects.models.DeleteMemoryStoreResult": "Azure.AI.Projects.DeleteMemoryStoreResponse", "azure.ai.projects.models.DeleteSkillResult": "Azure.AI.Projects.DeleteSkillResponse", "azure.ai.projects.models.Deployment": "Azure.AI.Projects.Deployment", + "azure.ai.projects.models.Dimension": "Azure.AI.Projects.Dimension", + "azure.ai.projects.models.DispatchRoutineResponse": "Azure.AI.Projects.DispatchRoutineResponse", + "azure.ai.projects.models.DoubleClickAction": "OpenAI.DoubleClickAction", + "azure.ai.projects.models.DragParam": "OpenAI.DragParam", "azure.ai.projects.models.EmbeddingConfiguration": "Azure.AI.Projects.EmbeddingConfiguration", "azure.ai.projects.models.EntraAuthorizationScheme": "Azure.AI.Projects.EntraAuthorizationScheme", "azure.ai.projects.models.EntraIDCredentials": "Azure.AI.Projects.EntraIDCredentials", + "azure.ai.projects.models.EvalGraderLabelModel": "OpenAI.EvalGraderLabelModel", + "azure.ai.projects.models.EvalGraderPython": "OpenAI.EvalGraderPython", + "azure.ai.projects.models.EvalGraderScoreModel": "OpenAI.EvalGraderScoreModel", + "azure.ai.projects.models.EvalGraderScoreModelSamplingParams": "OpenAI.EvalGraderScoreModelSamplingParams", + "azure.ai.projects.models.EvalGraderStringCheck": "OpenAI.EvalGraderStringCheck", + "azure.ai.projects.models.EvalGraderTextSimilarity": "OpenAI.EvalGraderTextSimilarity", + "azure.ai.projects.models.EvalItem": "OpenAI.EvalItem", + "azure.ai.projects.models.EvalItemContentItemObject": "OpenAI.EvalItemContentItemObject", + "azure.ai.projects.models.EvalItemContentItemObjectInputTextContent": "OpenAI.EvalItemContentItemObjectInputTextContent", + "azure.ai.projects.models.EvalItemContentOutputText": "OpenAI.EvalItemContentOutputText", + "azure.ai.projects.models.EvalItemInputImage": "OpenAI.EvalItemInputImage", "azure.ai.projects.models.EvalResult": "Azure.AI.Projects.EvalResult", + "azure.ai.projects.models.EvalRunOutputItemResult": "Azure.AI.Projects.EvalRunOutputItemResult", "azure.ai.projects.models.EvalRunResultCompareItem": "Azure.AI.Projects.EvalRunResultCompareItem", "azure.ai.projects.models.EvalRunResultComparison": "Azure.AI.Projects.EvalRunResultComparison", "azure.ai.projects.models.EvalRunResultSummary": "Azure.AI.Projects.EvalRunResultSummary", "azure.ai.projects.models.EvaluationComparisonInsightRequest": "Azure.AI.Projects.EvaluationComparisonInsightRequest", "azure.ai.projects.models.EvaluationComparisonInsightResult": "Azure.AI.Projects.EvaluationComparisonInsightResult", + "azure.ai.projects.models.EvaluationCriterion": "Azure.AI.Projects.EvaluationCriterion", + "azure.ai.projects.models.EvaluationDatasetReference": "Azure.AI.Projects.EvaluationDatasetReference", "azure.ai.projects.models.InsightSample": "Azure.AI.Projects.InsightSample", "azure.ai.projects.models.EvaluationResultSample": "Azure.AI.Projects.EvaluationResultSample", "azure.ai.projects.models.EvaluationRule": "Azure.AI.Projects.EvaluationRule", @@ -131,27 +191,51 @@ "azure.ai.projects.models.EvaluationRunClusterInsightResult": "Azure.AI.Projects.EvaluationRunClusterInsightResult", "azure.ai.projects.models.ScheduleTask": "Azure.AI.Projects.ScheduleTask", "azure.ai.projects.models.EvaluationScheduleTask": "Azure.AI.Projects.EvaluationScheduleTask", + "azure.ai.projects.models.EvaluationSuiteDataGenerationOptions": "Azure.AI.Projects.EvaluationSuiteDataGenerationOptions", + "azure.ai.projects.models.EvaluationSuiteGenerationJob": "Azure.AI.Projects.EvaluationSuiteGenerationJob", + "azure.ai.projects.models.EvaluationSuiteGenerationJobInputs": "Azure.AI.Projects.EvaluationSuiteGenerationJobInputs", + "azure.ai.projects.models.EvaluationSuiteGenerationTokenUsage": "Azure.AI.Projects.EvaluationSuiteGenerationTokenUsage", + "azure.ai.projects.models.EvaluationSuiteRunRequest": "Azure.AI.Projects.EvaluationSuiteRunRequest", + "azure.ai.projects.models.EvaluationSuiteRunResponse": "Azure.AI.Projects.EvaluationSuiteRunResponse", + "azure.ai.projects.models.EvaluationSuiteRunResult": "Azure.AI.Projects.EvaluationSuiteRunResult", + "azure.ai.projects.models.EvaluationSuiteVersion": "Azure.AI.Projects.EvaluationSuiteVersion", + "azure.ai.projects.models.EvaluationSuiteVersionInputMessagesTemplate1": "Azure.AI.Projects.EvaluationSuiteVersion.input_messages.template.anonymous", "azure.ai.projects.models.EvaluationTaxonomy": "Azure.AI.Projects.EvaluationTaxonomy", + "azure.ai.projects.models.EvaluatorCredentialRequest": "Azure.AI.Projects.EvaluatorCredentialRequest", "azure.ai.projects.models.EvaluatorGenerationArtifacts": "Azure.AI.Projects.EvaluatorGenerationArtifacts", "azure.ai.projects.models.EvaluatorGenerationInputs": "Azure.AI.Projects.EvaluatorGenerationInputs", "azure.ai.projects.models.EvaluatorGenerationJob": "Azure.AI.Projects.EvaluatorGenerationJob", "azure.ai.projects.models.EvaluatorGenerationTokenUsage": "Azure.AI.Projects.EvaluatorGenerationTokenUsage", "azure.ai.projects.models.EvaluatorMetric": "Azure.AI.Projects.EvaluatorMetric", "azure.ai.projects.models.EvaluatorVersion": "Azure.AI.Projects.EvaluatorVersion", + "azure.ai.projects.models.ExternalAgentDefinition": "Azure.AI.Projects.ExternalAgentDefinition", + "azure.ai.projects.models.FabricDataAgentToolCall": "Azure.AI.Projects.FabricDataAgentToolCall", + "azure.ai.projects.models.FabricDataAgentToolCallOutput": "Azure.AI.Projects.FabricDataAgentToolCallOutput", "azure.ai.projects.models.FabricDataAgentToolParameters": "Azure.AI.Projects.FabricDataAgentToolParameters", "azure.ai.projects.models.FabricIQPreviewTool": "Azure.AI.Projects.FabricIQPreviewTool", "azure.ai.projects.models.FieldMapping": "Azure.AI.Projects.FieldMapping", + "azure.ai.projects.models.FileCitationBody": "OpenAI.FileCitationBody", "azure.ai.projects.models.FileDataGenerationJobOutput": "Azure.AI.Projects.FileDataGenerationJobOutput", "azure.ai.projects.models.FileDataGenerationJobSource": "Azure.AI.Projects.FileDataGenerationJobSource", "azure.ai.projects.models.FileDatasetVersion": "Azure.AI.Projects.FileDatasetVersion", + "azure.ai.projects.models.FilePath": "OpenAI.FilePath", "azure.ai.projects.models.FileSearchTool": "OpenAI.FileSearchTool", + "azure.ai.projects.models.FileSearchToolCallResults": "OpenAI.FileSearchToolCallResults", "azure.ai.projects.models.VersionSelectionRule": "Azure.AI.Projects.VersionSelectionRule", "azure.ai.projects.models.FixedRatioVersionSelectionRule": "Azure.AI.Projects.FixedRatioVersionSelectionRule", "azure.ai.projects.models.FolderDatasetVersion": "Azure.AI.Projects.FolderDatasetVersion", + "azure.ai.projects.models.FoundryModelWarning": "Azure.AI.Projects.FoundryModelWarning", + "azure.ai.projects.models.FunctionShellAction": "OpenAI.FunctionShellAction", + "azure.ai.projects.models.FunctionShellCallOutputContent": "OpenAI.FunctionShellCallOutputContent", + "azure.ai.projects.models.FunctionShellCallOutputOutcome": "OpenAI.FunctionShellCallOutputOutcome", + "azure.ai.projects.models.FunctionShellCallOutputExitOutcome": "OpenAI.FunctionShellCallOutputExitOutcome", + "azure.ai.projects.models.FunctionShellCallOutputTimeoutOutcome": "OpenAI.FunctionShellCallOutputTimeoutOutcome", "azure.ai.projects.models.FunctionShellToolParam": "OpenAI.FunctionShellToolParam", "azure.ai.projects.models.FunctionShellToolParamEnvironmentContainerReferenceParam": "OpenAI.FunctionShellToolParamEnvironmentContainerReferenceParam", "azure.ai.projects.models.FunctionShellToolParamEnvironmentLocalEnvironmentParam": "OpenAI.FunctionShellToolParamEnvironmentLocalEnvironmentParam", "azure.ai.projects.models.FunctionTool": "OpenAI.FunctionTool", + "azure.ai.projects.models.RoutineTrigger": "Azure.AI.Projects.RoutineTrigger", + "azure.ai.projects.models.GitHubIssueOpenedRoutineTrigger": "Azure.AI.Projects.GitHubIssueOpenedRoutineTrigger", "azure.ai.projects.models.TelemetryEndpointAuth": "Azure.AI.Projects.TelemetryEndpointAuth", "azure.ai.projects.models.HeaderTelemetryEndpointAuth": "Azure.AI.Projects.HeaderTelemetryEndpointAuth", "azure.ai.projects.models.HostedAgentDefinition": "Azure.AI.Projects.HostedAgentDefinition", @@ -162,23 +246,42 @@ "azure.ai.projects.models.ImageGenToolInputImageMask": "OpenAI.ImageGenToolInputImageMask", "azure.ai.projects.models.InlineSkillParam": "OpenAI.InlineSkillParam", "azure.ai.projects.models.InlineSkillSourceParam": "OpenAI.InlineSkillSourceParam", + "azure.ai.projects.models.InputAudio": "OpenAI.InputAudio", + "azure.ai.projects.models.InputAudioInputAudio": "OpenAI.InputAudioInputAudio", "azure.ai.projects.models.Insight": "Azure.AI.Projects.Insight", "azure.ai.projects.models.InsightCluster": "Azure.AI.Projects.InsightCluster", "azure.ai.projects.models.InsightModelConfiguration": "Azure.AI.Projects.InsightModelConfiguration", "azure.ai.projects.models.InsightScheduleTask": "Azure.AI.Projects.InsightScheduleTask", "azure.ai.projects.models.InsightsMetadata": "Azure.AI.Projects.InsightsMetadata", "azure.ai.projects.models.InsightSummary": "Azure.AI.Projects.InsightSummary", + "azure.ai.projects.models.RoutineDispatchPayload": "Azure.AI.Projects.RoutineDispatchPayload", + "azure.ai.projects.models.InvokeAgentInvocationsApiDispatchPayload": "Azure.AI.Projects.InvokeAgentInvocationsApiDispatchPayload", + "azure.ai.projects.models.RoutineAction": "Azure.AI.Projects.RoutineAction", + "azure.ai.projects.models.InvokeAgentInvocationsApiRoutineAction": "Azure.AI.Projects.InvokeAgentInvocationsApiRoutineAction", + "azure.ai.projects.models.InvokeAgentResponsesApiDispatchPayload": "Azure.AI.Projects.InvokeAgentResponsesApiDispatchPayload", + "azure.ai.projects.models.InvokeAgentResponsesApiRoutineAction": "Azure.AI.Projects.InvokeAgentResponsesApiRoutineAction", + "azure.ai.projects.models.KeyPressAction": "OpenAI.KeyPressAction", + "azure.ai.projects.models.LocalEnvironmentResource": "OpenAI.LocalEnvironmentResource", + "azure.ai.projects.models.LocalShellExecAction": "OpenAI.LocalShellExecAction", "azure.ai.projects.models.LocalShellToolParam": "OpenAI.LocalShellToolParam", "azure.ai.projects.models.LocalSkillParam": "OpenAI.LocalSkillParam", + "azure.ai.projects.models.LogProb": "OpenAI.LogProb", + "azure.ai.projects.models.LoraConfig": "Azure.AI.Projects.LoraConfig", "azure.ai.projects.models.ManagedAgentIdentityBlueprintReference": "Azure.AI.Projects.ManagedAgentIdentityBlueprintReference", "azure.ai.projects.models.ManagedAzureAISearchIndex": "Azure.AI.Projects.ManagedAzureAISearchIndex", + "azure.ai.projects.models.MCPListToolsTool": "OpenAI.MCPListToolsTool", + "azure.ai.projects.models.MCPListToolsToolAnnotations": "OpenAI.MCPListToolsToolAnnotations", + "azure.ai.projects.models.MCPListToolsToolInputSchema": "OpenAI.MCPListToolsToolInputSchema", "azure.ai.projects.models.MCPTool": "OpenAI.MCPTool", "azure.ai.projects.models.MCPToolFilter": "OpenAI.MCPToolFilter", "azure.ai.projects.models.MCPToolRequireApproval": "OpenAI.MCPToolRequireApproval", + "azure.ai.projects.models.MemoryCommandToolCall": "Azure.AI.Projects.MemoryCommandToolCall", + "azure.ai.projects.models.MemoryCommandToolCallOutput": "Azure.AI.Projects.MemoryCommandToolCallOutput", "azure.ai.projects.models.MemoryOperation": "Azure.AI.Projects.MemoryOperation", "azure.ai.projects.models.MemorySearchItem": "Azure.AI.Projects.MemorySearchItem", "azure.ai.projects.models.MemorySearchOptions": "Azure.AI.Projects.MemorySearchOptions", "azure.ai.projects.models.MemorySearchPreviewTool": "Azure.AI.Projects.MemorySearchPreviewTool", + "azure.ai.projects.models.MemorySearchToolCall": "Azure.AI.Projects.MemorySearchToolCall", "azure.ai.projects.models.MemoryStoreDefinition": "Azure.AI.Projects.MemoryStoreDefinition", "azure.ai.projects.models.MemoryStoreDefaultDefinition": "Azure.AI.Projects.MemoryStoreDefaultDefinition", "azure.ai.projects.models.MemoryStoreDefaultOptions": "Azure.AI.Projects.MemoryStoreDefaultOptions", @@ -188,12 +291,20 @@ "azure.ai.projects.models.MemoryStoreSearchResult": "Azure.AI.Projects.MemoryStoreSearchResponse", "azure.ai.projects.models.MemoryStoreUpdateCompletedResult": "Azure.AI.Projects.MemoryStoreUpdateCompletedResult", "azure.ai.projects.models.MemoryStoreUpdateResult": "Azure.AI.Projects.MemoryStoreUpdateResponse", + "azure.ai.projects.models.MessageContent": "OpenAI.MessageContent", "azure.ai.projects.models.MicrosoftFabricPreviewTool": "Azure.AI.Projects.MicrosoftFabricPreviewTool", + "azure.ai.projects.models.ModelCredentialRequest": "Azure.AI.Projects.ModelCredentialRequest", "azure.ai.projects.models.ModelDeployment": "Azure.AI.Projects.ModelDeployment", "azure.ai.projects.models.ModelDeploymentSku": "Azure.AI.Projects.Sku", + "azure.ai.projects.models.ModelPendingUploadRequest": "Azure.AI.Projects.ModelPendingUploadRequest", + "azure.ai.projects.models.ModelPendingUploadResponse": "Azure.AI.Projects.ModelPendingUploadResponse", "azure.ai.projects.models.ModelSamplingParams": "Azure.AI.Projects.ModelSamplingParams", + "azure.ai.projects.models.ModelSourceData": "Azure.AI.Projects.ModelSourceData", + "azure.ai.projects.models.ModelVersion": "Azure.AI.Projects.ModelVersion", "azure.ai.projects.models.MonthlyRecurrenceSchedule": "Azure.AI.Projects.MonthlyRecurrenceSchedule", + "azure.ai.projects.models.MoveParam": "OpenAI.MoveParam", "azure.ai.projects.models.NoAuthenticationCredentials": "Azure.AI.Projects.NoAuthenticationCredentials", + "azure.ai.projects.models.OAuthConsentRequestOutputItem": "Azure.AI.Projects.OAuthConsentRequestOutputItem", "azure.ai.projects.models.OneTimeTrigger": "Azure.AI.Projects.OneTimeTrigger", "azure.ai.projects.models.OpenApiAuthDetails": "Azure.AI.Projects.OpenApiAuthDetails", "azure.ai.projects.models.OpenApiAnonymousAuthDetails": "Azure.AI.Projects.OpenApiAnonymousAuthDetails", @@ -204,32 +315,74 @@ "azure.ai.projects.models.OpenApiProjectConnectionAuthDetails": "Azure.AI.Projects.OpenApiProjectConnectionAuthDetails", "azure.ai.projects.models.OpenApiProjectConnectionSecurityScheme": "Azure.AI.Projects.OpenApiProjectConnectionSecurityScheme", "azure.ai.projects.models.OpenApiTool": "Azure.AI.Projects.OpenApiTool", + "azure.ai.projects.models.OpenApiToolCall": "Azure.AI.Projects.OpenApiToolCall", + "azure.ai.projects.models.OpenApiToolCallOutput": "Azure.AI.Projects.OpenApiToolCallOutput", + "azure.ai.projects.models.OptimizationAgentDefinition": "Azure.AI.Projects.OptimizationAgentDefinition", + "azure.ai.projects.models.OptimizationAgentSkill": "Azure.AI.Projects.OptimizationAgentSkill", + "azure.ai.projects.models.OptimizationCandidate": "Azure.AI.Projects.OptimizationCandidate", + "azure.ai.projects.models.OptimizationJob": "Azure.AI.Projects.OptimizationJob", + "azure.ai.projects.models.OptimizationJobInputs": "Azure.AI.Projects.OptimizationJobInputs", + "azure.ai.projects.models.OptimizationJobProgress": "Azure.AI.Projects.OptimizationJobProgress", + "azure.ai.projects.models.OptimizationJobResult": "Azure.AI.Projects.OptimizationJobResult", + "azure.ai.projects.models.OptimizationOptions": "Azure.AI.Projects.OptimizationOptions", + "azure.ai.projects.models.OptimizationTaskResult": "Azure.AI.Projects.OptimizationTaskResult", "azure.ai.projects.models.TelemetryEndpoint": "Azure.AI.Projects.TelemetryEndpoint", "azure.ai.projects.models.OtlpTelemetryEndpoint": "Azure.AI.Projects.OtlpTelemetryEndpoint", + "azure.ai.projects.models.OutputItemApplyPatchToolCall": "OpenAI.OutputItemApplyPatchToolCall", + "azure.ai.projects.models.OutputItemApplyPatchToolCallOutput": "OpenAI.OutputItemApplyPatchToolCallOutput", + "azure.ai.projects.models.OutputItemCodeInterpreterToolCall": "OpenAI.OutputItemCodeInterpreterToolCall", + "azure.ai.projects.models.OutputItemCompactionBody": "OpenAI.OutputItemCompactionBody", + "azure.ai.projects.models.OutputItemComputerToolCall": "OpenAI.OutputItemComputerToolCall", + "azure.ai.projects.models.OutputItemCustomToolCall": "OpenAI.OutputItemCustomToolCall", + "azure.ai.projects.models.OutputItemFileSearchToolCall": "OpenAI.OutputItemFileSearchToolCall", + "azure.ai.projects.models.OutputItemFunctionShellCall": "OpenAI.OutputItemFunctionShellCall", + "azure.ai.projects.models.OutputItemFunctionShellCallOutput": "OpenAI.OutputItemFunctionShellCallOutput", + "azure.ai.projects.models.OutputItemFunctionToolCall": "OpenAI.OutputItemFunctionToolCall", + "azure.ai.projects.models.OutputItemImageGenToolCall": "OpenAI.OutputItemImageGenToolCall", + "azure.ai.projects.models.OutputItemLocalShellToolCall": "OpenAI.OutputItemLocalShellToolCall", + "azure.ai.projects.models.OutputItemMcpApprovalRequest": "OpenAI.OutputItemMcpApprovalRequest", + "azure.ai.projects.models.OutputItemMcpListTools": "OpenAI.OutputItemMcpListTools", + "azure.ai.projects.models.OutputItemMcpToolCall": "OpenAI.OutputItemMcpToolCall", + "azure.ai.projects.models.OutputItemOutputMessage": "OpenAI.OutputItemOutputMessage", + "azure.ai.projects.models.OutputItemReasoningItem": "OpenAI.OutputItemReasoningItem", + "azure.ai.projects.models.OutputItemWebSearchToolCall": "OpenAI.OutputItemWebSearchToolCall", + "azure.ai.projects.models.OutputMessageContent": "OpenAI.OutputMessageContent", + "azure.ai.projects.models.OutputMessageContentOutputTextContent": "OpenAI.OutputMessageContentOutputTextContent", + "azure.ai.projects.models.OutputMessageContentRefusalContent": "OpenAI.OutputMessageContentRefusalContent", "azure.ai.projects.models.PendingUploadRequest": "Azure.AI.Projects.PendingUploadRequest", "azure.ai.projects.models.PendingUploadResult": "Azure.AI.Projects.PendingUploadResponse", + "azure.ai.projects.models.ProceduralMemoryItem": "Azure.AI.Projects.ProceduralMemoryItem", "azure.ai.projects.models.PromptAgentDefinition": "Azure.AI.Projects.PromptAgentDefinition", "azure.ai.projects.models.PromptAgentDefinitionTextOptions": "Azure.AI.Projects.PromptAgentDefinitionTextOptions", "azure.ai.projects.models.PromptBasedEvaluatorDefinition": "Azure.AI.Projects.PromptBasedEvaluatorDefinition", "azure.ai.projects.models.PromptDataGenerationJobSource": "Azure.AI.Projects.PromptDataGenerationJobSource", + "azure.ai.projects.models.PromptEvaluationSuiteJobSource": "Azure.AI.Projects.PromptEvaluationSuiteJobSource", "azure.ai.projects.models.PromptEvaluatorGenerationJobSource": "Azure.AI.Projects.PromptEvaluatorGenerationJobSource", "azure.ai.projects.models.ProtocolVersionRecord": "Azure.AI.Projects.ProtocolVersionRecord", "azure.ai.projects.models.RaiConfig": "Azure.AI.Projects.RaiConfig", "azure.ai.projects.models.RankingOptions": "OpenAI.RankingOptions", "azure.ai.projects.models.Reasoning": "OpenAI.Reasoning", + "azure.ai.projects.models.ReasoningTextContent": "OpenAI.ReasoningTextContent", "azure.ai.projects.models.RecurrenceTrigger": "Azure.AI.Projects.RecurrenceTrigger", "azure.ai.projects.models.RedTeam": "Azure.AI.Projects.RedTeam", "azure.ai.projects.models.ResponseUsageInputTokensDetails": "OpenAI.ResponseUsageInputTokensDetails", "azure.ai.projects.models.ResponseUsageOutputTokensDetails": "OpenAI.ResponseUsageOutputTokensDetails", + "azure.ai.projects.models.Routine": "Azure.AI.Projects.Routine", + "azure.ai.projects.models.RoutineRun": "Azure.AI.Projects.RoutineRun", + "azure.ai.projects.models.RoutineRunDiagnostics": "Azure.AI.Projects.RoutineRunDiagnostics", "azure.ai.projects.models.RubricBasedEvaluatorDefinition": "Azure.AI.Projects.RubricBasedEvaluatorDefinition", - "azure.ai.projects.models.RubricCriterion": "Azure.AI.Projects.RubricCriterion", "azure.ai.projects.models.SASCredentials": "Azure.AI.Projects.SASCredentials", "azure.ai.projects.models.Schedule": "Azure.AI.Projects.Schedule", + "azure.ai.projects.models.ScheduleRoutineTrigger": "Azure.AI.Projects.ScheduleRoutineTrigger", "azure.ai.projects.models.ScheduleRun": "Azure.AI.Projects.ScheduleRun", + "azure.ai.projects.models.ScreenshotParam": "OpenAI.ScreenshotParam", + "azure.ai.projects.models.ScrollParam": "OpenAI.ScrollParam", "azure.ai.projects.models.SessionDirectoryEntry": "Azure.AI.Projects.SessionDirectoryEntry", "azure.ai.projects.models.SessionDirectoryListResult": "Azure.AI.Projects.SessionDirectoryListResponse", "azure.ai.projects.models.SessionFileWriteResult": "Azure.AI.Projects.SessionFileWriteResponse", "azure.ai.projects.models.SessionLogEvent": "Azure.AI.Projects.SessionLogEvent", + "azure.ai.projects.models.SharepointGroundingToolCall": "Azure.AI.Projects.SharepointGroundingToolCall", + "azure.ai.projects.models.SharepointGroundingToolCallOutput": "Azure.AI.Projects.SharepointGroundingToolCallOutput", "azure.ai.projects.models.SharepointGroundingToolParameters": "Azure.AI.Projects.SharepointGroundingToolParameters", "azure.ai.projects.models.SharepointPreviewTool": "Azure.AI.Projects.SharepointPreviewTool", "azure.ai.projects.models.SimpleQnADataGenerationJobOptions": "Azure.AI.Projects.SimpleQnADataGenerationJobOptions", @@ -240,13 +393,18 @@ "azure.ai.projects.models.SpecificFunctionShellParam": "OpenAI.SpecificFunctionShellParam", "azure.ai.projects.models.StructuredInputDefinition": "Azure.AI.Projects.StructuredInputDefinition", "azure.ai.projects.models.StructuredOutputDefinition": "Azure.AI.Projects.StructuredOutputDefinition", + "azure.ai.projects.models.StructuredOutputsOutputItem": "Azure.AI.Projects.StructuredOutputsOutputItem", + "azure.ai.projects.models.SummaryTextContent": "OpenAI.SummaryTextContent", + "azure.ai.projects.models.SystemDataV3": "Azure.AI.Projects.SystemDataV3", "azure.ai.projects.models.TaxonomyCategory": "Azure.AI.Projects.TaxonomyCategory", "azure.ai.projects.models.TaxonomySubCategory": "Azure.AI.Projects.TaxonomySubCategory", "azure.ai.projects.models.TelemetryConfig": "Azure.AI.Projects.TelemetryConfig", + "azure.ai.projects.models.TestingCriterionAzureAIEvaluator": "Azure.AI.Projects.TestingCriterionAzureAIEvaluator", "azure.ai.projects.models.TextResponseFormat": "OpenAI.TextResponseFormatConfiguration", "azure.ai.projects.models.TextResponseFormatJsonObject": "OpenAI.TextResponseFormatConfigurationResponseFormatJsonObject", "azure.ai.projects.models.TextResponseFormatJsonSchema": "OpenAI.TextResponseFormatJsonSchema", "azure.ai.projects.models.TextResponseFormatText": "OpenAI.TextResponseFormatConfigurationResponseFormatText", + "azure.ai.projects.models.TimerRoutineTrigger": "Azure.AI.Projects.TimerRoutineTrigger", "azure.ai.projects.models.ToolboxObject": "Azure.AI.Projects.ToolboxObject", "azure.ai.projects.models.ToolboxPolicies": "Azure.AI.Projects.ToolboxPolicies", "azure.ai.projects.models.ToolboxSearchPreviewTool": "Azure.AI.Projects.ToolboxSearchPreviewTool", @@ -261,23 +419,36 @@ "azure.ai.projects.models.ToolChoiceMCP": "OpenAI.ToolChoiceMCP", "azure.ai.projects.models.ToolChoiceWebSearchPreview": "OpenAI.ToolChoiceWebSearchPreview", "azure.ai.projects.models.ToolChoiceWebSearchPreview20250311": "OpenAI.ToolChoiceWebSearchPreview20250311", + "azure.ai.projects.models.ToolConfig": "Azure.AI.Projects.ToolConfig", "azure.ai.projects.models.ToolDescription": "Azure.AI.Projects.ToolDescription", "azure.ai.projects.models.ToolProjectConnection": "Azure.AI.Projects.ToolProjectConnection", "azure.ai.projects.models.ToolUseFineTuningDataGenerationJobOptions": "Azure.AI.Projects.ToolUseFineTuningDataGenerationJobOptions", + "azure.ai.projects.models.TopLogProb": "OpenAI.TopLogProb", "azure.ai.projects.models.TracesDataGenerationJobOptions": "Azure.AI.Projects.TracesDataGenerationJobOptions", "azure.ai.projects.models.TracesDataGenerationJobSource": "Azure.AI.Projects.TracesDataGenerationJobSource", + "azure.ai.projects.models.TracesEvaluationSuiteJobSource": "Azure.AI.Projects.TracesEvaluationSuiteJobSource", "azure.ai.projects.models.TracesEvaluatorGenerationJobSource": "Azure.AI.Projects.TracesEvaluatorGenerationJobSource", + "azure.ai.projects.models.TypeParam": "OpenAI.TypeParam", + "azure.ai.projects.models.UpdateModelVersionRequest": "Azure.AI.Projects.UpdateModelVersionRequest", "azure.ai.projects.models.UpdateToolboxRequest": "Azure.AI.Projects.UpdateToolboxRequest", + "azure.ai.projects.models.UrlCitationBody": "OpenAI.UrlCitationBody", "azure.ai.projects.models.UserProfileMemoryItem": "Azure.AI.Projects.UserProfileMemoryItem", + "azure.ai.projects.models.VectorStoreFileAttributes": "OpenAI.VectorStoreFileAttributes", "azure.ai.projects.models.VersionIndicator": "Azure.AI.Projects.VersionIndicator", "azure.ai.projects.models.VersionRefIndicator": "Azure.AI.Projects.VersionRefIndicator", "azure.ai.projects.models.VersionSelector": "Azure.AI.Projects.VersionSelector", + "azure.ai.projects.models.WaitParam": "OpenAI.WaitParam", + "azure.ai.projects.models.WebSearchActionFind": "OpenAI.WebSearchActionFind", + "azure.ai.projects.models.WebSearchActionOpenPage": "OpenAI.WebSearchActionOpenPage", + "azure.ai.projects.models.WebSearchActionSearch": "OpenAI.WebSearchActionSearch", + "azure.ai.projects.models.WebSearchActionSearchSources": "OpenAI.WebSearchActionSearchSources", "azure.ai.projects.models.WebSearchApproximateLocation": "OpenAI.WebSearchApproximateLocation", "azure.ai.projects.models.WebSearchConfiguration": "Azure.AI.Projects.WebSearchConfiguration", "azure.ai.projects.models.WebSearchPreviewTool": "OpenAI.WebSearchPreviewTool", "azure.ai.projects.models.WebSearchTool": "OpenAI.WebSearchTool", "azure.ai.projects.models.WebSearchToolFilters": "OpenAI.WebSearchToolFilters", "azure.ai.projects.models.WeeklyRecurrenceSchedule": "Azure.AI.Projects.WeeklyRecurrenceSchedule", + "azure.ai.projects.models.WorkflowActionOutputItem": "Azure.AI.Projects.WorkflowActionOutputItem", "azure.ai.projects.models.WorkflowAgentDefinition": "Azure.AI.Projects.WorkflowAgentDefinition", "azure.ai.projects.models.WorkIQPreviewTool": "Azure.AI.Projects.WorkIQPreviewTool", "azure.ai.projects.models.AgentObjectType": "Azure.AI.Projects.AgentObjectType", @@ -313,6 +484,26 @@ "azure.ai.projects.models.AgentSessionStatus": "Azure.AI.Projects.AgentSessionStatus", "azure.ai.projects.models.PageOrder": "Azure.AI.Projects.PageOrder", "azure.ai.projects.models.SessionLogEventType": "Azure.AI.Projects.SessionLogEventType", + "azure.ai.projects.models.EvalRunOutputItemResultStatus": "Azure.AI.Projects.EvalRunOutputItemResultStatus", + "azure.ai.projects.models.OutputItemType": "OpenAI.OutputItemType", + "azure.ai.projects.models.ToolCallStatus": "Azure.AI.Projects.ToolCallStatus", + "azure.ai.projects.models.ApplyPatchCallStatus": "OpenAI.ApplyPatchCallStatus", + "azure.ai.projects.models.ApplyPatchFileOperationType": "OpenAI.ApplyPatchFileOperationType", + "azure.ai.projects.models.ApplyPatchCallOutputStatus": "OpenAI.ApplyPatchCallOutputStatus", + "azure.ai.projects.models.ComputerActionType": "OpenAI.ComputerActionType", + "azure.ai.projects.models.ClickButtonType": "OpenAI.ClickButtonType", + "azure.ai.projects.models.MCPToolCallStatus": "OpenAI.MCPToolCallStatus", + "azure.ai.projects.models.MemoryItemKind": "Azure.AI.Projects.MemoryItemKind", + "azure.ai.projects.models.OutputMessageContentType": "OpenAI.OutputMessageContentType", + "azure.ai.projects.models.AnnotationType": "OpenAI.AnnotationType", + "azure.ai.projects.models.MessageContentType": "OpenAI.MessageContentType", + "azure.ai.projects.models.LocalShellCallStatus": "OpenAI.LocalShellCallStatus", + "azure.ai.projects.models.FunctionShellCallEnvironmentType": "OpenAI.FunctionShellCallEnvironmentType", + "azure.ai.projects.models.LocalShellCallOutputStatusEnum": "OpenAI.LocalShellCallOutputStatusEnum", + "azure.ai.projects.models.FunctionShellCallOutputOutcomeType": "OpenAI.FunctionShellCallOutputOutcomeType", + "azure.ai.projects.models.OptimizationStrategy": "Azure.AI.Projects.OptimizationStrategy", + "azure.ai.projects.models.OptimizationMode": "Azure.AI.Projects.OptimizationMode", + "azure.ai.projects.models.JobStatus": "Azure.AI.Projects.JobStatus", "azure.ai.projects.models.EvaluationTaxonomyInputType": "Azure.AI.Projects.EvaluationTaxonomyInputType", "azure.ai.projects.models.RiskCategory": "Azure.AI.Projects.RiskCategory", "azure.ai.projects.models.EvaluatorType": "Azure.AI.Projects.EvaluatorType", @@ -320,17 +511,32 @@ "azure.ai.projects.models.EvaluatorDefinitionType": "Azure.AI.Projects.EvaluatorDefinitionType", "azure.ai.projects.models.EvaluatorMetricType": "Azure.AI.Projects.EvaluatorMetricType", "azure.ai.projects.models.EvaluatorMetricDirection": "Azure.AI.Projects.EvaluatorMetricDirection", + "azure.ai.projects.models.PendingUploadType": "Azure.AI.Projects.PendingUploadType", "azure.ai.projects.models.EvaluatorGenerationJobSourceType": "Azure.AI.Projects.EvaluatorGenerationJobSourceType", - "azure.ai.projects.models.JobStatus": "Azure.AI.Projects.JobStatus", + "azure.ai.projects.models.EvaluationSuiteSubtype": "Azure.AI.Projects.EvaluationSuiteSubtype", + "azure.ai.projects.models.EvalItemContentItemObjectType": "OpenAI.EvalItemContentItemObjectType", + "azure.ai.projects.models.EvaluationLevel": "Azure.AI.Projects.EvaluationLevel", + "azure.ai.projects.models.EvaluationSuiteJobSourceType": "Azure.AI.Projects.EvaluationSuiteJobSourceType", + "azure.ai.projects.models.EvaluationSuiteGenerationCategory": "Azure.AI.Projects.EvaluationSuiteGenerationCategory", + "azure.ai.projects.models.EvaluationDataGenerationType": "Azure.AI.Projects.EvaluationDataGenerationType", "azure.ai.projects.models.OperationState": "Azure.Core.Foundations.OperationState", "azure.ai.projects.models.InsightType": "Azure.AI.Projects.InsightType", "azure.ai.projects.models.SampleType": "Azure.AI.Projects.SampleType", "azure.ai.projects.models.TreatmentEffectType": "Azure.AI.Projects.TreatmentEffectType", "azure.ai.projects.models.MemoryStoreObjectType": "Azure.AI.Projects.MemoryStoreObjectType", "azure.ai.projects.models.MemoryStoreKind": "Azure.AI.Projects.MemoryStoreKind", - "azure.ai.projects.models.MemoryItemKind": "Azure.AI.Projects.MemoryItemKind", "azure.ai.projects.models.MemoryOperationKind": "Azure.AI.Projects.MemoryOperationKind", + "azure.ai.projects.models.FoundryModelWeightType": "Azure.AI.Projects.FoundryModelWeightType", + "azure.ai.projects.models.FoundryModelSourceType": "Azure.AI.Projects.FoundryModelSourceType", + "azure.ai.projects.models.FoundryModelArtifactProfileCategory": "Azure.AI.Projects.FoundryModelArtifactProfileCategory", + "azure.ai.projects.models.FoundryModelArtifactProfileSignal": "Azure.AI.Projects.FoundryModelArtifactProfileSignal", + "azure.ai.projects.models.FoundryModelWarningCode": "Azure.AI.Projects.FoundryModelWarningCode", "azure.ai.projects.models.AttackStrategy": "Azure.AI.Projects.AttackStrategy", + "azure.ai.projects.models.RoutineTriggerType": "Azure.AI.Projects.RoutineTriggerType", + "azure.ai.projects.models.RoutineActionType": "Azure.AI.Projects.RoutineActionType", + "azure.ai.projects.models.RoutineRunPhase": "Azure.AI.Projects.RoutineRunPhase", + "azure.ai.projects.models.RoutineAttemptSource": "Azure.AI.Projects.RoutineAttemptSource", + "azure.ai.projects.models.RoutineDispatchPayloadType": "Azure.AI.Projects.RoutineDispatchPayloadType", "azure.ai.projects.models.ScheduleProvisioningStatus": "Azure.AI.Projects.ScheduleProvisioningStatus", "azure.ai.projects.models.TriggerType": "Azure.AI.Projects.TriggerType", "azure.ai.projects.models.RecurrenceType": "Azure.AI.Projects.RecurrenceType", @@ -346,7 +552,6 @@ "azure.ai.projects.models.ConnectionType": "Azure.AI.Projects.ConnectionType", "azure.ai.projects.models.CredentialType": "Azure.AI.Projects.CredentialType", "azure.ai.projects.models.DatasetType": "Azure.AI.Projects.DatasetType", - "azure.ai.projects.models.PendingUploadType": "Azure.AI.Projects.PendingUploadType", "azure.ai.projects.models.DeploymentType": "Azure.AI.Projects.DeploymentType", "azure.ai.projects.models.IndexType": "Azure.AI.Projects.IndexType", "azure.ai.projects.models.MemoryStoreUpdateStatus": "Azure.AI.Projects.MemoryStoreUpdateStatus", @@ -403,6 +608,22 @@ "azure.ai.projects.operations.IndexesOperations.delete": "Azure.AI.Projects.Indexes.deleteVersion", "azure.ai.projects.aio.operations.IndexesOperations.delete": "Azure.AI.Projects.Indexes.deleteVersion", "azure.ai.projects.operations.IndexesOperations.create_or_update": "Azure.AI.Projects.Indexes.createOrUpdateVersion", - "azure.ai.projects.aio.operations.IndexesOperations.create_or_update": "Azure.AI.Projects.Indexes.createOrUpdateVersion" + "azure.ai.projects.aio.operations.IndexesOperations.create_or_update": "Azure.AI.Projects.Indexes.createOrUpdateVersion", + "azure.ai.projects.operations.ToolboxesOperations.create_version": "Azure.AI.Projects.Toolboxes.createToolboxVersion", + "azure.ai.projects.aio.operations.ToolboxesOperations.create_version": "Azure.AI.Projects.Toolboxes.createToolboxVersion", + "azure.ai.projects.operations.ToolboxesOperations.get": "Azure.AI.Projects.Toolboxes.getToolbox", + "azure.ai.projects.aio.operations.ToolboxesOperations.get": "Azure.AI.Projects.Toolboxes.getToolbox", + "azure.ai.projects.operations.ToolboxesOperations.list": "Azure.AI.Projects.Toolboxes.listToolboxes", + "azure.ai.projects.aio.operations.ToolboxesOperations.list": "Azure.AI.Projects.Toolboxes.listToolboxes", + "azure.ai.projects.operations.ToolboxesOperations.list_versions": "Azure.AI.Projects.Toolboxes.listToolboxVersions", + "azure.ai.projects.aio.operations.ToolboxesOperations.list_versions": "Azure.AI.Projects.Toolboxes.listToolboxVersions", + "azure.ai.projects.operations.ToolboxesOperations.get_version": "Azure.AI.Projects.Toolboxes.getToolboxVersion", + "azure.ai.projects.aio.operations.ToolboxesOperations.get_version": "Azure.AI.Projects.Toolboxes.getToolboxVersion", + "azure.ai.projects.operations.ToolboxesOperations.update": "Azure.AI.Projects.Toolboxes.updateToolbox", + "azure.ai.projects.aio.operations.ToolboxesOperations.update": "Azure.AI.Projects.Toolboxes.updateToolbox", + "azure.ai.projects.operations.ToolboxesOperations.delete": "Azure.AI.Projects.Toolboxes.deleteToolbox", + "azure.ai.projects.aio.operations.ToolboxesOperations.delete": "Azure.AI.Projects.Toolboxes.deleteToolbox", + "azure.ai.projects.operations.ToolboxesOperations.delete_version": "Azure.AI.Projects.Toolboxes.deleteToolboxVersion", + "azure.ai.projects.aio.operations.ToolboxesOperations.delete_version": "Azure.AI.Projects.Toolboxes.deleteToolboxVersion" } } \ No newline at end of file diff --git a/sdk/ai/azure-ai-projects/assets.json b/sdk/ai/azure-ai-projects/assets.json index e1116a1816ae..6640e7c30600 100644 --- a/sdk/ai/azure-ai-projects/assets.json +++ b/sdk/ai/azure-ai-projects/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/ai/azure-ai-projects", - "Tag": "python/ai/azure-ai-projects_b8c168cd69" + "Tag": "python/ai/azure-ai-projects_d5ecfcf953" } diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/_client.py b/sdk/ai/azure-ai-projects/azure/ai/projects/_client.py index 318f549168a8..c18303c54253 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/_client.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/_client.py @@ -24,6 +24,7 @@ DeploymentsOperations, EvaluationRulesOperations, IndexesOperations, + ToolboxesOperations, ) if TYPE_CHECKING: @@ -47,6 +48,8 @@ class AIProjectClient: # pylint: disable=too-many-instance-attributes :vartype deployments: azure.ai.projects.operations.DeploymentsOperations :ivar indexes: IndexesOperations operations :vartype indexes: azure.ai.projects.operations.IndexesOperations + :ivar toolboxes: ToolboxesOperations operations + :vartype toolboxes: azure.ai.projects.operations.ToolboxesOperations :param endpoint: Foundry Project endpoint in the form "https://{ai-services-account-name}.services.ai.azure.com/api/projects/{project-name}". If you only have one Project in your Foundry Hub, or to target the default Project in your Hub, use @@ -102,6 +105,7 @@ def __init__( self.datasets = DatasetsOperations(self._client, self._config, self._serialize, self._deserialize) self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) self.indexes = IndexesOperations(self._client, self._config, self._serialize, self._deserialize) + self.toolboxes = ToolboxesOperations(self._client, self._config, self._serialize, self._deserialize) def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/_types.py b/sdk/ai/azure-ai-projects/azure/ai/projects/_types.py index 5e23b3911701..6af87c116c47 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/_types.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/_types.py @@ -6,8 +6,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING, Union +from typing import Any, TYPE_CHECKING, Union if TYPE_CHECKING: from . import models as _models Filters = Union["_models.ComparisonFilter", "_models.CompoundFilter"] +ToolCallOutputContent = Union[dict[str, Any], str, list[Any]] +EvalItemContentItem = Union[str, "_models.EvalItemContentItemObject"] +EvalItemContent = Union["EvalItemContentItem", list["EvalItemContentItem"]] diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_client.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_client.py index e92b1057b268..0b95bd186ebb 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_client.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_client.py @@ -24,6 +24,7 @@ DeploymentsOperations, EvaluationRulesOperations, IndexesOperations, + ToolboxesOperations, ) if TYPE_CHECKING: @@ -47,6 +48,8 @@ class AIProjectClient: # pylint: disable=too-many-instance-attributes :vartype deployments: azure.ai.projects.aio.operations.DeploymentsOperations :ivar indexes: IndexesOperations operations :vartype indexes: azure.ai.projects.aio.operations.IndexesOperations + :ivar toolboxes: ToolboxesOperations operations + :vartype toolboxes: azure.ai.projects.aio.operations.ToolboxesOperations :param endpoint: Foundry Project endpoint in the form "https://{ai-services-account-name}.services.ai.azure.com/api/projects/{project-name}". If you only have one Project in your Foundry Hub, or to target the default Project in your Hub, use @@ -102,6 +105,7 @@ def __init__( self.datasets = DatasetsOperations(self._client, self._config, self._serialize, self._deserialize) self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) self.indexes = IndexesOperations(self._client, self._config, self._serialize, self._deserialize) + self.toolboxes = ToolboxesOperations(self._client, self._config, self._serialize, self._deserialize) def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/__init__.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/__init__.py index 1a1c0ffec86c..d6cf67b4d8cf 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/__init__.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/__init__.py @@ -19,6 +19,7 @@ from ._operations import DatasetsOperations # type: ignore from ._operations import DeploymentsOperations # type: ignore from ._operations import IndexesOperations # type: ignore +from ._operations import ToolboxesOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -32,6 +33,7 @@ "DatasetsOperations", "DeploymentsOperations", "IndexesOperations", + "ToolboxesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py index 98ac9d539ab0..4ce6737cb6f4 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py @@ -45,16 +45,24 @@ build_agents_get_version_request, build_agents_list_request, build_agents_list_versions_request, + build_beta_agents_cancel_optimization_job_request, build_beta_agents_create_agent_version_from_code_request, + build_beta_agents_create_optimization_job_request, build_beta_agents_create_session_request, + build_beta_agents_delete_optimization_job_request, build_beta_agents_delete_session_file_request, build_beta_agents_delete_session_request, build_beta_agents_download_agent_code_request, - build_beta_agents_download_agent_version_code_request, build_beta_agents_download_session_file_request, + build_beta_agents_get_optimization_candidate_config_request, + build_beta_agents_get_optimization_candidate_request, + build_beta_agents_get_optimization_candidate_results_request, + build_beta_agents_get_optimization_job_request, build_beta_agents_get_session_files_request, build_beta_agents_get_session_log_stream_request, build_beta_agents_get_session_request, + build_beta_agents_list_optimization_candidates_request, + build_beta_agents_list_optimization_jobs_request, build_beta_agents_list_sessions_request, build_beta_agents_patch_agent_details_request, build_beta_agents_update_agent_from_code_request, @@ -70,30 +78,65 @@ build_beta_evaluation_taxonomies_list_request, build_beta_evaluation_taxonomies_update_request, build_beta_evaluators_cancel_generation_job_request, + build_beta_evaluators_cancel_generation_suite_job_request, + build_beta_evaluators_create_evaluation_suite_request, build_beta_evaluators_create_generation_job_request, + build_beta_evaluators_create_generation_suite_job_request, + build_beta_evaluators_create_or_update_evaluation_suite_request, build_beta_evaluators_create_version_request, + build_beta_evaluators_delete_evaluation_suite_request, build_beta_evaluators_delete_generation_job_request, + build_beta_evaluators_delete_generation_suite_job_request, build_beta_evaluators_delete_version_request, + build_beta_evaluators_get_credentials_request, + build_beta_evaluators_get_evaluation_suite_request, build_beta_evaluators_get_generation_job_request, + build_beta_evaluators_get_generation_suite_job_request, build_beta_evaluators_get_version_request, + build_beta_evaluators_list_evaluation_suite_versions_request, + build_beta_evaluators_list_evaluation_suites_request, build_beta_evaluators_list_generation_jobs_request, + build_beta_evaluators_list_generation_suite_jobs_request, build_beta_evaluators_list_request, build_beta_evaluators_list_versions_request, + build_beta_evaluators_pending_upload_request, + build_beta_evaluators_run_evaluation_suite_request, build_beta_evaluators_update_version_request, build_beta_insights_generate_request, build_beta_insights_get_request, build_beta_insights_list_request, + build_beta_memory_stores_create_memory_request, build_beta_memory_stores_create_request, + build_beta_memory_stores_delete_memory_request, build_beta_memory_stores_delete_request, build_beta_memory_stores_delete_scope_request, + build_beta_memory_stores_get_memory_request, build_beta_memory_stores_get_request, + build_beta_memory_stores_list_memories_request, build_beta_memory_stores_list_request, build_beta_memory_stores_search_memories_request, build_beta_memory_stores_update_memories_request, + build_beta_memory_stores_update_memory_request, build_beta_memory_stores_update_request, + build_beta_models_create_async_request, + build_beta_models_delete_request, + build_beta_models_get_credentials_request, + build_beta_models_get_request, + build_beta_models_list_request, + build_beta_models_list_versions_request, + build_beta_models_pending_upload_request, + build_beta_models_update_request, build_beta_red_teams_create_request, build_beta_red_teams_get_request, build_beta_red_teams_list_request, + build_beta_routines_create_or_update_request, + build_beta_routines_delete_request, + build_beta_routines_disable_request, + build_beta_routines_dispatch_async_request, + build_beta_routines_enable_request, + build_beta_routines_get_request, + build_beta_routines_list_request, + build_beta_routines_list_runs_request, build_beta_schedules_create_or_update_request, build_beta_schedules_delete_request, build_beta_schedules_get_request, @@ -107,14 +150,6 @@ build_beta_skills_get_request, build_beta_skills_list_request, build_beta_skills_update_request, - build_beta_toolboxes_create_version_request, - build_beta_toolboxes_delete_request, - build_beta_toolboxes_delete_version_request, - build_beta_toolboxes_get_request, - build_beta_toolboxes_get_version_request, - build_beta_toolboxes_list_request, - build_beta_toolboxes_list_versions_request, - build_beta_toolboxes_update_request, build_connections_get_request, build_connections_get_with_credentials_request, build_connections_list_request, @@ -136,6 +171,14 @@ build_indexes_get_request, build_indexes_list_request, build_indexes_list_versions_request, + build_toolboxes_create_version_request, + build_toolboxes_delete_request, + build_toolboxes_delete_version_request, + build_toolboxes_get_request, + build_toolboxes_get_version_request, + build_toolboxes_list_request, + build_toolboxes_list_versions_request, + build_toolboxes_update_request, ) from .._configuration import AIProjectClientConfiguration @@ -170,9 +213,10 @@ def __init__(self, *args, **kwargs) -> None: self.evaluators = BetaEvaluatorsOperations(self._client, self._config, self._serialize, self._deserialize) self.insights = BetaInsightsOperations(self._client, self._config, self._serialize, self._deserialize) self.memory_stores = BetaMemoryStoresOperations(self._client, self._config, self._serialize, self._deserialize) + self.models = BetaModelsOperations(self._client, self._config, self._serialize, self._deserialize) self.red_teams = BetaRedTeamsOperations(self._client, self._config, self._serialize, self._deserialize) + self.routines = BetaRoutinesOperations(self._client, self._config, self._serialize, self._deserialize) self.schedules = BetaSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) - self.toolboxes = BetaToolboxesOperations(self._client, self._config, self._serialize, self._deserialize) self.skills = BetaSkillsOperations(self._client, self._config, self._serialize, self._deserialize) self.datasets = BetaDatasetsOperations(self._client, self._config, self._serialize, self._deserialize) @@ -260,11 +304,19 @@ async def get(self, agent_name: str, **kwargs: Any) -> _models.AgentDetails: return deserialized # type: ignore @distributed_trace_async - async def delete(self, agent_name: str, **kwargs: Any) -> _models.DeleteAgentResponse: - """Deletes an agent. + async def delete( + self, agent_name: str, *, force: Optional[bool] = None, **kwargs: Any + ) -> _models.DeleteAgentResponse: + """Deletes an agent. For hosted agents, if any version has active sessions, the request is + rejected with HTTP 409 unless ``force`` is set to true. When force is true, all associated + sessions are cascade-deleted along with the agent and its versions. :param agent_name: The name of the agent to delete. Required. :type agent_name: str + :keyword force: For Hosted Agents, if true, force-deletes the agent even if its versions have + active sessions, cascading deletion to all associated sessions. This value is not relevant for + other Agent types. Defaults to false. Default value is None. + :paramtype force: bool :return: DeleteAgentResponse. The DeleteAgentResponse is compatible with MutableMapping :rtype: ~azure.ai.projects.models.DeleteAgentResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -284,6 +336,7 @@ async def delete(self, agent_name: str, **kwargs: Any) -> _models.DeleteAgentRes _request = build_agents_delete_request( agent_name=agent_name, + force=force, api_version=self._config.api_version, headers=_headers, params=_params, @@ -337,7 +390,7 @@ def list( """Returns the list of all agents. :keyword kind: Filter agents by kind. If not provided, all agents are returned. Known values - are: "prompt", "hosted", and "workflow". Default value is None. + are: "prompt", "hosted", "workflow", and "external". Default value is None. :paramtype kind: str or ~azure.ai.projects.models.AgentKind :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the @@ -901,14 +954,20 @@ async def get_version(self, agent_name: str, agent_version: str, **kwargs: Any) @distributed_trace_async async def delete_version( - self, agent_name: str, agent_version: str, **kwargs: Any + self, agent_name: str, agent_version: str, *, force: Optional[bool] = None, **kwargs: Any ) -> _models.DeleteAgentVersionResponse: - """Deletes a specific version of an agent. + """Deletes a specific version of an agent. For hosted agents, if the version has active sessions, + the request is rejected with HTTP 409 unless ``force`` is set to true. When force is true, all + sessions associated with this version are cascade-deleted. :param agent_name: The name of the agent to delete. Required. :type agent_name: str :param agent_version: The version of the agent to delete. Required. :type agent_version: str + :keyword force: For Hosted Agents, if true, force-deletes the version even if it has active + sessions, cascading deletion to all associated sessions. This value is not relevant for other + Agent types. Defaults to false. Default value is None. + :paramtype force: bool :return: DeleteAgentVersionResponse. The DeleteAgentVersionResponse is compatible with MutableMapping :rtype: ~azure.ai.projects.models.DeleteAgentVersionResponse @@ -930,6 +989,7 @@ async def delete_version( _request = build_agents_delete_version_request( agent_name=agent_name, agent_version=agent_version, + force=force, api_version=self._config.api_version, headers=_headers, params=_params, @@ -3011,14 +3071,14 @@ async def create_or_update( return deserialized # type: ignore -class BetaAgentsOperations: +class ToolboxesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`agents` attribute. + :attr:`toolboxes` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -3029,90 +3089,107 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload - async def update_agent_from_code( + async def create_version( self, - agent_name: str, - content: _models.CreateAgentVersionFromCodeContent, + name: str, *, - code_zip_sha256: str, + tools: List[_models.Tool], + content_type: str = "application/json", + description: Optional[str] = None, + metadata: Optional[dict[str, str]] = None, + policies: Optional[_models.ToolboxPolicies] = None, **kwargs: Any - ) -> _models.AgentDetails: - """Updates a code-based agent by uploading new code and creating a new version. If the code and - definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing - version. The request body is multipart/form-data with a JSON metadata part and a binary code - part (part order is irrelevant). Maximum upload size is 250 MB. - - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + ) -> _models.ToolboxVersionObject: + """Create a new version of a toolbox. If the toolbox does not exist, it will be created. - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. - :type agent_name: str - :param content: Required. - :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent - :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change - detection (dedup) and integrity verification. Required. - :paramtype code_zip_sha256: str - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails + :param name: The name of the toolbox. If the toolbox does not exist, it will be created. + Required. + :type name: str + :keyword tools: The list of tools to include in this version. Required. + :paramtype tools: list[~azure.ai.projects.models.Tool] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword description: A human-readable description of the toolbox. Default value is None. + :paramtype description: str + :keyword metadata: Arbitrary key-value metadata to associate with the toolbox. Default value is + None. + :paramtype metadata: dict[str, str] + :keyword policies: Policy configuration for this toolbox version. Default value is None. + :paramtype policies: ~azure.ai.projects.models.ToolboxPolicies + :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxVersionObject :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update_agent_from_code( - self, agent_name: str, content: JSON, *, code_zip_sha256: str, **kwargs: Any - ) -> _models.AgentDetails: - """Updates a code-based agent by uploading new code and creating a new version. If the code and - definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing - version. The request body is multipart/form-data with a JSON metadata part and a binary code - part (part order is irrelevant). Maximum upload size is 250 MB. + async def create_version( + self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ToolboxVersionObject: + """Create a new version of a toolbox. If the toolbox does not exist, it will be created. - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + :param name: The name of the toolbox. If the toolbox does not exist, it will be created. + Required. + :type name: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxVersionObject + :raises ~azure.core.exceptions.HttpResponseError: + """ - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. - :type agent_name: str - :param content: Required. - :type content: JSON - :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change - detection (dedup) and integrity verification. Required. - :paramtype code_zip_sha256: str - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails + @overload + async def create_version( + self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ToolboxVersionObject: + """Create a new version of a toolbox. If the toolbox does not exist, it will be created. + + :param name: The name of the toolbox. If the toolbox does not exist, it will be created. + Required. + :type name: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxVersionObject :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def update_agent_from_code( + async def create_version( self, - agent_name: str, - content: Union[_models.CreateAgentVersionFromCodeContent, JSON], + name: str, + body: Union[JSON, IO[bytes]] = _Unset, *, - code_zip_sha256: str, + tools: List[_models.Tool] = _Unset, + description: Optional[str] = None, + metadata: Optional[dict[str, str]] = None, + policies: Optional[_models.ToolboxPolicies] = None, **kwargs: Any - ) -> _models.AgentDetails: - """Updates a code-based agent by uploading new code and creating a new version. If the code and - definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing - version. The request body is multipart/form-data with a JSON metadata part and a binary code - part (part order is irrelevant). Maximum upload size is 250 MB. - - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + ) -> _models.ToolboxVersionObject: + """Create a new version of a toolbox. If the toolbox does not exist, it will be created. - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. - :type agent_name: str - :param content: Is either a CreateAgentVersionFromCodeContent type or a JSON type. Required. - :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent or JSON - :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change - detection (dedup) and integrity verification. Required. - :paramtype code_zip_sha256: str - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails + :param name: The name of the toolbox. If the toolbox does not exist, it will be created. + Required. + :type name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword tools: The list of tools to include in this version. Required. + :paramtype tools: list[~azure.ai.projects.models.Tool] + :keyword description: A human-readable description of the toolbox. Default value is None. + :paramtype description: str + :keyword metadata: Arbitrary key-value metadata to associate with the toolbox. Default value is + None. + :paramtype metadata: dict[str, str] + :keyword policies: Policy configuration for this toolbox version. Default value is None. + :paramtype policies: ~azure.ai.projects.models.ToolboxPolicies + :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxVersionObject :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -3123,21 +3200,29 @@ async def update_agent_from_code( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.AgentDetails] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ToolboxVersionObject] = kwargs.pop("cls", None) - _body = content.as_dict() if isinstance(content, _Model) else content - _file_fields: list[str] = ["code"] - _data_fields: list[str] = ["metadata"] - _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) + if body is _Unset: + if tools is _Unset: + raise TypeError("missing required argument: tools") + body = {"description": description, "metadata": metadata, "policies": policies, "tools": tools} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_agents_update_agent_from_code_request( - agent_name=agent_name, - code_zip_sha256=code_zip_sha256, + _request = build_toolboxes_create_version_request( + name=name, + content_type=content_type, api_version=self._config.api_version, - files=_files, + content=_content, headers=_headers, params=_params, ) @@ -3170,97 +3255,3769 @@ async def update_agent_from_code( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.AgentDetails, response.json()) + deserialized = _deserialize(_models.ToolboxVersionObject, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def patch_agent_details( - self, - agent_name: str, - *, - content_type: str = "application/merge-patch+json", - agent_endpoint: Optional[_models.AgentEndpointConfig] = None, - agent_card: Optional[_models.AgentCard] = None, - **kwargs: Any - ) -> _models.AgentDetails: - """Updates an agent endpoint. + @distributed_trace_async + async def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: + """Retrieve a toolbox. - :param agent_name: The name of the agent to retrieve. Required. - :type agent_name: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :keyword agent_endpoint: The endpoint configuration for the agent. Default value is None. - :paramtype agent_endpoint: ~azure.ai.projects.models.AgentEndpointConfig - :keyword agent_card: Optional agent card for the agent. Default value is None. - :paramtype agent_card: ~azure.ai.projects.models.AgentCard - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails + :param name: The name of the toolbox to retrieve. Required. + :type name: str + :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxObject :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @overload - async def patch_agent_details( - self, agent_name: str, body: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.AgentDetails: - """Updates an agent endpoint. + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - :param agent_name: The name of the agent to retrieve. Required. - :type agent_name: str - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ + cls: ClsType[_models.ToolboxObject] = kwargs.pop("cls", None) - @overload - async def patch_agent_details( - self, agent_name: str, body: IO[bytes], *, content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.AgentDetails: - """Updates an agent endpoint. + _request = build_toolboxes_get_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - :param agent_name: The name of the agent to retrieve. Required. - :type agent_name: str - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/merge-patch+json". - :paramtype content_type: str + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ToolboxObject, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.ToolboxObject"]: + """List all toolboxes. + + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of ToolboxObject + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.ToolboxObject] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ToolboxObject]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(_continuation_token=None): + + _request = build_toolboxes_list_request( + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ToolboxObject], + deserialized.get("data", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, AsyncList(list_of_elem) + + async def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_versions( + self, + name: str, + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.ToolboxVersionObject"]: + """List all versions of a toolbox. + + :param name: The name of the toolbox to list versions for. Required. + :type name: str + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of ToolboxVersionObject + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.ToolboxVersionObject] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ToolboxVersionObject]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(_continuation_token=None): + + _request = build_toolboxes_list_versions_request( + name=name, + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ToolboxVersionObject], + deserialized.get("data", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, AsyncList(list_of_elem) + + async def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.ToolboxVersionObject: + """Retrieve a specific version of a toolbox. + + :param name: The name of the toolbox. Required. + :type name: str + :param version: The version identifier to retrieve. Required. + :type version: str + :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxVersionObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ToolboxVersionObject] = kwargs.pop("cls", None) + + _request = build_toolboxes_get_version_request( + name=name, + version=version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ToolboxVersionObject, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, name: str, *, default_version: str, content_type: str = "application/json", **kwargs: Any + ) -> _models.ToolboxObject: + """Update a toolbox to point to a specific version. + + :param name: The name of the toolbox to update. Required. + :type name: str + :keyword default_version: The version identifier that the toolbox should point to. When set, + the toolbox's default version will resolve to this version instead of the latest. Required. + :paramtype default_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ToolboxObject: + """Update a toolbox to point to a specific version. + + :param name: The name of the toolbox to update. Required. + :type name: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ToolboxObject: + """Update a toolbox to point to a specific version. + + :param name: The name of the toolbox to update. Required. + :type name: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, name: str, body: Union[JSON, IO[bytes]] = _Unset, *, default_version: str = _Unset, **kwargs: Any + ) -> _models.ToolboxObject: + """Update a toolbox to point to a specific version. + + :param name: The name of the toolbox to update. Required. + :type name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword default_version: The version identifier that the toolbox should point to. When set, + the toolbox's default version will resolve to this version instead of the latest. Required. + :paramtype default_version: str + :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ToolboxObject] = kwargs.pop("cls", None) + + if body is _Unset: + if default_version is _Unset: + raise TypeError("missing required argument: default_version") + body = {"default_version": default_version} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_toolboxes_update_request( + name=name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ToolboxObject, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, name: str, **kwargs: Any) -> None: + """Delete a toolbox and all its versions. + + :param name: The name of the toolbox to delete. Required. + :type name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_toolboxes_delete_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def delete_version(self, name: str, version: str, **kwargs: Any) -> None: + """Delete a specific version of a toolbox. + + :param name: The name of the toolbox. Required. + :type name: str + :param version: The version identifier to delete. Required. + :type version: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_toolboxes_delete_version_request( + name=name, + version=version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class BetaAgentsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.aio.AIProjectClient`'s + :attr:`agents` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def update_agent_from_code( + self, + agent_name: str, + content: _models.CreateAgentVersionFromCodeContent, + *, + code_zip_sha256: str, + **kwargs: Any + ) -> _models.AgentDetails: + """Updates a code-based agent by uploading new code and creating a new version. If the code and + definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing + version. The request body is multipart/form-data with a JSON metadata part and a binary code + part (part order is irrelevant). Maximum upload size is 250 MB. + + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param content: Required. + :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent + :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change + detection (dedup) and integrity verification. Required. + :paramtype code_zip_sha256: str + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_agent_from_code( + self, agent_name: str, content: JSON, *, code_zip_sha256: str, **kwargs: Any + ) -> _models.AgentDetails: + """Updates a code-based agent by uploading new code and creating a new version. If the code and + definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing + version. The request body is multipart/form-data with a JSON metadata part and a binary code + part (part order is irrelevant). Maximum upload size is 250 MB. + + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param content: Required. + :type content: JSON + :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change + detection (dedup) and integrity verification. Required. + :paramtype code_zip_sha256: str + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_agent_from_code( + self, + agent_name: str, + content: Union[_models.CreateAgentVersionFromCodeContent, JSON], + *, + code_zip_sha256: str, + **kwargs: Any + ) -> _models.AgentDetails: + """Updates a code-based agent by uploading new code and creating a new version. If the code and + definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing + version. The request body is multipart/form-data with a JSON metadata part and a binary code + part (part order is irrelevant). Maximum upload size is 250 MB. + + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param content: Is either a CreateAgentVersionFromCodeContent type or a JSON type. Required. + :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent or JSON + :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change + detection (dedup) and integrity verification. Required. + :paramtype code_zip_sha256: str + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AgentDetails] = kwargs.pop("cls", None) + + _body = content.as_dict() if isinstance(content, _Model) else content + _file_fields: list[str] = ["code"] + _data_fields: list[str] = ["metadata"] + _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) + + _request = build_beta_agents_update_agent_from_code_request( + agent_name=agent_name, + code_zip_sha256=code_zip_sha256, + api_version=self._config.api_version, + files=_files, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def patch_agent_details( + self, + agent_name: str, + *, + content_type: str = "application/merge-patch+json", + agent_endpoint: Optional[_models.AgentEndpointConfig] = None, + agent_card: Optional[_models.AgentCard] = None, + **kwargs: Any + ) -> _models.AgentDetails: + """Updates an agent endpoint. + + :param agent_name: The name of the agent to retrieve. Required. + :type agent_name: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :keyword agent_endpoint: The endpoint configuration for the agent. Default value is None. + :paramtype agent_endpoint: ~azure.ai.projects.models.AgentEndpointConfig + :keyword agent_card: Optional agent card for the agent. Default value is None. + :paramtype agent_card: ~azure.ai.projects.models.AgentCard + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def patch_agent_details( + self, agent_name: str, body: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any + ) -> _models.AgentDetails: + """Updates an agent endpoint. + + :param agent_name: The name of the agent to retrieve. Required. + :type agent_name: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def patch_agent_details( + self, agent_name: str, body: IO[bytes], *, content_type: str = "application/merge-patch+json", **kwargs: Any + ) -> _models.AgentDetails: + """Updates an agent endpoint. + + :param agent_name: The name of the agent to retrieve. Required. + :type agent_name: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def patch_agent_details( + self, + agent_name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + agent_endpoint: Optional[_models.AgentEndpointConfig] = None, + agent_card: Optional[_models.AgentCard] = None, + **kwargs: Any + ) -> _models.AgentDetails: + """Updates an agent endpoint. + + :param agent_name: The name of the agent to retrieve. Required. + :type agent_name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword agent_endpoint: The endpoint configuration for the agent. Default value is None. + :paramtype agent_endpoint: ~azure.ai.projects.models.AgentEndpointConfig + :keyword agent_card: Optional agent card for the agent. Default value is None. + :paramtype agent_card: ~azure.ai.projects.models.AgentCard :return: AgentDetails. The AgentDetails is compatible with MutableMapping :rtype: ~azure.ai.projects.models.AgentDetails :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AgentDetails] = kwargs.pop("cls", None) + + if body is _Unset: + body = {"agent_card": agent_card, "agent_endpoint": agent_endpoint} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/merge-patch+json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_agents_patch_agent_details_request( + agent_name=agent_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_agent_version_from_code( + self, + agent_name: str, + content: _models.CreateAgentVersionFromCodeContent, + *, + code_zip_sha256: str, + **kwargs: Any + ) -> _models.AgentVersionDetails: + """create_agent_version_from_code. + + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param content: Required. + :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent + :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change + detection (dedup) and integrity verification. Required. + :paramtype code_zip_sha256: str + :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentVersionDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_agent_version_from_code( + self, agent_name: str, content: JSON, *, code_zip_sha256: str, **kwargs: Any + ) -> _models.AgentVersionDetails: + """create_agent_version_from_code. + + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param content: Required. + :type content: JSON + :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change + detection (dedup) and integrity verification. Required. + :paramtype code_zip_sha256: str + :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentVersionDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_agent_version_from_code( + self, + agent_name: str, + content: Union[_models.CreateAgentVersionFromCodeContent, JSON], + *, + code_zip_sha256: str, + **kwargs: Any + ) -> _models.AgentVersionDetails: + """create_agent_version_from_code. + + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param content: Is either a CreateAgentVersionFromCodeContent type or a JSON type. Required. + :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent or JSON + :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change + detection (dedup) and integrity verification. Required. + :paramtype code_zip_sha256: str + :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentVersionDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AgentVersionDetails] = kwargs.pop("cls", None) + + _body = content.as_dict() if isinstance(content, _Model) else content + _file_fields: list[str] = ["code"] + _data_fields: list[str] = ["metadata"] + _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) + + _request = build_beta_agents_create_agent_version_from_code_request( + agent_name=agent_name, + code_zip_sha256=code_zip_sha256, + api_version=self._config.api_version, + files=_files, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentVersionDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def download_agent_code( + self, agent_name: str, *, agent_version: Optional[str] = None, **kwargs: Any + ) -> AsyncIterator[bytes]: + """Download the code zip for a code-based hosted agent. + Returns the previously-uploaded zip (``application/zip``). + + If ``agent_version`` is supplied, returns that version's code zip; otherwise + returns the latest version's code zip. + + The SHA-256 digest of the returned bytes matches the ``content_hash`` on the + resolved version's ``code_configuration``. + + :param agent_name: The name of the agent. Required. + :type agent_name: str + :keyword agent_version: The version of the agent whose code zip should be downloaded. + If omitted, the latest version's code zip is returned. Default value is None. + :paramtype agent_version: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_beta_agents_download_agent_code_request( + agent_name=agent_name, + agent_version=agent_version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["x-ms-agent-version"] = self._deserialize("str", response.headers.get("x-ms-agent-version")) + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_session( + self, + agent_name: str, + *, + version_indicator: _models.VersionIndicator, + content_type: str = "application/json", + agent_session_id: Optional[str] = None, + **kwargs: Any + ) -> _models.AgentSessionResource: + """Creates a new session for an agent endpoint. The endpoint resolves the backing agent version + from ``version_indicator`` and enforces session ownership using the provided isolation key for + session-mutating operations. + + :param agent_name: The name of the agent to create a session for. Required. + :type agent_name: str + :keyword version_indicator: Determines which agent version backs the session. Required. + :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword agent_session_id: Optional caller-provided session ID. If specified, it must be unique + within the agent endpoint. Auto-generated if omitted. Default value is None. + :paramtype agent_session_id: str + :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentSessionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_session( + self, agent_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AgentSessionResource: + """Creates a new session for an agent endpoint. The endpoint resolves the backing agent version + from ``version_indicator`` and enforces session ownership using the provided isolation key for + session-mutating operations. + + :param agent_name: The name of the agent to create a session for. Required. + :type agent_name: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentSessionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_session( + self, agent_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AgentSessionResource: + """Creates a new session for an agent endpoint. The endpoint resolves the backing agent version + from ``version_indicator`` and enforces session ownership using the provided isolation key for + session-mutating operations. + + :param agent_name: The name of the agent to create a session for. Required. + :type agent_name: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentSessionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_session( + self, + agent_name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + version_indicator: _models.VersionIndicator = _Unset, + agent_session_id: Optional[str] = None, + **kwargs: Any + ) -> _models.AgentSessionResource: + """Creates a new session for an agent endpoint. The endpoint resolves the backing agent version + from ``version_indicator`` and enforces session ownership using the provided isolation key for + session-mutating operations. + + :param agent_name: The name of the agent to create a session for. Required. + :type agent_name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword version_indicator: Determines which agent version backs the session. Required. + :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator + :keyword agent_session_id: Optional caller-provided session ID. If specified, it must be unique + within the agent endpoint. Auto-generated if omitted. Default value is None. + :paramtype agent_session_id: str + :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentSessionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AgentSessionResource] = kwargs.pop("cls", None) + + if body is _Unset: + if version_indicator is _Unset: + raise TypeError("missing required argument: version_indicator") + body = {"agent_session_id": agent_session_id, "version_indicator": version_indicator} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_agents_create_session_request( + agent_name=agent_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentSessionResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_session(self, agent_name: str, session_id: str, **kwargs: Any) -> _models.AgentSessionResource: + """Retrieves a session by ID. + + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param session_id: The session identifier. Required. + :type session_id: str + :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentSessionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AgentSessionResource] = kwargs.pop("cls", None) + + _request = build_beta_agents_get_session_request( + agent_name=agent_name, + session_id=session_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentSessionResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete_session(self, agent_name: str, session_id: str, **kwargs: Any) -> None: + """Deletes a session synchronously. Returns 204 No Content when the session is deleted or does not + exist. + + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param session_id: The session identifier. Required. + :type session_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_beta_agents_delete_session_request( + agent_name=agent_name, + session_id=session_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_sessions( + self, + agent_name: str, + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.AgentSessionResource"]: + """Returns a list of sessions for the specified agent. + + :param agent_name: The name of the agent. Required. + :type agent_name: str + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of AgentSessionResource + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.AgentSessionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AgentSessionResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(_continuation_token=None): + + _request = build_beta_agents_list_sessions_request( + agent_name=agent_name, + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.AgentSessionResource], + deserialized.get("data", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, AsyncList(list_of_elem) + + async def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_session_log_stream( + self, agent_name: str, agent_version: str, session_id: str, **kwargs: Any + ) -> _models.SessionLogEvent: + """Streams console logs (stdout / stderr) for a specific hosted agent session + as a Server-Sent Events (SSE) stream. + + Each SSE frame contains: + + * `event`: always `"log"` + * `data`: a plain-text log line (currently JSON-formatted, but the schema is not contractual and may include additional keys or change format over time; clients should treat it as an opaque string) + + Example SSE frames: + + .. code-block:: + + event: log + data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting FoundryCBAgent server on port 8088"} + + event: log + data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application startup complete."} + + event: log + data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} + + event: log + data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since last 60 seconds"} + + The stream remains open until the client disconnects or the server + terminates the connection. Clients should handle reconnection as needed. + + :param agent_name: The name of the hosted agent. Required. + :type agent_name: str + :param agent_version: The version of the agent. Required. + :type agent_version: str + :param session_id: The session ID (maps to an ADC sandbox). Required. + :type session_id: str + :return: SessionLogEvent. The SessionLogEvent is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SessionLogEvent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SessionLogEvent] = kwargs.pop("cls", None) + + _request = build_beta_agents_get_session_log_stream_request( + agent_name=agent_name, + agent_version=agent_version, + session_id=session_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SessionLogEvent, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def _upload_session_file( + self, + agent_name: str, + agent_session_id: str, + content: bytes, + *, + path: str, + user_isolation_key: Optional[str] = None, + **kwargs: Any + ) -> _models.SessionFileWriteResult: + """Upload a file to the session sandbox via binary stream. Maximum file size is 50 MB. Uploads + exceeding this limit return 413 Payload Too Large. + + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param agent_session_id: The session ID. Required. + :type agent_session_id: str + :param content: Required. + :type content: bytes + :keyword path: The destination file path within the sandbox, relative to the session home + directory. Required. + :paramtype path: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SessionFileWriteResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + cls: ClsType[_models.SessionFileWriteResult] = kwargs.pop("cls", None) + + _content = content + + _request = build_beta_agents_upload_session_file_request( + agent_name=agent_name, + agent_session_id=agent_session_id, + path=path, + user_isolation_key=user_isolation_key, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SessionFileWriteResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def download_session_file( + self, + agent_name: str, + agent_session_id: str, + *, + path: str, + user_isolation_key: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Download a file from the session sandbox as a binary stream. + + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param agent_session_id: The session ID. Required. + :type agent_session_id: str + :keyword path: The file path to download from the sandbox, relative to the session home + directory. Required. + :paramtype path: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_beta_agents_download_session_file_request( + agent_name=agent_name, + agent_session_id=agent_session_id, + path=path, + user_isolation_key=user_isolation_key, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_session_files( + self, + agent_name: str, + agent_session_id: str, + *, + path: str, + user_isolation_key: Optional[str] = None, + **kwargs: Any + ) -> _models.SessionDirectoryListResult: + """List files and directories at a given path in the session sandbox. Returns only the immediate + children of the specified directory (non-recursive). + + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param agent_session_id: The session ID. Required. + :type agent_session_id: str + :keyword path: The directory path to list, relative to the session home directory. Required. + :paramtype path: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :return: SessionDirectoryListResult. The SessionDirectoryListResult is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.SessionDirectoryListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SessionDirectoryListResult] = kwargs.pop("cls", None) + + _request = build_beta_agents_get_session_files_request( + agent_name=agent_name, + agent_session_id=agent_session_id, + path=path, + user_isolation_key=user_isolation_key, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SessionDirectoryListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete_session_file( + self, + agent_name: str, + agent_session_id: str, + *, + path: str, + recursive: Optional[bool] = None, + user_isolation_key: Optional[str] = None, + **kwargs: Any + ) -> None: + """Delete a file or directory from the session sandbox. If ``recursive`` is false (default) and + the target is a non-empty directory, the API returns 409 Conflict. + + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param agent_session_id: The session ID. Required. + :type agent_session_id: str + :keyword path: The file or directory path to delete, relative to the session home directory. + Required. + :paramtype path: str + :keyword recursive: Whether to recursively delete directory contents. Defaults to false. + Default value is None. + :paramtype recursive: bool + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_beta_agents_delete_session_file_request( + agent_name=agent_name, + agent_session_id=agent_session_id, + path=path, + recursive=recursive, + user_isolation_key=user_isolation_key, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def create_optimization_job( + self, + job: _models.OptimizationJob, + *, + operation_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.OptimizationJob: + """Creates an agent optimization job. + + Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for + idempotent retry. + + :param job: The job to create. Required. + :type job: ~azure.ai.projects.models.OptimizationJob + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_optimization_job( + self, job: JSON, *, operation_id: Optional[str] = None, content_type: str = "application/json", **kwargs: Any + ) -> _models.OptimizationJob: + """Creates an agent optimization job. + + Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for + idempotent retry. + + :param job: The job to create. Required. + :type job: JSON + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_optimization_job( + self, + job: IO[bytes], + *, + operation_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.OptimizationJob: + """Creates an agent optimization job. + + Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for + idempotent retry. + + :param job: The job to create. Required. + :type job: IO[bytes] + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_optimization_job( + self, job: Union[_models.OptimizationJob, JSON, IO[bytes]], *, operation_id: Optional[str] = None, **kwargs: Any + ) -> _models.OptimizationJob: + """Creates an agent optimization job. + + Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for + idempotent retry. + + :param job: The job to create. Is one of the following types: OptimizationJob, JSON, IO[bytes] + Required. + :type job: ~azure.ai.projects.models.OptimizationJob or JSON or IO[bytes] + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OptimizationJob] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(job, (IOBase, bytes)): + _content = job + else: + _content = json.dumps(job, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_agents_create_optimization_job_request( + operation_id=operation_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.OptimizationJob, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_optimization_job(self, job_id: str, **kwargs: Any) -> _models.OptimizationJob: + """Get info about an agent optimization job. + + Get an optimization job by id. Emits ``Retry-After`` while the job is non-terminal. + + :param job_id: The ID of the job. Required. + :type job_id: str + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OptimizationJob] = kwargs.pop("cls", None) + + _request = build_beta_agents_get_optimization_job_request( + job_id=job_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.OptimizationJob, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_optimization_jobs( + self, + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, + status: Optional[Union[str, _models.JobStatus]] = None, + agent_name: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.OptimizationJob"]: + """Returns a list of agent optimization jobs. + + List optimization jobs. Supports cursor pagination and optional ``status`` / ``agent_name`` + filters. + + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :keyword status: Filter to jobs in this lifecycle state. Known values are: "queued", + "in_progress", "succeeded", "failed", and "cancelled". Default value is None. + :paramtype status: str or ~azure.ai.projects.models.JobStatus + :keyword agent_name: Filter to jobs targeting this agent name. Default value is None. + :paramtype agent_name: str + :return: An iterator like instance of OptimizationJob + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.OptimizationJob] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.OptimizationJob]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(_continuation_token=None): + + _request = build_beta_agents_list_optimization_jobs_request( + limit=limit, + order=order, + after=_continuation_token, + before=before, + status=status, + agent_name=agent_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.OptimizationJob], + deserialized.get("data", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, AsyncList(list_of_elem) + + async def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def cancel_optimization_job(self, job_id: str, **kwargs: Any) -> _models.OptimizationJob: + """Cancels an agent optimization job. + + Request cancellation. Idempotent on terminal states. + + :param job_id: The ID of the job to cancel. Required. + :type job_id: str + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OptimizationJob] = kwargs.pop("cls", None) + + _request = build_beta_agents_cancel_optimization_job_request( + job_id=job_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.OptimizationJob, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete_optimization_job(self, job_id: str, **kwargs: Any) -> None: + """Deletes an agent optimization job. + + Delete the job and its candidate artifacts. Cancels first if non-terminal. + + :param job_id: The ID of the job to delete. Required. + :type job_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_beta_agents_delete_optimization_job_request( + job_id=job_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def list_optimization_candidates( + self, + job_id: str, + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + after: Optional[str] = None, + before: Optional[str] = None, + **kwargs: Any + ) -> _models.AgentsPagedResultOptimizationCandidate: + """Returns a list of candidates for an optimization job. + + List candidates produced by a job. + + :param job_id: The optimization job id. Required. + :type job_id: str + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword after: A cursor for use in pagination. ``after`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include after=obj_foo in order to fetch the next page of the list. Default + value is None. + :paramtype after: str + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: AgentsPagedResultOptimizationCandidate. The AgentsPagedResultOptimizationCandidate is + compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentsPagedResultOptimizationCandidate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AgentsPagedResultOptimizationCandidate] = kwargs.pop("cls", None) + + _request = build_beta_agents_list_optimization_candidates_request( + job_id=job_id, + limit=limit, + order=order, + after=after, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentsPagedResultOptimizationCandidate, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_optimization_candidate( + self, job_id: str, candidate_id: str, **kwargs: Any + ) -> _models.OptimizationCandidate: + """Get a candidate by id. + + Get a single candidate manifest and aggregated evaluation summary. + + :param job_id: The optimization job id. Required. + :type job_id: str + :param candidate_id: The candidate id. Required. + :type candidate_id: str + :return: OptimizationCandidate. The OptimizationCandidate is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationCandidate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OptimizationCandidate] = kwargs.pop("cls", None) + + _request = build_beta_agents_get_optimization_candidate_request( + job_id=job_id, + candidate_id=candidate_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.OptimizationCandidate, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_optimization_candidate_config( + self, job_id: str, candidate_id: str, **kwargs: Any + ) -> _models.CandidateDeployConfig: + """Get candidate deploy config. + + Get the candidate's deploy config JSON. Used to compose ``agents.create_version(...)`` from a + candidate. + + :param job_id: The optimization job id. Required. + :type job_id: str + :param candidate_id: The candidate id. Required. + :type candidate_id: str + :return: CandidateDeployConfig. The CandidateDeployConfig is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.CandidateDeployConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CandidateDeployConfig] = kwargs.pop("cls", None) + + _request = build_beta_agents_get_optimization_candidate_config_request( + job_id=job_id, + candidate_id=candidate_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CandidateDeployConfig, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_optimization_candidate_results( + self, job_id: str, candidate_id: str, **kwargs: Any + ) -> _models.CandidateResults: + """Get candidate evaluation results. + + Get full per-task evaluation results for a candidate. + + :param job_id: The optimization job id. Required. + :type job_id: str + :param candidate_id: The candidate id. Required. + :type candidate_id: str + :return: CandidateResults. The CandidateResults is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.CandidateResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CandidateResults] = kwargs.pop("cls", None) + + _request = build_beta_agents_get_optimization_candidate_results_request( + job_id=job_id, + candidate_id=candidate_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CandidateResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class BetaEvaluationTaxonomiesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.aio.AIProjectClient`'s + :attr:`evaluation_taxonomies` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, name: str, **kwargs: Any) -> _models.EvaluationTaxonomy: + """Get an evaluation run by name. + + :param name: The name of the resource. Required. + :type name: str + :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.EvaluationTaxonomy] = kwargs.pop("cls", None) + + _request = build_beta_evaluation_taxonomies_get_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.EvaluationTaxonomy, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, *, input_name: Optional[str] = None, input_type: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.EvaluationTaxonomy"]: + """List evaluation taxonomies. + + :keyword input_name: Filter by the evaluation input name. Default value is None. + :paramtype input_name: str + :keyword input_type: Filter by taxonomy input type. Default value is None. + :paramtype input_type: str + :return: An iterator like instance of EvaluationTaxonomy + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.EvaluationTaxonomy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.EvaluationTaxonomy]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_beta_evaluation_taxonomies_list_request( + input_name=input_name, + input_type=input_type, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.EvaluationTaxonomy], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def delete(self, name: str, **kwargs: Any) -> None: + """Delete an evaluation taxonomy by name. + + :param name: The name of the resource. Required. + :type name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_beta_evaluation_taxonomies_delete_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def create( + self, name: str, taxonomy: _models.EvaluationTaxonomy, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationTaxonomy: + """Create an evaluation taxonomy. + + :param name: The name of the evaluation taxonomy. Required. + :type name: str + :param taxonomy: The evaluation taxonomy. Required. + :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, name: str, taxonomy: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationTaxonomy: + """Create an evaluation taxonomy. + + :param name: The name of the evaluation taxonomy. Required. + :type name: str + :param taxonomy: The evaluation taxonomy. Required. + :type taxonomy: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, name: str, taxonomy: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationTaxonomy: + """Create an evaluation taxonomy. + + :param name: The name of the evaluation taxonomy. Required. + :type name: str + :param taxonomy: The evaluation taxonomy. Required. + :type taxonomy: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, name: str, taxonomy: Union[_models.EvaluationTaxonomy, JSON, IO[bytes]], **kwargs: Any + ) -> _models.EvaluationTaxonomy: + """Create an evaluation taxonomy. + + :param name: The name of the evaluation taxonomy. Required. + :type name: str + :param taxonomy: The evaluation taxonomy. Is one of the following types: EvaluationTaxonomy, + JSON, IO[bytes] Required. + :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy or JSON or IO[bytes] + :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EvaluationTaxonomy] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(taxonomy, (IOBase, bytes)): + _content = taxonomy + else: + _content = json.dumps(taxonomy, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_evaluation_taxonomies_create_request( + name=name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.EvaluationTaxonomy, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, name: str, taxonomy: _models.EvaluationTaxonomy, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationTaxonomy: + """Update an evaluation taxonomy. + + :param name: The name of the evaluation taxonomy. Required. + :type name: str + :param taxonomy: The evaluation taxonomy. Required. + :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, name: str, taxonomy: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationTaxonomy: + """Update an evaluation taxonomy. + + :param name: The name of the evaluation taxonomy. Required. + :type name: str + :param taxonomy: The evaluation taxonomy. Required. + :type taxonomy: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, name: str, taxonomy: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationTaxonomy: + """Update an evaluation taxonomy. + + :param name: The name of the evaluation taxonomy. Required. + :type name: str + :param taxonomy: The evaluation taxonomy. Required. + :type taxonomy: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, name: str, taxonomy: Union[_models.EvaluationTaxonomy, JSON, IO[bytes]], **kwargs: Any + ) -> _models.EvaluationTaxonomy: + """Update an evaluation taxonomy. + + :param name: The name of the evaluation taxonomy. Required. + :type name: str + :param taxonomy: The evaluation taxonomy. Is one of the following types: EvaluationTaxonomy, + JSON, IO[bytes] Required. + :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy or JSON or IO[bytes] + :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EvaluationTaxonomy] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(taxonomy, (IOBase, bytes)): + _content = taxonomy + else: + _content = json.dumps(taxonomy, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_evaluation_taxonomies_update_request( + name=name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.EvaluationTaxonomy, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class BetaEvaluatorsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.aio.AIProjectClient`'s + :attr:`evaluators` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_versions( + self, + name: str, + *, + type: Optional[Union[Literal["builtin"], Literal["custom"], Literal["all"], str]] = None, + limit: Optional[int] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.EvaluatorVersion"]: + """List all versions of the given evaluator. + + :param name: The name of the resource. Required. + :type name: str + :keyword type: Filter evaluators by type. Possible values: 'all', 'custom', 'builtin'. Is one + of the following types: Literal["builtin"], Literal["custom"], Literal["all"], str Default + value is None. + :paramtype type: str or str or str or str + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the default is 20. Default value is None. + :paramtype limit: int + :return: An iterator like instance of EvaluatorVersion + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.EvaluatorVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.EvaluatorVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_beta_evaluators_list_versions_request( + name=name, + type=type, + limit=limit, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.EvaluatorVersion], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list( + self, + *, + type: Optional[Union[Literal["builtin"], Literal["custom"], Literal["all"], str]] = None, + limit: Optional[int] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.EvaluatorVersion"]: + """List the latest version of each evaluator. + + :keyword type: Filter evaluators by type. Possible values: 'all', 'custom', 'builtin'. Is one + of the following types: Literal["builtin"], Literal["custom"], Literal["all"], str Default + value is None. + :paramtype type: str or str or str or str + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the default is 20. Default value is None. + :paramtype limit: int + :return: An iterator like instance of EvaluatorVersion + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.EvaluatorVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.EvaluatorVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_beta_evaluators_list_request( + type=type, + limit=limit, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.EvaluatorVersion], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.EvaluatorVersion: + """Get the specific version of the EvaluatorVersion. The service returns 404 Not Found error if + the EvaluatorVersion does not exist. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the EvaluatorVersion to retrieve. Required. + :type version: str + :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.EvaluatorVersion] = kwargs.pop("cls", None) + + _request = build_beta_evaluators_get_version_request( + name=name, + version=version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.EvaluatorVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete_version(self, name: str, version: str, **kwargs: Any) -> None: + """Delete the specific version of the EvaluatorVersion. The service returns 204 No Content if the + EvaluatorVersion was deleted successfully or if the EvaluatorVersion does not exist. + + :param name: The name of the resource. Required. + :type name: str + :param version: The version of the EvaluatorVersion to delete. Required. + :type version: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_beta_evaluators_delete_version_request( + name=name, + version=version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def create_version( + self, + name: str, + evaluator_version: _models.EvaluatorVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EvaluatorVersion: + """Create a new EvaluatorVersion with auto incremented version id. + + :param name: The name of the resource. Required. + :type name: str + :param evaluator_version: Required. + :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_version( + self, name: str, evaluator_version: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluatorVersion: + """Create a new EvaluatorVersion with auto incremented version id. + + :param name: The name of the resource. Required. + :type name: str + :param evaluator_version: Required. + :type evaluator_version: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_version( + self, name: str, evaluator_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluatorVersion: + """Create a new EvaluatorVersion with auto incremented version id. + + :param name: The name of the resource. Required. + :type name: str + :param evaluator_version: Required. + :type evaluator_version: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_version( + self, name: str, evaluator_version: Union[_models.EvaluatorVersion, JSON, IO[bytes]], **kwargs: Any + ) -> _models.EvaluatorVersion: + """Create a new EvaluatorVersion with auto incremented version id. + + :param name: The name of the resource. Required. + :type name: str + :param evaluator_version: Is one of the following types: EvaluatorVersion, JSON, IO[bytes] + Required. + :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion or JSON or IO[bytes] + :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EvaluatorVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(evaluator_version, (IOBase, bytes)): + _content = evaluator_version + else: + _content = json.dumps(evaluator_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_evaluators_create_version_request( + name=name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.EvaluatorVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update_version( + self, + name: str, + version: str, + evaluator_version: _models.EvaluatorVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EvaluatorVersion: + """Update an existing EvaluatorVersion with the given version id. + + :param name: The name of the resource. Required. + :type name: str + :param version: The version of the EvaluatorVersion to update. Required. + :type version: str + :param evaluator_version: Evaluator resource. Required. + :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_version( + self, name: str, version: str, evaluator_version: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluatorVersion: + """Update an existing EvaluatorVersion with the given version id. + + :param name: The name of the resource. Required. + :type name: str + :param version: The version of the EvaluatorVersion to update. Required. + :type version: str + :param evaluator_version: Evaluator resource. Required. + :type evaluator_version: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_version( + self, + name: str, + version: str, + evaluator_version: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EvaluatorVersion: + """Update an existing EvaluatorVersion with the given version id. + + :param name: The name of the resource. Required. + :type name: str + :param version: The version of the EvaluatorVersion to update. Required. + :type version: str + :param evaluator_version: Evaluator resource. Required. + :type evaluator_version: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def patch_agent_details( + async def update_version( self, - agent_name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - agent_endpoint: Optional[_models.AgentEndpointConfig] = None, - agent_card: Optional[_models.AgentCard] = None, + name: str, + version: str, + evaluator_version: Union[_models.EvaluatorVersion, JSON, IO[bytes]], **kwargs: Any - ) -> _models.AgentDetails: - """Updates an agent endpoint. + ) -> _models.EvaluatorVersion: + """Update an existing EvaluatorVersion with the given version id. - :param agent_name: The name of the agent to retrieve. Required. - :type agent_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword agent_endpoint: The endpoint configuration for the agent. Default value is None. - :paramtype agent_endpoint: ~azure.ai.projects.models.AgentEndpointConfig - :keyword agent_card: Optional agent card for the agent. Default value is None. - :paramtype agent_card: ~azure.ai.projects.models.AgentCard - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails + :param name: The name of the resource. Required. + :type name: str + :param version: The version of the EvaluatorVersion to update. Required. + :type version: str + :param evaluator_version: Evaluator resource. Is one of the following types: EvaluatorVersion, + JSON, IO[bytes] Required. + :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion or JSON or IO[bytes] + :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -3275,20 +7032,18 @@ async def patch_agent_details( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentDetails] = kwargs.pop("cls", None) + cls: ClsType[_models.EvaluatorVersion] = kwargs.pop("cls", None) - if body is _Unset: - body = {"agent_card": agent_card, "agent_endpoint": agent_endpoint} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/merge-patch+json" + content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(evaluator_version, (IOBase, bytes)): + _content = evaluator_version else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(evaluator_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_agents_patch_agent_details_request( - agent_name=agent_name, + _request = build_beta_evaluators_update_version_request( + name=name, + version=version, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -3315,16 +7070,12 @@ async def patch_agent_details( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.AgentDetails, response.json()) + deserialized = _deserialize(_models.EvaluatorVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3332,159 +7083,103 @@ async def patch_agent_details( return deserialized # type: ignore @overload - async def create_agent_version_from_code( + async def pending_upload( self, - agent_name: str, - content: _models.CreateAgentVersionFromCodeContent, + name: str, + version: str, + pending_upload_request: _models.PendingUploadRequest, *, - code_zip_sha256: str, + content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentVersionDetails: - """create_agent_version_from_code. - - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + ) -> _models.PendingUploadResult: + """Start a new or get an existing pending upload of an evaluator for a specific version. - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. - :type agent_name: str - :param content: Required. - :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent - :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change - detection (dedup) and integrity verification. Required. - :paramtype code_zip_sha256: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :param name: Required. + :type name: str + :param version: The specific version id of the EvaluatorVersion to operate on. Required. + :type version: str + :param pending_upload_request: The pending upload request parameters. Required. + :type pending_upload_request: ~azure.ai.projects.models.PendingUploadRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResult :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_agent_version_from_code( - self, agent_name: str, content: JSON, *, code_zip_sha256: str, **kwargs: Any - ) -> _models.AgentVersionDetails: - """create_agent_version_from_code. - - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + async def pending_upload( + self, + name: str, + version: str, + pending_upload_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PendingUploadResult: + """Start a new or get an existing pending upload of an evaluator for a specific version. - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. - :type agent_name: str - :param content: Required. - :type content: JSON - :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change - detection (dedup) and integrity verification. Required. - :paramtype code_zip_sha256: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :param name: Required. + :type name: str + :param version: The specific version id of the EvaluatorVersion to operate on. Required. + :type version: str + :param pending_upload_request: The pending upload request parameters. Required. + :type pending_upload_request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResult :raises ~azure.core.exceptions.HttpResponseError: """ - @distributed_trace_async - async def create_agent_version_from_code( + @overload + async def pending_upload( self, - agent_name: str, - content: Union[_models.CreateAgentVersionFromCodeContent, JSON], + name: str, + version: str, + pending_upload_request: IO[bytes], *, - code_zip_sha256: str, + content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentVersionDetails: - """create_agent_version_from_code. - - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + ) -> _models.PendingUploadResult: + """Start a new or get an existing pending upload of an evaluator for a specific version. - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. - :type agent_name: str - :param content: Is either a CreateAgentVersionFromCodeContent type or a JSON type. Required. - :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent or JSON - :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change - detection (dedup) and integrity verification. Required. - :paramtype code_zip_sha256: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :param name: Required. + :type name: str + :param version: The specific version id of the EvaluatorVersion to operate on. Required. + :type version: str + :param pending_upload_request: The pending upload request parameters. Required. + :type pending_upload_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.AgentVersionDetails] = kwargs.pop("cls", None) - - _body = content.as_dict() if isinstance(content, _Model) else content - _file_fields: list[str] = ["code"] - _data_fields: list[str] = ["metadata"] - _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) - - _request = build_beta_agents_create_agent_version_from_code_request( - agent_name=agent_name, - code_zip_sha256=code_zip_sha256, - api_version=self._config.api_version, - files=_files, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.AgentVersionDetails, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore @distributed_trace_async - async def download_agent_version_code( - self, agent_name: str, agent_version: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - """Download the code zip for a specific version of a code-based hosted agent. Returns the - previously-uploaded zip (``application/zip``). The SHA-256 digest of the returned bytes matches - the ``content_hash`` on the agent version's ``code_configuration``. + async def pending_upload( + self, + name: str, + version: str, + pending_upload_request: Union[_models.PendingUploadRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.PendingUploadResult: + """Start a new or get an existing pending upload of an evaluator for a specific version. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param agent_version: The version of the agent whose code zip should be downloaded. Required. - :type agent_version: str - :return: AsyncIterator[bytes] - :rtype: AsyncIterator[bytes] + :param name: Required. + :type name: str + :param version: The specific version id of the EvaluatorVersion to operate on. Required. + :type version: str + :param pending_upload_request: The pending upload request parameters. Is one of the following + types: PendingUploadRequest, JSON, IO[bytes] Required. + :type pending_upload_request: ~azure.ai.projects.models.PendingUploadRequest or JSON or + IO[bytes] + :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -3495,15 +7190,25 @@ async def download_agent_version_code( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PendingUploadResult] = kwargs.pop("cls", None) - _request = build_beta_agents_download_agent_version_code_request( - agent_name=agent_name, - agent_version=agent_version, + content_type = content_type or "application/json" + _content = None + if isinstance(pending_upload_request, (IOBase, bytes)): + _content = pending_upload_request + else: + _content = json.dumps(pending_upload_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_evaluators_pending_upload_request( + name=name, + version=version, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -3513,7 +7218,7 @@ async def download_agent_version_code( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3533,27 +7238,114 @@ async def download_agent_version_code( ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PendingUploadResult, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + @overload + async def get_credentials( + self, + name: str, + version: str, + credential_request: _models.EvaluatorCredentialRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DatasetCredential: + """Get the SAS credential to access the storage account associated with an Evaluator version. + + :param name: Required. + :type name: str + :param version: The specific version id of the EvaluatorVersion to operate on. Required. + :type version: str + :param credential_request: The credential request parameters. Required. + :type credential_request: ~azure.ai.projects.models.EvaluatorCredentialRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetCredential + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_credentials( + self, + name: str, + version: str, + credential_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DatasetCredential: + """Get the SAS credential to access the storage account associated with an Evaluator version. + + :param name: Required. + :type name: str + :param version: The specific version id of the EvaluatorVersion to operate on. Required. + :type version: str + :param credential_request: The credential request parameters. Required. + :type credential_request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetCredential + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_credentials( + self, + name: str, + version: str, + credential_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DatasetCredential: + """Get the SAS credential to access the storage account associated with an Evaluator version. + + :param name: Required. + :type name: str + :param version: The specific version id of the EvaluatorVersion to operate on. Required. + :type version: str + :param credential_request: The credential request parameters. Required. + :type credential_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetCredential + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def download_agent_code(self, agent_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - """Download the code zip for the latest version of a code-based hosted agent. Returns the - previously-uploaded zip (``application/zip``). The SHA-256 digest of the returned bytes matches - the ``content_hash`` on the latest version's ``code_configuration``. + async def get_credentials( + self, + name: str, + version: str, + credential_request: Union[_models.EvaluatorCredentialRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.DatasetCredential: + """Get the SAS credential to access the storage account associated with an Evaluator version. - :param agent_name: The name of the agent whose latest-version code zip should be downloaded. - Required. - :type agent_name: str - :return: AsyncIterator[bytes] - :rtype: AsyncIterator[bytes] + :param name: Required. + :type name: str + :param version: The specific version id of the EvaluatorVersion to operate on. Required. + :type version: str + :param credential_request: The credential request parameters. Is one of the following types: + EvaluatorCredentialRequest, JSON, IO[bytes] Required. + :type credential_request: ~azure.ai.projects.models.EvaluatorCredentialRequest or JSON or + IO[bytes] + :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetCredential :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -3564,14 +7356,25 @@ async def download_agent_code(self, agent_name: str, **kwargs: Any) -> AsyncIter } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatasetCredential] = kwargs.pop("cls", None) - _request = build_beta_agents_download_agent_code_request( - agent_name=agent_name, + content_type = content_type or "application/json" + _content = None + if isinstance(credential_request, (IOBase, bytes)): + _content = credential_request + else: + _content = json.dumps(credential_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_evaluators_get_credentials_request( + name=name, + version=version, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -3581,7 +7384,7 @@ async def download_agent_code(self, agent_name: str, **kwargs: Any) -> AsyncIter _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3601,110 +7404,113 @@ async def download_agent_code(self, agent_name: str, **kwargs: Any) -> AsyncIter ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DatasetCredential, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @overload - async def create_session( + async def create_generation_job( self, - agent_name: str, + job: _models.EvaluatorGenerationJob, *, - version_indicator: _models.VersionIndicator, + operation_id: Optional[str] = None, content_type: str = "application/json", - agent_session_id: Optional[str] = None, **kwargs: Any - ) -> _models.AgentSessionResource: - """Creates a new session for an agent endpoint. The endpoint resolves the backing agent version - from ``version_indicator`` and enforces session ownership using the provided isolation key for - session-mutating operations. + ) -> _models.EvaluatorGenerationJob: + """Creates an evaluator generation job. - :param agent_name: The name of the agent to create a session for. Required. - :type agent_name: str - :keyword version_indicator: Determines which agent version backs the session. Required. - :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator + Creates an evaluator generation job. The service generates rubric-based evaluator definitions + from the provided source materials asynchronously. + + :param job: The job to create. Required. + :type job: ~azure.ai.projects.models.EvaluatorGenerationJob + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword agent_session_id: Optional caller-provided session ID. If specified, it must be unique - within the agent endpoint. Auto-generated if omitted. Default value is None. - :paramtype agent_session_id: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource + :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_session( - self, agent_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentSessionResource: - """Creates a new session for an agent endpoint. The endpoint resolves the backing agent version - from ``version_indicator`` and enforces session ownership using the provided isolation key for - session-mutating operations. + async def create_generation_job( + self, job: JSON, *, operation_id: Optional[str] = None, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluatorGenerationJob: + """Creates an evaluator generation job. - :param agent_name: The name of the agent to create a session for. Required. - :type agent_name: str - :param body: Required. - :type body: JSON + Creates an evaluator generation job. The service generates rubric-based evaluator definitions + from the provided source materials asynchronously. + + :param job: The job to create. Required. + :type job: JSON + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource + :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_session( - self, agent_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentSessionResource: - """Creates a new session for an agent endpoint. The endpoint resolves the backing agent version - from ``version_indicator`` and enforces session ownership using the provided isolation key for - session-mutating operations. + async def create_generation_job( + self, + job: IO[bytes], + *, + operation_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EvaluatorGenerationJob: + """Creates an evaluator generation job. - :param agent_name: The name of the agent to create a session for. Required. - :type agent_name: str - :param body: Required. - :type body: IO[bytes] + Creates an evaluator generation job. The service generates rubric-based evaluator definitions + from the provided source materials asynchronously. + + :param job: The job to create. Required. + :type job: IO[bytes] + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource + :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create_session( + async def create_generation_job( self, - agent_name: str, - body: Union[JSON, IO[bytes]] = _Unset, + job: Union[_models.EvaluatorGenerationJob, JSON, IO[bytes]], *, - version_indicator: _models.VersionIndicator = _Unset, - agent_session_id: Optional[str] = None, + operation_id: Optional[str] = None, **kwargs: Any - ) -> _models.AgentSessionResource: - """Creates a new session for an agent endpoint. The endpoint resolves the backing agent version - from ``version_indicator`` and enforces session ownership using the provided isolation key for - session-mutating operations. + ) -> _models.EvaluatorGenerationJob: + """Creates an evaluator generation job. - :param agent_name: The name of the agent to create a session for. Required. - :type agent_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword version_indicator: Determines which agent version backs the session. Required. - :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator - :keyword agent_session_id: Optional caller-provided session ID. If specified, it must be unique - within the agent endpoint. Auto-generated if omitted. Default value is None. - :paramtype agent_session_id: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource + Creates an evaluator generation job. The service generates rubric-based evaluator definitions + from the provided source materials asynchronously. + + :param job: The job to create. Is one of the following types: EvaluatorGenerationJob, JSON, + IO[bytes] Required. + :type job: ~azure.ai.projects.models.EvaluatorGenerationJob or JSON or IO[bytes] + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -3718,23 +7524,18 @@ async def create_session( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentSessionResource] = kwargs.pop("cls", None) - - if body is _Unset: - if version_indicator is _Unset: - raise TypeError("missing required argument: version_indicator") - body = {"agent_session_id": agent_session_id, "version_indicator": version_indicator} - body = {k: v for k, v in body.items() if v is not None} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EvaluatorGenerationJob] = kwargs.pop("cls", None) + content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(job, (IOBase, bytes)): + _content = job else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(job, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_agents_create_session_request( - agent_name=agent_name, + _request = build_beta_evaluators_create_generation_job_request( + operation_id=operation_id, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -3767,26 +7568,30 @@ async def create_session( ) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.AgentSessionResource, response.json()) + deserialized = _deserialize(_models.EvaluatorGenerationJob, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def get_session(self, agent_name: str, session_id: str, **kwargs: Any) -> _models.AgentSessionResource: - """Retrieves a session by ID. + async def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.EvaluatorGenerationJob: + """Get info about an evaluator generation job. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param session_id: The session identifier. Required. - :type session_id: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource + Gets the details of an evaluator generation job by its ID. + + :param job_id: The ID of the job. Required. + :type job_id: str + :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -3800,11 +7605,10 @@ async def get_session(self, agent_name: str, session_id: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.AgentSessionResource] = kwargs.pop("cls", None) + cls: ClsType[_models.EvaluatorGenerationJob] = kwargs.pop("cls", None) - _request = build_beta_agents_get_session_request( - agent_name=agent_name, - session_id=session_id, + _request = build_beta_evaluators_get_generation_job_request( + job_id=job_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -3835,86 +7639,33 @@ async def get_session(self, agent_name: str, session_id: str, **kwargs: Any) -> ) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.AgentSessionResource, response.json()) + deserialized = _deserialize(_models.EvaluatorGenerationJob, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def delete_session(self, agent_name: str, session_id: str, **kwargs: Any) -> None: - """Deletes a session synchronously. Returns 204 No Content when the session is deleted or does not - exist. - - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param session_id: The session identifier. Required. - :type session_id: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_beta_agents_delete_session_request( - agent_name=agent_name, - session_id=session_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace - def list_sessions( + def list_generation_jobs( self, - agent_name: str, *, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, + category: Optional[Union[str, _models.EvaluatorCategory]] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.AgentSessionResource"]: - """Returns a list of sessions for the specified agent. + ) -> AsyncItemPaged["_models.EvaluatorGenerationJob"]: + """Returns a list of evaluator generation jobs. + + Returns a list of evaluator generation jobs. - :param agent_name: The name of the agent. Required. - :type agent_name: str :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None. @@ -3929,14 +7680,18 @@ def list_sessions( subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None. :paramtype before: str - :return: An iterator like instance of AgentSessionResource - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.AgentSessionResource] + :keyword category: Filter evaluator generation jobs by category. Known values are: "quality", + "safety", and "agents". Default value is None. + :paramtype category: str or ~azure.ai.projects.models.EvaluatorCategory + :return: An iterator like instance of EvaluatorGenerationJob + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.EvaluatorGenerationJob] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.AgentSessionResource]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.EvaluatorGenerationJob]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3948,12 +7703,12 @@ def list_sessions( def prepare_request(_continuation_token=None): - _request = build_beta_agents_list_sessions_request( - agent_name=agent_name, + _request = build_beta_evaluators_list_generation_jobs_request( limit=limit, order=order, after=_continuation_token, before=before, + category=category, api_version=self._config.api_version, headers=_headers, params=_params, @@ -3967,7 +7722,7 @@ def prepare_request(_continuation_token=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.AgentSessionResource], + List[_models.EvaluatorGenerationJob], deserialized.get("data", []), ) if cls: @@ -3992,128 +7747,19 @@ async def get_next(_continuation_token=None): raise HttpResponseError(response=response, model=error) return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get_session_log_stream( - self, agent_name: str, agent_version: str, session_id: str, **kwargs: Any - ) -> _models.SessionLogEvent: - """Streams console logs (stdout / stderr) for a specific hosted agent session - as a Server-Sent Events (SSE) stream. - - Each SSE frame contains: - - * `event`: always `"log"` - * `data`: a plain-text log line (currently JSON-formatted, but the schema is not contractual and may include additional keys or change format over time; clients should treat it as an opaque string) - - Example SSE frames: - - .. code-block:: - - event: log - data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting FoundryCBAgent server on port 8088"} - - event: log - data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application startup complete."} - - event: log - data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} - - event: log - data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since last 60 seconds"} - - The stream remains open until the client disconnects or the server - terminates the connection. Clients should handle reconnection as needed. - - :param agent_name: The name of the hosted agent. Required. - :type agent_name: str - :param agent_version: The version of the agent. Required. - :type agent_version: str - :param session_id: The session ID (maps to an ADC sandbox). Required. - :type session_id: str - :return: SessionLogEvent. The SessionLogEvent is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SessionLogEvent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.SessionLogEvent] = kwargs.pop("cls", None) - - _request = build_beta_agents_get_session_log_stream_request( - agent_name=agent_name, - agent_version=agent_version, - session_id=session_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.SessionLogEvent, response.text()) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def _upload_session_file( - self, agent_name: str, agent_session_id: str, content: bytes, *, path: str, **kwargs: Any - ) -> _models.SessionFileWriteResult: - """Upload a file to the session sandbox via binary stream. Maximum file size is 50 MB. Uploads - exceeding this limit return 413 Payload Too Large. - - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param agent_session_id: The session ID. Required. - :type agent_session_id: str - :param content: Required. - :type content: bytes - :keyword path: The destination file path within the sandbox, relative to the session home - directory. Required. - :paramtype path: str - :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SessionFileWriteResult + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.EvaluatorGenerationJob: + """Cancels an evaluator generation job. + + Cancels an evaluator generation job by its ID. + + :param job_id: The ID of the job to cancel. Required. + :type job_id: str + :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4124,21 +7770,14 @@ async def _upload_session_file( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) - cls: ClsType[_models.SessionFileWriteResult] = kwargs.pop("cls", None) - - _content = content + cls: ClsType[_models.EvaluatorGenerationJob] = kwargs.pop("cls", None) - _request = build_beta_agents_upload_session_file_request( - agent_name=agent_name, - agent_session_id=agent_session_id, - path=path, - content_type=content_type, + _request = build_beta_evaluators_cancel_generation_job_request( + job_id=job_id, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -4155,7 +7794,7 @@ async def _upload_session_file( response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200]: if _stream: try: await response.read() # Load the body in memory and close the socket @@ -4171,7 +7810,7 @@ async def _upload_session_file( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SessionFileWriteResult, response.json()) + deserialized = _deserialize(_models.EvaluatorGenerationJob, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4179,20 +7818,14 @@ async def _upload_session_file( return deserialized # type: ignore @distributed_trace_async - async def download_session_file( - self, agent_name: str, agent_session_id: str, *, path: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - """Download a file from the session sandbox as a binary stream. + async def delete_generation_job(self, job_id: str, **kwargs: Any) -> None: + """Deletes an evaluator generation job by its ID. Deletes the job record only; the generated + evaluator (if any) is preserved. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param agent_session_id: The session ID. Required. - :type agent_session_id: str - :keyword path: The file path to download from the sandbox, relative to the session home - directory. Required. - :paramtype path: str - :return: AsyncIterator[bytes] - :rtype: AsyncIterator[bytes] + :param job_id: The ID of the job to delete. Required. + :type job_id: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4206,12 +7839,10 @@ async def download_session_file( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_agents_download_session_file_request( - agent_name=agent_name, - agent_session_id=agent_session_id, - path=path, + _request = build_beta_evaluators_delete_generation_job_request( + job_id=job_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4221,20 +7852,14 @@ async def download_session_file( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", True) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -4242,29 +7867,209 @@ async def download_session_file( ) raise HttpResponseError(response=response, model=error) - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, None, {}) # type: ignore - return deserialized # type: ignore + @distributed_trace + def list_evaluation_suite_versions( + self, name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.EvaluationSuiteVersion"]: + """List all versions of the given EvaluationSuiteVersion. - @distributed_trace_async - async def get_session_files( - self, agent_name: str, agent_session_id: str, *, path: str, **kwargs: Any - ) -> _models.SessionDirectoryListResult: - """List files and directories at a given path in the session sandbox. Returns only the immediate - children of the specified directory (non-recursive). + :param name: The name of the resource. Required. + :type name: str + :return: An iterator like instance of EvaluationSuiteVersion + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.EvaluationSuiteVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param agent_session_id: The session ID. Required. - :type agent_session_id: str - :keyword path: The directory path to list, relative to the session home directory. Required. - :paramtype path: str - :return: SessionDirectoryListResult. The SessionDirectoryListResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.SessionDirectoryListResult + cls: ClsType[List[_models.EvaluationSuiteVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_beta_evaluators_list_evaluation_suite_versions_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.EvaluationSuiteVersion], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_evaluation_suites( + self, *, agent_name: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.EvaluationSuiteVersion"]: + """List the latest version of each EvaluationSuiteVersion. + + :keyword agent_name: Filter by associated Foundry agent name (from target). Default value is + None. + :paramtype agent_name: str + :return: An iterator like instance of EvaluationSuiteVersion + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.EvaluationSuiteVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.EvaluationSuiteVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_beta_evaluators_list_evaluation_suites_request( + agent_name=agent_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.EvaluationSuiteVersion], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_evaluation_suite(self, name: str, version: str, **kwargs: Any) -> _models.EvaluationSuiteVersion: + """Get the specific version of the EvaluationSuiteVersion. The service returns 404 Not Found error + if the EvaluationSuiteVersion does not exist. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the EvaluationSuiteVersion to retrieve. Required. + :type version: str + :return: EvaluationSuiteVersion. The EvaluationSuiteVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4278,12 +8083,11 @@ async def get_session_files( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SessionDirectoryListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.EvaluationSuiteVersion] = kwargs.pop("cls", None) - _request = build_beta_agents_get_session_files_request( - agent_name=agent_name, - agent_session_id=agent_session_id, - path=path, + _request = build_beta_evaluators_get_evaluation_suite_request( + name=name, + version=version, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4308,16 +8112,12 @@ async def get_session_files( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SessionDirectoryListResult, response.json()) + deserialized = _deserialize(_models.EvaluationSuiteVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4325,22 +8125,15 @@ async def get_session_files( return deserialized # type: ignore @distributed_trace_async - async def delete_session_file( - self, agent_name: str, agent_session_id: str, *, path: str, recursive: Optional[bool] = None, **kwargs: Any - ) -> None: - """Delete a file or directory from the session sandbox. If ``recursive`` is false (default) and - the target is a non-empty directory, the API returns 409 Conflict. + async def delete_evaluation_suite(self, name: str, version: str, **kwargs: Any) -> None: + """Delete the specific version of the EvaluationSuiteVersion. The service returns 204 No Content + if the EvaluationSuiteVersion was deleted successfully or if the EvaluationSuiteVersion does + not exist. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param agent_session_id: The session ID. Required. - :type agent_session_id: str - :keyword path: The file or directory path to delete, relative to the session home directory. - Required. - :paramtype path: str - :keyword recursive: Whether to recursively delete directory contents. Defaults to false. - Default value is None. - :paramtype recursive: bool + :param name: The name of the resource. Required. + :type name: str + :param version: The version of the EvaluationSuiteVersion to delete. Required. + :type version: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -4358,11 +8151,9 @@ async def delete_session_file( cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_agents_delete_session_file_request( - agent_name=agent_name, - agent_session_id=agent_session_id, - path=path, - recursive=recursive, + _request = build_beta_evaluators_delete_evaluation_suite_request( + name=name, + version=version, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4381,41 +8172,113 @@ async def delete_session_file( if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if cls: return cls(pipeline_response, None, {}) # type: ignore + @overload + async def create_or_update_evaluation_suite( + self, + name: str, + version: str, + evaluation_suite_version: _models.EvaluationSuiteVersion, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.EvaluationSuiteVersion: + """Create a new or update an existing EvaluationSuiteVersion with the given version id. -class BetaEvaluationTaxonomiesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the EvaluationSuiteVersion to create or update. + Required. + :type version: str + :param evaluation_suite_version: The EvaluationSuiteVersion to create or update. Required. + :type evaluation_suite_version: ~azure.ai.projects.models.EvaluationSuiteVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: EvaluationSuiteVersion. The EvaluationSuiteVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ - Instead, you should access the following operations through - :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`evaluation_taxonomies` attribute. - """ + @overload + async def create_or_update_evaluation_suite( + self, + name: str, + version: str, + evaluation_suite_version: JSON, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.EvaluationSuiteVersion: + """Create a new or update an existing EvaluationSuiteVersion with the given version id. - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the EvaluationSuiteVersion to create or update. + Required. + :type version: str + :param evaluation_suite_version: The EvaluationSuiteVersion to create or update. Required. + :type evaluation_suite_version: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: EvaluationSuiteVersion. The EvaluationSuiteVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_evaluation_suite( + self, + name: str, + version: str, + evaluation_suite_version: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.EvaluationSuiteVersion: + """Create a new or update an existing EvaluationSuiteVersion with the given version id. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the EvaluationSuiteVersion to create or update. + Required. + :type version: str + :param evaluation_suite_version: The EvaluationSuiteVersion to create or update. Required. + :type evaluation_suite_version: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: EvaluationSuiteVersion. The EvaluationSuiteVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def get(self, name: str, **kwargs: Any) -> _models.EvaluationTaxonomy: - """Get an evaluation run by name. + async def create_or_update_evaluation_suite( + self, + name: str, + version: str, + evaluation_suite_version: Union[_models.EvaluationSuiteVersion, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.EvaluationSuiteVersion: + """Create a new or update an existing EvaluationSuiteVersion with the given version id. :param name: The name of the resource. Required. :type name: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :param version: The specific version id of the EvaluationSuiteVersion to create or update. + Required. + :type version: str + :param evaluation_suite_version: The EvaluationSuiteVersion to create or update. Is one of the + following types: EvaluationSuiteVersion, JSON, IO[bytes] Required. + :type evaluation_suite_version: ~azure.ai.projects.models.EvaluationSuiteVersion or JSON or + IO[bytes] + :return: EvaluationSuiteVersion. The EvaluationSuiteVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4426,14 +8289,25 @@ async def get(self, name: str, **kwargs: Any) -> _models.EvaluationTaxonomy: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.EvaluationTaxonomy] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EvaluationSuiteVersion] = kwargs.pop("cls", None) - _request = build_beta_evaluation_taxonomies_get_request( + content_type = content_type or "application/merge-patch+json" + _content = None + if isinstance(evaluation_suite_version, (IOBase, bytes)): + _content = evaluation_suite_version + else: + _content = json.dumps(evaluation_suite_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_evaluators_create_or_update_evaluation_suite_request( name=name, + version=version, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -4450,7 +8324,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.EvaluationTaxonomy: response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: if _stream: try: await response.read() # Load the body in memory and close the socket @@ -4462,117 +8336,86 @@ async def get(self, name: str, **kwargs: Any) -> _models.EvaluationTaxonomy: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluationTaxonomy, response.json()) + deserialized = _deserialize(_models.EvaluationSuiteVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list( - self, *, input_name: Optional[str] = None, input_type: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.EvaluationTaxonomy"]: - """List evaluation taxonomies. + @overload + async def create_evaluation_suite( + self, + name: str, + evaluation_suite_version: _models.EvaluationSuiteVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EvaluationSuiteVersion: + """Create a new EvaluationSuiteVersion with auto incremented version id. - :keyword input_name: Filter by the evaluation input name. Default value is None. - :paramtype input_name: str - :keyword input_type: Filter by taxonomy input type. Default value is None. - :paramtype input_type: str - :return: An iterator like instance of EvaluationTaxonomy - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.EvaluationTaxonomy] + :param name: The name of the evaluation suite. Required. + :type name: str + :param evaluation_suite_version: The evaluation suite version to create. Required. + :type evaluation_suite_version: ~azure.ai.projects.models.EvaluationSuiteVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationSuiteVersion. The EvaluationSuiteVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteVersion :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.EvaluationTaxonomy]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_beta_evaluation_taxonomies_list_request( - input_name=input_name, - input_type=input_type, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.EvaluationTaxonomy], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + @overload + async def create_evaluation_suite( + self, name: str, evaluation_suite_version: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationSuiteVersion: + """Create a new EvaluationSuiteVersion with auto incremented version id. - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + :param name: The name of the evaluation suite. Required. + :type name: str + :param evaluation_suite_version: The evaluation suite version to create. Required. + :type evaluation_suite_version: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationSuiteVersion. The EvaluationSuiteVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ - return pipeline_response + @overload + async def create_evaluation_suite( + self, name: str, evaluation_suite_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationSuiteVersion: + """Create a new EvaluationSuiteVersion with auto incremented version id. - return AsyncItemPaged(get_next, extract_data) + :param name: The name of the evaluation suite. Required. + :type name: str + :param evaluation_suite_version: The evaluation suite version to create. Required. + :type evaluation_suite_version: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationSuiteVersion. The EvaluationSuiteVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def delete(self, name: str, **kwargs: Any) -> None: - """Delete an evaluation taxonomy by name. + async def create_evaluation_suite( + self, name: str, evaluation_suite_version: Union[_models.EvaluationSuiteVersion, JSON, IO[bytes]], **kwargs: Any + ) -> _models.EvaluationSuiteVersion: + """Create a new EvaluationSuiteVersion with auto incremented version id. - :param name: The name of the resource. Required. + :param name: The name of the evaluation suite. Required. :type name: str - :return: None - :rtype: None + :param evaluation_suite_version: The evaluation suite version to create. Is one of the + following types: EvaluationSuiteVersion, JSON, IO[bytes] Required. + :type evaluation_suite_version: ~azure.ai.projects.models.EvaluationSuiteVersion or JSON or + IO[bytes] + :return: EvaluationSuiteVersion. The EvaluationSuiteVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4583,14 +8426,24 @@ async def delete(self, name: str, **kwargs: Any) -> None: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EvaluationSuiteVersion] = kwargs.pop("cls", None) - _request = build_beta_evaluation_taxonomies_delete_request( + content_type = content_type or "application/json" + _content = None + if isinstance(evaluation_suite_version, (IOBase, bytes)): + _content = evaluation_suite_version + else: + _content = json.dumps(evaluation_suite_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_evaluators_create_evaluation_suite_request( name=name, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -4599,87 +8452,113 @@ async def delete(self, name: str, **kwargs: Any) -> None: } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.EvaluationSuiteVersion, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload - async def create( - self, name: str, taxonomy: _models.EvaluationTaxonomy, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Create an evaluation taxonomy. + async def run_evaluation_suite( + self, + name: str, + body: _models.EvaluationSuiteRunRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EvaluationSuiteRunResponse: + """Run an evaluation using the suite's testing criteria and dataset. - :param name: The name of the evaluation taxonomy. Required. + :param name: The name of the evaluation suite. Required. :type name: str - :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy + :param body: The run request parameters. Required. + :type body: ~azure.ai.projects.models.EvaluationSuiteRunRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :return: EvaluationSuiteRunResponse. The EvaluationSuiteRunResponse is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteRunResponse :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create( - self, name: str, taxonomy: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Create an evaluation taxonomy. + async def run_evaluation_suite( + self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationSuiteRunResponse: + """Run an evaluation using the suite's testing criteria and dataset. - :param name: The name of the evaluation taxonomy. Required. + :param name: The name of the evaluation suite. Required. :type name: str - :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: JSON + :param body: The run request parameters. Required. + :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :return: EvaluationSuiteRunResponse. The EvaluationSuiteRunResponse is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteRunResponse :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create( - self, name: str, taxonomy: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Create an evaluation taxonomy. + async def run_evaluation_suite( + self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationSuiteRunResponse: + """Run an evaluation using the suite's testing criteria and dataset. - :param name: The name of the evaluation taxonomy. Required. + :param name: The name of the evaluation suite. Required. :type name: str - :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: IO[bytes] + :param body: The run request parameters. Required. + :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :return: EvaluationSuiteRunResponse. The EvaluationSuiteRunResponse is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteRunResponse :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create( - self, name: str, taxonomy: Union[_models.EvaluationTaxonomy, JSON, IO[bytes]], **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Create an evaluation taxonomy. + async def run_evaluation_suite( + self, name: str, body: Union[_models.EvaluationSuiteRunRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.EvaluationSuiteRunResponse: + """Run an evaluation using the suite's testing criteria and dataset. - :param name: The name of the evaluation taxonomy. Required. + :param name: The name of the evaluation suite. Required. :type name: str - :param taxonomy: The evaluation taxonomy. Is one of the following types: EvaluationTaxonomy, - JSON, IO[bytes] Required. - :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy or JSON or IO[bytes] - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :param body: The run request parameters. Is one of the following types: + EvaluationSuiteRunRequest, JSON, IO[bytes] Required. + :type body: ~azure.ai.projects.models.EvaluationSuiteRunRequest or JSON or IO[bytes] + :return: EvaluationSuiteRunResponse. The EvaluationSuiteRunResponse is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteRunResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4694,16 +8573,16 @@ async def create( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EvaluationTaxonomy] = kwargs.pop("cls", None) + cls: ClsType[_models.EvaluationSuiteRunResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(taxonomy, (IOBase, bytes)): - _content = taxonomy + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(taxonomy, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_evaluation_taxonomies_create_request( + _request = build_beta_evaluators_run_evaluation_suite_request( name=name, content_type=content_type, api_version=self._config.api_version, @@ -4724,19 +8603,23 @@ async def create( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [201]: if _stream: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluationTaxonomy, response.json()) + deserialized = _deserialize(_models.EvaluationSuiteRunResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4744,72 +8627,106 @@ async def create( return deserialized # type: ignore @overload - async def update( - self, name: str, taxonomy: _models.EvaluationTaxonomy, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Update an evaluation taxonomy. + async def create_generation_suite_job( + self, + job: _models.EvaluationSuiteGenerationJob, + *, + operation_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EvaluationSuiteGenerationJob: + """Creates an evaluation suite generation job. - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy + Create a new job (preview). Includes optional Foundry-Features header and Operation-Id for + idempotent retries. + + :param job: The job to create. Required. + :type job: ~azure.ai.projects.models.EvaluationSuiteGenerationJob + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :return: EvaluationSuiteGenerationJob. The EvaluationSuiteGenerationJob is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update( - self, name: str, taxonomy: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Update an evaluation taxonomy. + async def create_generation_suite_job( + self, job: JSON, *, operation_id: Optional[str] = None, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationSuiteGenerationJob: + """Creates an evaluation suite generation job. - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: JSON + Create a new job (preview). Includes optional Foundry-Features header and Operation-Id for + idempotent retries. + + :param job: The job to create. Required. + :type job: JSON + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :return: EvaluationSuiteGenerationJob. The EvaluationSuiteGenerationJob is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update( - self, name: str, taxonomy: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Update an evaluation taxonomy. + async def create_generation_suite_job( + self, + job: IO[bytes], + *, + operation_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EvaluationSuiteGenerationJob: + """Creates an evaluation suite generation job. - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: IO[bytes] + Create a new job (preview). Includes optional Foundry-Features header and Operation-Id for + idempotent retries. + + :param job: The job to create. Required. + :type job: IO[bytes] + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :return: EvaluationSuiteGenerationJob. The EvaluationSuiteGenerationJob is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def update( - self, name: str, taxonomy: Union[_models.EvaluationTaxonomy, JSON, IO[bytes]], **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Update an evaluation taxonomy. + async def create_generation_suite_job( + self, + job: Union[_models.EvaluationSuiteGenerationJob, JSON, IO[bytes]], + *, + operation_id: Optional[str] = None, + **kwargs: Any + ) -> _models.EvaluationSuiteGenerationJob: + """Creates an evaluation suite generation job. - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Is one of the following types: EvaluationTaxonomy, + Create a new job (preview). Includes optional Foundry-Features header and Operation-Id for + idempotent retries. + + :param job: The job to create. Is one of the following types: EvaluationSuiteGenerationJob, JSON, IO[bytes] Required. - :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy or JSON or IO[bytes] - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :type job: ~azure.ai.projects.models.EvaluationSuiteGenerationJob or JSON or IO[bytes] + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :return: EvaluationSuiteGenerationJob. The EvaluationSuiteGenerationJob is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4824,20 +8741,92 @@ async def update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EvaluationTaxonomy] = kwargs.pop("cls", None) + cls: ClsType[_models.EvaluationSuiteGenerationJob] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(taxonomy, (IOBase, bytes)): - _content = taxonomy + if isinstance(job, (IOBase, bytes)): + _content = job else: - _content = json.dumps(taxonomy, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(job, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_evaluation_taxonomies_update_request( - name=name, + _request = build_beta_evaluators_create_generation_suite_job_request( + operation_id=operation_id, content_type=content_type, api_version=self._config.api_version, - content=_content, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.EvaluationSuiteGenerationJob, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_generation_suite_job(self, job_id: str, **kwargs: Any) -> _models.EvaluationSuiteGenerationJob: + """Get info about an evaluation suite generation job. + + Get a job by ID (preview). Includes optional Foundry-Features header. + + :param job_id: The ID of the job. Required. + :type job_id: str + :return: EvaluationSuiteGenerationJob. The EvaluationSuiteGenerationJob is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteGenerationJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.EvaluationSuiteGenerationJob] = kwargs.pop("cls", None) + + _request = build_beta_evaluators_get_generation_suite_job_request( + job_id=job_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) @@ -4861,168 +8850,61 @@ async def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluationTaxonomy, response.json()) + deserialized = _deserialize(_models.EvaluationSuiteGenerationJob, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - -class BetaEvaluatorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`evaluators` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list_versions( + def list_generation_suite_jobs( self, - name: str, *, - type: Optional[Union[Literal["builtin"], Literal["custom"], Literal["all"], str]] = None, limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.EvaluatorVersion"]: - """List all versions of the given evaluator. - - :param name: The name of the resource. Required. - :type name: str - :keyword type: Filter evaluators by type. Possible values: 'all', 'custom', 'builtin'. Is one - of the following types: Literal["builtin"], Literal["custom"], Literal["all"], str Default - value is None. - :paramtype type: str or str or str or str - :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. Default value is None. - :paramtype limit: int - :return: An iterator like instance of EvaluatorVersion - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.EvaluatorVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.EvaluatorVersion]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_beta_evaluators_list_versions_request( - name=name, - type=type, - limit=limit, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.EvaluatorVersion], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + ) -> AsyncItemPaged["_models.EvaluationSuiteGenerationJob"]: + """Returns a list of evaluation suite generation jobs. - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list( - self, - *, - type: Optional[Union[Literal["builtin"], Literal["custom"], Literal["all"], str]] = None, - limit: Optional[int] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.EvaluatorVersion"]: - """List the latest version of each evaluator. + List jobs with cursor-based pagination (preview). Includes optional Foundry-Features header. - :keyword type: Filter evaluators by type. Possible values: 'all', 'custom', 'builtin'. Is one - of the following types: Literal["builtin"], Literal["custom"], Literal["all"], str Default - value is None. - :paramtype type: str or str or str or str :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. Default value is None. + 100, and the + default is 20. Default value is None. :paramtype limit: int - :return: An iterator like instance of EvaluatorVersion - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.EvaluatorVersion] + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of EvaluationSuiteGenerationJob + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.EvaluationSuiteGenerationJob] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.EvaluatorVersion]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.EvaluationSuiteGenerationJob]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5032,60 +8914,35 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_beta_evaluators_list_request( - type=type, - limit=limit, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + def prepare_request(_continuation_token=None): + _request = build_beta_evaluators_list_generation_suite_jobs_request( + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) return _request async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.EvaluatorVersion], - deserialized.get("value", []), + List[_models.EvaluationSuiteGenerationJob], + deserialized.get("data", []), ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + return deserialized.get("last_id") or None, AsyncList(list_of_elem) - async def get_next(next_link=None): - _request = prepare_request(next_link) + async def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access @@ -5095,23 +8952,27 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) return pipeline_response return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.EvaluatorVersion: - """Get the specific version of the EvaluatorVersion. The service returns 404 Not Found error if - the EvaluatorVersion does not exist. + async def cancel_generation_suite_job(self, job_id: str, **kwargs: Any) -> _models.EvaluationSuiteGenerationJob: + """Cancels an evaluation suite generation job. - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the EvaluatorVersion to retrieve. Required. - :type version: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion + Cancel a running job (preview). Returns 200 with the updated job. + + :param job_id: The ID of the job to cancel. Required. + :type job_id: str + :return: EvaluationSuiteGenerationJob. The EvaluationSuiteGenerationJob is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5125,11 +8986,10 @@ async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.E _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.EvaluatorVersion] = kwargs.pop("cls", None) + cls: ClsType[_models.EvaluationSuiteGenerationJob] = kwargs.pop("cls", None) - _request = build_beta_evaluators_get_version_request( - name=name, - version=version, + _request = build_beta_evaluators_cancel_generation_suite_job_request( + job_id=job_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5154,12 +9014,16 @@ async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.E except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorVersion, response.json()) + deserialized = _deserialize(_models.EvaluationSuiteGenerationJob, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5167,14 +9031,13 @@ async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.E return deserialized # type: ignore @distributed_trace_async - async def delete_version(self, name: str, version: str, **kwargs: Any) -> None: - """Delete the specific version of the EvaluatorVersion. The service returns 204 No Content if the - EvaluatorVersion was deleted successfully or if the EvaluatorVersion does not exist. + async def delete_generation_suite_job(self, job_id: str, **kwargs: Any) -> None: + """Deletes an evaluation suite generation job. - :param name: The name of the resource. Required. - :type name: str - :param version: The version of the EvaluatorVersion to delete. Required. - :type version: str + Delete a job (preview). Returns 204 No Content. + + :param job_id: The ID of the job to delete. Required. + :type job_id: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -5192,9 +9055,8 @@ async def delete_version(self, name: str, version: str, **kwargs: Any) -> None: cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_evaluators_delete_version_request( - name=name, - version=version, + _request = build_beta_evaluators_delete_generation_suite_job_request( + job_id=job_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5213,83 +9075,93 @@ async def delete_version(self, name: str, version: str, **kwargs: Any) -> None: if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if cls: return cls(pipeline_response, None, {}) # type: ignore + +class BetaInsightsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.aio.AIProjectClient`'s + :attr:`insights` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload - async def create_version( - self, - name: str, - evaluator_version: _models.EvaluatorVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.EvaluatorVersion: - """Create a new EvaluatorVersion with auto incremented version id. + async def generate( + self, insight: _models.Insight, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.Insight: + """Generate Insights. - :param name: The name of the resource. Required. - :type name: str - :param evaluator_version: Required. - :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion + :param insight: Complete evaluation configuration including data source, evaluators, and result + settings. Required. + :type insight: ~azure.ai.projects.models.Insight :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion + :return: Insight. The Insight is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Insight :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_version( - self, name: str, evaluator_version: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluatorVersion: - """Create a new EvaluatorVersion with auto incremented version id. + async def generate( + self, insight: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.Insight: + """Generate Insights. - :param name: The name of the resource. Required. - :type name: str - :param evaluator_version: Required. - :type evaluator_version: JSON + :param insight: Complete evaluation configuration including data source, evaluators, and result + settings. Required. + :type insight: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion + :return: Insight. The Insight is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Insight :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_version( - self, name: str, evaluator_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluatorVersion: - """Create a new EvaluatorVersion with auto incremented version id. + async def generate( + self, insight: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.Insight: + """Generate Insights. - :param name: The name of the resource. Required. - :type name: str - :param evaluator_version: Required. - :type evaluator_version: IO[bytes] + :param insight: Complete evaluation configuration including data source, evaluators, and result + settings. Required. + :type insight: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion + :return: Insight. The Insight is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Insight :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create_version( - self, name: str, evaluator_version: Union[_models.EvaluatorVersion, JSON, IO[bytes]], **kwargs: Any - ) -> _models.EvaluatorVersion: - """Create a new EvaluatorVersion with auto incremented version id. + async def generate(self, insight: Union[_models.Insight, JSON, IO[bytes]], **kwargs: Any) -> _models.Insight: + """Generate Insights. - :param name: The name of the resource. Required. - :type name: str - :param evaluator_version: Is one of the following types: EvaluatorVersion, JSON, IO[bytes] - Required. - :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion or JSON or IO[bytes] - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion + :param insight: Complete evaluation configuration including data source, evaluators, and result + settings. Is one of the following types: Insight, JSON, IO[bytes] Required. + :type insight: ~azure.ai.projects.models.Insight or JSON or IO[bytes] + :return: Insight. The Insight is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Insight :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5304,17 +9176,16 @@ async def create_version( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EvaluatorVersion] = kwargs.pop("cls", None) + cls: ClsType[_models.Insight] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(evaluator_version, (IOBase, bytes)): - _content = evaluator_version + if isinstance(insight, (IOBase, bytes)): + _content = insight else: - _content = json.dumps(evaluator_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(insight, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_evaluators_create_version_request( - name=name, + _request = build_beta_insights_generate_request( content_type=content_type, api_version=self._config.api_version, content=_content, @@ -5341,109 +9212,35 @@ async def create_version( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorVersion, response.json()) + deserialized = _deserialize(_models.Insight, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def update_version( - self, - name: str, - version: str, - evaluator_version: _models.EvaluatorVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.EvaluatorVersion: - """Update an existing EvaluatorVersion with the given version id. - - :param name: The name of the resource. Required. - :type name: str - :param version: The version of the EvaluatorVersion to update. Required. - :type version: str - :param evaluator_version: Evaluator resource. Required. - :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update_version( - self, name: str, version: str, evaluator_version: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluatorVersion: - """Update an existing EvaluatorVersion with the given version id. - - :param name: The name of the resource. Required. - :type name: str - :param version: The version of the EvaluatorVersion to update. Required. - :type version: str - :param evaluator_version: Evaluator resource. Required. - :type evaluator_version: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update_version( - self, - name: str, - version: str, - evaluator_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.EvaluatorVersion: - """Update an existing EvaluatorVersion with the given version id. - - :param name: The name of the resource. Required. - :type name: str - :param version: The version of the EvaluatorVersion to update. Required. - :type version: str - :param evaluator_version: Evaluator resource. Required. - :type evaluator_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def update_version( - self, - name: str, - version: str, - evaluator_version: Union[_models.EvaluatorVersion, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.EvaluatorVersion: - """Update an existing EvaluatorVersion with the given version id. + async def get( + self, insight_id: str, *, include_coordinates: Optional[bool] = None, **kwargs: Any + ) -> _models.Insight: + """Get a specific insight by Id. - :param name: The name of the resource. Required. - :type name: str - :param version: The version of the EvaluatorVersion to update. Required. - :type version: str - :param evaluator_version: Evaluator resource. Is one of the following types: EvaluatorVersion, - JSON, IO[bytes] Required. - :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion or JSON or IO[bytes] - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion + :param insight_id: The unique identifier for the insights report. Required. + :type insight_id: str + :keyword include_coordinates: Whether to include coordinates for visualization in the response. + Defaults to false. Default value is None. + :paramtype include_coordinates: bool + :return: Insight. The Insight is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Insight :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5454,25 +9251,15 @@ async def update_version( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EvaluatorVersion] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(evaluator_version, (IOBase, bytes)): - _content = evaluator_version - else: - _content = json.dumps(evaluator_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.Insight] = kwargs.pop("cls", None) - _request = build_beta_evaluators_update_version_request( - name=name, - version=version, - content_type=content_type, + _request = build_beta_insights_get_request( + insight_id=insight_id, + include_coordinates=include_coordinates, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -5496,115 +9283,246 @@ async def update_version( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorVersion, response.json()) + deserialized = _deserialize(_models.Insight, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + @distributed_trace + def list( + self, + *, + type: Optional[Union[str, _models.InsightType]] = None, + eval_id: Optional[str] = None, + run_id: Optional[str] = None, + agent_name: Optional[str] = None, + include_coordinates: Optional[bool] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.Insight"]: + """List all insights in reverse chronological order (newest first). + + :keyword type: Filter by the type of analysis. Known values are: "EvaluationRunClusterInsight", + "AgentClusterInsight", and "EvaluationComparison". Default value is None. + :paramtype type: str or ~azure.ai.projects.models.InsightType + :keyword eval_id: Filter by the evaluation ID. Default value is None. + :paramtype eval_id: str + :keyword run_id: Filter by the evaluation run ID. Default value is None. + :paramtype run_id: str + :keyword agent_name: Filter by the agent name. Default value is None. + :paramtype agent_name: str + :keyword include_coordinates: Whether to include coordinates for visualization in the response. + Defaults to false. Default value is None. + :paramtype include_coordinates: bool + :return: An iterator like instance of Insight + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.Insight] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Insight]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_beta_insights_list_request( + type=type, + eval_id=eval_id, + run_id=run_id, + agent_name=agent_name, + include_coordinates=include_coordinates, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Insight], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class BetaMemoryStoresOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.aio.AIProjectClient`'s + :attr:`memory_stores` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload - async def create_generation_job( + async def create( self, - job: _models.EvaluatorGenerationJob, *, - operation_id: Optional[str] = None, + name: str, + definition: _models.MemoryStoreDefinition, content_type: str = "application/json", + description: Optional[str] = None, + metadata: Optional[dict[str, str]] = None, **kwargs: Any - ) -> _models.EvaluatorGenerationJob: - """Creates an evaluator generation job. - - Creates an evaluator generation job. The service generates rubric-based evaluator definitions - from the provided source materials asynchronously. + ) -> _models.MemoryStoreDetails: + """Create a memory store. - :param job: The job to create. Required. - :type job: ~azure.ai.projects.models.EvaluatorGenerationJob - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str + :keyword name: The name of the memory store. Required. + :paramtype name: str + :keyword definition: The memory store definition. Required. + :paramtype definition: ~azure.ai.projects.models.MemoryStoreDefinition :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob + :keyword description: A human-readable description of the memory store. Default value is None. + :paramtype description: str + :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default + value is None. + :paramtype metadata: dict[str, str] + :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_generation_job( - self, job: JSON, *, operation_id: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluatorGenerationJob: - """Creates an evaluator generation job. - - Creates an evaluator generation job. The service generates rubric-based evaluator definitions - from the provided source materials asynchronously. + async def create( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryStoreDetails: + """Create a memory store. - :param job: The job to create. Required. - :type job: JSON - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str + :param body: Required. + :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob + :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_generation_job( - self, - job: IO[bytes], - *, - operation_id: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.EvaluatorGenerationJob: - """Creates an evaluator generation job. - - Creates an evaluator generation job. The service generates rubric-based evaluator definitions - from the provided source materials asynchronously. + async def create( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryStoreDetails: + """Create a memory store. - :param job: The job to create. Required. - :type job: IO[bytes] - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str + :param body: Required. + :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob + :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create_generation_job( + async def create( self, - job: Union[_models.EvaluatorGenerationJob, JSON, IO[bytes]], + body: Union[JSON, IO[bytes]] = _Unset, *, - operation_id: Optional[str] = None, + name: str = _Unset, + definition: _models.MemoryStoreDefinition = _Unset, + description: Optional[str] = None, + metadata: Optional[dict[str, str]] = None, **kwargs: Any - ) -> _models.EvaluatorGenerationJob: - """Creates an evaluator generation job. - - Creates an evaluator generation job. The service generates rubric-based evaluator definitions - from the provided source materials asynchronously. + ) -> _models.MemoryStoreDetails: + """Create a memory store. - :param job: The job to create. Is one of the following types: EvaluatorGenerationJob, JSON, - IO[bytes] Required. - :type job: ~azure.ai.projects.models.EvaluatorGenerationJob or JSON or IO[bytes] - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str - :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword name: The name of the memory store. Required. + :paramtype name: str + :keyword definition: The memory store definition. Required. + :paramtype definition: ~azure.ai.projects.models.MemoryStoreDefinition + :keyword description: A human-readable description of the memory store. Default value is None. + :paramtype description: str + :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default + value is None. + :paramtype metadata: dict[str, str] + :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5619,17 +9537,23 @@ async def create_generation_job( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EvaluatorGenerationJob] = kwargs.pop("cls", None) + cls: ClsType[_models.MemoryStoreDetails] = kwargs.pop("cls", None) + if body is _Unset: + if name is _Unset: + raise TypeError("missing required argument: name") + if definition is _Unset: + raise TypeError("missing required argument: definition") + body = {"definition": definition, "description": description, "metadata": metadata, "name": name} + body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None - if isinstance(job, (IOBase, bytes)): - _content = job + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(job, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_evaluators_create_generation_job_request( - operation_id=operation_id, + _request = build_beta_memory_stores_create_request( content_type=content_type, api_version=self._config.api_version, content=_content, @@ -5649,77 +9573,6 @@ async def create_generation_job( response = pipeline_response.http_response - if response.status_code not in [201]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.EvaluatorGenerationJob, response.json()) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.EvaluatorGenerationJob: - """Get info about an evaluator generation job. - - Gets the details of an evaluator generation job by its ID. - - :param job_id: The ID of the job. Required. - :type job_id: str - :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.EvaluatorGenerationJob] = kwargs.pop("cls", None) - - _request = build_beta_evaluators_get_generation_job_request( - job_id=job_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - if response.status_code not in [200]: if _stream: try: @@ -5733,127 +9586,102 @@ async def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.Evalua ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorGenerationJob, response.json()) + deserialized = _deserialize(_models.MemoryStoreDetails, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list_generation_jobs( + @overload + async def update( self, + name: str, *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, - category: Optional[Union[str, _models.EvaluatorCategory]] = None, + content_type: str = "application/json", + description: Optional[str] = None, + metadata: Optional[dict[str, str]] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.EvaluatorGenerationJob"]: - """Returns a list of evaluator generation jobs. - - Returns a list of evaluator generation jobs. + ) -> _models.MemoryStoreDetails: + """Update a memory store. - :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the - default is 20. Default value is None. - :paramtype limit: int - :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for - ascending order and``desc`` - for descending order. Known values are: "asc" and "desc". Default value is None. - :paramtype order: str or ~azure.ai.projects.models.PageOrder - :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your - place in the list. - For instance, if you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page of the list. - Default value is None. - :paramtype before: str - :keyword category: Filter evaluator generation jobs by category. Known values are: "quality", - "safety", and "agents". Default value is None. - :paramtype category: str or ~azure.ai.projects.models.EvaluatorCategory - :return: An iterator like instance of EvaluatorGenerationJob - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.EvaluatorGenerationJob] + :param name: The name of the memory store to update. Required. + :type name: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword description: A human-readable description of the memory store. Default value is None. + :paramtype description: str + :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default + value is None. + :paramtype metadata: dict[str, str] + :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.EvaluatorGenerationJob]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(_continuation_token=None): - - _request = build_beta_evaluators_list_generation_jobs_request( - limit=limit, - order=order, - after=_continuation_token, - before=before, - category=category, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.EvaluatorGenerationJob], - deserialized.get("data", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("last_id") or None, AsyncList(list_of_elem) - async def get_next(_continuation_token=None): - _request = prepare_request(_continuation_token) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + @overload + async def update( + self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryStoreDetails: + """Update a memory store. - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + :param name: The name of the memory store to update. Required. + :type name: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ - return pipeline_response + @overload + async def update( + self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryStoreDetails: + """Update a memory store. - return AsyncItemPaged(get_next, extract_data) + :param name: The name of the memory store to update. Required. + :type name: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.EvaluatorGenerationJob: - """Cancels an evaluator generation job. - - Cancels an evaluator generation job by its ID. + async def update( + self, + name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + description: Optional[str] = None, + metadata: Optional[dict[str, str]] = None, + **kwargs: Any + ) -> _models.MemoryStoreDetails: + """Update a memory store. - :param job_id: The ID of the job to cancel. Required. - :type job_id: str - :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob + :param name: The name of the memory store to update. Required. + :type name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword description: A human-readable description of the memory store. Default value is None. + :paramtype description: str + :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default + value is None. + :paramtype metadata: dict[str, str] + :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5864,14 +9692,27 @@ async def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.Eva } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.EvaluatorGenerationJob] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MemoryStoreDetails] = kwargs.pop("cls", None) - _request = build_beta_evaluators_cancel_generation_job_request( - job_id=job_id, + if body is _Unset: + body = {"description": description, "metadata": metadata} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_memory_stores_update_request( + name=name, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -5904,7 +9745,7 @@ async def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.Eva if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorGenerationJob, response.json()) + deserialized = _deserialize(_models.MemoryStoreDetails, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5912,14 +9753,13 @@ async def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.Eva return deserialized # type: ignore @distributed_trace_async - async def delete_generation_job(self, job_id: str, **kwargs: Any) -> None: - """Deletes an evaluator generation job by its ID. Deletes the job record only; the generated - evaluator (if any) is preserved. + async def get(self, name: str, **kwargs: Any) -> _models.MemoryStoreDetails: + """Retrieve a memory store. - :param job_id: The ID of the job to delete. Required. - :type job_id: str - :return: None - :rtype: None + :param name: The name of the memory store to retrieve. Required. + :type name: str + :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5933,10 +9773,10 @@ async def delete_generation_job(self, job_id: str, **kwargs: Any) -> None: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.MemoryStoreDetails] = kwargs.pop("cls", None) - _request = build_beta_evaluators_delete_generation_job_request( - job_id=job_id, + _request = build_beta_memory_stores_get_request( + name=name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5946,14 +9786,20 @@ async def delete_generation_job(self, job_id: str, **kwargs: Any) -> None: } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -5961,89 +9807,50 @@ async def delete_generation_job(self, job_id: str, **kwargs: Any) -> None: ) raise HttpResponseError(response=response, model=error) - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class BetaInsightsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`insights` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def generate( - self, insight: _models.Insight, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Insight: - """Generate Insights. - - :param insight: Complete evaluation configuration including data source, evaluators, and result - settings. Required. - :type insight: ~azure.ai.projects.models.Insight - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Insight. The Insight is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Insight - :raises ~azure.core.exceptions.HttpResponseError: - """ + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.MemoryStoreDetails, response.json()) - @overload - async def generate( - self, insight: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Insight: - """Generate Insights. + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - :param insight: Complete evaluation configuration including data source, evaluators, and result - settings. Required. - :type insight: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Insight. The Insight is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Insight - :raises ~azure.core.exceptions.HttpResponseError: - """ + return deserialized # type: ignore - @overload - async def generate( - self, insight: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Insight: - """Generate Insights. + @distributed_trace + def list( + self, + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.MemoryStoreDetails"]: + """List all memory stores. - :param insight: Complete evaluation configuration including data source, evaluators, and result - settings. Required. - :type insight: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Insight. The Insight is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Insight + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of MemoryStoreDetails + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.MemoryStoreDetails] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @distributed_trace_async - async def generate(self, insight: Union[_models.Insight, JSON, IO[bytes]], **kwargs: Any) -> _models.Insight: - """Generate Insights. + cls: ClsType[List[_models.MemoryStoreDetails]] = kwargs.pop("cls", None) - :param insight: Complete evaluation configuration including data source, evaluators, and result - settings. Is one of the following types: Insight, JSON, IO[bytes] Required. - :type insight: ~azure.ai.projects.models.Insight or JSON or IO[bytes] - :return: Insight. The Insight is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Insight - :raises ~azure.core.exceptions.HttpResponseError: - """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6052,75 +9859,62 @@ async def generate(self, insight: Union[_models.Insight, JSON, IO[bytes]], **kwa } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Insight] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(insight, (IOBase, bytes)): - _content = insight - else: - _content = json.dumps(insight, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + def prepare_request(_continuation_token=None): - _request = build_beta_insights_generate_request( - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_beta_memory_stores_list_request( + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.MemoryStoreDetails], + deserialized.get("data", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, AsyncList(list_of_elem) - response = pipeline_response.http_response + async def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) - if response.status_code not in [201]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - raise HttpResponseError(response=response, model=error) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Insight, response.json()) + response = pipeline_response.http_response - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) - return deserialized # type: ignore + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def get( - self, insight_id: str, *, include_coordinates: Optional[bool] = None, **kwargs: Any - ) -> _models.Insight: - """Get a specific insight by Id. + async def delete(self, name: str, **kwargs: Any) -> _models.DeleteMemoryStoreResult: + """Delete a memory store. - :param insight_id: The unique identifier for the insights report. Required. - :type insight_id: str - :keyword include_coordinates: Whether to include coordinates for visualization in the response. - Defaults to false. Default value is None. - :paramtype include_coordinates: bool - :return: Insight. The Insight is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Insight + :param name: The name of the memory store to delete. Required. + :type name: str + :return: DeleteMemoryStoreResult. The DeleteMemoryStoreResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DeleteMemoryStoreResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6134,11 +9928,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Insight] = kwargs.pop("cls", None) + cls: ClsType[_models.DeleteMemoryStoreResult] = kwargs.pop("cls", None) - _request = build_beta_insights_get_request( - insight_id=insight_id, - include_coordinates=include_coordinates, + _request = build_beta_memory_stores_delete_request( + name=name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6172,237 +9965,64 @@ async def get( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Insight, response.json()) + deserialized = _deserialize(_models.DeleteMemoryStoreResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list( - self, - *, - type: Optional[Union[str, _models.InsightType]] = None, - eval_id: Optional[str] = None, - run_id: Optional[str] = None, - agent_name: Optional[str] = None, - include_coordinates: Optional[bool] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.Insight"]: - """List all insights in reverse chronological order (newest first). - - :keyword type: Filter by the type of analysis. Known values are: "EvaluationRunClusterInsight", - "AgentClusterInsight", and "EvaluationComparison". Default value is None. - :paramtype type: str or ~azure.ai.projects.models.InsightType - :keyword eval_id: Filter by the evaluation ID. Default value is None. - :paramtype eval_id: str - :keyword run_id: Filter by the evaluation run ID. Default value is None. - :paramtype run_id: str - :keyword agent_name: Filter by the agent name. Default value is None. - :paramtype agent_name: str - :keyword include_coordinates: Whether to include coordinates for visualization in the response. - Defaults to false. Default value is None. - :paramtype include_coordinates: bool - :return: An iterator like instance of Insight - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.Insight] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Insight]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_beta_insights_list_request( - type=type, - eval_id=eval_id, - run_id=run_id, - agent_name=agent_name, - include_coordinates=include_coordinates, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Insight], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -class BetaMemoryStoresOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`memory_stores` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @overload - async def create( + async def _search_memories( self, - *, name: str, - definition: _models.MemoryStoreDefinition, + *, + scope: str, content_type: str = "application/json", - description: Optional[str] = None, - metadata: Optional[dict[str, str]] = None, + items: Optional[List[dict[str, Any]]] = None, + previous_search_id: Optional[str] = None, + options: Optional[_models.MemorySearchOptions] = None, **kwargs: Any - ) -> _models.MemoryStoreDetails: - """Create a memory store. - - :keyword name: The name of the memory store. Required. - :paramtype name: str - :keyword definition: The memory store definition. Required. - :paramtype definition: ~azure.ai.projects.models.MemoryStoreDefinition - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword description: A human-readable description of the memory store. Default value is None. - :paramtype description: str - :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default - value is None. - :paramtype metadata: dict[str, str] - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - + ) -> _models.MemoryStoreSearchResult: ... @overload - async def create( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDetails: - """Create a memory store. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - + async def _search_memories( + self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryStoreSearchResult: ... @overload - async def create( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDetails: - """Create a memory store. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _search_memories( + self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryStoreSearchResult: ... @distributed_trace_async - async def create( + async def _search_memories( self, + name: str, body: Union[JSON, IO[bytes]] = _Unset, *, - name: str = _Unset, - definition: _models.MemoryStoreDefinition = _Unset, - description: Optional[str] = None, - metadata: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> _models.MemoryStoreDetails: - """Create a memory store. + scope: str = _Unset, + items: Optional[List[dict[str, Any]]] = None, + previous_search_id: Optional[str] = None, + options: Optional[_models.MemorySearchOptions] = None, + **kwargs: Any + ) -> _models.MemoryStoreSearchResult: + """Search for relevant memories from a memory store based on conversation context. + :param name: The name of the memory store to search. Required. + :type name: str :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword name: The name of the memory store. Required. - :paramtype name: str - :keyword definition: The memory store definition. Required. - :paramtype definition: ~azure.ai.projects.models.MemoryStoreDefinition - :keyword description: A human-readable description of the memory store. Default value is None. - :paramtype description: str - :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default - value is None. - :paramtype metadata: dict[str, str] - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. + Required. + :paramtype scope: str + :keyword items: Items for which to search for relevant memories. Default value is None. + :paramtype items: list[dict[str, any]] + :keyword previous_search_id: The unique ID of the previous search request, enabling incremental + memory search from where the last operation left off. Default value is None. + :paramtype previous_search_id: str + :keyword options: Memory search options. Default value is None. + :paramtype options: ~azure.ai.projects.models.MemorySearchOptions + :return: MemoryStoreSearchResult. The MemoryStoreSearchResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreSearchResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6417,14 +10037,17 @@ async def create( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryStoreDetails] = kwargs.pop("cls", None) + cls: ClsType[_models.MemoryStoreSearchResult] = kwargs.pop("cls", None) if body is _Unset: - if name is _Unset: - raise TypeError("missing required argument: name") - if definition is _Unset: - raise TypeError("missing required argument: definition") - body = {"definition": definition, "description": description, "metadata": metadata, "name": name} + if scope is _Unset: + raise TypeError("missing required argument: scope") + body = { + "items": items, + "options": options, + "previous_search_id": previous_search_id, + "scope": scope, + } body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None @@ -6433,7 +10056,8 @@ async def create( else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_memory_stores_create_request( + _request = build_beta_memory_stores_search_memories_request( + name=name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -6469,99 +10093,292 @@ async def create( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryStoreDetails, response.json()) + deserialized = _deserialize(_models.MemoryStoreSearchResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + async def _update_memories_initial( + self, + name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + scope: str = _Unset, + items: Optional[List[dict[str, Any]]] = None, + previous_update_id: Optional[str] = None, + update_delay: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + if body is _Unset: + if scope is _Unset: + raise TypeError("missing required argument: scope") + body = { + "items": items, + "previous_update_id": previous_update_id, + "scope": scope, + "update_delay": update_delay, + } + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_memory_stores_update_memories_request( + name=name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + @overload - async def update( + async def _begin_update_memories( self, name: str, *, + scope: str, content_type: str = "application/json", - description: Optional[str] = None, - metadata: Optional[dict[str, str]] = None, + items: Optional[List[dict[str, Any]]] = None, + previous_update_id: Optional[str] = None, + update_delay: Optional[int] = None, **kwargs: Any - ) -> _models.MemoryStoreDetails: - """Update a memory store. + ) -> AsyncLROPoller[_models.MemoryStoreUpdateCompletedResult]: ... + @overload + async def _begin_update_memories( + self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.MemoryStoreUpdateCompletedResult]: ... + @overload + async def _begin_update_memories( + self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.MemoryStoreUpdateCompletedResult]: ... + + @distributed_trace_async + async def _begin_update_memories( + self, + name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + scope: str = _Unset, + items: Optional[List[dict[str, Any]]] = None, + previous_update_id: Optional[str] = None, + update_delay: Optional[int] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.MemoryStoreUpdateCompletedResult]: + """Update memory store with conversation memories. :param name: The name of the memory store to update. Required. :type name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. + Required. + :paramtype scope: str + :keyword items: Conversation items to be stored in memory. Default value is None. + :paramtype items: list[dict[str, any]] + :keyword previous_update_id: The unique ID of the previous update request, enabling incremental + memory updates from where the last operation left off. Default value is None. + :paramtype previous_update_id: str + :keyword update_delay: Timeout period before processing the memory update in seconds. + If a new update request is received during this period, it will cancel the current request and + reset the timeout. + Set to 0 to immediately trigger the update without delay. + Defaults to 300 (5 minutes). Default value is None. + :paramtype update_delay: int + :return: An instance of AsyncLROPoller that returns MemoryStoreUpdateCompletedResult. The + MemoryStoreUpdateCompletedResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.ai.projects.models.MemoryStoreUpdateCompletedResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MemoryStoreUpdateCompletedResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_memories_initial( + name=name, + body=body, + scope=scope, + items=items, + previous_update_id=previous_update_id, + update_delay=update_delay, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + + deserialized = _deserialize(_models.MemoryStoreUpdateCompletedResult, response.json().get("result", {})) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.MemoryStoreUpdateCompletedResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MemoryStoreUpdateCompletedResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def delete_scope( + self, name: str, *, scope: str, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryStoreDeleteScopeResult: + """Delete all memories associated with a specific scope from a memory store. + + :param name: The name of the memory store. Required. + :type name: str + :keyword scope: The namespace that logically groups and isolates memories to delete, such as a + user ID. Required. + :paramtype scope: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword description: A human-readable description of the memory store. Default value is None. - :paramtype description: str - :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default - value is None. - :paramtype metadata: dict[str, str] - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update( + async def delete_scope( self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDetails: - """Update a memory store. + ) -> _models.MemoryStoreDeleteScopeResult: + """Delete all memories associated with a specific scope from a memory store. - :param name: The name of the memory store to update. Required. + :param name: The name of the memory store. Required. :type name: str :param body: Required. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update( + async def delete_scope( self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDetails: - """Update a memory store. + ) -> _models.MemoryStoreDeleteScopeResult: + """Delete all memories associated with a specific scope from a memory store. - :param name: The name of the memory store to update. Required. + :param name: The name of the memory store. Required. :type name: str :param body: Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def update( - self, - name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - description: Optional[str] = None, - metadata: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> _models.MemoryStoreDetails: - """Update a memory store. + async def delete_scope( + self, name: str, body: Union[JSON, IO[bytes]] = _Unset, *, scope: str = _Unset, **kwargs: Any + ) -> _models.MemoryStoreDeleteScopeResult: + """Delete all memories associated with a specific scope from a memory store. - :param name: The name of the memory store to update. Required. + :param name: The name of the memory store. Required. :type name: str :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword description: A human-readable description of the memory store. Default value is None. - :paramtype description: str - :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default - value is None. - :paramtype metadata: dict[str, str] - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :keyword scope: The namespace that logically groups and isolates memories to delete, such as a + user ID. Required. + :paramtype scope: str + :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6576,10 +10393,12 @@ async def update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryStoreDetails] = kwargs.pop("cls", None) + cls: ClsType[_models.MemoryStoreDeleteScopeResult] = kwargs.pop("cls", None) if body is _Unset: - body = {"description": description, "metadata": metadata} + if scope is _Unset: + raise TypeError("missing required argument: scope") + body = {"scope": scope} body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None @@ -6588,7 +10407,7 @@ async def update( else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_memory_stores_update_request( + _request = build_beta_memory_stores_delete_scope_request( name=name, content_type=content_type, api_version=self._config.api_version, @@ -6625,176 +10444,107 @@ async def update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryStoreDetails, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get(self, name: str, **kwargs: Any) -> _models.MemoryStoreDetails: - """Retrieve a memory store. - - :param name: The name of the memory store to retrieve. Required. - :type name: str - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.MemoryStoreDetails] = kwargs.pop("cls", None) - - _request = build_beta_memory_stores_get_request( - name=name, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.MemoryStoreDetails, response.json()) + deserialized = _deserialize(_models.MemoryStoreDeleteScopeResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list( + @overload + async def create_memory( self, + name: str, *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, + scope: str, + content: str, + kind: Union[str, _models.MemoryItemKind], + content_type: str = "application/json", **kwargs: Any - ) -> AsyncItemPaged["_models.MemoryStoreDetails"]: - """List all memory stores. + ) -> _models.MemoryItem: + """Create a memory item in a memory store. - :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the - default is 20. Default value is None. - :paramtype limit: int - :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for - ascending order and``desc`` - for descending order. Known values are: "asc" and "desc". Default value is None. - :paramtype order: str or ~azure.ai.projects.models.PageOrder - :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your - place in the list. - For instance, if you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page of the list. - Default value is None. - :paramtype before: str - :return: An iterator like instance of MemoryStoreDetails - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.MemoryStoreDetails] + :param name: The name of the memory store. Required. + :type name: str + :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. + Required. + :paramtype scope: str + :keyword content: The content of the memory. Required. + :paramtype content: str + :keyword kind: The kind of the memory item. Known values are: "user_profile", "chat_summary", + and "procedural". Required. + :paramtype kind: str or ~azure.ai.projects.models.MemoryItemKind + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MemoryItem. The MemoryItem is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.MemoryStoreDetails]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(_continuation_token=None): - - _request = build_beta_memory_stores_list_request( - limit=limit, - order=order, - after=_continuation_token, - before=before, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.MemoryStoreDetails], - deserialized.get("data", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("last_id") or None, AsyncList(list_of_elem) - - async def get_next(_continuation_token=None): - _request = prepare_request(_continuation_token) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + @overload + async def create_memory( + self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryItem: + """Create a memory item in a memory store. - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + :param name: The name of the memory store. Required. + :type name: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MemoryItem. The MemoryItem is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryItem + :raises ~azure.core.exceptions.HttpResponseError: + """ - return pipeline_response + @overload + async def create_memory( + self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryItem: + """Create a memory item in a memory store. - return AsyncItemPaged(get_next, extract_data) + :param name: The name of the memory store. Required. + :type name: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: MemoryItem. The MemoryItem is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryItem + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def delete(self, name: str, **kwargs: Any) -> _models.DeleteMemoryStoreResult: - """Delete a memory store. + async def create_memory( + self, + name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + scope: str = _Unset, + content: str = _Unset, + kind: Union[str, _models.MemoryItemKind] = _Unset, + **kwargs: Any + ) -> _models.MemoryItem: + """Create a memory item in a memory store. - :param name: The name of the memory store to delete. Required. + :param name: The name of the memory store. Required. :type name: str - :return: DeleteMemoryStoreResult. The DeleteMemoryStoreResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DeleteMemoryStoreResult + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. + Required. + :paramtype scope: str + :keyword content: The content of the memory. Required. + :paramtype content: str + :keyword kind: The kind of the memory item. Known values are: "user_profile", "chat_summary", + and "procedural". Required. + :paramtype kind: str or ~azure.ai.projects.models.MemoryItemKind + :return: MemoryItem. The MemoryItem is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6805,14 +10555,33 @@ async def delete(self, name: str, **kwargs: Any) -> _models.DeleteMemoryStoreRes } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DeleteMemoryStoreResult] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MemoryItem] = kwargs.pop("cls", None) - _request = build_beta_memory_stores_delete_request( + if body is _Unset: + if scope is _Unset: + raise TypeError("missing required argument: scope") + if content is _Unset: + raise TypeError("missing required argument: content") + if kind is _Unset: + raise TypeError("missing required argument: kind") + body = {"content": content, "kind": kind, "scope": scope} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_memory_stores_create_memory_request( name=name, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -6845,7 +10614,7 @@ async def delete(self, name: str, **kwargs: Any) -> _models.DeleteMemoryStoreRes if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DeleteMemoryStoreResult, response.json()) + deserialized = _deserialize(_models.MemoryItem, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6853,56 +10622,81 @@ async def delete(self, name: str, **kwargs: Any) -> _models.DeleteMemoryStoreRes return deserialized # type: ignore @overload - async def _search_memories( - self, - name: str, - *, - scope: str, - content_type: str = "application/json", - items: Optional[List[dict[str, Any]]] = None, - previous_search_id: Optional[str] = None, - options: Optional[_models.MemorySearchOptions] = None, - **kwargs: Any - ) -> _models.MemoryStoreSearchResult: ... + async def update_memory( + self, name: str, memory_id: str, *, content: str, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryItem: + """Update a memory item in a memory store. + + :param name: The name of the memory store. Required. + :type name: str + :param memory_id: The ID of the memory item to update. Required. + :type memory_id: str + :keyword content: The updated content of the memory. Required. + :paramtype content: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MemoryItem. The MemoryItem is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryItem + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload - async def _search_memories( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreSearchResult: ... + async def update_memory( + self, name: str, memory_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryItem: + """Update a memory item in a memory store. + + :param name: The name of the memory store. Required. + :type name: str + :param memory_id: The ID of the memory item to update. Required. + :type memory_id: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MemoryItem. The MemoryItem is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryItem + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload - async def _search_memories( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreSearchResult: ... + async def update_memory( + self, name: str, memory_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryItem: + """Update a memory item in a memory store. + + :param name: The name of the memory store. Required. + :type name: str + :param memory_id: The ID of the memory item to update. Required. + :type memory_id: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: MemoryItem. The MemoryItem is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryItem + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def _search_memories( - self, - name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - scope: str = _Unset, - items: Optional[List[dict[str, Any]]] = None, - previous_search_id: Optional[str] = None, - options: Optional[_models.MemorySearchOptions] = None, - **kwargs: Any - ) -> _models.MemoryStoreSearchResult: - """Search for relevant memories from a memory store based on conversation context. + async def update_memory( + self, name: str, memory_id: str, body: Union[JSON, IO[bytes]] = _Unset, *, content: str = _Unset, **kwargs: Any + ) -> _models.MemoryItem: + """Update a memory item in a memory store. - :param name: The name of the memory store to search. Required. + :param name: The name of the memory store. Required. :type name: str + :param memory_id: The ID of the memory item to update. Required. + :type memory_id: str :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. - Required. - :paramtype scope: str - :keyword items: Items for which to search for relevant memories. Default value is None. - :paramtype items: list[dict[str, any]] - :keyword previous_search_id: The unique ID of the previous search request, enabling incremental - memory search from where the last operation left off. Default value is None. - :paramtype previous_search_id: str - :keyword options: Memory search options. Default value is None. - :paramtype options: ~azure.ai.projects.models.MemorySearchOptions - :return: MemoryStoreSearchResult. The MemoryStoreSearchResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreSearchResult + :keyword content: The updated content of the memory. Required. + :paramtype content: str + :return: MemoryItem. The MemoryItem is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6917,17 +10711,12 @@ async def _search_memories( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryStoreSearchResult] = kwargs.pop("cls", None) + cls: ClsType[_models.MemoryItem] = kwargs.pop("cls", None) if body is _Unset: - if scope is _Unset: - raise TypeError("missing required argument: scope") - body = { - "items": items, - "options": options, - "previous_search_id": previous_search_id, - "scope": scope, - } + if content is _Unset: + raise TypeError("missing required argument: content") + body = {"content": content} body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None @@ -6936,8 +10725,9 @@ async def _search_memories( else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_memory_stores_search_memories_request( + _request = build_beta_memory_stores_update_memory_request( name=name, + memory_id=memory_id, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -6973,24 +10763,25 @@ async def _search_memories( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryStoreSearchResult, response.json()) + deserialized = _deserialize(_models.MemoryItem, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _update_memories_initial( - self, - name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - scope: str = _Unset, - items: Optional[List[dict[str, Any]]] = None, - previous_update_id: Optional[str] = None, - update_delay: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: + @distributed_trace_async + async def get_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models.MemoryItem: + """Retrieve a memory item from a memory store. + + :param name: The name of the memory store. Required. + :type name: str + :param memory_id: The ID of the memory item to retrieve. Required. + :type memory_id: str + :return: MemoryItem. The MemoryItem is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryItem + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6999,34 +10790,15 @@ async def _update_memories_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - if body is _Unset: - if scope is _Unset: - raise TypeError("missing required argument: scope") - body = { - "items": items, - "previous_update_id": previous_update_id, - "scope": scope, - "update_delay": update_delay, - } - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.MemoryItem] = kwargs.pop("cls", None) - _request = build_beta_memory_stores_update_memories_request( + _request = build_beta_memory_stores_get_memory_request( name=name, - content_type=content_type, + memory_id=memory_id, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -7036,18 +10808,19 @@ async def _update_memories_initial( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -7055,210 +10828,120 @@ async def _update_memories_initial( ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.MemoryItem, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def _begin_update_memories( - self, - name: str, - *, - scope: str, - content_type: str = "application/json", - items: Optional[List[dict[str, Any]]] = None, - previous_update_id: Optional[str] = None, - update_delay: Optional[int] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.MemoryStoreUpdateCompletedResult]: ... - @overload - async def _begin_update_memories( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MemoryStoreUpdateCompletedResult]: ... - @overload - async def _begin_update_memories( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MemoryStoreUpdateCompletedResult]: ... - - @distributed_trace_async - async def _begin_update_memories( + @distributed_trace + def list_memories( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, *, - scope: str = _Unset, - items: Optional[List[dict[str, Any]]] = None, - previous_update_id: Optional[str] = None, - update_delay: Optional[int] = None, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.MemoryStoreUpdateCompletedResult]: - """Update memory store with conversation memories. + ) -> AsyncItemPaged["_models.MemoryItem"]: + """List all memory items in a memory store. - :param name: The name of the memory store to update. Required. + :param name: The name of the memory store. Required. :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. - Required. - :paramtype scope: str - :keyword items: Conversation items to be stored in memory. Default value is None. - :paramtype items: list[dict[str, any]] - :keyword previous_update_id: The unique ID of the previous update request, enabling incremental - memory updates from where the last operation left off. Default value is None. - :paramtype previous_update_id: str - :keyword update_delay: Timeout period before processing the memory update in seconds. - If a new update request is received during this period, it will cancel the current request and - reset the timeout. - Set to 0 to immediately trigger the update without delay. - Defaults to 300 (5 minutes). Default value is None. - :paramtype update_delay: int - :return: An instance of AsyncLROPoller that returns MemoryStoreUpdateCompletedResult. The - MemoryStoreUpdateCompletedResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.ai.projects.models.MemoryStoreUpdateCompletedResult] + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of MemoryItem + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.MemoryItem] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryStoreUpdateCompletedResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_memories_initial( + cls: ClsType[List[_models.MemoryItem]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(_continuation_token=None): + + _request = build_beta_memory_stores_list_memories_request( name=name, - body=body, - scope=scope, - items=items, - previous_update_id=previous_update_id, - update_delay=update_delay, - content_type=content_type, - cls=lambda x, y, z: x, + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, headers=_headers, params=_params, - **kwargs ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Operation-Location"] = self._deserialize( - "str", response.headers.get("Operation-Location") + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.MemoryItem], + deserialized.get("data", []), ) - - deserialized = _deserialize(_models.MemoryStoreUpdateCompletedResult, response.json().get("result", {})) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, AsyncList(list_of_elem) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } + async def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MemoryStoreUpdateCompletedResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return AsyncLROPoller[_models.MemoryStoreUpdateCompletedResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def delete_scope( - self, name: str, *, scope: str, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDeleteScopeResult: - """Delete all memories associated with a specific scope from a memory store. - - :param name: The name of the memory store. Required. - :type name: str - :keyword scope: The namespace that logically groups and isolates memories to delete, such as a - user ID. Required. - :paramtype scope: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def delete_scope( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDeleteScopeResult: - """Delete all memories associated with a specific scope from a memory store. + response = pipeline_response.http_response - :param name: The name of the memory store. Required. - :type name: str - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult - :raises ~azure.core.exceptions.HttpResponseError: - """ + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) - @overload - async def delete_scope( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDeleteScopeResult: - """Delete all memories associated with a specific scope from a memory store. + return pipeline_response - :param name: The name of the memory store. Required. - :type name: str - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult - :raises ~azure.core.exceptions.HttpResponseError: - """ + return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def delete_scope( - self, name: str, body: Union[JSON, IO[bytes]] = _Unset, *, scope: str = _Unset, **kwargs: Any - ) -> _models.MemoryStoreDeleteScopeResult: - """Delete all memories associated with a specific scope from a memory store. + async def delete_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models.DeleteMemoryResponse: + """Delete a memory item from a memory store. :param name: The name of the memory store. Required. :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword scope: The namespace that logically groups and isolates memories to delete, such as a - user ID. Required. - :paramtype scope: str - :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult + :param memory_id: The ID of the memory item to delete. Required. + :type memory_id: str + :return: DeleteMemoryResponse. The DeleteMemoryResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DeleteMemoryResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7269,29 +10952,15 @@ async def delete_scope( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryStoreDeleteScopeResult] = kwargs.pop("cls", None) - - if body is _Unset: - if scope is _Unset: - raise TypeError("missing required argument: scope") - body = {"scope": scope} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.DeleteMemoryResponse] = kwargs.pop("cls", None) - _request = build_beta_memory_stores_delete_scope_request( + _request = build_beta_memory_stores_delete_memory_request( name=name, - content_type=content_type, + memory_id=memory_id, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -7324,7 +10993,7 @@ async def delete_scope( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryStoreDeleteScopeResult, response.json()) + deserialized = _deserialize(_models.DeleteMemoryResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7332,14 +11001,14 @@ async def delete_scope( return deserialized # type: ignore -class BetaRedTeamsOperations: +class BetaModelsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`red_teams` attribute. + :attr:`models` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -7349,16 +11018,21 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def get(self, name: str, **kwargs: Any) -> _models.RedTeam: - """Get a redteam by name. + @distributed_trace + def list_versions(self, name: str, **kwargs: Any) -> AsyncItemPaged["_models.ModelVersion"]: + """List all versions of the given ModelVersion. - :param name: Identifier of the red team run. Required. + :param name: The name of the resource. Required. :type name: str - :return: RedTeam. The RedTeam is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.RedTeam + :return: An iterator like instance of ModelVersion + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.ModelVersion] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ModelVersion]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7367,61 +11041,86 @@ async def get(self, name: str, **kwargs: Any) -> _models.RedTeam: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[_models.RedTeam] = kwargs.pop("cls", None) + _request = build_beta_models_list_versions_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_beta_red_teams_get_request( - name=name, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ModelVersion], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.RedTeam, response.json()) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.RedTeam"]: - """List a redteam by name. + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.ModelVersion"]: + """List the latest version of each ModelVersion. - :return: An iterator like instance of RedTeam - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.RedTeam] + :return: An iterator like instance of ModelVersion + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.ModelVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RedTeam]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ModelVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7434,7 +11133,7 @@ def list(self, **kwargs: Any) -> AsyncItemPaged["_models.RedTeam"]: def prepare_request(next_link=None): if not next_link: - _request = build_beta_red_teams_list_request( + _request = build_beta_models_list_request( api_version=self._config.api_version, headers=_headers, params=_params, @@ -7474,7 +11173,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RedTeam], + List[_models.ModelVersion], deserialized.get("value", []), ) if cls: @@ -7498,61 +11197,214 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + @distributed_trace_async + async def get(self, name: str, version: str, **kwargs: Any) -> _models.ModelVersion: + """Get the specific version of the ModelVersion. The service returns 404 Not Found error if the + ModelVersion does not exist. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the ModelVersion to retrieve. Required. + :type version: str + :return: ModelVersion. The ModelVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ModelVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelVersion] = kwargs.pop("cls", None) + + _request = build_beta_models_get_request( + name=name, + version=version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ModelVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, name: str, version: str, **kwargs: Any) -> None: + """Delete the specific version of the ModelVersion. The service returns 200 OK if the ModelVersion + was deleted successfully or if the ModelVersion does not exist. + + :param name: The name of the resource. Required. + :type name: str + :param version: The version of the ModelVersion to delete. Required. + :type version: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_beta_models_delete_request( + name=name, + version=version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + @overload - async def create( - self, red_team: _models.RedTeam, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RedTeam: - """Creates a redteam run. + async def update( + self, + name: str, + version: str, + body: _models.UpdateModelVersionRequest, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.ModelVersion: + """Update an existing ModelVersion with the given version id. - :param red_team: Redteam to be run. Required. - :type red_team: ~azure.ai.projects.models.RedTeam + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the UpdateModelVersionRequest to create or update. + Required. + :type version: str + :param body: The UpdateModelVersionRequest to create or update. Required. + :type body: ~azure.ai.projects.models.UpdateModelVersionRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". + Default value is "application/merge-patch+json". :paramtype content_type: str - :return: RedTeam. The RedTeam is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.RedTeam + :return: ModelVersion. The ModelVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ModelVersion :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create(self, red_team: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.RedTeam: - """Creates a redteam run. + async def update( + self, name: str, version: str, body: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any + ) -> _models.ModelVersion: + """Update an existing ModelVersion with the given version id. - :param red_team: Redteam to be run. Required. - :type red_team: JSON + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the UpdateModelVersionRequest to create or update. + Required. + :type version: str + :param body: The UpdateModelVersionRequest to create or update. Required. + :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". + Default value is "application/merge-patch+json". :paramtype content_type: str - :return: RedTeam. The RedTeam is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.RedTeam + :return: ModelVersion. The ModelVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ModelVersion :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create( - self, red_team: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RedTeam: - """Creates a redteam run. + async def update( + self, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.ModelVersion: + """Update an existing ModelVersion with the given version id. - :param red_team: Redteam to be run. Required. - :type red_team: IO[bytes] + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the UpdateModelVersionRequest to create or update. + Required. + :type version: str + :param body: The UpdateModelVersionRequest to create or update. Required. + :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". + Default value is "application/merge-patch+json". :paramtype content_type: str - :return: RedTeam. The RedTeam is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.RedTeam + :return: ModelVersion. The ModelVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ModelVersion :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create(self, red_team: Union[_models.RedTeam, JSON, IO[bytes]], **kwargs: Any) -> _models.RedTeam: - """Creates a redteam run. + async def update( + self, name: str, version: str, body: Union[_models.UpdateModelVersionRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.ModelVersion: + """Update an existing ModelVersion with the given version id. - :param red_team: Redteam to be run. Is one of the following types: RedTeam, JSON, IO[bytes] + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the UpdateModelVersionRequest to create or update. Required. - :type red_team: ~azure.ai.projects.models.RedTeam or JSON or IO[bytes] - :return: RedTeam. The RedTeam is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.RedTeam + :type version: str + :param body: The UpdateModelVersionRequest to create or update. Is one of the following types: + UpdateModelVersionRequest, JSON, IO[bytes] Required. + :type body: ~azure.ai.projects.models.UpdateModelVersionRequest or JSON or IO[bytes] + :return: ModelVersion. The ModelVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ModelVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7567,16 +11419,18 @@ async def create(self, red_team: Union[_models.RedTeam, JSON, IO[bytes]], **kwar _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RedTeam] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelVersion] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/merge-patch+json" _content = None - if isinstance(red_team, (IOBase, bytes)): - _content = red_team + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(red_team, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_red_teams_create_request( + _request = build_beta_models_update_request( + name=name, + version=version, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -7596,55 +11450,110 @@ async def create(self, red_team: Union[_models.RedTeam, JSON, IO[bytes]], **kwar response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200, 201]: if _stream: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.RedTeam, response.json()) + deserialized = _deserialize(_models.ModelVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + @overload + async def create_async( + self, + name: str, + version: str, + body: _models.ModelVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CreateAsyncResponse: + """Creates a model version asynchronously with blob content validation. Returns 202 Accepted with + a Location header for polling. -class BetaSchedulesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + :param name: Name of the model. Required. + :type name: str + :param version: Version of the model. Required. + :type version: str + :param body: Model version to create. Required. + :type body: ~azure.ai.projects.models.ModelVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CreateAsyncResponse. The CreateAsyncResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.CreateAsyncResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ - Instead, you should access the following operations through - :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`schedules` attribute. - """ + @overload + async def create_async( + self, name: str, version: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CreateAsyncResponse: + """Creates a model version asynchronously with blob content validation. Returns 202 Accepted with + a Location header for polling. + + :param name: Name of the model. Required. + :type name: str + :param version: Version of the model. Required. + :type version: str + :param body: Model version to create. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CreateAsyncResponse. The CreateAsyncResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.CreateAsyncResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + async def create_async( + self, name: str, version: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CreateAsyncResponse: + """Creates a model version asynchronously with blob content validation. Returns 202 Accepted with + a Location header for polling. + + :param name: Name of the model. Required. + :type name: str + :param version: Version of the model. Required. + :type version: str + :param body: Model version to create. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CreateAsyncResponse. The CreateAsyncResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.CreateAsyncResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def delete(self, schedule_id: str, **kwargs: Any) -> None: - """Delete a schedule. + async def create_async( + self, name: str, version: str, body: Union[_models.ModelVersion, JSON, IO[bytes]], **kwargs: Any + ) -> _models.CreateAsyncResponse: + """Creates a model version asynchronously with blob content validation. Returns 202 Accepted with + a Location header for polling. - :param schedule_id: Identifier of the schedule. Required. - :type schedule_id: str - :return: None - :rtype: None + :param name: Name of the model. Required. + :type name: str + :param version: Version of the model. Required. + :type version: str + :param body: Model version to create. Is one of the following types: ModelVersion, JSON, + IO[bytes] Required. + :type body: ~azure.ai.projects.models.ModelVersion or JSON or IO[bytes] + :return: CreateAsyncResponse. The CreateAsyncResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.CreateAsyncResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7655,14 +11564,25 @@ async def delete(self, schedule_id: str, **kwargs: Any) -> None: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CreateAsyncResponse] = kwargs.pop("cls", None) - _request = build_beta_schedules_delete_request( - schedule_id=schedule_id, + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_models_create_async_request( + name=name, + version=version, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -7671,28 +11591,121 @@ async def delete(self, schedule_id: str, **kwargs: Any) -> None: } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [202]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CreateAsyncResponse, response.json()) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def pending_upload( + self, + name: str, + version: str, + body: _models.ModelPendingUploadRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ModelPendingUploadResponse: + """Start or retrieve a pending upload for a model version. + + :param name: Name of the model. Required. + :type name: str + :param version: Version of the model. Required. + :type version: str + :param body: Required. + :type body: ~azure.ai.projects.models.ModelPendingUploadRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ModelPendingUploadResponse. The ModelPendingUploadResponse is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.ModelPendingUploadResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def pending_upload( + self, name: str, version: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ModelPendingUploadResponse: + """Start or retrieve a pending upload for a model version. + + :param name: Name of the model. Required. + :type name: str + :param version: Version of the model. Required. + :type version: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ModelPendingUploadResponse. The ModelPendingUploadResponse is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.ModelPendingUploadResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def pending_upload( + self, name: str, version: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ModelPendingUploadResponse: + """Start or retrieve a pending upload for a model version. + + :param name: Name of the model. Required. + :type name: str + :param version: Version of the model. Required. + :type version: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ModelPendingUploadResponse. The ModelPendingUploadResponse is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.ModelPendingUploadResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def get(self, schedule_id: str, **kwargs: Any) -> _models.Schedule: - """Get a schedule by id. + async def pending_upload( + self, name: str, version: str, body: Union[_models.ModelPendingUploadRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.ModelPendingUploadResponse: + """Start or retrieve a pending upload for a model version. - :param schedule_id: Identifier of the schedule. Required. - :type schedule_id: str - :return: Schedule. The Schedule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Schedule + :param name: Name of the model. Required. + :type name: str + :param version: Version of the model. Required. + :type version: str + :param body: Is one of the following types: ModelPendingUploadRequest, JSON, IO[bytes] + Required. + :type body: ~azure.ai.projects.models.ModelPendingUploadRequest or JSON or IO[bytes] + :return: ModelPendingUploadResponse. The ModelPendingUploadResponse is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.ModelPendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7703,14 +11716,25 @@ async def get(self, schedule_id: str, **kwargs: Any) -> _models.Schedule: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ModelPendingUploadResponse] = kwargs.pop("cls", None) - _request = build_beta_schedules_get_request( - schedule_id=schedule_id, + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_models_pending_upload_request( + name=name, + version=version, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -7739,181 +11763,93 @@ async def get(self, schedule_id: str, **kwargs: Any) -> _models.Schedule: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Schedule, response.json()) + deserialized = _deserialize(_models.ModelPendingUploadResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list( + @overload + async def get_credentials( self, + name: str, + version: str, + body: _models.ModelCredentialRequest, *, - type: Optional[Union[str, _models.ScheduleTaskType]] = None, - enabled: Optional[bool] = None, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncItemPaged["_models.Schedule"]: - """List all schedules. - - :keyword type: Filter by the type of schedule. Known values are: "Evaluation" and "Insight". - Default value is None. - :paramtype type: str or ~azure.ai.projects.models.ScheduleTaskType - :keyword enabled: Filter by the enabled status. Default value is None. - :paramtype enabled: bool - :return: An iterator like instance of Schedule - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.Schedule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Schedule]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_beta_schedules_list_request( - type=type, - enabled=enabled, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Schedule], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) + ) -> _models.DatasetCredential: + """Get credentials for a model version asset. - @overload - async def create_or_update( - self, schedule_id: str, schedule: _models.Schedule, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Schedule: - """Create or update operation template. - - :param schedule_id: Identifier of the schedule. Required. - :type schedule_id: str - :param schedule: The resource instance. Required. - :type schedule: ~azure.ai.projects.models.Schedule + :param name: Name of the model. Required. + :type name: str + :param version: Version of the model. Required. + :type version: str + :param body: Required. + :type body: ~azure.ai.projects.models.ModelCredentialRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". - :paramtype content_type: str - :return: Schedule. The Schedule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Schedule + :paramtype content_type: str + :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetCredential :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_or_update( - self, schedule_id: str, schedule: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Schedule: - """Create or update operation template. + async def get_credentials( + self, name: str, version: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.DatasetCredential: + """Get credentials for a model version asset. - :param schedule_id: Identifier of the schedule. Required. - :type schedule_id: str - :param schedule: The resource instance. Required. - :type schedule: JSON + :param name: Name of the model. Required. + :type name: str + :param version: Version of the model. Required. + :type version: str + :param body: Required. + :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Schedule. The Schedule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Schedule + :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetCredential :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_or_update( - self, schedule_id: str, schedule: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Schedule: - """Create or update operation template. + async def get_credentials( + self, name: str, version: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.DatasetCredential: + """Get credentials for a model version asset. - :param schedule_id: Identifier of the schedule. Required. - :type schedule_id: str - :param schedule: The resource instance. Required. - :type schedule: IO[bytes] + :param name: Name of the model. Required. + :type name: str + :param version: Version of the model. Required. + :type version: str + :param body: Required. + :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: Schedule. The Schedule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Schedule + :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetCredential :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create_or_update( - self, schedule_id: str, schedule: Union[_models.Schedule, JSON, IO[bytes]], **kwargs: Any - ) -> _models.Schedule: - """Create or update operation template. + async def get_credentials( + self, name: str, version: str, body: Union[_models.ModelCredentialRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.DatasetCredential: + """Get credentials for a model version asset. - :param schedule_id: Identifier of the schedule. Required. - :type schedule_id: str - :param schedule: The resource instance. Is one of the following types: Schedule, JSON, - IO[bytes] Required. - :type schedule: ~azure.ai.projects.models.Schedule or JSON or IO[bytes] - :return: Schedule. The Schedule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Schedule + :param name: Name of the model. Required. + :type name: str + :param version: Version of the model. Required. + :type version: str + :param body: Is one of the following types: ModelCredentialRequest, JSON, IO[bytes] Required. + :type body: ~azure.ai.projects.models.ModelCredentialRequest or JSON or IO[bytes] + :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetCredential :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7928,17 +11864,18 @@ async def create_or_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) + cls: ClsType[_models.DatasetCredential] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(schedule, (IOBase, bytes)): - _content = schedule + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(schedule, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_schedules_create_or_update_request( - schedule_id=schedule_id, + _request = build_beta_models_get_credentials_request( + name=name, + version=version, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -7958,7 +11895,7 @@ async def create_or_update( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200]: if _stream: try: await response.read() # Load the body in memory and close the socket @@ -7970,23 +11907,39 @@ async def create_or_update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Schedule, response.json()) + deserialized = _deserialize(_models.DatasetCredential, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + +class BetaRedTeamsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.aio.AIProjectClient`'s + :attr:`red_teams` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async - async def get_run(self, schedule_id: str, run_id: str, **kwargs: Any) -> _models.ScheduleRun: - """Get a schedule run by id. + async def get(self, name: str, **kwargs: Any) -> _models.RedTeam: + """Get a redteam by name. - :param schedule_id: The unique identifier of the schedule. Required. - :type schedule_id: str - :param run_id: The unique identifier of the schedule run. Required. - :type run_id: str - :return: ScheduleRun. The ScheduleRun is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ScheduleRun + :param name: Identifier of the red team run. Required. + :type name: str + :return: RedTeam. The RedTeam is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.RedTeam :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8000,11 +11953,10 @@ async def get_run(self, schedule_id: str, run_id: str, **kwargs: Any) -> _models _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ScheduleRun] = kwargs.pop("cls", None) + cls: ClsType[_models.RedTeam] = kwargs.pop("cls", None) - _request = build_beta_schedules_get_run_request( - schedule_id=schedule_id, - run_id=run_id, + _request = build_beta_red_teams_get_request( + name=name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -8029,16 +11981,12 @@ async def get_run(self, schedule_id: str, run_id: str, **kwargs: Any) -> _models except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ScheduleRun, response.json()) + deserialized = _deserialize(_models.RedTeam, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8046,31 +11994,17 @@ async def get_run(self, schedule_id: str, run_id: str, **kwargs: Any) -> _models return deserialized # type: ignore @distributed_trace - def list_runs( - self, - schedule_id: str, - *, - type: Optional[Union[str, _models.ScheduleTaskType]] = None, - enabled: Optional[bool] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.ScheduleRun"]: - """List all schedule runs. + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.RedTeam"]: + """List a redteam by name. - :param schedule_id: Identifier of the schedule. Required. - :type schedule_id: str - :keyword type: Filter by the type of schedule. Known values are: "Evaluation" and "Insight". - Default value is None. - :paramtype type: str or ~azure.ai.projects.models.ScheduleTaskType - :keyword enabled: Filter by the enabled status. Default value is None. - :paramtype enabled: bool - :return: An iterator like instance of ScheduleRun - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.ScheduleRun] + :return: An iterator like instance of RedTeam + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.RedTeam] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ScheduleRun]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RedTeam]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8083,10 +12017,7 @@ def list_runs( def prepare_request(next_link=None): if not next_link: - _request = build_beta_schedules_list_runs_request( - schedule_id=schedule_id, - type=type, - enabled=enabled, + _request = build_beta_red_teams_list_request( api_version=self._config.api_version, headers=_headers, params=_params, @@ -8126,7 +12057,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.ScheduleRun], + List[_models.RedTeam], deserialized.get("value", []), ) if cls: @@ -8136,29 +12067,150 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): _request = prepare_request(next_link) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def create( + self, red_team: _models.RedTeam, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.RedTeam: + """Creates a redteam run. + + :param red_team: Redteam to be run. Required. + :type red_team: ~azure.ai.projects.models.RedTeam + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RedTeam. The RedTeam is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.RedTeam + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create(self, red_team: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.RedTeam: + """Creates a redteam run. + + :param red_team: Redteam to be run. Required. + :type red_team: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RedTeam. The RedTeam is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.RedTeam + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, red_team: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.RedTeam: + """Creates a redteam run. + + :param red_team: Redteam to be run. Required. + :type red_team: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: RedTeam. The RedTeam is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.RedTeam + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create(self, red_team: Union[_models.RedTeam, JSON, IO[bytes]], **kwargs: Any) -> _models.RedTeam: + """Creates a redteam run. + + :param red_team: Redteam to be run. Is one of the following types: RedTeam, JSON, IO[bytes] + Required. + :type red_team: ~azure.ai.projects.models.RedTeam or JSON or IO[bytes] + :return: RedTeam. The RedTeam is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.RedTeam + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RedTeam] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(red_team, (IOBase, bytes)): + _content = red_team + else: + _content = json.dumps(red_team, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_red_teams_create_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, ) - response = pipeline_response.http_response + raise HttpResponseError(response=response, model=error) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RedTeam, response.json()) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return AsyncItemPaged(get_next, extract_data) + return deserialized # type: ignore -class BetaToolboxesOperations: +class BetaRoutinesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`toolboxes` attribute. + :attr:`routines` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -8169,107 +12221,103 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload - async def create_version( + async def create_or_update( self, - name: str, + routine_name: str, *, - tools: List[_models.Tool], + triggers: dict[str, _models.RoutineTrigger], + action: _models.RoutineAction, content_type: str = "application/json", description: Optional[str] = None, - metadata: Optional[dict[str, str]] = None, - policies: Optional[_models.ToolboxPolicies] = None, + enabled: Optional[bool] = None, **kwargs: Any - ) -> _models.ToolboxVersionObject: - """Create a new version of a toolbox. If the toolbox does not exist, it will be created. - - :param name: The name of the toolbox. If the toolbox does not exist, it will be created. - Required. - :type name: str - :keyword tools: The list of tools to include in this version. Required. - :paramtype tools: list[~azure.ai.projects.models.Tool] + ) -> _models.Routine: + """Create or update a routine. + + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :keyword triggers: The triggers configured for the routine. In v1, exactly one trigger entry is + supported. Required. + :paramtype triggers: dict[str, ~azure.ai.projects.models.RoutineTrigger] + :keyword action: The action executed when the routine fires. Required. + :paramtype action: ~azure.ai.projects.models.RoutineAction :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword description: A human-readable description of the toolbox. Default value is None. + :keyword description: A human-readable description of the routine. Default value is None. :paramtype description: str - :keyword metadata: Arbitrary key-value metadata to associate with the toolbox. Default value is - None. - :paramtype metadata: dict[str, str] - :keyword policies: Policy configuration for this toolbox version. Default value is None. - :paramtype policies: ~azure.ai.projects.models.ToolboxPolicies - :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxVersionObject + :keyword enabled: Whether the routine is enabled. Default value is None. + :paramtype enabled: bool + :return: Routine. The Routine is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Routine :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_version( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxVersionObject: - """Create a new version of a toolbox. If the toolbox does not exist, it will be created. + async def create_or_update( + self, routine_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.Routine: + """Create or update a routine. - :param name: The name of the toolbox. If the toolbox does not exist, it will be created. - Required. - :type name: str + :param routine_name: The unique name of the routine. Required. + :type routine_name: str :param body: Required. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxVersionObject + :return: Routine. The Routine is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Routine :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_version( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxVersionObject: - """Create a new version of a toolbox. If the toolbox does not exist, it will be created. + async def create_or_update( + self, routine_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.Routine: + """Create or update a routine. - :param name: The name of the toolbox. If the toolbox does not exist, it will be created. - Required. - :type name: str + :param routine_name: The unique name of the routine. Required. + :type routine_name: str :param body: Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxVersionObject + :return: Routine. The Routine is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Routine :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create_version( + async def create_or_update( self, - name: str, + routine_name: str, body: Union[JSON, IO[bytes]] = _Unset, *, - tools: List[_models.Tool] = _Unset, + triggers: dict[str, _models.RoutineTrigger] = _Unset, + action: _models.RoutineAction = _Unset, description: Optional[str] = None, - metadata: Optional[dict[str, str]] = None, - policies: Optional[_models.ToolboxPolicies] = None, + enabled: Optional[bool] = None, **kwargs: Any - ) -> _models.ToolboxVersionObject: - """Create a new version of a toolbox. If the toolbox does not exist, it will be created. + ) -> _models.Routine: + """Create or update a routine. - :param name: The name of the toolbox. If the toolbox does not exist, it will be created. - Required. - :type name: str + :param routine_name: The unique name of the routine. Required. + :type routine_name: str :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword tools: The list of tools to include in this version. Required. - :paramtype tools: list[~azure.ai.projects.models.Tool] - :keyword description: A human-readable description of the toolbox. Default value is None. + :keyword triggers: The triggers configured for the routine. In v1, exactly one trigger entry is + supported. Required. + :paramtype triggers: dict[str, ~azure.ai.projects.models.RoutineTrigger] + :keyword action: The action executed when the routine fires. Required. + :paramtype action: ~azure.ai.projects.models.RoutineAction + :keyword description: A human-readable description of the routine. Default value is None. :paramtype description: str - :keyword metadata: Arbitrary key-value metadata to associate with the toolbox. Default value is - None. - :paramtype metadata: dict[str, str] - :keyword policies: Policy configuration for this toolbox version. Default value is None. - :paramtype policies: ~azure.ai.projects.models.ToolboxPolicies - :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxVersionObject + :keyword enabled: Whether the routine is enabled. Default value is None. + :paramtype enabled: bool + :return: Routine. The Routine is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Routine :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8284,12 +12332,14 @@ async def create_version( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ToolboxVersionObject] = kwargs.pop("cls", None) + cls: ClsType[_models.Routine] = kwargs.pop("cls", None) if body is _Unset: - if tools is _Unset: - raise TypeError("missing required argument: tools") - body = {"description": description, "metadata": metadata, "policies": policies, "tools": tools} + if triggers is _Unset: + raise TypeError("missing required argument: triggers") + if action is _Unset: + raise TypeError("missing required argument: action") + body = {"action": action, "description": description, "enabled": enabled, "triggers": triggers} body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None @@ -8298,11 +12348,206 @@ async def create_version( else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_toolboxes_create_version_request( - name=name, - content_type=content_type, + _request = build_beta_routines_create_or_update_request( + routine_name=routine_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Routine, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get(self, routine_name: str, **kwargs: Any) -> _models.Routine: + """Retrieve a routine. + + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :return: Routine. The Routine is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Routine + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Routine] = kwargs.pop("cls", None) + + _request = build_beta_routines_get_request( + routine_name=routine_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Routine, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def enable(self, routine_name: str, **kwargs: Any) -> _models.Routine: + """Enable a routine. + + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :return: Routine. The Routine is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Routine + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Routine] = kwargs.pop("cls", None) + + _request = build_beta_routines_enable_request( + routine_name=routine_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Routine, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def disable(self, routine_name: str, **kwargs: Any) -> _models.Routine: + """Disable a routine. + + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :return: Routine. The Routine is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Routine + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Routine] = kwargs.pop("cls", None) + + _request = build_beta_routines_disable_request( + routine_name=routine_name, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -8335,21 +12580,111 @@ async def create_version( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ToolboxVersionObject, response.json()) + deserialized = _deserialize(_models.Routine, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + @distributed_trace + def list( + self, + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.Routine"]: + """List routines. + + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of Routine + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.Routine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Routine]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(_continuation_token=None): + + _request = build_beta_routines_list_request( + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Routine], + deserialized.get("data", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, AsyncList(list_of_elem) + + async def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + @distributed_trace_async - async def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: - """Retrieve a toolbox. + async def delete(self, routine_name: str, **kwargs: Any) -> None: + """Delete a routine. - :param name: The name of the toolbox to retrieve. Required. - :type name: str - :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxObject + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8363,10 +12698,10 @@ async def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ToolboxObject] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_toolboxes_get_request( - name=name, + _request = build_beta_routines_delete_request( + routine_name=routine_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -8376,20 +12711,14 @@ async def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -8397,27 +12726,27 @@ async def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: ) raise HttpResponseError(response=response, model=error) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.ToolboxObject, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - def list( + def list_runs( self, + routine_name: str, *, + filter: Optional[str] = None, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.ToolboxObject"]: - """List all toolboxes. - + ) -> AsyncItemPaged["_models.RoutineRun"]: + """List prior runs for a routine. + + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :keyword filter: An optional MLflow search-runs filter expression applied within the routine's + experiment. Default value is None. + :paramtype filter: str :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None. @@ -8432,14 +12761,14 @@ def list( subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None. :paramtype before: str - :return: An iterator like instance of ToolboxObject - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.ToolboxObject] + :return: An iterator like instance of RoutineRun + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.RoutineRun] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ToolboxObject]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RoutineRun]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8451,7 +12780,9 @@ def list( def prepare_request(_continuation_token=None): - _request = build_beta_toolboxes_list_request( + _request = build_beta_routines_list_runs_request( + routine_name=routine_name, + filter=filter, limit=limit, order=order, after=_continuation_token, @@ -8469,7 +12800,7 @@ def prepare_request(_continuation_token=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.ToolboxObject], + List[_models.RoutineRun], deserialized.get("data", []), ) if cls: @@ -8495,45 +12826,186 @@ async def get_next(_continuation_token=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + return AsyncItemPaged(get_next, extract_data) + + @overload + async def dispatch_async( + self, + routine_name: str, + *, + content_type: str = "application/json", + payload: Optional[_models.RoutineDispatchPayload] = None, + **kwargs: Any + ) -> _models.DispatchRoutineResponse: + """Queue an asynchronous routine dispatch. + + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword payload: A direct action-input override sent downstream when testing a routine. + Default value is None. + :paramtype payload: ~azure.ai.projects.models.RoutineDispatchPayload + :return: DispatchRoutineResponse. The DispatchRoutineResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DispatchRoutineResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def dispatch_async( + self, routine_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.DispatchRoutineResponse: + """Queue an asynchronous routine dispatch. + + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DispatchRoutineResponse. The DispatchRoutineResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DispatchRoutineResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def dispatch_async( + self, routine_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.DispatchRoutineResponse: + """Queue an asynchronous routine dispatch. + + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DispatchRoutineResponse. The DispatchRoutineResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DispatchRoutineResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def dispatch_async( + self, + routine_name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + payload: Optional[_models.RoutineDispatchPayload] = None, + **kwargs: Any + ) -> _models.DispatchRoutineResponse: + """Queue an asynchronous routine dispatch. + + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword payload: A direct action-input override sent downstream when testing a routine. + Default value is None. + :paramtype payload: ~azure.ai.projects.models.RoutineDispatchPayload + :return: DispatchRoutineResponse. The DispatchRoutineResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DispatchRoutineResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DispatchRoutineResponse] = kwargs.pop("cls", None) + + if body is _Unset: + body = {"payload": payload} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_routines_dispatch_async_request( + routine_name=routine_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DispatchRoutineResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class BetaSchedulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.aio.AIProjectClient`'s + :attr:`schedules` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list_versions( - self, - name: str, - *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.ToolboxVersionObject"]: - """List all versions of a toolbox. + @distributed_trace_async + async def delete(self, schedule_id: str, **kwargs: Any) -> None: + """Delete a schedule. - :param name: The name of the toolbox to list versions for. Required. - :type name: str - :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the - default is 20. Default value is None. - :paramtype limit: int - :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for - ascending order and``desc`` - for descending order. Known values are: "asc" and "desc". Default value is None. - :paramtype order: str or ~azure.ai.projects.models.PageOrder - :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your - place in the list. - For instance, if you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page of the list. - Default value is None. - :paramtype before: str - :return: An iterator like instance of ToolboxVersionObject - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.ToolboxVersionObject] + :param schedule_id: Identifier of the schedule. Required. + :type schedule_id: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.ToolboxVersionObject]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8542,65 +13014,44 @@ def list_versions( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(_continuation_token=None): - - _request = build_beta_toolboxes_list_versions_request( - name=name, - limit=limit, - order=order, - after=_continuation_token, - before=before, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.ToolboxVersionObject], - deserialized.get("data", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("last_id") or None, AsyncList(list_of_elem) + cls: ClsType[None] = kwargs.pop("cls", None) - async def get_next(_continuation_token=None): - _request = prepare_request(_continuation_token) + _request = build_beta_schedules_delete_request( + schedule_id=schedule_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + response = pipeline_response.http_response - return pipeline_response + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async - async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.ToolboxVersionObject: - """Retrieve a specific version of a toolbox. + async def get(self, schedule_id: str, **kwargs: Any) -> _models.Schedule: + """Get a schedule by id. - :param name: The name of the toolbox. Required. - :type name: str - :param version: The version identifier to retrieve. Required. - :type version: str - :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxVersionObject + :param schedule_id: Identifier of the schedule. Required. + :type schedule_id: str + :return: Schedule. The Schedule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Schedule :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8614,11 +13065,10 @@ async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.T _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ToolboxVersionObject] = kwargs.pop("cls", None) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) - _request = build_beta_toolboxes_get_version_request( - name=name, - version=version, + _request = build_beta_schedules_get_request( + schedule_id=schedule_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -8643,92 +13093,186 @@ async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.T except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ToolboxVersionObject, response.json()) + deserialized = _deserialize(_models.Schedule, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + @distributed_trace + def list( + self, + *, + type: Optional[Union[str, _models.ScheduleTaskType]] = None, + enabled: Optional[bool] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.Schedule"]: + """List all schedules. + + :keyword type: Filter by the type of schedule. Known values are: "Evaluation" and "Insight". + Default value is None. + :paramtype type: str or ~azure.ai.projects.models.ScheduleTaskType + :keyword enabled: Filter by the enabled status. Default value is None. + :paramtype enabled: bool + :return: An iterator like instance of Schedule + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.Schedule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Schedule]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_beta_schedules_list_request( + type=type, + enabled=enabled, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Schedule], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + @overload - async def update( - self, name: str, *, default_version: str, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxObject: - """Update a toolbox to point to a specific version. + async def create_or_update( + self, schedule_id: str, schedule: _models.Schedule, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.Schedule: + """Create or update operation template. - :param name: The name of the toolbox to update. Required. - :type name: str - :keyword default_version: The version identifier that the toolbox should point to. When set, - the toolbox's default version will resolve to this version instead of the latest. Required. - :paramtype default_version: str + :param schedule_id: Identifier of the schedule. Required. + :type schedule_id: str + :param schedule: The resource instance. Required. + :type schedule: ~azure.ai.projects.models.Schedule :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxObject + :return: Schedule. The Schedule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Schedule :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxObject: - """Update a toolbox to point to a specific version. + async def create_or_update( + self, schedule_id: str, schedule: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.Schedule: + """Create or update operation template. - :param name: The name of the toolbox to update. Required. - :type name: str - :param body: Required. - :type body: JSON + :param schedule_id: Identifier of the schedule. Required. + :type schedule_id: str + :param schedule: The resource instance. Required. + :type schedule: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxObject + :return: Schedule. The Schedule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Schedule :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxObject: - """Update a toolbox to point to a specific version. + async def create_or_update( + self, schedule_id: str, schedule: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.Schedule: + """Create or update operation template. - :param name: The name of the toolbox to update. Required. - :type name: str - :param body: Required. - :type body: IO[bytes] + :param schedule_id: Identifier of the schedule. Required. + :type schedule_id: str + :param schedule: The resource instance. Required. + :type schedule: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxObject + :return: Schedule. The Schedule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Schedule :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def update( - self, name: str, body: Union[JSON, IO[bytes]] = _Unset, *, default_version: str = _Unset, **kwargs: Any - ) -> _models.ToolboxObject: - """Update a toolbox to point to a specific version. + async def create_or_update( + self, schedule_id: str, schedule: Union[_models.Schedule, JSON, IO[bytes]], **kwargs: Any + ) -> _models.Schedule: + """Create or update operation template. - :param name: The name of the toolbox to update. Required. - :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword default_version: The version identifier that the toolbox should point to. When set, - the toolbox's default version will resolve to this version instead of the latest. Required. - :paramtype default_version: str - :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxObject + :param schedule_id: Identifier of the schedule. Required. + :type schedule_id: str + :param schedule: The resource instance. Is one of the following types: Schedule, JSON, + IO[bytes] Required. + :type schedule: ~azure.ai.projects.models.Schedule or JSON or IO[bytes] + :return: Schedule. The Schedule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Schedule :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8743,22 +13287,17 @@ async def update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ToolboxObject] = kwargs.pop("cls", None) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) - if body is _Unset: - if default_version is _Unset: - raise TypeError("missing required argument: default_version") - body = {"default_version": default_version} - body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(schedule, (IOBase, bytes)): + _content = schedule else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(schedule, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_toolboxes_update_request( - name=name, + _request = build_beta_schedules_create_or_update_request( + schedule_id=schedule_id, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -8778,23 +13317,19 @@ async def update( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: if _stream: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ToolboxObject, response.json()) + deserialized = _deserialize(_models.Schedule, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8802,13 +13337,15 @@ async def update( return deserialized # type: ignore @distributed_trace_async - async def delete(self, name: str, **kwargs: Any) -> None: - """Delete a toolbox and all its versions. + async def get_run(self, schedule_id: str, run_id: str, **kwargs: Any) -> _models.ScheduleRun: + """Get a schedule run by id. - :param name: The name of the toolbox to delete. Required. - :type name: str - :return: None - :rtype: None + :param schedule_id: The unique identifier of the schedule. Required. + :type schedule_id: str + :param run_id: The unique identifier of the schedule run. Required. + :type run_id: str + :return: ScheduleRun. The ScheduleRun is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ScheduleRun :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8822,10 +13359,11 @@ async def delete(self, name: str, **kwargs: Any) -> None: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.ScheduleRun] = kwargs.pop("cls", None) - _request = build_beta_toolboxes_delete_request( - name=name, + _request = build_beta_schedules_get_run_request( + schedule_id=schedule_id, + run_id=run_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -8835,14 +13373,20 @@ async def delete(self, name: str, **kwargs: Any) -> None: } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -8850,21 +13394,43 @@ async def delete(self, name: str, **kwargs: Any) -> None: ) raise HttpResponseError(response=response, model=error) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ScheduleRun, response.json()) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore - @distributed_trace_async - async def delete_version(self, name: str, version: str, **kwargs: Any) -> None: - """Delete a specific version of a toolbox. + return deserialized # type: ignore - :param name: The name of the toolbox. Required. - :type name: str - :param version: The version identifier to delete. Required. - :type version: str - :return: None - :rtype: None + @distributed_trace + def list_runs( + self, + schedule_id: str, + *, + type: Optional[Union[str, _models.ScheduleTaskType]] = None, + enabled: Optional[bool] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.ScheduleRun"]: + """List all schedule runs. + + :param schedule_id: Identifier of the schedule. Required. + :type schedule_id: str + :keyword type: Filter by the type of schedule. Known values are: "Evaluation" and "Insight". + Default value is None. + :paramtype type: str or ~azure.ai.projects.models.ScheduleTaskType + :keyword enabled: Filter by the enabled status. Default value is None. + :paramtype enabled: bool + :return: An iterator like instance of ScheduleRun + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.ScheduleRun] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ScheduleRun]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8873,40 +13439,75 @@ async def delete_version(self, name: str, version: str, **kwargs: Any) -> None: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[None] = kwargs.pop("cls", None) + _request = build_beta_schedules_list_runs_request( + schedule_id=schedule_id, + type=type, + enabled=enabled, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_beta_toolboxes_delete_version_request( - name=name, - version=version, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ScheduleRun], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - raise HttpResponseError(response=response, model=error) + response = pipeline_response.http_response - if cls: - return cls(pipeline_response, None, {}) # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) class BetaSkillsOperations: diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch.py index 3c3e527771b4..fad7887d397e 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch.py @@ -22,11 +22,12 @@ BetaEvaluationTaxonomiesOperations, BetaEvaluatorsOperations, BetaInsightsOperations, + BetaModelsOperations, BetaOperations as GeneratedBetaOperations, BetaRedTeamsOperations, + BetaRoutinesOperations, BetaSchedulesOperations, BetaSkillsOperations, - BetaToolboxesOperations, ) @@ -50,12 +51,14 @@ class BetaOperations(GeneratedBetaOperations): """:class:`~azure.ai.projects.aio.operations.BetaInsightsOperations` operations""" memory_stores: BetaMemoryStoresOperations """:class:`~azure.ai.projects.aio.operations.BetaMemoryStoresOperations` operations""" + models: BetaModelsOperations + """:class:`~azure.ai.projects.aio.operations.BetaModelsOperations` operations""" red_teams: BetaRedTeamsOperations """:class:`~azure.ai.projects.aio.operations.BetaRedTeamsOperations` operations""" + routines: BetaRoutinesOperations + """:class:`~azure.ai.projects.aio.operations.BetaRoutinesOperations` operations""" schedules: BetaSchedulesOperations """:class:`~azure.ai.projects.aio.operations.BetaSchedulesOperations` operations""" - toolboxes: BetaToolboxesOperations - """:class:`~azure.ai.projects.aio.operations.BetaToolboxesOperations` operations""" skills: BetaSkillsOperations """:class:`~azure.ai.projects.aio.operations.BetaSkillsOperations` operations""" datasets: BetaDatasetsOperations @@ -86,11 +89,12 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: "BetaEvaluatorsOperations", "BetaInsightsOperations", "BetaMemoryStoresOperations", + "BetaModelsOperations", "BetaOperations", "BetaRedTeamsOperations", + "BetaRoutinesOperations", "BetaSchedulesOperations", "BetaSkillsOperations", - "BetaToolboxesOperations", "ConnectionsOperations", "DatasetsOperations", "EvaluationRulesOperations", diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py b/sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py index 58d3839bdce5..a5f096f3d268 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -15,6 +16,8 @@ from ._models import ( # type: ignore A2APreviewTool, + A2AToolCall, + A2AToolCallOutput, AISearchIndexResource, AgentBlueprintReference, AgentCard, @@ -26,67 +29,99 @@ AgentDetails, AgentEndpointAuthorizationScheme, AgentEndpointConfig, + AgentEvaluationSuiteJobSource, AgentEvaluatorGenerationJobSource, AgentIdentity, AgentObjectVersions, + AgentReference, AgentSessionResource, AgentTaxonomyInput, AgentVersionDetails, AgenticIdentityPreviewCredentials, + AgentsPagedResultOptimizationCandidate, + Annotation, ApiError, ApiErrorResponse, ApiKeyCredentials, + ApplyPatchCreateFileOperation, + ApplyPatchDeleteFileOperation, + ApplyPatchFileOperation, ApplyPatchToolParam, + ApplyPatchUpdateFileOperation, ApproximateLocation, + ArtifactProfile, AutoCodeInterpreterToolParam, AzureAIAgentTarget, AzureAIModelTarget, AzureAISearchIndex, AzureAISearchTool, + AzureAISearchToolCall, + AzureAISearchToolCallOutput, AzureAISearchToolResource, AzureFunctionBinding, AzureFunctionDefinition, AzureFunctionDefinitionFunction, AzureFunctionStorageQueue, AzureFunctionTool, + AzureFunctionToolCall, + AzureFunctionToolCallOutput, AzureOpenAIModelConfiguration, BaseCredentials, BingCustomSearchConfiguration, BingCustomSearchPreviewTool, + BingCustomSearchToolCall, + BingCustomSearchToolCallOutput, BingCustomSearchToolParameters, BingGroundingSearchConfiguration, BingGroundingSearchToolParameters, BingGroundingTool, + BingGroundingToolCall, + BingGroundingToolCallOutput, BlobReference, BlobReferenceSasCredential, BotServiceAuthorizationScheme, BotServiceRbacAuthorizationScheme, BrowserAutomationPreviewTool, + BrowserAutomationToolCall, + BrowserAutomationToolCallOutput, BrowserAutomationToolConnectionParameters, BrowserAutomationToolParameters, + CandidateDeployConfig, + CandidateResults, CaptureStructuredOutputsTool, ChartCoordinate, ChatSummaryMemoryItem, + ClickParam, ClusterInsightResult, ClusterTokenUsage, CodeBasedEvaluatorDefinition, CodeConfiguration, + CodeInterpreterOutputImage, + CodeInterpreterOutputLogs, CodeInterpreterTool, ComparisonFilter, CompoundFilter, + ComputerAction, + ComputerCallSafetyCheckParam, ComputerUsePreviewTool, Connection, ContainerAutoParam, ContainerConfiguration, + ContainerFileCitationBody, ContainerNetworkPolicyAllowlistParam, ContainerNetworkPolicyDisabledParam, ContainerNetworkPolicyDomainSecretParam, ContainerNetworkPolicyParam, + ContainerReferenceResource, ContainerSkill, ContinuousEvaluationRuleAction, + CoordParam, CosmosDBIndex, CreateAgentVersionFromCodeContent, CreateAgentVersionFromCodeMetadata, + CreateAsyncResponse, + CreateEvalCompletionsRunDataSourceInputMessagesItemReference, + CreateEvalResponsesRunDataSourceInputMessagesTemplate, CronTrigger, CustomCredential, CustomGrammarFormatParam, @@ -98,6 +133,7 @@ DataGenerationJobInputs, DataGenerationJobOptions, DataGenerationJobOutput, + DataGenerationJobOutputOptions, DataGenerationJobResult, DataGenerationJobSource, DataGenerationModelOptions, @@ -105,23 +141,45 @@ DatasetCredential, DatasetDataGenerationJobOutput, DatasetDataGenerationJobSource, + DatasetEvaluationSuiteJobSource, DatasetEvaluatorGenerationJobSource, + DatasetItem, + DatasetRef, DatasetReference, DatasetVersion, DeleteAgentResponse, DeleteAgentVersionResponse, + DeleteMemoryResponse, DeleteMemoryStoreResult, DeleteSkillResult, Deployment, + Dimension, + DispatchRoutineResponse, + DoubleClickAction, + DragParam, EmbeddingConfiguration, EntraAuthorizationScheme, EntraIDCredentials, + EvalGraderLabelModel, + EvalGraderPython, + EvalGraderScoreModel, + EvalGraderScoreModelSamplingParams, + EvalGraderStringCheck, + EvalGraderTextSimilarity, + EvalItem, + EvalItemContentItemObject, + EvalItemContentItemObjectInputTextContent, + EvalItemContentOutputText, + EvalItemInputImage, EvalResult, + EvalRunOutputItemResult, EvalRunResultCompareItem, EvalRunResultComparison, EvalRunResultSummary, EvaluationComparisonInsightRequest, EvaluationComparisonInsightResult, + EvaluationCriterion, + EvaluationDatasetReference, EvaluationResultSample, EvaluationRule, EvaluationRuleAction, @@ -129,8 +187,20 @@ EvaluationRunClusterInsightRequest, EvaluationRunClusterInsightResult, EvaluationScheduleTask, + EvaluationSuiteDataGenerationOptions, + EvaluationSuiteGenerationJob, + EvaluationSuiteGenerationJobInputs, + EvaluationSuiteGenerationTokenUsage, + EvaluationSuiteJobSource, + EvaluationSuiteRunRequest, + EvaluationSuiteRunResponse, + EvaluationSuiteRunResult, + EvaluationSuiteVersion, + EvaluationSuiteVersionInputMessagesTemplate1, + EvaluationTarget, EvaluationTaxonomy, EvaluationTaxonomyInput, + EvaluatorCredentialRequest, EvaluatorDefinition, EvaluatorGenerationArtifacts, EvaluatorGenerationInputs, @@ -139,20 +209,34 @@ EvaluatorGenerationTokenUsage, EvaluatorMetric, EvaluatorVersion, + ExternalAgentDefinition, + FabricDataAgentToolCall, + FabricDataAgentToolCallOutput, FabricDataAgentToolParameters, FabricIQPreviewTool, FieldMapping, + FileCitationBody, FileDataGenerationJobOutput, FileDataGenerationJobSource, FileDatasetVersion, + FilePath, FileSearchTool, + FileSearchToolCallResults, FixedRatioVersionSelectionRule, FolderDatasetVersion, + FoundryModelWarning, + FunctionShellAction, + FunctionShellCallEnvironment, + FunctionShellCallOutputContent, + FunctionShellCallOutputExitOutcome, + FunctionShellCallOutputOutcome, + FunctionShellCallOutputTimeoutOutcome, FunctionShellToolParam, FunctionShellToolParamEnvironment, FunctionShellToolParamEnvironmentContainerReferenceParam, FunctionShellToolParamEnvironmentLocalEnvironmentParam, FunctionTool, + GitHubIssueOpenedRoutineTrigger, HeaderTelemetryEndpointAuth, HostedAgentDefinition, HourlyRecurrenceSchedule, @@ -163,6 +247,8 @@ Index, InlineSkillParam, InlineSkillSourceParam, + InputAudio, + InputAudioInputAudio, Insight, InsightCluster, InsightModelConfiguration, @@ -172,18 +258,33 @@ InsightScheduleTask, InsightSummary, InsightsMetadata, + InvokeAgentInvocationsApiDispatchPayload, + InvokeAgentInvocationsApiRoutineAction, + InvokeAgentResponsesApiDispatchPayload, + InvokeAgentResponsesApiRoutineAction, + KeyPressAction, + LocalEnvironmentResource, + LocalShellExecAction, LocalShellToolParam, LocalSkillParam, + LogProb, + LoraConfig, + MCPListToolsTool, + MCPListToolsToolAnnotations, + MCPListToolsToolInputSchema, MCPTool, MCPToolFilter, MCPToolRequireApproval, ManagedAgentIdentityBlueprintReference, ManagedAzureAISearchIndex, + MemoryCommandToolCall, + MemoryCommandToolCallOutput, MemoryItem, MemoryOperation, MemorySearchItem, MemorySearchOptions, MemorySearchPreviewTool, + MemorySearchToolCall, MemoryStoreDefaultDefinition, MemoryStoreDefaultOptions, MemoryStoreDefinition, @@ -193,12 +294,20 @@ MemoryStoreSearchResult, MemoryStoreUpdateCompletedResult, MemoryStoreUpdateResult, + MessageContent, MicrosoftFabricPreviewTool, + ModelCredentialRequest, ModelDeployment, ModelDeploymentSku, + ModelPendingUploadRequest, + ModelPendingUploadResponse, ModelSamplingParams, + ModelSourceData, + ModelVersion, MonthlyRecurrenceSchedule, + MoveParam, NoAuthenticationCredentials, + OAuthConsentRequestOutputItem, OneTimeTrigger, OpenApiAnonymousAuthDetails, OpenApiAuthDetails, @@ -209,33 +318,80 @@ OpenApiProjectConnectionAuthDetails, OpenApiProjectConnectionSecurityScheme, OpenApiTool, + OpenApiToolCall, + OpenApiToolCallOutput, + OptimizationAgentDefinition, + OptimizationAgentSkill, + OptimizationCandidate, + OptimizationJob, + OptimizationJobInputs, + OptimizationJobProgress, + OptimizationJobResult, + OptimizationOptions, + OptimizationTaskResult, OtlpTelemetryEndpoint, + OutputItem, + OutputItemApplyPatchToolCall, + OutputItemApplyPatchToolCallOutput, + OutputItemCodeInterpreterToolCall, + OutputItemCompactionBody, + OutputItemComputerToolCall, + OutputItemCustomToolCall, + OutputItemFileSearchToolCall, + OutputItemFunctionShellCall, + OutputItemFunctionShellCallOutput, + OutputItemFunctionToolCall, + OutputItemImageGenToolCall, + OutputItemLocalShellToolCall, + OutputItemMcpApprovalRequest, + OutputItemMcpListTools, + OutputItemMcpToolCall, + OutputItemOutputMessage, + OutputItemReasoningItem, + OutputItemWebSearchToolCall, + OutputMessageContent, + OutputMessageContentOutputTextContent, + OutputMessageContentRefusalContent, PendingUploadRequest, PendingUploadResult, + ProceduralMemoryItem, PromptAgentDefinition, PromptAgentDefinitionTextOptions, PromptBasedEvaluatorDefinition, PromptDataGenerationJobSource, + PromptEvaluationSuiteJobSource, PromptEvaluatorGenerationJobSource, ProtocolVersionRecord, RaiConfig, RankingOptions, Reasoning, + ReasoningTextContent, RecurrenceSchedule, RecurrenceTrigger, RedTeam, + RedTeamTargetConfig, ResponseUsageInputTokensDetails, ResponseUsageOutputTokensDetails, + Routine, + RoutineAction, + RoutineDispatchPayload, + RoutineRun, + RoutineRunDiagnostics, + RoutineTrigger, RubricBasedEvaluatorDefinition, - RubricCriterion, SASCredentials, Schedule, + ScheduleRoutineTrigger, ScheduleRun, ScheduleTask, + ScreenshotParam, + ScrollParam, SessionDirectoryEntry, SessionDirectoryListResult, SessionFileWriteResult, SessionLogEvent, + SharepointGroundingToolCall, + SharepointGroundingToolCallOutput, SharepointGroundingToolParameters, SharepointPreviewTool, SimpleQnADataGenerationJobOptions, @@ -245,17 +401,20 @@ SpecificFunctionShellParam, StructuredInputDefinition, StructuredOutputDefinition, - Target, - TargetConfig, + StructuredOutputsOutputItem, + SummaryTextContent, + SystemDataV3, TaxonomyCategory, TaxonomySubCategory, TelemetryConfig, TelemetryEndpoint, TelemetryEndpointAuth, + TestingCriterionAzureAIEvaluator, TextResponseFormat, TextResponseFormatJsonObject, TextResponseFormatJsonSchema, TextResponseFormatText, + TimerRoutineTrigger, Tool, ToolChoiceAllowed, ToolChoiceCodeInterpreter, @@ -268,6 +427,7 @@ ToolChoiceParam, ToolChoiceWebSearchPreview, ToolChoiceWebSearchPreview20250311, + ToolConfig, ToolDescription, ToolProjectConnection, ToolUseFineTuningDataGenerationJobOptions, @@ -275,16 +435,27 @@ ToolboxPolicies, ToolboxSearchPreviewTool, ToolboxVersionObject, + TopLogProb, TracesDataGenerationJobOptions, TracesDataGenerationJobSource, + TracesEvaluationSuiteJobSource, TracesEvaluatorGenerationJobSource, Trigger, + TypeParam, + UpdateModelVersionRequest, UpdateToolboxRequest, + UrlCitationBody, UserProfileMemoryItem, + VectorStoreFileAttributes, VersionIndicator, VersionRefIndicator, VersionSelectionRule, VersionSelector, + WaitParam, + WebSearchActionFind, + WebSearchActionOpenPage, + WebSearchActionSearch, + WebSearchActionSearchSources, WebSearchApproximateLocation, WebSearchConfiguration, WebSearchPreviewTool, @@ -292,6 +463,7 @@ WebSearchToolFilters, WeeklyRecurrenceSchedule, WorkIQPreviewTool, + WorkflowActionOutputItem, WorkflowAgentDefinition, ) @@ -304,9 +476,15 @@ AgentProtocol, AgentSessionStatus, AgentVersionStatus, + AnnotationType, + ApplyPatchCallOutputStatus, + ApplyPatchCallStatus, + ApplyPatchFileOperationType, AttackStrategy, AzureAISearchQueryType, + ClickButtonType, CodeDependencyResolution, + ComputerActionType, ComputerEnvironment, ConnectionType, ContainerMemoryLimit, @@ -321,8 +499,15 @@ DatasetType, DayOfWeek, DeploymentType, + EvalItemContentItemObjectType, + EvalRunOutputItemResultStatus, + EvaluationDataGenerationType, + EvaluationLevel, EvaluationRuleActionType, EvaluationRuleEventType, + EvaluationSuiteGenerationCategory, + EvaluationSuiteJobSourceType, + EvaluationSuiteSubtype, EvaluationTaxonomyInputType, EvaluatorCategory, EvaluatorDefinitionType, @@ -330,6 +515,13 @@ EvaluatorMetricDirection, EvaluatorMetricType, EvaluatorType, + FoundryModelArtifactProfileCategory, + FoundryModelArtifactProfileSignal, + FoundryModelSourceType, + FoundryModelWarningCode, + FoundryModelWeightType, + FunctionShellCallEnvironmentType, + FunctionShellCallOutputOutcomeType, FunctionShellToolParamEnvironmentType, GrammarSyntax1, ImageGenAction, @@ -337,18 +529,31 @@ InputFidelity, InsightType, JobStatus, + LocalShellCallOutputStatusEnum, + LocalShellCallStatus, + MCPToolCallStatus, MemoryItemKind, MemoryOperationKind, MemoryStoreKind, MemoryStoreObjectType, MemoryStoreUpdateStatus, + MessageContentType, OpenApiAuthType, OperationState, + OptimizationMode, + OptimizationStrategy, + OutputItemType, + OutputMessageContentType, PageOrder, PendingUploadType, RankerVersionType, RecurrenceType, RiskCategory, + RoutineActionType, + RoutineAttemptSource, + RoutineDispatchPayloadType, + RoutineRunPhase, + RoutineTriggerType, SampleType, ScheduleProvisioningStatus, ScheduleTaskType, @@ -360,6 +565,7 @@ TelemetryEndpointKind, TelemetryTransportProtocol, TextResponseFormatConfigurationType, + ToolCallStatus, ToolChoiceParamType, ToolType, TreatmentEffectType, @@ -373,6 +579,8 @@ __all__ = [ "A2APreviewTool", + "A2AToolCall", + "A2AToolCallOutput", "AISearchIndexResource", "AgentBlueprintReference", "AgentCard", @@ -384,67 +592,99 @@ "AgentDetails", "AgentEndpointAuthorizationScheme", "AgentEndpointConfig", + "AgentEvaluationSuiteJobSource", "AgentEvaluatorGenerationJobSource", "AgentIdentity", "AgentObjectVersions", + "AgentReference", "AgentSessionResource", "AgentTaxonomyInput", "AgentVersionDetails", "AgenticIdentityPreviewCredentials", + "AgentsPagedResultOptimizationCandidate", + "Annotation", "ApiError", "ApiErrorResponse", "ApiKeyCredentials", + "ApplyPatchCreateFileOperation", + "ApplyPatchDeleteFileOperation", + "ApplyPatchFileOperation", "ApplyPatchToolParam", + "ApplyPatchUpdateFileOperation", "ApproximateLocation", + "ArtifactProfile", "AutoCodeInterpreterToolParam", "AzureAIAgentTarget", "AzureAIModelTarget", "AzureAISearchIndex", "AzureAISearchTool", + "AzureAISearchToolCall", + "AzureAISearchToolCallOutput", "AzureAISearchToolResource", "AzureFunctionBinding", "AzureFunctionDefinition", "AzureFunctionDefinitionFunction", "AzureFunctionStorageQueue", "AzureFunctionTool", + "AzureFunctionToolCall", + "AzureFunctionToolCallOutput", "AzureOpenAIModelConfiguration", "BaseCredentials", "BingCustomSearchConfiguration", "BingCustomSearchPreviewTool", + "BingCustomSearchToolCall", + "BingCustomSearchToolCallOutput", "BingCustomSearchToolParameters", "BingGroundingSearchConfiguration", "BingGroundingSearchToolParameters", "BingGroundingTool", + "BingGroundingToolCall", + "BingGroundingToolCallOutput", "BlobReference", "BlobReferenceSasCredential", "BotServiceAuthorizationScheme", "BotServiceRbacAuthorizationScheme", "BrowserAutomationPreviewTool", + "BrowserAutomationToolCall", + "BrowserAutomationToolCallOutput", "BrowserAutomationToolConnectionParameters", "BrowserAutomationToolParameters", + "CandidateDeployConfig", + "CandidateResults", "CaptureStructuredOutputsTool", "ChartCoordinate", "ChatSummaryMemoryItem", + "ClickParam", "ClusterInsightResult", "ClusterTokenUsage", "CodeBasedEvaluatorDefinition", "CodeConfiguration", + "CodeInterpreterOutputImage", + "CodeInterpreterOutputLogs", "CodeInterpreterTool", "ComparisonFilter", "CompoundFilter", + "ComputerAction", + "ComputerCallSafetyCheckParam", "ComputerUsePreviewTool", "Connection", "ContainerAutoParam", "ContainerConfiguration", + "ContainerFileCitationBody", "ContainerNetworkPolicyAllowlistParam", "ContainerNetworkPolicyDisabledParam", "ContainerNetworkPolicyDomainSecretParam", "ContainerNetworkPolicyParam", + "ContainerReferenceResource", "ContainerSkill", "ContinuousEvaluationRuleAction", + "CoordParam", "CosmosDBIndex", "CreateAgentVersionFromCodeContent", "CreateAgentVersionFromCodeMetadata", + "CreateAsyncResponse", + "CreateEvalCompletionsRunDataSourceInputMessagesItemReference", + "CreateEvalResponsesRunDataSourceInputMessagesTemplate", "CronTrigger", "CustomCredential", "CustomGrammarFormatParam", @@ -456,6 +696,7 @@ "DataGenerationJobInputs", "DataGenerationJobOptions", "DataGenerationJobOutput", + "DataGenerationJobOutputOptions", "DataGenerationJobResult", "DataGenerationJobSource", "DataGenerationModelOptions", @@ -463,23 +704,45 @@ "DatasetCredential", "DatasetDataGenerationJobOutput", "DatasetDataGenerationJobSource", + "DatasetEvaluationSuiteJobSource", "DatasetEvaluatorGenerationJobSource", + "DatasetItem", + "DatasetRef", "DatasetReference", "DatasetVersion", "DeleteAgentResponse", "DeleteAgentVersionResponse", + "DeleteMemoryResponse", "DeleteMemoryStoreResult", "DeleteSkillResult", "Deployment", + "Dimension", + "DispatchRoutineResponse", + "DoubleClickAction", + "DragParam", "EmbeddingConfiguration", "EntraAuthorizationScheme", "EntraIDCredentials", + "EvalGraderLabelModel", + "EvalGraderPython", + "EvalGraderScoreModel", + "EvalGraderScoreModelSamplingParams", + "EvalGraderStringCheck", + "EvalGraderTextSimilarity", + "EvalItem", + "EvalItemContentItemObject", + "EvalItemContentItemObjectInputTextContent", + "EvalItemContentOutputText", + "EvalItemInputImage", "EvalResult", + "EvalRunOutputItemResult", "EvalRunResultCompareItem", "EvalRunResultComparison", "EvalRunResultSummary", "EvaluationComparisonInsightRequest", "EvaluationComparisonInsightResult", + "EvaluationCriterion", + "EvaluationDatasetReference", "EvaluationResultSample", "EvaluationRule", "EvaluationRuleAction", @@ -487,8 +750,20 @@ "EvaluationRunClusterInsightRequest", "EvaluationRunClusterInsightResult", "EvaluationScheduleTask", + "EvaluationSuiteDataGenerationOptions", + "EvaluationSuiteGenerationJob", + "EvaluationSuiteGenerationJobInputs", + "EvaluationSuiteGenerationTokenUsage", + "EvaluationSuiteJobSource", + "EvaluationSuiteRunRequest", + "EvaluationSuiteRunResponse", + "EvaluationSuiteRunResult", + "EvaluationSuiteVersion", + "EvaluationSuiteVersionInputMessagesTemplate1", + "EvaluationTarget", "EvaluationTaxonomy", "EvaluationTaxonomyInput", + "EvaluatorCredentialRequest", "EvaluatorDefinition", "EvaluatorGenerationArtifacts", "EvaluatorGenerationInputs", @@ -497,20 +772,34 @@ "EvaluatorGenerationTokenUsage", "EvaluatorMetric", "EvaluatorVersion", + "ExternalAgentDefinition", + "FabricDataAgentToolCall", + "FabricDataAgentToolCallOutput", "FabricDataAgentToolParameters", "FabricIQPreviewTool", "FieldMapping", + "FileCitationBody", "FileDataGenerationJobOutput", "FileDataGenerationJobSource", "FileDatasetVersion", + "FilePath", "FileSearchTool", + "FileSearchToolCallResults", "FixedRatioVersionSelectionRule", "FolderDatasetVersion", + "FoundryModelWarning", + "FunctionShellAction", + "FunctionShellCallEnvironment", + "FunctionShellCallOutputContent", + "FunctionShellCallOutputExitOutcome", + "FunctionShellCallOutputOutcome", + "FunctionShellCallOutputTimeoutOutcome", "FunctionShellToolParam", "FunctionShellToolParamEnvironment", "FunctionShellToolParamEnvironmentContainerReferenceParam", "FunctionShellToolParamEnvironmentLocalEnvironmentParam", "FunctionTool", + "GitHubIssueOpenedRoutineTrigger", "HeaderTelemetryEndpointAuth", "HostedAgentDefinition", "HourlyRecurrenceSchedule", @@ -521,6 +810,8 @@ "Index", "InlineSkillParam", "InlineSkillSourceParam", + "InputAudio", + "InputAudioInputAudio", "Insight", "InsightCluster", "InsightModelConfiguration", @@ -530,18 +821,33 @@ "InsightScheduleTask", "InsightSummary", "InsightsMetadata", + "InvokeAgentInvocationsApiDispatchPayload", + "InvokeAgentInvocationsApiRoutineAction", + "InvokeAgentResponsesApiDispatchPayload", + "InvokeAgentResponsesApiRoutineAction", + "KeyPressAction", + "LocalEnvironmentResource", + "LocalShellExecAction", "LocalShellToolParam", "LocalSkillParam", + "LogProb", + "LoraConfig", + "MCPListToolsTool", + "MCPListToolsToolAnnotations", + "MCPListToolsToolInputSchema", "MCPTool", "MCPToolFilter", "MCPToolRequireApproval", "ManagedAgentIdentityBlueprintReference", "ManagedAzureAISearchIndex", + "MemoryCommandToolCall", + "MemoryCommandToolCallOutput", "MemoryItem", "MemoryOperation", "MemorySearchItem", "MemorySearchOptions", "MemorySearchPreviewTool", + "MemorySearchToolCall", "MemoryStoreDefaultDefinition", "MemoryStoreDefaultOptions", "MemoryStoreDefinition", @@ -551,12 +857,20 @@ "MemoryStoreSearchResult", "MemoryStoreUpdateCompletedResult", "MemoryStoreUpdateResult", + "MessageContent", "MicrosoftFabricPreviewTool", + "ModelCredentialRequest", "ModelDeployment", "ModelDeploymentSku", + "ModelPendingUploadRequest", + "ModelPendingUploadResponse", "ModelSamplingParams", + "ModelSourceData", + "ModelVersion", "MonthlyRecurrenceSchedule", + "MoveParam", "NoAuthenticationCredentials", + "OAuthConsentRequestOutputItem", "OneTimeTrigger", "OpenApiAnonymousAuthDetails", "OpenApiAuthDetails", @@ -567,33 +881,80 @@ "OpenApiProjectConnectionAuthDetails", "OpenApiProjectConnectionSecurityScheme", "OpenApiTool", + "OpenApiToolCall", + "OpenApiToolCallOutput", + "OptimizationAgentDefinition", + "OptimizationAgentSkill", + "OptimizationCandidate", + "OptimizationJob", + "OptimizationJobInputs", + "OptimizationJobProgress", + "OptimizationJobResult", + "OptimizationOptions", + "OptimizationTaskResult", "OtlpTelemetryEndpoint", + "OutputItem", + "OutputItemApplyPatchToolCall", + "OutputItemApplyPatchToolCallOutput", + "OutputItemCodeInterpreterToolCall", + "OutputItemCompactionBody", + "OutputItemComputerToolCall", + "OutputItemCustomToolCall", + "OutputItemFileSearchToolCall", + "OutputItemFunctionShellCall", + "OutputItemFunctionShellCallOutput", + "OutputItemFunctionToolCall", + "OutputItemImageGenToolCall", + "OutputItemLocalShellToolCall", + "OutputItemMcpApprovalRequest", + "OutputItemMcpListTools", + "OutputItemMcpToolCall", + "OutputItemOutputMessage", + "OutputItemReasoningItem", + "OutputItemWebSearchToolCall", + "OutputMessageContent", + "OutputMessageContentOutputTextContent", + "OutputMessageContentRefusalContent", "PendingUploadRequest", "PendingUploadResult", + "ProceduralMemoryItem", "PromptAgentDefinition", "PromptAgentDefinitionTextOptions", "PromptBasedEvaluatorDefinition", "PromptDataGenerationJobSource", + "PromptEvaluationSuiteJobSource", "PromptEvaluatorGenerationJobSource", "ProtocolVersionRecord", "RaiConfig", "RankingOptions", "Reasoning", + "ReasoningTextContent", "RecurrenceSchedule", "RecurrenceTrigger", "RedTeam", + "RedTeamTargetConfig", "ResponseUsageInputTokensDetails", "ResponseUsageOutputTokensDetails", + "Routine", + "RoutineAction", + "RoutineDispatchPayload", + "RoutineRun", + "RoutineRunDiagnostics", + "RoutineTrigger", "RubricBasedEvaluatorDefinition", - "RubricCriterion", "SASCredentials", "Schedule", + "ScheduleRoutineTrigger", "ScheduleRun", "ScheduleTask", + "ScreenshotParam", + "ScrollParam", "SessionDirectoryEntry", "SessionDirectoryListResult", "SessionFileWriteResult", "SessionLogEvent", + "SharepointGroundingToolCall", + "SharepointGroundingToolCallOutput", "SharepointGroundingToolParameters", "SharepointPreviewTool", "SimpleQnADataGenerationJobOptions", @@ -603,17 +964,20 @@ "SpecificFunctionShellParam", "StructuredInputDefinition", "StructuredOutputDefinition", - "Target", - "TargetConfig", + "StructuredOutputsOutputItem", + "SummaryTextContent", + "SystemDataV3", "TaxonomyCategory", "TaxonomySubCategory", "TelemetryConfig", "TelemetryEndpoint", "TelemetryEndpointAuth", + "TestingCriterionAzureAIEvaluator", "TextResponseFormat", "TextResponseFormatJsonObject", "TextResponseFormatJsonSchema", "TextResponseFormatText", + "TimerRoutineTrigger", "Tool", "ToolChoiceAllowed", "ToolChoiceCodeInterpreter", @@ -626,6 +990,7 @@ "ToolChoiceParam", "ToolChoiceWebSearchPreview", "ToolChoiceWebSearchPreview20250311", + "ToolConfig", "ToolDescription", "ToolProjectConnection", "ToolUseFineTuningDataGenerationJobOptions", @@ -633,16 +998,27 @@ "ToolboxPolicies", "ToolboxSearchPreviewTool", "ToolboxVersionObject", + "TopLogProb", "TracesDataGenerationJobOptions", "TracesDataGenerationJobSource", + "TracesEvaluationSuiteJobSource", "TracesEvaluatorGenerationJobSource", "Trigger", + "TypeParam", + "UpdateModelVersionRequest", "UpdateToolboxRequest", + "UrlCitationBody", "UserProfileMemoryItem", + "VectorStoreFileAttributes", "VersionIndicator", "VersionRefIndicator", "VersionSelectionRule", "VersionSelector", + "WaitParam", + "WebSearchActionFind", + "WebSearchActionOpenPage", + "WebSearchActionSearch", + "WebSearchActionSearchSources", "WebSearchApproximateLocation", "WebSearchConfiguration", "WebSearchPreviewTool", @@ -650,6 +1026,7 @@ "WebSearchToolFilters", "WeeklyRecurrenceSchedule", "WorkIQPreviewTool", + "WorkflowActionOutputItem", "WorkflowAgentDefinition", "AgentBlueprintReferenceType", "AgentEndpointAuthorizationSchemeType", @@ -659,9 +1036,15 @@ "AgentProtocol", "AgentSessionStatus", "AgentVersionStatus", + "AnnotationType", + "ApplyPatchCallOutputStatus", + "ApplyPatchCallStatus", + "ApplyPatchFileOperationType", "AttackStrategy", "AzureAISearchQueryType", + "ClickButtonType", "CodeDependencyResolution", + "ComputerActionType", "ComputerEnvironment", "ConnectionType", "ContainerMemoryLimit", @@ -676,8 +1059,15 @@ "DatasetType", "DayOfWeek", "DeploymentType", + "EvalItemContentItemObjectType", + "EvalRunOutputItemResultStatus", + "EvaluationDataGenerationType", + "EvaluationLevel", "EvaluationRuleActionType", "EvaluationRuleEventType", + "EvaluationSuiteGenerationCategory", + "EvaluationSuiteJobSourceType", + "EvaluationSuiteSubtype", "EvaluationTaxonomyInputType", "EvaluatorCategory", "EvaluatorDefinitionType", @@ -685,6 +1075,13 @@ "EvaluatorMetricDirection", "EvaluatorMetricType", "EvaluatorType", + "FoundryModelArtifactProfileCategory", + "FoundryModelArtifactProfileSignal", + "FoundryModelSourceType", + "FoundryModelWarningCode", + "FoundryModelWeightType", + "FunctionShellCallEnvironmentType", + "FunctionShellCallOutputOutcomeType", "FunctionShellToolParamEnvironmentType", "GrammarSyntax1", "ImageGenAction", @@ -692,18 +1089,31 @@ "InputFidelity", "InsightType", "JobStatus", + "LocalShellCallOutputStatusEnum", + "LocalShellCallStatus", + "MCPToolCallStatus", "MemoryItemKind", "MemoryOperationKind", "MemoryStoreKind", "MemoryStoreObjectType", "MemoryStoreUpdateStatus", + "MessageContentType", "OpenApiAuthType", "OperationState", + "OptimizationMode", + "OptimizationStrategy", + "OutputItemType", + "OutputMessageContentType", "PageOrder", "PendingUploadType", "RankerVersionType", "RecurrenceType", "RiskCategory", + "RoutineActionType", + "RoutineAttemptSource", + "RoutineDispatchPayloadType", + "RoutineRunPhase", + "RoutineTriggerType", "SampleType", "ScheduleProvisioningStatus", "ScheduleTaskType", @@ -715,6 +1125,7 @@ "TelemetryEndpointKind", "TelemetryTransportProtocol", "TextResponseFormatConfigurationType", + "ToolCallStatus", "ToolChoiceParamType", "ToolType", "TreatmentEffectType", diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py index 40648951bbda..537550e5a0cf 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -17,19 +18,17 @@ class _AgentDefinitionOptInKeys(str, Enum, metaclass=CaseInsensitiveEnumMeta): """HOSTED_AGENTS_V1_PREVIEW.""" WORKFLOW_AGENTS_V1_PREVIEW = "WorkflowAgents=V1Preview" """WORKFLOW_AGENTS_V1_PREVIEW.""" - CONTAINER_AGENTS_V1_PREVIEW = "ContainerAgents=V1Preview" - """CONTAINER_AGENTS_V1_PREVIEW.""" AGENT_ENDPOINT_V1_PREVIEW = "AgentEndpoints=V1Preview" """AGENT_ENDPOINT_V1_PREVIEW.""" CODE_AGENTS_V1_PREVIEW = "CodeAgents=V1Preview" """CODE_AGENTS_V1_PREVIEW.""" + EXTERNAL_AGENTS_V1_PREVIEW = "ExternalAgents=V1Preview" + """EXTERNAL_AGENTS_V1_PREVIEW.""" class _FoundryFeaturesOptInKeys(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of _FoundryFeaturesOptInKeys.""" - SKILLS_V1_PREVIEW = "Skills=V1Preview" - """SKILLS_V1_PREVIEW.""" EVALUATIONS_V1_PREVIEW = "Evaluations=V1Preview" """EVALUATIONS_V1_PREVIEW.""" SCHEDULES_V1_PREVIEW = "Schedules=V1Preview" @@ -40,10 +39,16 @@ class _FoundryFeaturesOptInKeys(str, Enum, metaclass=CaseInsensitiveEnumMeta): """INSIGHTS_V1_PREVIEW.""" MEMORY_STORES_V1_PREVIEW = "MemoryStores=V1Preview" """MEMORY_STORES_V1_PREVIEW.""" - TOOLBOXES_V1_PREVIEW = "Toolboxes=V1Preview" - """TOOLBOXES_V1_PREVIEW.""" + ROUTINES_V1_PREVIEW = "Routines=V1Preview" + """ROUTINES_V1_PREVIEW.""" + SKILLS_V1_PREVIEW = "Skills=V1Preview" + """SKILLS_V1_PREVIEW.""" DATA_GENERATION_JOBS_V1_PREVIEW = "DataGenerationJobs=V1Preview" """DATA_GENERATION_JOBS_V1_PREVIEW.""" + MODELS_V1_PREVIEW = "Models=V1Preview" + """MODELS_V1_PREVIEW.""" + AGENTS_OPTIMIZATION_V1_PREVIEW = "AgentsOptimization=V1Preview" + """AGENTS_OPTIMIZATION_V1_PREVIEW.""" class AgentBlueprintReferenceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -73,6 +78,8 @@ class AgentEndpointProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): """RESPONSES.""" A2A = "a2a" """A2A.""" + MCP = "mcp" + """MCP.""" INVOCATIONS = "invocations" """INVOCATIONS.""" @@ -86,6 +93,8 @@ class AgentKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """HOSTED.""" WORKFLOW = "workflow" """WORKFLOW.""" + EXTERNAL = "external" + """EXTERNAL.""" class AgentObjectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -110,6 +119,8 @@ class AgentProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ACTIVITY_PROTOCOL.""" RESPONSES = "responses" """RESPONSES.""" + MCP = "mcp" + """MCP.""" INVOCATIONS = "invocations" """INVOCATIONS.""" @@ -150,6 +161,48 @@ class AgentVersionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The agent version has been deleted.""" +class AnnotationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of AnnotationType.""" + + FILE_CITATION = "file_citation" + """FILE_CITATION.""" + URL_CITATION = "url_citation" + """URL_CITATION.""" + CONTAINER_FILE_CITATION = "container_file_citation" + """CONTAINER_FILE_CITATION.""" + FILE_PATH = "file_path" + """FILE_PATH.""" + + +class ApplyPatchCallOutputStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of ApplyPatchCallOutputStatus.""" + + COMPLETED = "completed" + """COMPLETED.""" + FAILED = "failed" + """FAILED.""" + + +class ApplyPatchCallStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of ApplyPatchCallStatus.""" + + IN_PROGRESS = "in_progress" + """IN_PROGRESS.""" + COMPLETED = "completed" + """COMPLETED.""" + + +class ApplyPatchFileOperationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of ApplyPatchFileOperationType.""" + + CREATE_FILE = "create_file" + """CREATE_FILE.""" + DELETE_FILE = "delete_file" + """DELETE_FILE.""" + UPDATE_FILE = "update_file" + """UPDATE_FILE.""" + + class AttackStrategy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Strategies for attacks.""" @@ -236,6 +289,21 @@ class AzureAISearchQueryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Query type ``vector_semantic_hybrid``.""" +class ClickButtonType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of ClickButtonType.""" + + LEFT = "left" + """LEFT.""" + RIGHT = "right" + """RIGHT.""" + WHEEL = "wheel" + """WHEEL.""" + BACK = "back" + """BACK.""" + FORWARD = "forward" + """FORWARD.""" + + class CodeDependencyResolution(str, Enum, metaclass=CaseInsensitiveEnumMeta): """How package dependencies are resolved at deployment time for a code-based hosted agent.""" @@ -246,6 +314,29 @@ class CodeDependencyResolution(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The service builds dependencies remotely from the manifest included in the uploaded zip.""" +class ComputerActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of ComputerActionType.""" + + CLICK = "click" + """CLICK.""" + DOUBLE_CLICK = "double_click" + """DOUBLE_CLICK.""" + DRAG = "drag" + """DRAG.""" + KEYPRESS = "keypress" + """KEYPRESS.""" + MOVE = "move" + """MOVE.""" + SCREENSHOT = "screenshot" + """SCREENSHOT.""" + SCROLL = "scroll" + """SCROLL.""" + TYPE = "type" + """TYPE.""" + WAIT = "wait" + """WAIT.""" + + class ComputerEnvironment(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of ComputerEnvironment.""" @@ -424,6 +515,52 @@ class DeploymentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Model deployment.""" +class EvalItemContentItemObjectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of EvalItemContentItemObjectType.""" + + INPUT_TEXT = "input_text" + """INPUT_TEXT.""" + OUTPUT_TEXT = "output_text" + """OUTPUT_TEXT.""" + INPUT_IMAGE = "input_image" + """INPUT_IMAGE.""" + INPUT_AUDIO = "input_audio" + """INPUT_AUDIO.""" + + +class EvalRunOutputItemResultStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The evaluation status for an evaluation run output item result.""" + + COMPLETED = "completed" + """The evaluator completed successfully for this result item.""" + ERRORED = "errored" + """The evaluator encountered an error for this result item.""" + SKIPPED = "skipped" + """The evaluator skipped this result item.""" + + +class EvaluationDataGenerationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The data generation type.""" + + SIMPLE_QNA = "simple_qna" + """Simple question and answer generation.""" + TRACES = "traces" + """Traces-based generation.""" + TOOL_USE = "tool_use" + """Tool use generation.""" + TASK = "task" + """Task-based generation.""" + + +class EvaluationLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The level at which evaluation is performed.""" + + TURN = "turn" + """Evaluation is performed at the turn level.""" + CONVERSATION = "conversation" + """Evaluation is performed at the conversation level.""" + + class EvaluationRuleActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of the evaluation action.""" @@ -442,6 +579,37 @@ class EvaluationRuleEventType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Manual trigger.""" +class EvaluationSuiteGenerationCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The category of evaluator generation.""" + + QUALITY = "quality" + """Quality-focused rubric criteria.""" + SAFETY = "safety" + """Safety-focused policy criteria.""" + + +class EvaluationSuiteJobSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The supported source types for evaluation suite generation jobs.""" + + PROMPT = "prompt" + """Prompt source — inline text provided by the user.""" + AGENT = "agent" + """Agent source — references an agent.""" + TRACES = "traces" + """Traces source — conversation traces from Application Insights.""" + DATASET = "dataset" + """Dataset source — reference to a dataset.""" + + +class EvaluationSuiteSubtype(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The subtype of an evaluation suite.""" + + DEFAULT = "default" + """Default suite type.""" + BENCHMARK = "benchmark" + """Benchmark suite.""" + + class EvaluationTaxonomyInputType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of the evaluation taxonomy input.""" @@ -475,9 +643,9 @@ class EvaluatorDefinitionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Service-based evaluator.""" OPENAI_GRADERS = "openai_graders" """OpenAI graders.""" - RUBRICS = "rubrics" - """Rubric-based evaluator definition. Stores rubric criteria for both quality and safety - evaluators. Can be created via the generate API or manually via createVersion.""" + RUBRIC = "rubric" + """Rubric-based evaluator definition. Stores dimensions (the scoring blueprint) for both quality + and safety evaluators. Can be created via the generate API or manually via createVersion.""" class EvaluatorGenerationJobSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -526,6 +694,79 @@ class EvaluatorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Custom evaluator.""" +class FoundryModelArtifactProfileCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The artifact profile category.""" + + DATA_ONLY = "DataOnly" + """Data only artifacts.""" + RUNTIME_DEPENDENT = "RuntimeDependent" + """Runtime dependent artifacts.""" + UNKNOWN = "Unknown" + """Unknown category.""" + + +class FoundryModelArtifactProfileSignal(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Signals detected in the model artifact.""" + + PICKLE_DESERIALIZATION = "PickleDeserialization" + """Pickle deserialization detected.""" + CUSTOM_PYTHON_CODE = "CustomPythonCode" + """Custom Python code detected.""" + DYNAMIC_OPS = "DynamicOps" + """Dynamic operations detected.""" + NATIVE_BINARY = "NativeBinary" + """Native binary code detected.""" + UNKNOWN_FORMAT = "UnknownFormat" + """Unknown format detected.""" + + +class FoundryModelSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The source type of the model.""" + + LOCAL_UPLOAD = "LocalUpload" + """Model was uploaded locally.""" + TRAINING_JOB = "TrainingJob" + """Model was produced by a training job.""" + + +class FoundryModelWarningCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Warning code for model artifacts.""" + + RUNTIME_DEPENDENT_ARTIFACT = "RuntimeDependentArtifact" + """Runtime dependent artifact warning.""" + UNCLASSIFIED_ARTIFACT = "UnclassifiedArtifact" + """Unclassified artifact warning.""" + + +class FoundryModelWeightType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The weight type of the model.""" + + FULL_WEIGHT = "FullWeight" + """Full weight model.""" + LO_RA = "LoRA" + """LoRA adapter weights.""" + DRAFT_MODEL = "DraftModel" + """Draft model weights.""" + + +class FunctionShellCallEnvironmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of FunctionShellCallEnvironmentType.""" + + LOCAL = "local" + """LOCAL.""" + CONTAINER_REFERENCE = "container_reference" + """CONTAINER_REFERENCE.""" + + +class FunctionShellCallOutputOutcomeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of FunctionShellCallOutputOutcomeType.""" + + TIMEOUT = "timeout" + """TIMEOUT.""" + EXIT = "exit" + """EXIT.""" + + class FunctionShellToolParamEnvironmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of FunctionShellToolParamEnvironmentType.""" @@ -607,6 +848,43 @@ class JobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Job was cancelled by the caller.""" +class LocalShellCallOutputStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of LocalShellCallOutputStatusEnum.""" + + IN_PROGRESS = "in_progress" + """IN_PROGRESS.""" + COMPLETED = "completed" + """COMPLETED.""" + INCOMPLETE = "incomplete" + """INCOMPLETE.""" + + +class LocalShellCallStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of LocalShellCallStatus.""" + + IN_PROGRESS = "in_progress" + """IN_PROGRESS.""" + COMPLETED = "completed" + """COMPLETED.""" + INCOMPLETE = "incomplete" + """INCOMPLETE.""" + + +class MCPToolCallStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of MCPToolCallStatus.""" + + IN_PROGRESS = "in_progress" + """IN_PROGRESS.""" + COMPLETED = "completed" + """COMPLETED.""" + INCOMPLETE = "incomplete" + """INCOMPLETE.""" + CALLING = "calling" + """CALLING.""" + FAILED = "failed" + """FAILED.""" + + class MemoryItemKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Memory item kind.""" @@ -614,6 +892,8 @@ class MemoryItemKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """User profile information extracted from conversations.""" CHAT_SUMMARY = "chat_summary" """Summary of chat conversations.""" + PROCEDURAL = "procedural" + """Routine procedures extracted from conversations.""" class MemoryOperationKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -643,6 +923,8 @@ class MemoryStoreObjectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """MEMORY_STORE_DELETED.""" MEMORY_STORE_SCOPE_DELETED = "memory_store.scope.deleted" """MEMORY_STORE_SCOPE_DELETED.""" + MEMORY_DELETED = "memory.deleted" + """MEMORY_DELETED.""" class MemoryStoreUpdateStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -660,6 +942,29 @@ class MemoryStoreUpdateStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SUPERSEDED.""" +class MessageContentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of MessageContentType.""" + + INPUT_TEXT = "input_text" + """INPUT_TEXT.""" + OUTPUT_TEXT = "output_text" + """OUTPUT_TEXT.""" + TEXT = "text" + """TEXT.""" + SUMMARY_TEXT = "summary_text" + """SUMMARY_TEXT.""" + REASONING_TEXT = "reasoning_text" + """REASONING_TEXT.""" + REFUSAL = "refusal" + """REFUSAL.""" + INPUT_IMAGE = "input_image" + """INPUT_IMAGE.""" + COMPUTER_SCREENSHOT = "computer_screenshot" + """COMPUTER_SCREENSHOT.""" + INPUT_FILE = "input_file" + """INPUT_FILE.""" + + class OpenApiAuthType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Authentication type for OpenApi endpoint. Allowed types are: @@ -691,6 +996,122 @@ class OperationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operation has been canceled by the user.""" +class OptimizationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Run mode for an optimization job.""" + + OPTIMIZE = "optimize" + """Full optimization: baseline + mutation strategies.""" + + +class OptimizationStrategy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Optimization strategy dimension.""" + + INSTRUCTION = "instruction" + """Instruction-tuning strategy — rewrites agent system prompts.""" + MODEL = "model" + """Model-selection strategy — evaluates alternative LLM deployments.""" + SKILL = "skill" + """Skill-tuning strategy — generates or modifies agent tool descriptions.""" + + +class OutputItemType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of OutputItemType.""" + + OUTPUT_MESSAGE = "output_message" + """OUTPUT_MESSAGE.""" + FILE_SEARCH_CALL = "file_search_call" + """FILE_SEARCH_CALL.""" + FUNCTION_CALL = "function_call" + """FUNCTION_CALL.""" + WEB_SEARCH_CALL = "web_search_call" + """WEB_SEARCH_CALL.""" + COMPUTER_CALL = "computer_call" + """COMPUTER_CALL.""" + REASONING = "reasoning" + """REASONING.""" + COMPACTION = "compaction" + """COMPACTION.""" + IMAGE_GENERATION_CALL = "image_generation_call" + """IMAGE_GENERATION_CALL.""" + CODE_INTERPRETER_CALL = "code_interpreter_call" + """CODE_INTERPRETER_CALL.""" + LOCAL_SHELL_CALL = "local_shell_call" + """LOCAL_SHELL_CALL.""" + SHELL_CALL = "shell_call" + """SHELL_CALL.""" + SHELL_CALL_OUTPUT = "shell_call_output" + """SHELL_CALL_OUTPUT.""" + APPLY_PATCH_CALL = "apply_patch_call" + """APPLY_PATCH_CALL.""" + APPLY_PATCH_CALL_OUTPUT = "apply_patch_call_output" + """APPLY_PATCH_CALL_OUTPUT.""" + MCP_CALL = "mcp_call" + """MCP_CALL.""" + MCP_LIST_TOOLS = "mcp_list_tools" + """MCP_LIST_TOOLS.""" + MCP_APPROVAL_REQUEST = "mcp_approval_request" + """MCP_APPROVAL_REQUEST.""" + CUSTOM_TOOL_CALL = "custom_tool_call" + """CUSTOM_TOOL_CALL.""" + STRUCTURED_OUTPUTS = "structured_outputs" + """STRUCTURED_OUTPUTS.""" + OAUTH_CONSENT_REQUEST = "oauth_consent_request" + """OAUTH_CONSENT_REQUEST.""" + MEMORY_SEARCH_CALL = "memory_search_call" + """MEMORY_SEARCH_CALL.""" + MEMORY_COMMAND_PREVIEW_CALL = "memory_command_preview_call" + """MEMORY_COMMAND_PREVIEW_CALL.""" + MEMORY_COMMAND_PREVIEW_CALL_OUTPUT = "memory_command_preview_call_output" + """MEMORY_COMMAND_PREVIEW_CALL_OUTPUT.""" + WORKFLOW_ACTION = "workflow_action" + """WORKFLOW_ACTION.""" + A2A_PREVIEW_CALL = "a2a_preview_call" + """A2A_PREVIEW_CALL.""" + A2A_PREVIEW_CALL_OUTPUT = "a2a_preview_call_output" + """A2A_PREVIEW_CALL_OUTPUT.""" + BING_GROUNDING_CALL = "bing_grounding_call" + """BING_GROUNDING_CALL.""" + BING_GROUNDING_CALL_OUTPUT = "bing_grounding_call_output" + """BING_GROUNDING_CALL_OUTPUT.""" + SHAREPOINT_GROUNDING_PREVIEW_CALL = "sharepoint_grounding_preview_call" + """SHAREPOINT_GROUNDING_PREVIEW_CALL.""" + SHAREPOINT_GROUNDING_PREVIEW_CALL_OUTPUT = "sharepoint_grounding_preview_call_output" + """SHAREPOINT_GROUNDING_PREVIEW_CALL_OUTPUT.""" + AZURE_AI_SEARCH_CALL = "azure_ai_search_call" + """AZURE_AI_SEARCH_CALL.""" + AZURE_AI_SEARCH_CALL_OUTPUT = "azure_ai_search_call_output" + """AZURE_AI_SEARCH_CALL_OUTPUT.""" + BING_CUSTOM_SEARCH_PREVIEW_CALL = "bing_custom_search_preview_call" + """BING_CUSTOM_SEARCH_PREVIEW_CALL.""" + BING_CUSTOM_SEARCH_PREVIEW_CALL_OUTPUT = "bing_custom_search_preview_call_output" + """BING_CUSTOM_SEARCH_PREVIEW_CALL_OUTPUT.""" + OPENAPI_CALL = "openapi_call" + """OPENAPI_CALL.""" + OPENAPI_CALL_OUTPUT = "openapi_call_output" + """OPENAPI_CALL_OUTPUT.""" + BROWSER_AUTOMATION_PREVIEW_CALL = "browser_automation_preview_call" + """BROWSER_AUTOMATION_PREVIEW_CALL.""" + BROWSER_AUTOMATION_PREVIEW_CALL_OUTPUT = "browser_automation_preview_call_output" + """BROWSER_AUTOMATION_PREVIEW_CALL_OUTPUT.""" + FABRIC_DATAAGENT_PREVIEW_CALL = "fabric_dataagent_preview_call" + """FABRIC_DATAAGENT_PREVIEW_CALL.""" + FABRIC_DATAAGENT_PREVIEW_CALL_OUTPUT = "fabric_dataagent_preview_call_output" + """FABRIC_DATAAGENT_PREVIEW_CALL_OUTPUT.""" + AZURE_FUNCTION_CALL = "azure_function_call" + """AZURE_FUNCTION_CALL.""" + AZURE_FUNCTION_CALL_OUTPUT = "azure_function_call_output" + """AZURE_FUNCTION_CALL_OUTPUT.""" + + +class OutputMessageContentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of OutputMessageContentType.""" + + OUTPUT_TEXT = "output_text" + """OUTPUT_TEXT.""" + REFUSAL = "refusal" + """REFUSAL.""" + + class PageOrder(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of PageOrder.""" @@ -706,7 +1127,10 @@ class PendingUploadType(str, Enum, metaclass=CaseInsensitiveEnumMeta): NONE = "None" """No pending upload.""" BLOB_REFERENCE = "BlobReference" - """Blob Reference is the only supported type.""" + """Deprecated: the service never read this value and silently ignored it. Use + TemporaryBlobReference instead.""" + TEMPORARY_BLOB_REFERENCE = "TemporaryBlobReference" + """Temporary blob reference.""" class RankerVersionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -756,6 +1180,63 @@ class RiskCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Represents content that involves task adherence.""" +class RoutineActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The discriminator values supported for routine actions.""" + + INVOKE_AGENT_RESPONSES_API = "invoke_agent_responses_api" + """Dispatches through the responses API.""" + INVOKE_AGENT_INVOCATIONS_API = "invoke_agent_invocations_api" + """Dispatches through the raw invocations API.""" + + +class RoutineAttemptSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Known source paths that can produce a routine run.""" + + EVENT_FIRE = "event_fire" + """A dispatch fired from an event delivery.""" + MANUAL_DISPATCH = "manual_dispatch" + """A dispatch executed synchronously by a direct request.""" + QUEUED_DISPATCH = "queued_dispatch" + """A dispatch executed asynchronously from the dispatch queue.""" + SCHEDULE_DELIVERY = "schedule_delivery" + """A dispatch fired from a schedule delivery.""" + TIMER_DELIVERY = "timer_delivery" + """A dispatch fired from a timer delivery.""" + + +class RoutineDispatchPayloadType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The discriminator values supported for manual routine dispatch payloads.""" + + INVOKE_AGENT_RESPONSES_API = "invoke_agent_responses_api" + """A manual payload for a responses API routine dispatch.""" + INVOKE_AGENT_INVOCATIONS_API = "invoke_agent_invocations_api" + """A manual payload for an invocations API routine dispatch.""" + + +class RoutineRunPhase(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Known lifecycle phases recorded for a routine run.""" + + QUEUED = "queued" + """The run is queued for dispatch.""" + DISPATCHING = "dispatching" + """The run is currently being dispatched.""" + COMPLETED = "completed" + """The run finished successfully.""" + FAILED = "failed" + """The run finished with an error.""" + + +class RoutineTriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The discriminator values supported for routine triggers.""" + + GITHUB_ISSUE_OPENED = "github_issue_opened" + """A GitHub issue-opened trigger.""" + SCHEDULE = "schedule" + """A recurring cron-based trigger.""" + TIMER = "timer" + """A one-shot timer trigger.""" + + class SampleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of sample used in the analysis.""" @@ -861,6 +1342,19 @@ class TextResponseFormatConfigurationType(str, Enum, metaclass=CaseInsensitiveEn """JSON_OBJECT.""" +class ToolCallStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of a tool call.""" + + IN_PROGRESS = "in_progress" + """IN_PROGRESS.""" + COMPLETED = "completed" + """COMPLETED.""" + INCOMPLETE = "incomplete" + """INCOMPLETE.""" + FAILED = "failed" + """FAILED.""" + + class ToolChoiceParamType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of ToolChoiceParamType.""" diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py index 3606e0a5d9b8..e932d9919ac6 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py @@ -18,6 +18,9 @@ AgentEndpointAuthorizationSchemeType, AgentKind, AgentObjectType, + AnnotationType, + ApplyPatchFileOperationType, + ComputerActionType, ContainerNetworkPolicyParamType, ContainerSkillType, CredentialType, @@ -27,19 +30,29 @@ DataGenerationJobType, DatasetType, DeploymentType, + EvalItemContentItemObjectType, EvaluationRuleActionType, + EvaluationSuiteJobSourceType, EvaluationTaxonomyInputType, EvaluatorDefinitionType, EvaluatorGenerationJobSourceType, + FunctionShellCallEnvironmentType, + FunctionShellCallOutputOutcomeType, FunctionShellToolParamEnvironmentType, IndexType, InsightType, MemoryItemKind, MemoryStoreKind, MemoryStoreObjectType, + MessageContentType, OpenApiAuthType, + OutputItemType, + OutputMessageContentType, PendingUploadType, RecurrenceType, + RoutineActionType, + RoutineDispatchPayloadType, + RoutineTriggerType, SampleType, ScheduleTaskType, TelemetryEndpointAuthType, @@ -115,6 +128,10 @@ class A2APreviewTool(Tool, discriminator="a2a_preview"): :vartype name: str :ivar description: Optional user-defined description for this tool or configuration. :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar base_url: Base URL of the agent. :vartype base_url: str :ivar agent_card_path: The path to the agent card relative to the ``base_url``. If not @@ -132,6 +149,12 @@ class A2APreviewTool(Tool, discriminator="a2a_preview"): """Optional user-defined name for this tool or configuration.""" description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Optional user-defined description for this tool or configuration.""" + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: + exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at + runtime.""" base_url: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Base URL of the agent.""" agent_card_path: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -147,6 +170,7 @@ def __init__( *, name: Optional[str] = None, description: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, base_url: Optional[str] = None, agent_card_path: Optional[str] = None, project_connection_id: Optional[str] = None, @@ -164,6 +188,208 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = ToolType.A2A_PREVIEW # type: ignore +class OutputItem(_Model): + """OutputItem. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AToolCall, A2AToolCallOutput, OutputItemApplyPatchToolCall, + OutputItemApplyPatchToolCallOutput, AzureAISearchToolCall, AzureAISearchToolCallOutput, + AzureFunctionToolCall, AzureFunctionToolCallOutput, BingCustomSearchToolCall, + BingCustomSearchToolCallOutput, BingGroundingToolCall, BingGroundingToolCallOutput, + BrowserAutomationToolCall, BrowserAutomationToolCallOutput, OutputItemCodeInterpreterToolCall, + OutputItemCompactionBody, OutputItemComputerToolCall, OutputItemCustomToolCall, + FabricDataAgentToolCall, FabricDataAgentToolCallOutput, OutputItemFileSearchToolCall, + OutputItemFunctionToolCall, OutputItemImageGenToolCall, OutputItemLocalShellToolCall, + OutputItemMcpApprovalRequest, OutputItemMcpToolCall, OutputItemMcpListTools, + MemoryCommandToolCall, MemoryCommandToolCallOutput, MemorySearchToolCall, + OAuthConsentRequestOutputItem, OpenApiToolCall, OpenApiToolCallOutput, OutputItemOutputMessage, + OutputItemReasoningItem, SharepointGroundingToolCall, SharepointGroundingToolCallOutput, + OutputItemFunctionShellCall, OutputItemFunctionShellCallOutput, StructuredOutputsOutputItem, + OutputItemWebSearchToolCall, WorkflowActionOutputItem + + :ivar type: Required. Known values are: "output_message", "file_search_call", "function_call", + "web_search_call", "computer_call", "reasoning", "compaction", "image_generation_call", + "code_interpreter_call", "local_shell_call", "shell_call", "shell_call_output", + "apply_patch_call", "apply_patch_call_output", "mcp_call", "mcp_list_tools", + "mcp_approval_request", "custom_tool_call", "structured_outputs", "oauth_consent_request", + "memory_search_call", "memory_command_preview_call", "memory_command_preview_call_output", + "workflow_action", "a2a_preview_call", "a2a_preview_call_output", "bing_grounding_call", + "bing_grounding_call_output", "sharepoint_grounding_preview_call", + "sharepoint_grounding_preview_call_output", "azure_ai_search_call", + "azure_ai_search_call_output", "bing_custom_search_preview_call", + "bing_custom_search_preview_call_output", "openapi_call", "openapi_call_output", + "browser_automation_preview_call", "browser_automation_preview_call_output", + "fabric_dataagent_preview_call", "fabric_dataagent_preview_call_output", "azure_function_call", + and "azure_function_call_output". + :vartype type: str or ~azure.ai.projects.models.OutputItemType + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + """ + + __mapping__: dict[str, _Model] = {} + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """Required. Known values are: \"output_message\", \"file_search_call\", \"function_call\", + \"web_search_call\", \"computer_call\", \"reasoning\", \"compaction\", + \"image_generation_call\", \"code_interpreter_call\", \"local_shell_call\", \"shell_call\", + \"shell_call_output\", \"apply_patch_call\", \"apply_patch_call_output\", \"mcp_call\", + \"mcp_list_tools\", \"mcp_approval_request\", \"custom_tool_call\", \"structured_outputs\", + \"oauth_consent_request\", \"memory_search_call\", \"memory_command_preview_call\", + \"memory_command_preview_call_output\", \"workflow_action\", \"a2a_preview_call\", + \"a2a_preview_call_output\", \"bing_grounding_call\", \"bing_grounding_call_output\", + \"sharepoint_grounding_preview_call\", \"sharepoint_grounding_preview_call_output\", + \"azure_ai_search_call\", \"azure_ai_search_call_output\", \"bing_custom_search_preview_call\", + \"bing_custom_search_preview_call_output\", \"openapi_call\", \"openapi_call_output\", + \"browser_automation_preview_call\", \"browser_automation_preview_call_output\", + \"fabric_dataagent_preview_call\", \"fabric_dataagent_preview_call_output\", + \"azure_function_call\", and \"azure_function_call_output\".""" + agent_reference: Optional["_models.AgentReference"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The agent that created the item.""" + response_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The response on which the item is created.""" + + @overload + def __init__( + self, + *, + type: str, + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class A2AToolCall(OutputItem, discriminator="a2a_preview_call"): + """An A2A (Agent-to-Agent) tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. A2A_PREVIEW_CALL. + :vartype type: str or ~azure.ai.projects.models.A2A_PREVIEW_CALL + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the A2A agent card being called. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.projects.models.ToolCallStatus + """ + + type: Literal[OutputItemType.A2A_PREVIEW_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. A2A_PREVIEW_CALL.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the tool call generated by the model. Required.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the A2A agent card being called. Required.""" + arguments: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A JSON string of the arguments to pass to the tool. Required.""" + status: Union[str, "_models.ToolCallStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + + @overload + def __init__( + self, + *, + call_id: str, + name: str, + arguments: str, + status: Union[str, "_models.ToolCallStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = OutputItemType.A2A_PREVIEW_CALL # type: ignore + + +class A2AToolCallOutput(OutputItem, discriminator="a2a_preview_call_output"): + """The output of an A2A (Agent-to-Agent) tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. A2A_PREVIEW_CALL_OUTPUT. + :vartype type: str or ~azure.ai.projects.models.A2A_PREVIEW_CALL_OUTPUT + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the A2A agent card that was called. Required. + :vartype name: str + :ivar output: The output from the A2A tool call. Is one of the following types: {str: Any}, + str, [Any] + :vartype output: dict[str, any] or str or list[any] + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.projects.models.ToolCallStatus + """ + + type: Literal[OutputItemType.A2A_PREVIEW_CALL_OUTPUT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. A2A_PREVIEW_CALL_OUTPUT.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the tool call generated by the model. Required.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the A2A agent card that was called. Required.""" + output: Optional["_types.ToolCallOutputContent"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The output from the A2A tool call. Is one of the following types: {str: Any}, str, [Any]""" + status: Union[str, "_models.ToolCallStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + + @overload + def __init__( + self, + *, + call_id: str, + name: str, + status: Union[str, "_models.ToolCallStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + output: Optional["_types.ToolCallOutputContent"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = OutputItemType.A2A_PREVIEW_CALL_OUTPUT # type: ignore + + class AgentBlueprintReference(_Model): """AgentBlueprintReference. @@ -518,9 +744,9 @@ class AgentDefinition(_Model): """AgentDefinition. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - HostedAgentDefinition, PromptAgentDefinition, WorkflowAgentDefinition + ExternalAgentDefinition, HostedAgentDefinition, PromptAgentDefinition, WorkflowAgentDefinition - :ivar kind: Required. Known values are: "prompt", "hosted", and "workflow". + :ivar kind: Required. Known values are: "prompt", "hosted", "workflow", and "external". :vartype kind: str or ~azure.ai.projects.models.AgentKind :ivar rai_config: Configuration for Responsible AI (RAI) content filtering and safety features. :vartype rai_config: ~azure.ai.projects.models.RaiConfig @@ -528,7 +754,7 @@ class AgentDefinition(_Model): __mapping__: dict[str, _Model] = {} kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) - """Required. Known values are: \"prompt\", \"hosted\", and \"workflow\".""" + """Required. Known values are: \"prompt\", \"hosted\", \"workflow\", and \"external\".""" rai_config: Optional["_models.RaiConfig"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Configuration for Responsible AI (RAI) content filtering and safety features.""" @@ -696,6 +922,94 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class EvaluationSuiteJobSource(_Model): + """The base source model for evaluation suite generation jobs. Polymorphic over ``type``. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AgentEvaluationSuiteJobSource, DatasetEvaluationSuiteJobSource, PromptEvaluationSuiteJobSource, + TracesEvaluationSuiteJobSource + + :ivar type: The type of source. Required. Known values are: "prompt", "agent", "traces", and + "dataset". + :vartype type: str or ~azure.ai.projects.models.EvaluationSuiteJobSourceType + :ivar description: Optional description of what this source represents — helps the pipeline + interpret its content (e.g., 'Company refund policy document' or 'Describes the agent's core + capabilities'). + :vartype description: str + """ + + __mapping__: dict[str, _Model] = {} + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """The type of source. Required. Known values are: \"prompt\", \"agent\", \"traces\", and + \"dataset\".""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional description of what this source represents — helps the pipeline interpret its content + (e.g., 'Company refund policy document' or 'Describes the agent's core capabilities').""" + + @overload + def __init__( + self, + *, + type: str, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AgentEvaluationSuiteJobSource(EvaluationSuiteJobSource, discriminator="agent"): + """Agent source for evaluation suite generation jobs — references an agent to fetch instructions + and metadata from. + + :ivar description: Optional description of what this source represents — helps the pipeline + interpret its content (e.g., 'Company refund policy document' or 'Describes the agent's core + capabilities'). + :vartype description: str + :ivar type: The source type for this source, which is Agent. Required. Agent source — + references an agent. + :vartype type: str or ~azure.ai.projects.models.AGENT + :ivar agent_name: The agent name to fetch instructions from. Required. + :vartype agent_name: str + :ivar agent_version: The agent version. If not specified, the latest version is used. + :vartype agent_version: str + """ + + type: Literal[EvaluationSuiteJobSourceType.AGENT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The source type for this source, which is Agent. Required. Agent source — references an agent.""" + agent_name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The agent name to fetch instructions from. Required.""" + agent_version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The agent version. If not specified, the latest version is used.""" + + @overload + def __init__( + self, + *, + agent_name: str, + description: Optional[str] = None, + agent_version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = EvaluationSuiteJobSourceType.AGENT # type: ignore + + class EvaluatorGenerationJobSource(_Model): """The base source model for evaluator generation jobs. Polymorphic over ``type``. @@ -904,6 +1218,44 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class AgentReference(_Model): + """AgentReference. + + :ivar type: Required. Default value is "agent_reference". + :vartype type: str + :ivar name: The name of the agent. Required. + :vartype name: str + :ivar version: The version identifier of the agent. + :vartype version: str + """ + + type: Literal["agent_reference"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required. Default value is \"agent_reference\".""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the agent. Required.""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The version identifier of the agent.""" + + @overload + def __init__( + self, + *, + name: str, + version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type: Literal["agent_reference"] = "agent_reference" + + class AgentSessionResource(_Model): """An agent session providing a long-lived compute sandbox for hosted agent invocations. @@ -964,6 +1316,51 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class AgentsPagedResultOptimizationCandidate(_Model): + """The response data for a requested list of items. + + :ivar data: The requested list of items. Required. + :vartype data: list[~azure.ai.projects.models.OptimizationCandidate] + :ivar first_id: The first ID represented in this list. + :vartype first_id: str + :ivar last_id: The last ID represented in this list. + :vartype last_id: str + :ivar has_more: A value indicating whether there are additional values available not captured + in this list. Required. + :vartype has_more: bool + """ + + data: list["_models.OptimizationCandidate"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The requested list of items. Required.""" + first_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The first ID represented in this list.""" + last_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The last ID represented in this list.""" + has_more: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A value indicating whether there are additional values available not captured in this list. + Required.""" + + @overload + def __init__( + self, + *, + data: list["_models.OptimizationCandidate"], + has_more: bool, + first_id: Optional[str] = None, + last_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class EvaluationTaxonomyInput(_Model): """Input configuration for the evaluation taxonomy. @@ -1003,14 +1400,14 @@ class AgentTaxonomyInput(EvaluationTaxonomyInput, discriminator="agent"): :ivar type: Input type of the evaluation taxonomy. Required. Agent. :vartype type: str or ~azure.ai.projects.models.AGENT :ivar target: Target configuration for the agent. Required. - :vartype target: ~azure.ai.projects.models.Target + :vartype target: ~azure.ai.projects.models.EvaluationTarget :ivar risk_categories: List of risk categories to evaluate against. Required. :vartype risk_categories: list[str or ~azure.ai.projects.models.RiskCategory] """ type: Literal[EvaluationTaxonomyInputType.AGENT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """Input type of the evaluation taxonomy. Required. Agent.""" - target: "_models.Target" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + target: "_models.EvaluationTarget" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Target configuration for the agent. Required.""" risk_categories: list[Union[str, "_models.RiskCategory"]] = rest_field( name="riskCategories", visibility=["read", "create", "update", "delete", "query"] @@ -1021,7 +1418,7 @@ class AgentTaxonomyInput(EvaluationTaxonomyInput, discriminator="agent"): def __init__( self, *, - target: "_models.Target", + target: "_models.EvaluationTarget", risk_categories: list[Union[str, "_models.RiskCategory"]], ) -> None: ... @@ -1203,6 +1600,40 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class Annotation(_Model): + """An annotation that applies to a span of output text. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ContainerFileCitationBody, FileCitationBody, FilePath, UrlCitationBody + + :ivar type: Required. Known values are: "file_citation", "url_citation", + "container_file_citation", and "file_path". + :vartype type: str or ~azure.ai.projects.models.AnnotationType + """ + + __mapping__: dict[str, _Model] = {} + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """Required. Known values are: \"file_citation\", \"url_citation\", \"container_file_citation\", + and \"file_path\".""" + + @overload + def __init__( + self, + *, + type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class ApiError(_Model): """ApiError. @@ -1319,19 +1750,25 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = CredentialType.API_KEY # type: ignore -class ApplyPatchToolParam(Tool, discriminator="apply_patch"): - """Apply patch tool. +class ApplyPatchFileOperation(_Model): + """Apply patch operation. - :ivar type: The type of the tool. Always ``apply_patch``. Required. APPLY_PATCH. - :vartype type: str or ~azure.ai.projects.models.APPLY_PATCH + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ApplyPatchCreateFileOperation, ApplyPatchDeleteFileOperation, ApplyPatchUpdateFileOperation + + :ivar type: Required. Known values are: "create_file", "delete_file", and "update_file". + :vartype type: str or ~azure.ai.projects.models.ApplyPatchFileOperationType """ - type: Literal[ToolType.APPLY_PATCH] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The type of the tool. Always ``apply_patch``. Required. APPLY_PATCH.""" + __mapping__: dict[str, _Model] = {} + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """Required. Known values are: \"create_file\", \"delete_file\", and \"update_file\".""" @overload def __init__( self, + *, + type: str, ) -> None: ... @overload @@ -1343,16 +1780,151 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.APPLY_PATCH # type: ignore -class ApproximateLocation(_Model): - """ApproximateLocation. +class ApplyPatchCreateFileOperation(ApplyPatchFileOperation, discriminator="create_file"): + """Apply patch create file operation. - :ivar type: The type of location approximation. Always ``approximate``. Required. Default value - is "approximate". - :vartype type: str - :ivar country: + :ivar type: Create a new file with the provided diff. Required. CREATE_FILE. + :vartype type: str or ~azure.ai.projects.models.CREATE_FILE + :ivar path: Path of the file to create. Required. + :vartype path: str + :ivar diff: Diff to apply. Required. + :vartype diff: str + """ + + type: Literal[ApplyPatchFileOperationType.CREATE_FILE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Create a new file with the provided diff. Required. CREATE_FILE.""" + path: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Path of the file to create. Required.""" + diff: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Diff to apply. Required.""" + + @overload + def __init__( + self, + *, + path: str, + diff: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ApplyPatchFileOperationType.CREATE_FILE # type: ignore + + +class ApplyPatchDeleteFileOperation(ApplyPatchFileOperation, discriminator="delete_file"): + """Apply patch delete file operation. + + :ivar type: Delete the specified file. Required. DELETE_FILE. + :vartype type: str or ~azure.ai.projects.models.DELETE_FILE + :ivar path: Path of the file to delete. Required. + :vartype path: str + """ + + type: Literal[ApplyPatchFileOperationType.DELETE_FILE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Delete the specified file. Required. DELETE_FILE.""" + path: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Path of the file to delete. Required.""" + + @overload + def __init__( + self, + *, + path: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ApplyPatchFileOperationType.DELETE_FILE # type: ignore + + +class ApplyPatchToolParam(Tool, discriminator="apply_patch"): + """Apply patch tool. + + :ivar type: The type of the tool. Always ``apply_patch``. Required. APPLY_PATCH. + :vartype type: str or ~azure.ai.projects.models.APPLY_PATCH + """ + + type: Literal[ToolType.APPLY_PATCH] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the tool. Always ``apply_patch``. Required. APPLY_PATCH.""" + + @overload + def __init__( + self, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ToolType.APPLY_PATCH # type: ignore + + +class ApplyPatchUpdateFileOperation(ApplyPatchFileOperation, discriminator="update_file"): + """Apply patch update file operation. + + :ivar type: Update an existing file with the provided diff. Required. UPDATE_FILE. + :vartype type: str or ~azure.ai.projects.models.UPDATE_FILE + :ivar path: Path of the file to update. Required. + :vartype path: str + :ivar diff: Diff to apply. Required. + :vartype diff: str + """ + + type: Literal[ApplyPatchFileOperationType.UPDATE_FILE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Update an existing file with the provided diff. Required. UPDATE_FILE.""" + path: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Path of the file to update. Required.""" + diff: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Diff to apply. Required.""" + + @overload + def __init__( + self, + *, + path: str, + diff: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ApplyPatchFileOperationType.UPDATE_FILE # type: ignore + + +class ApproximateLocation(_Model): + """ApproximateLocation. + + :ivar type: The type of location approximation. Always ``approximate``. Required. Default value + is "approximate". + :vartype type: str + :ivar country: :vartype country: str :ivar region: :vartype region: str @@ -1392,6 +1964,45 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type: Literal["approximate"] = "approximate" +class ArtifactProfile(_Model): + """Artifact profile of the model. + + :ivar category: The category of the artifact profile. Required. Known values are: "DataOnly", + "RuntimeDependent", and "Unknown". + :vartype category: str or ~azure.ai.projects.models.FoundryModelArtifactProfileCategory + :ivar signals: Signals detected in the model artifact. + :vartype signals: list[str or ~azure.ai.projects.models.FoundryModelArtifactProfileSignal] + """ + + category: Union[str, "_models.FoundryModelArtifactProfileCategory"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The category of the artifact profile. Required. Known values are: \"DataOnly\", + \"RuntimeDependent\", and \"Unknown\".""" + signals: Optional[list[Union[str, "_models.FoundryModelArtifactProfileSignal"]]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Signals detected in the model artifact.""" + + @overload + def __init__( + self, + *, + category: Union[str, "_models.FoundryModelArtifactProfileCategory"], + signals: Optional[list[Union[str, "_models.FoundryModelArtifactProfileSignal"]]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class AutoCodeInterpreterToolParam(_Model): """Automatic Code Interpreter Tool Parameters. @@ -1438,7 +2049,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type: Literal["auto"] = "auto" -class Target(_Model): +class EvaluationTarget(_Model): """Base class for targets with discriminator support. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -1470,7 +2081,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AzureAIAgentTarget(Target, discriminator="azure_ai_agent"): +class AzureAIAgentTarget(EvaluationTarget, discriminator="azure_ai_agent"): """Represents a target specifying an Azure AI agent. :ivar type: The type of target, always ``azure_ai_agent``. Required. Default value is @@ -1483,6 +2094,8 @@ class AzureAIAgentTarget(Target, discriminator="azure_ai_agent"): :ivar tool_descriptions: The parameters used to control the sampling behavior of the agent during text generation. :vartype tool_descriptions: list[~azure.ai.projects.models.ToolDescription] + :ivar tools: + :vartype tools: list[~azure.ai.projects.models.Tool] """ type: Literal["azure_ai_agent"] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -1495,6 +2108,7 @@ class AzureAIAgentTarget(Target, discriminator="azure_ai_agent"): visibility=["read", "create", "update", "delete", "query"] ) """The parameters used to control the sampling behavior of the agent during text generation.""" + tools: Optional[list["_models.Tool"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @overload def __init__( @@ -1503,6 +2117,7 @@ def __init__( name: str, version: Optional[str] = None, tool_descriptions: Optional[list["_models.ToolDescription"]] = None, + tools: Optional[list["_models.Tool"]] = None, ) -> None: ... @overload @@ -1517,7 +2132,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = "azure_ai_agent" # type: ignore -class AzureAIModelTarget(Target, discriminator="azure_ai_model"): +class AzureAIModelTarget(EvaluationTarget, discriminator="azure_ai_model"): """Represents a target specifying an Azure AI model for operations requiring model selection. :ivar type: The type of target, always ``azure_ai_model``. Required. Default value is @@ -1679,6 +2294,10 @@ class AzureAISearchTool(Tool, discriminator="azure_ai_search"): :vartype name: str :ivar description: Optional user-defined description for this tool or configuration. :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar azure_ai_search: The azure ai search index resource. Required. :vartype azure_ai_search: ~azure.ai.projects.models.AzureAISearchToolResource """ @@ -1689,6 +2308,12 @@ class AzureAISearchTool(Tool, discriminator="azure_ai_search"): """Optional user-defined name for this tool or configuration.""" description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Optional user-defined description for this tool or configuration.""" + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: + exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at + runtime.""" azure_ai_search: "_models.AzureAISearchToolResource" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -1701,6 +2326,7 @@ def __init__( azure_ai_search: "_models.AzureAISearchToolResource", name: Optional[str] = None, description: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @overload @@ -1715,6 +2341,116 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = ToolType.AZURE_AI_SEARCH # type: ignore +class AzureAISearchToolCall(OutputItem, discriminator="azure_ai_search_call"): + """An Azure AI Search tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. AZURE_AI_SEARCH_CALL. + :vartype type: str or ~azure.ai.projects.models.AZURE_AI_SEARCH_CALL + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.projects.models.ToolCallStatus + """ + + type: Literal[OutputItemType.AZURE_AI_SEARCH_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. AZURE_AI_SEARCH_CALL.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the tool call generated by the model. Required.""" + arguments: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A JSON string of the arguments to pass to the tool. Required.""" + status: Union[str, "_models.ToolCallStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + + @overload + def __init__( + self, + *, + call_id: str, + arguments: str, + status: Union[str, "_models.ToolCallStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = OutputItemType.AZURE_AI_SEARCH_CALL # type: ignore + + +class AzureAISearchToolCallOutput(OutputItem, discriminator="azure_ai_search_call_output"): + """The output of an Azure AI Search tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. AZURE_AI_SEARCH_CALL_OUTPUT. + :vartype type: str or ~azure.ai.projects.models.AZURE_AI_SEARCH_CALL_OUTPUT + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the Azure AI Search tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: dict[str, any] or str or list[any] + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.projects.models.ToolCallStatus + """ + + type: Literal[OutputItemType.AZURE_AI_SEARCH_CALL_OUTPUT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. AZURE_AI_SEARCH_CALL_OUTPUT.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the tool call generated by the model. Required.""" + output: Optional["_types.ToolCallOutputContent"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The output from the Azure AI Search tool call. Is one of the following types: {str: Any}, str, + [Any]""" + status: Union[str, "_models.ToolCallStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + + @overload + def __init__( + self, + *, + call_id: str, + status: Union[str, "_models.ToolCallStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + output: Optional["_types.ToolCallOutputContent"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = OutputItemType.AZURE_AI_SEARCH_CALL_OUTPUT # type: ignore + + class AzureAISearchToolResource(_Model): """A set of index resources used by the ``azure_ai_search`` tool. @@ -1914,6 +2650,10 @@ class AzureFunctionTool(Tool, discriminator="azure_function"): :vartype type: str or ~azure.ai.projects.models.AZURE_FUNCTION :ivar azure_function: The Azure Function Tool definition. Required. :vartype azure_function: ~azure.ai.projects.models.AzureFunctionDefinition + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] """ type: Literal[ToolType.AZURE_FUNCTION] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -1922,12 +2662,19 @@ class AzureFunctionTool(Tool, discriminator="azure_function"): visibility=["read", "create", "update", "delete", "query"] ) """The Azure Function Tool definition. Required.""" + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: + exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at + runtime.""" @overload def __init__( self, *, azure_function: "_models.AzureFunctionDefinition", + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @overload @@ -1942,7 +2689,127 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = ToolType.AZURE_FUNCTION # type: ignore -class TargetConfig(_Model): +class AzureFunctionToolCall(OutputItem, discriminator="azure_function_call"): + """An Azure Function tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. AZURE_FUNCTION_CALL. + :vartype type: str or ~azure.ai.projects.models.AZURE_FUNCTION_CALL + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the Azure Function being called. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.projects.models.ToolCallStatus + """ + + type: Literal[OutputItemType.AZURE_FUNCTION_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. AZURE_FUNCTION_CALL.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the tool call generated by the model. Required.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the Azure Function being called. Required.""" + arguments: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A JSON string of the arguments to pass to the tool. Required.""" + status: Union[str, "_models.ToolCallStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + + @overload + def __init__( + self, + *, + call_id: str, + name: str, + arguments: str, + status: Union[str, "_models.ToolCallStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = OutputItemType.AZURE_FUNCTION_CALL # type: ignore + + +class AzureFunctionToolCallOutput(OutputItem, discriminator="azure_function_call_output"): + """The output of an Azure Function tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. AZURE_FUNCTION_CALL_OUTPUT. + :vartype type: str or ~azure.ai.projects.models.AZURE_FUNCTION_CALL_OUTPUT + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the Azure Function that was called. Required. + :vartype name: str + :ivar output: The output from the Azure Function tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: dict[str, any] or str or list[any] + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.projects.models.ToolCallStatus + """ + + type: Literal[OutputItemType.AZURE_FUNCTION_CALL_OUTPUT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. AZURE_FUNCTION_CALL_OUTPUT.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the tool call generated by the model. Required.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the Azure Function that was called. Required.""" + output: Optional["_types.ToolCallOutputContent"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The output from the Azure Function tool call. Is one of the following types: {str: Any}, str, + [Any]""" + status: Union[str, "_models.ToolCallStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + + @overload + def __init__( + self, + *, + call_id: str, + name: str, + status: Union[str, "_models.ToolCallStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + output: Optional["_types.ToolCallOutputContent"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = OutputItemType.AZURE_FUNCTION_CALL_OUTPUT # type: ignore + + +class RedTeamTargetConfig(_Model): """Abstract class for target configuration. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -1974,7 +2841,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AzureOpenAIModelConfiguration(TargetConfig, discriminator="AzureOpenAIModel"): +class AzureOpenAIModelConfiguration(RedTeamTargetConfig, discriminator="AzureOpenAIModel"): """Azure OpenAI model configuration. The API version would be selected by the service for querying the model. @@ -2078,6 +2945,10 @@ class BingCustomSearchPreviewTool(Tool, discriminator="bing_custom_search_previe :vartype name: str :ivar description: Optional user-defined description for this tool or configuration. :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar bing_custom_search_preview: The bing custom search tool parameters. Required. :vartype bing_custom_search_preview: ~azure.ai.projects.models.BingCustomSearchToolParameters """ @@ -2089,6 +2960,12 @@ class BingCustomSearchPreviewTool(Tool, discriminator="bing_custom_search_previe """Optional user-defined name for this tool or configuration.""" description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Optional user-defined description for this tool or configuration.""" + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: + exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at + runtime.""" bing_custom_search_preview: "_models.BingCustomSearchToolParameters" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -2101,6 +2978,7 @@ def __init__( bing_custom_search_preview: "_models.BingCustomSearchToolParameters", name: Optional[str] = None, description: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @overload @@ -2115,25 +2993,45 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = ToolType.BING_CUSTOM_SEARCH_PREVIEW # type: ignore -class BingCustomSearchToolParameters(_Model): - """The bing custom search tool parameters. - - :ivar search_configurations: The project connections attached to this tool. There can be a - maximum of 1 connection resource attached to the tool. Required. - :vartype search_configurations: list[~azure.ai.projects.models.BingCustomSearchConfiguration] - """ - - search_configurations: list["_models.BingCustomSearchConfiguration"] = rest_field( +class BingCustomSearchToolCall(OutputItem, discriminator="bing_custom_search_preview_call"): + """A Bing custom search tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BING_CUSTOM_SEARCH_PREVIEW_CALL. + :vartype type: str or ~azure.ai.projects.models.BING_CUSTOM_SEARCH_PREVIEW_CALL + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.projects.models.ToolCallStatus + """ + + type: Literal[OutputItemType.BING_CUSTOM_SEARCH_PREVIEW_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. BING_CUSTOM_SEARCH_PREVIEW_CALL.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the tool call generated by the model. Required.""" + arguments: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A JSON string of the arguments to pass to the tool. Required.""" + status: Union[str, "_models.ToolCallStatus"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The project connections attached to this tool. There can be a maximum of 1 connection resource - attached to the tool. Required.""" + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" @overload def __init__( self, *, - search_configurations: list["_models.BingCustomSearchConfiguration"], + call_id: str, + arguments: str, + status: Union[str, "_models.ToolCallStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, ) -> None: ... @overload @@ -2145,17 +3043,107 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = OutputItemType.BING_CUSTOM_SEARCH_PREVIEW_CALL # type: ignore -class BingGroundingSearchConfiguration(_Model): - """Search configuration for Bing Grounding. +class BingCustomSearchToolCallOutput(OutputItem, discriminator="bing_custom_search_preview_call_output"): + """The output of a Bing custom search tool call. - :ivar project_connection_id: Project connection id for grounding with bing search. Required. - :vartype project_connection_id: str - :ivar market: The market where the results come from. - :vartype market: str - :ivar set_lang: The language to use for user interface strings when calling Bing API. - :vartype set_lang: str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BING_CUSTOM_SEARCH_PREVIEW_CALL_OUTPUT. + :vartype type: str or ~azure.ai.projects.models.BING_CUSTOM_SEARCH_PREVIEW_CALL_OUTPUT + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the Bing custom search tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: dict[str, any] or str or list[any] + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.projects.models.ToolCallStatus + """ + + type: Literal[OutputItemType.BING_CUSTOM_SEARCH_PREVIEW_CALL_OUTPUT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. BING_CUSTOM_SEARCH_PREVIEW_CALL_OUTPUT.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the tool call generated by the model. Required.""" + output: Optional["_types.ToolCallOutputContent"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The output from the Bing custom search tool call. Is one of the following types: {str: Any}, + str, [Any]""" + status: Union[str, "_models.ToolCallStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + + @overload + def __init__( + self, + *, + call_id: str, + status: Union[str, "_models.ToolCallStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + output: Optional["_types.ToolCallOutputContent"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = OutputItemType.BING_CUSTOM_SEARCH_PREVIEW_CALL_OUTPUT # type: ignore + + +class BingCustomSearchToolParameters(_Model): + """The bing custom search tool parameters. + + :ivar search_configurations: The project connections attached to this tool. There can be a + maximum of 1 connection resource attached to the tool. Required. + :vartype search_configurations: list[~azure.ai.projects.models.BingCustomSearchConfiguration] + """ + + search_configurations: list["_models.BingCustomSearchConfiguration"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The project connections attached to this tool. There can be a maximum of 1 connection resource + attached to the tool. Required.""" + + @overload + def __init__( + self, + *, + search_configurations: list["_models.BingCustomSearchConfiguration"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BingGroundingSearchConfiguration(_Model): + """Search configuration for Bing Grounding. + + :ivar project_connection_id: Project connection id for grounding with bing search. Required. + :vartype project_connection_id: str + :ivar market: The market where the results come from. + :vartype market: str + :ivar set_lang: The language to use for user interface strings when calling Bing API. + :vartype set_lang: str :ivar count: The number of search results to return in the bing api response. :vartype count: int :ivar freshness: Filter search results by a specific time range. See `accepted values here @@ -2240,6 +3228,10 @@ class BingGroundingTool(Tool, discriminator="bing_grounding"): :vartype name: str :ivar description: Optional user-defined description for this tool or configuration. :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar bing_grounding: The bing grounding search tool parameters. Required. :vartype bing_grounding: ~azure.ai.projects.models.BingGroundingSearchToolParameters """ @@ -2250,6 +3242,12 @@ class BingGroundingTool(Tool, discriminator="bing_grounding"): """Optional user-defined name for this tool or configuration.""" description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Optional user-defined description for this tool or configuration.""" + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: + exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at + runtime.""" bing_grounding: "_models.BingGroundingSearchToolParameters" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -2262,6 +3260,7 @@ def __init__( bing_grounding: "_models.BingGroundingSearchToolParameters", name: Optional[str] = None, description: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @overload @@ -2276,6 +3275,116 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = ToolType.BING_GROUNDING # type: ignore +class BingGroundingToolCall(OutputItem, discriminator="bing_grounding_call"): + """A Bing grounding tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BING_GROUNDING_CALL. + :vartype type: str or ~azure.ai.projects.models.BING_GROUNDING_CALL + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.projects.models.ToolCallStatus + """ + + type: Literal[OutputItemType.BING_GROUNDING_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. BING_GROUNDING_CALL.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the tool call generated by the model. Required.""" + arguments: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A JSON string of the arguments to pass to the tool. Required.""" + status: Union[str, "_models.ToolCallStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + + @overload + def __init__( + self, + *, + call_id: str, + arguments: str, + status: Union[str, "_models.ToolCallStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = OutputItemType.BING_GROUNDING_CALL # type: ignore + + +class BingGroundingToolCallOutput(OutputItem, discriminator="bing_grounding_call_output"): + """The output of a Bing grounding tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BING_GROUNDING_CALL_OUTPUT. + :vartype type: str or ~azure.ai.projects.models.BING_GROUNDING_CALL_OUTPUT + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the Bing grounding tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: dict[str, any] or str or list[any] + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.projects.models.ToolCallStatus + """ + + type: Literal[OutputItemType.BING_GROUNDING_CALL_OUTPUT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. BING_GROUNDING_CALL_OUTPUT.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the tool call generated by the model. Required.""" + output: Optional["_types.ToolCallOutputContent"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The output from the Bing grounding tool call. Is one of the following types: {str: Any}, str, + [Any]""" + status: Union[str, "_models.ToolCallStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + + @overload + def __init__( + self, + *, + call_id: str, + status: Union[str, "_models.ToolCallStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + output: Optional["_types.ToolCallOutputContent"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = OutputItemType.BING_GROUNDING_CALL_OUTPUT # type: ignore + + class BlobReference(_Model): """Blob reference details. @@ -2403,6 +3512,10 @@ class BrowserAutomationPreviewTool(Tool, discriminator="browser_automation_previ :vartype name: str :ivar description: Optional user-defined description for this tool or configuration. :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar browser_automation_preview: The Browser Automation Tool parameters. Required. :vartype browser_automation_preview: ~azure.ai.projects.models.BrowserAutomationToolParameters """ @@ -2414,6 +3527,12 @@ class BrowserAutomationPreviewTool(Tool, discriminator="browser_automation_previ """Optional user-defined name for this tool or configuration.""" description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Optional user-defined description for this tool or configuration.""" + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: + exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at + runtime.""" browser_automation_preview: "_models.BrowserAutomationToolParameters" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -2426,6 +3545,7 @@ def __init__( browser_automation_preview: "_models.BrowserAutomationToolParameters", name: Optional[str] = None, description: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @overload @@ -2440,6 +3560,116 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = ToolType.BROWSER_AUTOMATION_PREVIEW # type: ignore +class BrowserAutomationToolCall(OutputItem, discriminator="browser_automation_preview_call"): + """A browser automation tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BROWSER_AUTOMATION_PREVIEW_CALL. + :vartype type: str or ~azure.ai.projects.models.BROWSER_AUTOMATION_PREVIEW_CALL + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.projects.models.ToolCallStatus + """ + + type: Literal[OutputItemType.BROWSER_AUTOMATION_PREVIEW_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. BROWSER_AUTOMATION_PREVIEW_CALL.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the tool call generated by the model. Required.""" + arguments: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A JSON string of the arguments to pass to the tool. Required.""" + status: Union[str, "_models.ToolCallStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + + @overload + def __init__( + self, + *, + call_id: str, + arguments: str, + status: Union[str, "_models.ToolCallStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = OutputItemType.BROWSER_AUTOMATION_PREVIEW_CALL # type: ignore + + +class BrowserAutomationToolCallOutput(OutputItem, discriminator="browser_automation_preview_call_output"): + """The output of a browser automation tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BROWSER_AUTOMATION_PREVIEW_CALL_OUTPUT. + :vartype type: str or ~azure.ai.projects.models.BROWSER_AUTOMATION_PREVIEW_CALL_OUTPUT + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the browser automation tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: dict[str, any] or str or list[any] + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.projects.models.ToolCallStatus + """ + + type: Literal[OutputItemType.BROWSER_AUTOMATION_PREVIEW_CALL_OUTPUT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. BROWSER_AUTOMATION_PREVIEW_CALL_OUTPUT.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the tool call generated by the model. Required.""" + output: Optional["_types.ToolCallOutputContent"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The output from the browser automation tool call. Is one of the following types: {str: Any}, + str, [Any]""" + status: Union[str, "_models.ToolCallStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + + @overload + def __init__( + self, + *, + call_id: str, + status: Union[str, "_models.ToolCallStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + output: Optional["_types.ToolCallOutputContent"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = OutputItemType.BROWSER_AUTOMATION_PREVIEW_CALL_OUTPUT # type: ignore + + class BrowserAutomationToolConnectionParameters(_Model): # pylint: disable=name-too-long """Definition of input parameters for the connection used by the Browser Automation Tool. @@ -2500,6 +3730,87 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class CandidateDeployConfig(_Model): + """Deploy-config blob for a candidate. Suitable for setting OPTIMIZATION_CONFIG on a hosted-agent + version. + + :ivar instructions: System prompt / instructions. + :vartype instructions: str + :ivar model: Foundry deployment name. + :vartype model: str + :ivar temperature: Optional sampling temperature. + :vartype temperature: float + :ivar skills: Optional skill overrides. + :vartype skills: list[~azure.ai.projects.models.OptimizationAgentSkill] + """ + + instructions: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """System prompt / instructions.""" + model: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Foundry deployment name.""" + temperature: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional sampling temperature.""" + skills: Optional[list["_models.OptimizationAgentSkill"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Optional skill overrides.""" + + @overload + def __init__( + self, + *, + instructions: Optional[str] = None, + model: Optional[str] = None, + temperature: Optional[float] = None, + skills: Optional[list["_models.OptimizationAgentSkill"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CandidateResults(_Model): + """Full per-task evaluation results for a candidate, returned by GET /candidates/{id}/results. + + :ivar candidate_id: Owning candidate id. Required. + :vartype candidate_id: str + :ivar results: Per-task evaluation rows. Required. + :vartype results: list[~azure.ai.projects.models.OptimizationTaskResult] + """ + + candidate_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Owning candidate id. Required.""" + results: list["_models.OptimizationTaskResult"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-task evaluation rows. Required.""" + + @overload + def __init__( + self, + *, + candidate_id: str, + results: list["_models.OptimizationTaskResult"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class CaptureStructuredOutputsTool(Tool, discriminator="capture_structured_outputs"): """A tool for capturing structured outputs. @@ -2510,6 +3821,10 @@ class CaptureStructuredOutputsTool(Tool, discriminator="capture_structured_outpu :vartype name: str :ivar description: Optional user-defined description for this tool or configuration. :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar outputs: The structured outputs to capture from the model. Required. :vartype outputs: ~azure.ai.projects.models.StructuredOutputDefinition """ @@ -2521,6 +3836,12 @@ class CaptureStructuredOutputsTool(Tool, discriminator="capture_structured_outpu """Optional user-defined name for this tool or configuration.""" description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Optional user-defined description for this tool or configuration.""" + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: + exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at + runtime.""" outputs: "_models.StructuredOutputDefinition" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -2533,6 +3854,7 @@ def __init__( outputs: "_models.StructuredOutputDefinition", name: Optional[str] = None, description: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @overload @@ -2589,7 +3911,7 @@ class MemoryItem(_Model): """A single memory item stored in the memory store, containing content and metadata. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ChatSummaryMemoryItem, UserProfileMemoryItem + ChatSummaryMemoryItem, ProceduralMemoryItem, UserProfileMemoryItem :ivar memory_id: The unique ID of the memory item. Required. :vartype memory_id: str @@ -2600,8 +3922,8 @@ class MemoryItem(_Model): :vartype scope: str :ivar content: The content of the memory. Required. :vartype content: str - :ivar kind: The kind of the memory item. Required. Known values are: "user_profile" and - "chat_summary". + :ivar kind: The kind of the memory item. Required. Known values are: "user_profile", + "chat_summary", and "procedural". :vartype kind: str or ~azure.ai.projects.models.MemoryItemKind """ @@ -2617,7 +3939,8 @@ class MemoryItem(_Model): content: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The content of the memory. Required.""" kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) - """The kind of the memory item. Required. Known values are: \"user_profile\" and \"chat_summary\".""" + """The kind of the memory item. Required. Known values are: \"user_profile\", \"chat_summary\", + and \"procedural\".""" @overload def __init__( @@ -2682,35 +4005,121 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = MemoryItemKind.CHAT_SUMMARY # type: ignore -class ClusterInsightResult(_Model): - """Insights from the cluster analysis. +class ComputerAction(_Model): + """ComputerAction. - :ivar summary: Summary of the insights report. Required. - :vartype summary: ~azure.ai.projects.models.InsightSummary - :ivar clusters: List of clusters identified in the insights. Required. - :vartype clusters: list[~azure.ai.projects.models.InsightCluster] - :ivar coordinates: Optional mapping of IDs to 2D coordinates used by the UX for - visualization. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ClickParam, DoubleClickAction, DragParam, KeyPressAction, MoveParam, ScreenshotParam, + ScrollParam, TypeParam, WaitParam - The map keys are string identifiers (for example, a cluster id or a sample id) - and the values are the coordinates and visual size for rendering on a 2D chart. + :ivar type: Required. Known values are: "click", "double_click", "drag", "keypress", "move", + "screenshot", "scroll", "type", and "wait". + :vartype type: str or ~azure.ai.projects.models.ComputerActionType + """ - This property is omitted unless the client requests coordinates (for example, - by passing ``includeCoordinates=true`` as a query parameter). + __mapping__: dict[str, _Model] = {} + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """Required. Known values are: \"click\", \"double_click\", \"drag\", \"keypress\", \"move\", + \"screenshot\", \"scroll\", \"type\", and \"wait\".""" - Example: + @overload + def __init__( + self, + *, + type: str, + ) -> None: ... - .. code-block:: + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ - { - "cluster-1": { "x": 12, "y": 34, "size": 8 }, - "sample-123": { "x": 18, "y": 22, "size": 4 } - } + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) - Coordinates are intended only for client-side visualization and do not - modify the canonical insights results. - :vartype coordinates: dict[str, ~azure.ai.projects.models.ChartCoordinate] - """ + +class ClickParam(ComputerAction, discriminator="click"): + """Click. + + :ivar type: Specifies the event type. For a click action, this property is always ``click``. + Required. CLICK. + :vartype type: str or ~azure.ai.projects.models.CLICK + :ivar button: Indicates which mouse button was pressed during the click. One of ``left``, + ``right``, ``wheel``, ``back``, or ``forward``. Required. Known values are: "left", "right", + "wheel", "back", and "forward". + :vartype button: str or ~azure.ai.projects.models.ClickButtonType + :ivar x: The x-coordinate where the click occurred. Required. + :vartype x: int + :ivar y: The y-coordinate where the click occurred. Required. + :vartype y: int + """ + + type: Literal[ComputerActionType.CLICK] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Specifies the event type. For a click action, this property is always ``click``. Required. + CLICK.""" + button: Union[str, "_models.ClickButtonType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates which mouse button was pressed during the click. One of ``left``, ``right``, + ``wheel``, ``back``, or ``forward``. Required. Known values are: \"left\", \"right\", + \"wheel\", \"back\", and \"forward\".""" + x: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The x-coordinate where the click occurred. Required.""" + y: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The y-coordinate where the click occurred. Required.""" + + @overload + def __init__( + self, + *, + button: Union[str, "_models.ClickButtonType"], + x: int, + y: int, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ComputerActionType.CLICK # type: ignore + + +class ClusterInsightResult(_Model): + """Insights from the cluster analysis. + + :ivar summary: Summary of the insights report. Required. + :vartype summary: ~azure.ai.projects.models.InsightSummary + :ivar clusters: List of clusters identified in the insights. Required. + :vartype clusters: list[~azure.ai.projects.models.InsightCluster] + :ivar coordinates: Optional mapping of IDs to 2D coordinates used by the UX for + visualization. + + The map keys are string identifiers (for example, a cluster id or a sample id) + and the values are the coordinates and visual size for rendering on a 2D chart. + + This property is omitted unless the client requests coordinates (for example, + by passing ``includeCoordinates=true`` as a query parameter). + + Example: + + .. code-block:: + + { + "cluster-1": { "x": 12, "y": 34, "size": 8 }, + "sample-123": { "x": 18, "y": 22, "size": 4 } + } + + Coordinates are intended only for client-side visualization and do not + modify the canonical insights results. + :vartype coordinates: dict[str, ~azure.ai.projects.models.ChartCoordinate] + """ summary: "_models.InsightSummary" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Summary of the insights report. Required.""" @@ -2810,7 +4219,7 @@ class EvaluatorDefinition(_Model): CodeBasedEvaluatorDefinition, PromptBasedEvaluatorDefinition, RubricBasedEvaluatorDefinition :ivar type: The type of evaluator definition. Required. Known values are: "prompt", "code", - "prompt_and_code", "service", "openai_graders", and "rubrics". + "prompt_and_code", "service", "openai_graders", and "rubric". :vartype type: str or ~azure.ai.projects.models.EvaluatorDefinitionType :ivar init_parameters: The JSON schema (Draft 2020-12) for the evaluator's input parameters. This includes parameters like type, properties, required. @@ -2825,7 +4234,7 @@ class EvaluatorDefinition(_Model): __mapping__: dict[str, _Model] = {} type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) """The type of evaluator definition. Required. Known values are: \"prompt\", \"code\", - \"prompt_and_code\", \"service\", \"openai_graders\", and \"rubrics\".""" + \"prompt_and_code\", \"service\", \"openai_graders\", and \"rubric\".""" init_parameters: Optional[dict[str, Any]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The JSON schema (Draft 2020-12) for the evaluator's input parameters. This includes parameters like type, properties, required.""" @@ -2976,6 +4385,72 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class CodeInterpreterOutputImage(_Model): + """Code interpreter output image. + + :ivar type: The type of the output. Always ``image``. Required. Default value is "image". + :vartype type: str + :ivar url: The URL of the image output from the code interpreter. Required. + :vartype url: str + """ + + type: Literal["image"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The type of the output. Always ``image``. Required. Default value is \"image\".""" + url: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The URL of the image output from the code interpreter. Required.""" + + @overload + def __init__( + self, + *, + url: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type: Literal["image"] = "image" + + +class CodeInterpreterOutputLogs(_Model): + """Code interpreter output logs. + + :ivar type: The type of the output. Always ``logs``. Required. Default value is "logs". + :vartype type: str + :ivar logs: The logs output from the code interpreter. Required. + :vartype logs: str + """ + + type: Literal["logs"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The type of the output. Always ``logs``. Required. Default value is \"logs\".""" + logs: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The logs output from the code interpreter. Required.""" + + @overload + def __init__( + self, + *, + logs: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type: Literal["logs"] = "logs" + + class CodeInterpreterTool(Tool, discriminator="code_interpreter"): """Code interpreter. @@ -2986,6 +4461,10 @@ class CodeInterpreterTool(Tool, discriminator="code_interpreter"): :vartype name: str :ivar description: Optional user-defined description for this tool or configuration. :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar container: The code interpreter container. Can be a container ID or an object that specifies uploaded file IDs to make available to your code, along with an optional ``memory_limit`` setting. If not provided, the service assumes auto. Is either a str type or a @@ -2999,6 +4478,12 @@ class CodeInterpreterTool(Tool, discriminator="code_interpreter"): """Optional user-defined name for this tool or configuration.""" description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Optional user-defined description for this tool or configuration.""" + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: + exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at + runtime.""" container: Optional[Union[str, "_models.AutoCodeInterpreterToolParam"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -3013,6 +4498,7 @@ def __init__( *, name: Optional[str] = None, description: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, container: Optional[Union[str, "_models.AutoCodeInterpreterToolParam"]] = None, ) -> None: ... @@ -3132,6 +4618,42 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class ComputerCallSafetyCheckParam(_Model): + """A pending safety check for the computer call. + + :ivar id: The ID of the pending safety check. Required. + :vartype id: str + :ivar code: + :vartype code: str + :ivar message: + :vartype message: str + """ + + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ID of the pending safety check. Required.""" + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + code: Optional[str] = None, + message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class ComputerUsePreviewTool(Tool, discriminator="computer_use_preview"): """Computer use preview. @@ -3335,6 +4857,63 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class ContainerFileCitationBody(Annotation, discriminator="container_file_citation"): + """Container file citation. + + :ivar type: The type of the container file citation. Always ``container_file_citation``. + Required. CONTAINER_FILE_CITATION. + :vartype type: str or ~azure.ai.projects.models.CONTAINER_FILE_CITATION + :ivar container_id: The ID of the container file. Required. + :vartype container_id: str + :ivar file_id: The ID of the file. Required. + :vartype file_id: str + :ivar start_index: The index of the first character of the container file citation in the + message. Required. + :vartype start_index: int + :ivar end_index: The index of the last character of the container file citation in the message. + Required. + :vartype end_index: int + :ivar filename: The filename of the container file cited. Required. + :vartype filename: str + """ + + type: Literal[AnnotationType.CONTAINER_FILE_CITATION] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the container file citation. Always ``container_file_citation``. Required. + CONTAINER_FILE_CITATION.""" + container_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ID of the container file. Required.""" + file_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ID of the file. Required.""" + start_index: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The index of the first character of the container file citation in the message. Required.""" + end_index: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The index of the last character of the container file citation in the message. Required.""" + filename: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The filename of the container file cited. Required.""" + + @overload + def __init__( + self, + *, + container_id: str, + file_id: str, + start_index: int, + end_index: int, + filename: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = AnnotationType.CONTAINER_FILE_CITATION # type: ignore + + class ContainerNetworkPolicyParam(_Model): """Network access policy for the container. @@ -3475,6 +5054,72 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class FunctionShellCallEnvironment(_Model): + """FunctionShellCallEnvironment. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ContainerReferenceResource, LocalEnvironmentResource + + :ivar type: Required. Known values are: "local" and "container_reference". + :vartype type: str or ~azure.ai.projects.models.FunctionShellCallEnvironmentType + """ + + __mapping__: dict[str, _Model] = {} + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """Required. Known values are: \"local\" and \"container_reference\".""" + + @overload + def __init__( + self, + *, + type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerReferenceResource(FunctionShellCallEnvironment, discriminator="container_reference"): + """Container Reference. + + :ivar type: The environment type. Always ``container_reference``. Required. + CONTAINER_REFERENCE. + :vartype type: str or ~azure.ai.projects.models.CONTAINER_REFERENCE + :ivar container_id: Required. + :vartype container_id: str + """ + + type: Literal[FunctionShellCallEnvironmentType.CONTAINER_REFERENCE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The environment type. Always ``container_reference``. Required. CONTAINER_REFERENCE.""" + container_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + + @overload + def __init__( + self, + *, + container_id: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = FunctionShellCallEnvironmentType.CONTAINER_REFERENCE # type: ignore + + class ContainerSkill(_Model): """ContainerSkill. @@ -3581,6 +5226,39 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = EvaluationRuleActionType.CONTINUOUS_EVALUATION # type: ignore +class CoordParam(_Model): + """Coordinate. + + :ivar x: The x-coordinate. Required. + :vartype x: int + :ivar y: The y-coordinate. Required. + :vartype y: int + """ + + x: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The x-coordinate. Required.""" + y: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The y-coordinate. Required.""" + + @overload + def __init__( + self, + *, + x: int, + y: int, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class CosmosDBIndex(Index, discriminator="CosmosDBNoSqlVectorStore"): """CosmosDB Vector Store Index Definition. @@ -3739,26 +5417,29 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Trigger(_Model): - """Base model for Trigger of the schedule. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - CronTrigger, OneTimeTrigger, RecurrenceTrigger +class CreateAsyncResponse(_Model): + """CreateAsyncResponse. - :ivar type: Type of the trigger. Required. Known values are: "Cron", "Recurrence", and - "OneTime". - :vartype type: str or ~azure.ai.projects.models.TriggerType + :ivar location: URL to poll for operation status. + :vartype location: str + :ivar operation_result: URL to the operation result, or null if the operation is still in + progress. + :vartype operation_result: str """ - __mapping__: dict[str, _Model] = {} - type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) - """Type of the trigger. Required. Known values are: \"Cron\", \"Recurrence\", and \"OneTime\".""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """URL to poll for operation status.""" + operation_result: Optional[str] = rest_field( + name="operationResult", visibility=["read", "create", "update", "delete", "query"] + ) + """URL to the operation result, or null if the operation is still in progress.""" @overload def __init__( self, *, - type: str, + location: Optional[str] = None, + operation_result: Optional[str] = None, ) -> None: ... @overload @@ -3772,12 +5453,114 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CronTrigger(Trigger, discriminator="Cron"): - """Cron based trigger. +class CreateEvalCompletionsRunDataSourceInputMessagesItemReference(_Model): # pylint: disable=name-too-long + """CreateEvalCompletionsRunDataSourceInputMessagesItemReference. - :ivar type: Required. Cron based trigger. - :vartype type: str or ~azure.ai.projects.models.CRON - :ivar expression: Cron expression that defines the schedule frequency. Required. + :ivar type: Required. Default value is "item_reference". + :vartype type: str + :ivar item_reference: Required. + :vartype item_reference: str + """ + + type: Literal["item_reference"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required. Default value is \"item_reference\".""" + item_reference: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + + @overload + def __init__( + self, + *, + item_reference: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type: Literal["item_reference"] = "item_reference" + + +class CreateEvalResponsesRunDataSourceInputMessagesTemplate(_Model): # pylint: disable=name-too-long + """CreateEvalResponsesRunDataSourceInputMessagesTemplate. + + :ivar type: Required. Default value is "template". + :vartype type: str + :ivar template: Required. + :vartype template: list[~azure.ai.projects.models.EvaluationSuiteVersionInputMessagesTemplate1 + or ~azure.ai.projects.models.EvalItem] + """ + + type: Literal["template"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required. Default value is \"template\".""" + template: list[Union["_models.EvaluationSuiteVersionInputMessagesTemplate1", "_models.EvalItem"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Required.""" + + @overload + def __init__( + self, + *, + template: list[Union["_models.EvaluationSuiteVersionInputMessagesTemplate1", "_models.EvalItem"]], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type: Literal["template"] = "template" + + +class Trigger(_Model): + """Base model for Trigger of the schedule. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CronTrigger, OneTimeTrigger, RecurrenceTrigger + + :ivar type: Type of the trigger. Required. Known values are: "Cron", "Recurrence", and + "OneTime". + :vartype type: str or ~azure.ai.projects.models.TriggerType + """ + + __mapping__: dict[str, _Model] = {} + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """Type of the trigger. Required. Known values are: \"Cron\", \"Recurrence\", and \"OneTime\".""" + + @overload + def __init__( + self, + *, + type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CronTrigger(Trigger, discriminator="Cron"): + """Cron based trigger. + + :ivar type: Required. Cron based trigger. + :vartype type: str or ~azure.ai.projects.models.CRON + :ivar expression: Cron expression that defines the schedule frequency. Required. :vartype expression: str :ivar time_zone: Time zone for the cron schedule. :vartype time_zone: str @@ -4138,6 +5921,10 @@ class DataGenerationJobInputs(_Model): Required. Known values are: "supervised_finetuning", "reinforcement_finetuning", and "evaluation". :vartype scenario: str or ~azure.ai.projects.models.DataGenerationJobScenario + :ivar output_options: Optional caller-supplied metadata for the job's output. See individual + fields for whether they apply to file outputs (fine-tuning scenarios), dataset outputs + (evaluation scenario), or both. + :vartype output_options: ~azure.ai.projects.models.DataGenerationJobOutputOptions """ name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -4153,6 +5940,11 @@ class DataGenerationJobInputs(_Model): ) """The scenario of the data generation job. Either for fine-tuning or evaluation. Required. Known values are: \"supervised_finetuning\", \"reinforcement_finetuning\", and \"evaluation\".""" + output_options: Optional["_models.DataGenerationJobOutputOptions"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Optional caller-supplied metadata for the job's output. See individual fields for whether they + apply to file outputs (fine-tuning scenarios), dataset outputs (evaluation scenario), or both.""" @overload def __init__( @@ -4162,6 +5954,7 @@ def __init__( sources: list["_models.DataGenerationJobSource"], options: "_models.DataGenerationJobOptions", scenario: Union[str, "_models.DataGenerationJobScenario"], + output_options: Optional["_models.DataGenerationJobOutputOptions"] = None, ) -> None: ... @overload @@ -4261,6 +6054,50 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class DataGenerationJobOutputOptions(_Model): + """Output options for data generation job. + + :ivar name: Name to assign to the output. Used as the filename for Azure OpenAI file outputs + (fine-tuning scenarios) and as the dataset name for dataset outputs (evaluation scenario). + :vartype name: str + :ivar description: Description to assign to the output. Applies only to dataset outputs + (evaluation scenario); ignored for Azure OpenAI file outputs. + :vartype description: str + :ivar tags: Tags to assign to the output. Applies only to dataset outputs (evaluation + scenario); ignored for Azure OpenAI file outputs. + :vartype tags: dict[str, str] + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name to assign to the output. Used as the filename for Azure OpenAI file outputs (fine-tuning + scenarios) and as the dataset name for dataset outputs (evaluation scenario).""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Description to assign to the output. Applies only to dataset outputs (evaluation scenario); + ignored for Azure OpenAI file outputs.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Tags to assign to the output. Applies only to dataset outputs (evaluation scenario); ignored + for Azure OpenAI file outputs.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + description: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class DataGenerationJobResult(_Model): """Result produced by a successful data generation job. @@ -4388,15 +6225,13 @@ class DatasetDataGenerationJobOutput(DataGenerationJobOutput, discriminator="dat :vartype type: str or ~azure.ai.projects.models.DATASET :ivar id: The id of the output dataset created. :vartype id: str - :ivar name: The name of the output dataset and can be optionally set during job creation time. + :ivar name: The name of the output dataset. :vartype name: str :ivar version: The version of the output dataset. :vartype version: str - :ivar description: Description of the output dataset and can be optionally set during job - creation time. + :ivar description: Description of the output dataset. :vartype description: str - :ivar tags: Tag dictionary of the output dataset and can be optionally set during job creation - time. + :ivar tags: Tag dictionary of the output dataset. :vartype tags: dict[str, str] """ @@ -4404,22 +6239,18 @@ class DatasetDataGenerationJobOutput(DataGenerationJobOutput, discriminator="dat """Dataset output. Required. The generated data is a Dataset.""" id: Optional[str] = rest_field(visibility=["read"]) """The id of the output dataset created.""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The name of the output dataset and can be optionally set during job creation time.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the output dataset.""" version: Optional[str] = rest_field(visibility=["read"]) """The version of the output dataset.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Description of the output dataset and can be optionally set during job creation time.""" - tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Tag dictionary of the output dataset and can be optionally set during job creation time.""" + description: Optional[str] = rest_field(visibility=["read"]) + """Description of the output dataset.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read"]) + """Tag dictionary of the output dataset.""" @overload def __init__( self, - *, - name: Optional[str] = None, - description: Optional[str] = None, - tags: Optional[dict[str, str]] = None, ) -> None: ... @overload @@ -4479,6 +6310,51 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = DataGenerationJobSourceType.DATASET # type: ignore +class DatasetEvaluationSuiteJobSource(EvaluationSuiteJobSource, discriminator="dataset"): + """Dataset source for evaluation suite generation jobs — reference to a dataset. + + :ivar description: Optional description of what this source represents — helps the pipeline + interpret its content (e.g., 'Company refund policy document' or 'Describes the agent's core + capabilities'). + :vartype description: str + :ivar type: The source type for this source, which is Dataset. Required. Dataset source — + reference to a dataset. + :vartype type: str or ~azure.ai.projects.models.DATASET + :ivar name: The name of the dataset. Required. + :vartype name: str + :ivar version: The version of the dataset. If not specified, the latest version is used. + :vartype version: str + """ + + type: Literal[EvaluationSuiteJobSourceType.DATASET] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The source type for this source, which is Dataset. Required. Dataset source — reference to a + dataset.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the dataset. Required.""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The version of the dataset. If not specified, the latest version is used.""" + + @overload + def __init__( + self, + *, + name: str, + description: Optional[str] = None, + version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = EvaluationSuiteJobSourceType.DATASET # type: ignore + + class DatasetEvaluatorGenerationJobSource(EvaluatorGenerationJobSource, discriminator="dataset"): """Dataset source for evaluator generation jobs — reference to a dataset. @@ -4527,6 +6403,102 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = EvaluatorGenerationJobSourceType.DATASET # type: ignore +class DatasetItem(_Model): + """A single evaluation task with input query, expected output, and evaluation criteria. + + :ivar name: Unique-within-the-dataset identifier for this task. Required. + :vartype name: str + :ivar query: The user query / input for the task. Required. + :vartype query: str + :ivar ground_truth: Optional ground truth used by reference-based evaluators. + :vartype ground_truth: str + :ivar criteria: Per-task evaluation criteria. Defaults to the job-level evaluators if unset. + :vartype criteria: list[~azure.ai.projects.models.EvaluationCriterion] + :ivar eval_results: Pre-computed evaluation results in AOAI-compatible format. When provided + together with ``response_items``, the baseline run-and-evaluate phase is skipped. + :vartype eval_results: list[~azure.ai.projects.models.EvalRunOutputItemResult] + :ivar response_items: Pre-computed agent response output items. Captures the full trajectory + (function calls, tool outputs, messages) from a prior agent run. + :vartype response_items: list[~azure.ai.projects.models.OutputItem] + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Unique-within-the-dataset identifier for this task. Required.""" + query: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The user query / input for the task. Required.""" + ground_truth: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional ground truth used by reference-based evaluators.""" + criteria: Optional[list["_models.EvaluationCriterion"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-task evaluation criteria. Defaults to the job-level evaluators if unset.""" + eval_results: Optional[list["_models.EvalRunOutputItemResult"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Pre-computed evaluation results in AOAI-compatible format. When provided together with + ``response_items``, the baseline run-and-evaluate phase is skipped.""" + response_items: Optional[list["_models.OutputItem"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Pre-computed agent response output items. Captures the full trajectory (function calls, tool + outputs, messages) from a prior agent run.""" + + @overload + def __init__( + self, + *, + name: str, + query: str, + ground_truth: Optional[str] = None, + criteria: Optional[list["_models.EvaluationCriterion"]] = None, + eval_results: Optional[list["_models.EvalRunOutputItemResult"]] = None, + response_items: Optional[list["_models.OutputItem"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DatasetRef(_Model): + """Reference to a registered dataset in the Foundry Dataset Service. + + :ivar name: Dataset name. Required. + :vartype name: str + :ivar version: Dataset version. If not specified, the latest version is used. + :vartype version: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Dataset name. Required.""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Dataset version. If not specified, the latest version is used.""" + + @overload + def __init__( + self, + *, + name: str, + version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class DatasetReference(_Model): """Reference to a versioned Foundry Dataset. @@ -4719,32 +6691,37 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DeleteMemoryStoreResult(_Model): - """DeleteMemoryStoreResult. +class DeleteMemoryResponse(_Model): + """Response for deleting a memory item from a memory store. - :ivar object: The object type. Always 'memory_store.deleted'. Required. MEMORY_STORE_DELETED. - :vartype object: str or ~azure.ai.projects.models.MEMORY_STORE_DELETED + :ivar object: The object type. Always 'memory.deleted'. Required. MEMORY_DELETED. + :vartype object: str or ~azure.ai.projects.models.MEMORY_DELETED :ivar name: The name of the memory store. Required. :vartype name: str - :ivar deleted: Whether the memory store was successfully deleted. Required. + :ivar memory_id: The unique ID of the deleted memory item. Required. + :vartype memory_id: str + :ivar deleted: Whether the memory item was successfully deleted. Required. :vartype deleted: bool """ - object: Literal[MemoryStoreObjectType.MEMORY_STORE_DELETED] = rest_field( + object: Literal[MemoryStoreObjectType.MEMORY_DELETED] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The object type. Always 'memory_store.deleted'. Required. MEMORY_STORE_DELETED.""" + """The object type. Always 'memory.deleted'. Required. MEMORY_DELETED.""" name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The name of the memory store. Required.""" + memory_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the deleted memory item. Required.""" deleted: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Whether the memory store was successfully deleted. Required.""" + """Whether the memory item was successfully deleted. Required.""" @overload def __init__( self, *, - object: Literal[MemoryStoreObjectType.MEMORY_STORE_DELETED], + object: Literal[MemoryStoreObjectType.MEMORY_DELETED], name: str, + memory_id: str, deleted: bool, ) -> None: ... @@ -4759,19 +6736,59 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DeleteSkillResult(_Model): - """A deleted skill Object. +class DeleteMemoryStoreResult(_Model): + """DeleteMemoryStoreResult. - :ivar name: The unique name of the skill. Required. + :ivar object: The object type. Always 'memory_store.deleted'. Required. MEMORY_STORE_DELETED. + :vartype object: str or ~azure.ai.projects.models.MEMORY_STORE_DELETED + :ivar name: The name of the memory store. Required. :vartype name: str - :ivar deleted: Whether the skill was successfully deleted. Required. + :ivar deleted: Whether the memory store was successfully deleted. Required. :vartype deleted: bool """ + object: Literal[MemoryStoreObjectType.MEMORY_STORE_DELETED] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The object type. Always 'memory_store.deleted'. Required. MEMORY_STORE_DELETED.""" name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The unique name of the skill. Required.""" + """The name of the memory store. Required.""" deleted: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Whether the skill was successfully deleted. Required.""" + """Whether the memory store was successfully deleted. Required.""" + + @overload + def __init__( + self, + *, + object: Literal[MemoryStoreObjectType.MEMORY_STORE_DELETED], + name: str, + deleted: bool, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeleteSkillResult(_Model): + """A deleted skill Object. + + :ivar name: The unique name of the skill. Required. + :vartype name: str + :ivar deleted: Whether the skill was successfully deleted. Required. + :vartype deleted: bool + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique name of the skill. Required.""" + deleted: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Whether the skill was successfully deleted. Required.""" @overload def __init__( @@ -4828,28 +6845,53 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class EmbeddingConfiguration(_Model): - """Embedding configuration class. +class Dimension(_Model): + """A single dimension — one independent, measurable quality dimension within a rubric evaluator's + scoring blueprint. - :ivar model_deployment_name: Deployment name of embedding model. It can point to a model - deployment either in the parent AIServices or a connection. Required. - :vartype model_deployment_name: str - :ivar embedding_field: Embedding field. Required. - :vartype embedding_field: str + :ivar dimension_id: Stable identifier for this dimension (snake_case, e.g., + ``correct_resolution``). Required. Provided by the user when manually creating a rubric + evaluator or during human-in-the-loop review of a generated set; the generation pipeline + produces an initial value the user can edit. Editable when saving new versions. Required. + :vartype dimension_id: str + :ivar description: What this dimension measures (e.g., 'Correctly identifies the user's + reservation intent and pursues the appropriate workflow'). Required. + :vartype description: str + :ivar weight: Relative weight of this dimension (1-10). The generation pipeline assigns exactly + one dimension weight 8-10; all others use 1-6. User edits are not constrained by this + heuristic. Required. + :vartype weight: int + :ivar always_applicable: When true, the LLM judge always scores this dimension regardless of + relevance (skips applicability assessment). The service-generated general quality/policy + dimension has this set to true and is non-editable. Users may set this on their own custom + dimensions. + :vartype always_applicable: bool """ - model_deployment_name: str = rest_field(name="modelDeploymentName", visibility=["create"]) - """Deployment name of embedding model. It can point to a model deployment either in the parent - AIServices or a connection. Required.""" - embedding_field: str = rest_field(name="embeddingField", visibility=["create"]) - """Embedding field. Required.""" + dimension_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Stable identifier for this dimension (snake_case, e.g., ``correct_resolution``). Required. + Provided by the user when manually creating a rubric evaluator or during human-in-the-loop + review of a generated set; the generation pipeline produces an initial value the user can edit. + Editable when saving new versions. Required.""" + description: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """What this dimension measures (e.g., 'Correctly identifies the user's reservation intent and + pursues the appropriate workflow'). Required.""" + weight: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Relative weight of this dimension (1-10). The generation pipeline assigns exactly one dimension + weight 8-10; all others use 1-6. User edits are not constrained by this heuristic. Required.""" + always_applicable: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """When true, the LLM judge always scores this dimension regardless of relevance (skips + applicability assessment). The service-generated general quality/policy dimension has this set + to true and is non-editable. Users may set this on their own custom dimensions.""" @overload def __init__( self, *, - model_deployment_name: str, - embedding_field: str, + dimension_id: str, + description: str, + weight: int, + always_applicable: Optional[bool] = None, ) -> None: ... @overload @@ -4863,19 +6905,31 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class EntraAuthorizationScheme(AgentEndpointAuthorizationScheme, discriminator="Entra"): - """EntraAuthorizationScheme. +class DispatchRoutineResponse(_Model): + """Identifiers returned after a routine dispatch is queued. - :ivar type: Required. ENTRA. - :vartype type: str or ~azure.ai.projects.models.ENTRA + :ivar dispatch_id: The dispatch identifier created for the routine dispatch. + :vartype dispatch_id: str + :ivar action_correlation_id: A downstream action correlation identifier, when available. + :vartype action_correlation_id: str + :ivar task_id: A workspace task identifier created for the dispatch, when available. + :vartype task_id: str """ - type: Literal[AgentEndpointAuthorizationSchemeType.ENTRA] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. ENTRA.""" + dispatch_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The dispatch identifier created for the routine dispatch.""" + action_correlation_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A downstream action correlation identifier, when available.""" + task_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A workspace task identifier created for the dispatch, when available.""" @overload def __init__( self, + *, + dispatch_id: Optional[str] = None, + action_correlation_id: Optional[str] = None, + task_id: Optional[str] = None, ) -> None: ... @overload @@ -4887,22 +6941,34 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = AgentEndpointAuthorizationSchemeType.ENTRA # type: ignore -class EntraIDCredentials(BaseCredentials, discriminator="AAD"): - """Entra ID credential definition. +class DoubleClickAction(ComputerAction, discriminator="double_click"): + """DoubleClick. - :ivar type: The credential type. Required. Entra ID credential (formerly known as AAD). - :vartype type: str or ~azure.ai.projects.models.ENTRA_ID + :ivar type: Specifies the event type. For a double click action, this property is always set to + ``double_click``. Required. DOUBLE_CLICK. + :vartype type: str or ~azure.ai.projects.models.DOUBLE_CLICK + :ivar x: The x-coordinate where the double click occurred. Required. + :vartype x: int + :ivar y: The y-coordinate where the double click occurred. Required. + :vartype y: int """ - type: Literal[CredentialType.ENTRA_ID] = rest_discriminator(name="type", visibility=["read"]) # type: ignore - """The credential type. Required. Entra ID credential (formerly known as AAD).""" + type: Literal[ComputerActionType.DOUBLE_CLICK] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Specifies the event type. For a double click action, this property is always set to + ``double_click``. Required. DOUBLE_CLICK.""" + x: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The x-coordinate where the double click occurred. Required.""" + y: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The y-coordinate where the double click occurred. Required.""" @overload def __init__( self, + *, + x: int, + y: int, ) -> None: ... @overload @@ -4914,39 +6980,46 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = CredentialType.ENTRA_ID # type: ignore + self.type = ComputerActionType.DOUBLE_CLICK # type: ignore -class EvalResult(_Model): - """Result of the evaluation. +class DragParam(ComputerAction, discriminator="drag"): + """Drag. - :ivar name: name of the check. Required. - :vartype name: str - :ivar type: type of the check. Required. - :vartype type: str - :ivar score: score. Required. - :vartype score: float - :ivar passed: indicates if the check passed or failed. Required. - :vartype passed: bool + :ivar type: Specifies the event type. For a drag action, this property is always set to + ``drag``. Required. DRAG. + :vartype type: str or ~azure.ai.projects.models.DRAG + :ivar path: An array of coordinates representing the path of the drag action. Coordinates will + appear as an array of objects, eg + + .. code-block:: + + [ + { x: 100, y: 200 }, + { x: 200, y: 300 } + ] + :vartype path: list[~azure.ai.projects.models.CoordParam] """ - name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """name of the check. Required.""" - type: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """type of the check. Required.""" - score: float = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """score. Required.""" - passed: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """indicates if the check passed or failed. Required.""" + type: Literal[ComputerActionType.DRAG] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Specifies the event type. For a drag action, this property is always set to ``drag``. Required. + DRAG.""" + path: list["_models.CoordParam"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """An array of coordinates representing the path of the drag action. Coordinates will appear as an + array of objects, eg + + .. code-block:: + + [ + { x: 100, y: 200 }, + { x: 200, y: 300 } + ]""" @overload def __init__( self, *, - name: str, - type: str, - score: float, - passed: bool, + path: list["_models.CoordParam"], ) -> None: ... @overload @@ -4958,51 +7031,31 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = ComputerActionType.DRAG # type: ignore -class EvalRunResultCompareItem(_Model): - """Metric comparison for a treatment against the baseline. +class EmbeddingConfiguration(_Model): + """Embedding configuration class. - :ivar treatment_run_id: The treatment run ID. Required. - :vartype treatment_run_id: str - :ivar treatment_run_summary: Summary statistics of the treatment run. Required. - :vartype treatment_run_summary: ~azure.ai.projects.models.EvalRunResultSummary - :ivar delta_estimate: Estimated difference between treatment and baseline. Required. - :vartype delta_estimate: float - :ivar p_value: P-value for the treatment effect. Required. - :vartype p_value: float - :ivar treatment_effect: Type of treatment effect. Required. Known values are: "TooFewSamples", - "Inconclusive", "Changed", "Improved", and "Degraded". - :vartype treatment_effect: str or ~azure.ai.projects.models.TreatmentEffectType + :ivar model_deployment_name: Deployment name of embedding model. It can point to a model + deployment either in the parent AIServices or a connection. Required. + :vartype model_deployment_name: str + :ivar embedding_field: Embedding field. Required. + :vartype embedding_field: str """ - treatment_run_id: str = rest_field( - name="treatmentRunId", visibility=["read", "create", "update", "delete", "query"] - ) - """The treatment run ID. Required.""" - treatment_run_summary: "_models.EvalRunResultSummary" = rest_field( - name="treatmentRunSummary", visibility=["read", "create", "update", "delete", "query"] - ) - """Summary statistics of the treatment run. Required.""" - delta_estimate: float = rest_field(name="deltaEstimate", visibility=["read", "create", "update", "delete", "query"]) - """Estimated difference between treatment and baseline. Required.""" - p_value: float = rest_field(name="pValue", visibility=["read", "create", "update", "delete", "query"]) - """P-value for the treatment effect. Required.""" - treatment_effect: Union[str, "_models.TreatmentEffectType"] = rest_field( - name="treatmentEffect", visibility=["read", "create", "update", "delete", "query"] - ) - """Type of treatment effect. Required. Known values are: \"TooFewSamples\", \"Inconclusive\", - \"Changed\", \"Improved\", and \"Degraded\".""" + model_deployment_name: str = rest_field(name="modelDeploymentName", visibility=["create"]) + """Deployment name of embedding model. It can point to a model deployment either in the parent + AIServices or a connection. Required.""" + embedding_field: str = rest_field(name="embeddingField", visibility=["create"]) + """Embedding field. Required.""" @overload def __init__( self, *, - treatment_run_id: str, - treatment_run_summary: "_models.EvalRunResultSummary", - delta_estimate: float, - p_value: float, - treatment_effect: Union[str, "_models.TreatmentEffectType"], + model_deployment_name: str, + embedding_field: str, ) -> None: ... @overload @@ -5016,47 +7069,19 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class EvalRunResultComparison(_Model): - """Comparison results for treatment runs against the baseline. +class EntraAuthorizationScheme(AgentEndpointAuthorizationScheme, discriminator="Entra"): + """EntraAuthorizationScheme. - :ivar testing_criteria: Name of the testing criteria. Required. - :vartype testing_criteria: str - :ivar metric: Metric being evaluated. Required. - :vartype metric: str - :ivar evaluator: Name of the evaluator for this testing criteria. Required. - :vartype evaluator: str - :ivar baseline_run_summary: Summary statistics of the baseline run. Required. - :vartype baseline_run_summary: ~azure.ai.projects.models.EvalRunResultSummary - :ivar compare_items: List of comparison results for each treatment run. Required. - :vartype compare_items: list[~azure.ai.projects.models.EvalRunResultCompareItem] + :ivar type: Required. ENTRA. + :vartype type: str or ~azure.ai.projects.models.ENTRA """ - testing_criteria: str = rest_field( - name="testingCriteria", visibility=["read", "create", "update", "delete", "query"] - ) - """Name of the testing criteria. Required.""" - metric: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Metric being evaluated. Required.""" - evaluator: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Name of the evaluator for this testing criteria. Required.""" - baseline_run_summary: "_models.EvalRunResultSummary" = rest_field( - name="baselineRunSummary", visibility=["read", "create", "update", "delete", "query"] - ) - """Summary statistics of the baseline run. Required.""" - compare_items: list["_models.EvalRunResultCompareItem"] = rest_field( - name="compareItems", visibility=["read", "create", "update", "delete", "query"] - ) - """List of comparison results for each treatment run. Required.""" + type: Literal[AgentEndpointAuthorizationSchemeType.ENTRA] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. ENTRA.""" @overload def __init__( self, - *, - testing_criteria: str, - metric: str, - evaluator: str, - baseline_run_summary: "_models.EvalRunResultSummary", - compare_items: list["_models.EvalRunResultCompareItem"], ) -> None: ... @overload @@ -5068,40 +7093,22 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = AgentEndpointAuthorizationSchemeType.ENTRA # type: ignore -class EvalRunResultSummary(_Model): - """Summary statistics of a metric in an evaluation run. +class EntraIDCredentials(BaseCredentials, discriminator="AAD"): + """Entra ID credential definition. - :ivar run_id: The evaluation run ID. Required. - :vartype run_id: str - :ivar sample_count: Number of samples in the evaluation run. Required. - :vartype sample_count: int - :ivar average: Average value of the metric in the evaluation run. Required. - :vartype average: float - :ivar standard_deviation: Standard deviation of the metric in the evaluation run. Required. - :vartype standard_deviation: float + :ivar type: The credential type. Required. Entra ID credential (formerly known as AAD). + :vartype type: str or ~azure.ai.projects.models.ENTRA_ID """ - run_id: str = rest_field(name="runId", visibility=["read", "create", "update", "delete", "query"]) - """The evaluation run ID. Required.""" - sample_count: int = rest_field(name="sampleCount", visibility=["read", "create", "update", "delete", "query"]) - """Number of samples in the evaluation run. Required.""" - average: float = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Average value of the metric in the evaluation run. Required.""" - standard_deviation: float = rest_field( - name="standardDeviation", visibility=["read", "create", "update", "delete", "query"] - ) - """Standard deviation of the metric in the evaluation run. Required.""" + type: Literal[CredentialType.ENTRA_ID] = rest_discriminator(name="type", visibility=["read"]) # type: ignore + """The credential type. Required. Entra ID credential (formerly known as AAD).""" @overload def __init__( self, - *, - run_id: str, - sample_count: int, - average: float, - standard_deviation: float, ) -> None: ... @overload @@ -5113,39 +7120,50 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = CredentialType.ENTRA_ID # type: ignore -class EvaluationComparisonInsightRequest(InsightRequest, discriminator="EvaluationComparison"): - """Evaluation Comparison Request. +class EvalGraderLabelModel(_Model): + """LabelModelGrader. - :ivar type: The type of request. Required. Evaluation Comparison. - :vartype type: str or ~azure.ai.projects.models.EVALUATION_COMPARISON - :ivar eval_id: Identifier for the evaluation. Required. - :vartype eval_id: str - :ivar baseline_run_id: The baseline run ID for comparison. Required. - :vartype baseline_run_id: str - :ivar treatment_run_ids: List of treatment run IDs for comparison. Required. - :vartype treatment_run_ids: list[str] + :ivar type: The object type, which is always ``label_model``. Required. Default value is + "label_model". + :vartype type: str + :ivar name: The name of the grader. Required. + :vartype name: str + :ivar model: The model to use for the evaluation. Must support structured outputs. Required. + :vartype model: str + :ivar input: Required. + :vartype input: list[~azure.ai.projects.models.EvalItem] + :ivar labels: The labels to assign to each item in the evaluation. Required. + :vartype labels: list[str] + :ivar passing_labels: The labels that indicate a passing result. Must be a subset of labels. + Required. + :vartype passing_labels: list[str] """ - type: Literal[InsightType.EVALUATION_COMPARISON] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The type of request. Required. Evaluation Comparison.""" - eval_id: str = rest_field(name="evalId", visibility=["read", "create", "update", "delete", "query"]) - """Identifier for the evaluation. Required.""" - baseline_run_id: str = rest_field(name="baselineRunId", visibility=["read", "create", "update", "delete", "query"]) - """The baseline run ID for comparison. Required.""" - treatment_run_ids: list[str] = rest_field( - name="treatmentRunIds", visibility=["read", "create", "update", "delete", "query"] - ) - """List of treatment run IDs for comparison. Required.""" + type: Literal["label_model"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The object type, which is always ``label_model``. Required. Default value is \"label_model\".""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the grader. Required.""" + model: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The model to use for the evaluation. Must support structured outputs. Required.""" + input: list["_models.EvalItem"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + labels: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The labels to assign to each item in the evaluation. Required.""" + passing_labels: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The labels that indicate a passing result. Must be a subset of labels. Required.""" @overload def __init__( self, *, - eval_id: str, - baseline_run_id: str, - treatment_run_ids: list[str], + name: str, + model: str, + input: list["_models.EvalItem"], + labels: list[str], + passing_labels: list[str], ) -> None: ... @overload @@ -5157,35 +7175,43 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = InsightType.EVALUATION_COMPARISON # type: ignore + self.type: Literal["label_model"] = "label_model" -class EvaluationComparisonInsightResult(InsightResult, discriminator="EvaluationComparison"): - """Insights from the evaluation comparison. +class EvalGraderPython(_Model): + """PythonGrader. - :ivar type: The type of insights result. Required. Evaluation Comparison. - :vartype type: str or ~azure.ai.projects.models.EVALUATION_COMPARISON - :ivar comparisons: Comparison results for each treatment run against the baseline. Required. - :vartype comparisons: list[~azure.ai.projects.models.EvalRunResultComparison] - :ivar method: The statistical method used for comparison. Required. - :vartype method: str + :ivar type: The object type, which is always ``python``. Required. Default value is "python". + :vartype type: str + :ivar name: The name of the grader. Required. + :vartype name: str + :ivar source: The source code of the python script. Required. + :vartype source: str + :ivar image_tag: The image tag to use for the python script. + :vartype image_tag: str + :ivar pass_threshold: The threshold for the score. + :vartype pass_threshold: int """ - type: Literal[InsightType.EVALUATION_COMPARISON] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The type of insights result. Required. Evaluation Comparison.""" - comparisons: list["_models.EvalRunResultComparison"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Comparison results for each treatment run against the baseline. Required.""" - method: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The statistical method used for comparison. Required.""" + type: Literal["python"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The object type, which is always ``python``. Required. Default value is \"python\".""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the grader. Required.""" + source: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The source code of the python script. Required.""" + image_tag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The image tag to use for the python script.""" + pass_threshold: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The threshold for the score.""" @overload def __init__( self, *, - comparisons: list["_models.EvalRunResultComparison"], - method: str, + name: str, + source: str, + image_tag: Optional[str] = None, + pass_threshold: Optional[int] = None, ) -> None: ... @overload @@ -5197,45 +7223,58 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = InsightType.EVALUATION_COMPARISON # type: ignore - - -class InsightSample(_Model): - """A sample from the analysis. + self.type: Literal["python"] = "python" - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - EvaluationResultSample - :ivar id: The unique identifier for the analysis sample. Required. - :vartype id: str - :ivar type: Sample type. Required. "EvaluationResultSample" - :vartype type: str or ~azure.ai.projects.models.SampleType - :ivar features: Features to help with additional filtering of data in UX. Required. - :vartype features: dict[str, any] - :ivar correlation_info: Info about the correlation for the analysis sample. Required. - :vartype correlation_info: dict[str, any] - """ +class EvalGraderScoreModel(_Model): + """ScoreModelGrader. - __mapping__: dict[str, _Model] = {} - id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The unique identifier for the analysis sample. Required.""" - type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) - """Sample type. Required. \"EvaluationResultSample\"""" - features: dict[str, Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Features to help with additional filtering of data in UX. Required.""" - correlation_info: dict[str, Any] = rest_field( - name="correlationInfo", visibility=["read", "create", "update", "delete", "query"] + :ivar type: The object type, which is always ``score_model``. Required. Default value is + "score_model". + :vartype type: str + :ivar name: The name of the grader. Required. + :vartype name: str + :ivar model: The model to use for the evaluation. Required. + :vartype model: str + :ivar sampling_params: The sampling parameters for the model. + :vartype sampling_params: ~azure.ai.projects.models.EvalGraderScoreModelSamplingParams + :ivar input: The input messages evaluated by the grader. Supports text, output text, input + image, and input audio content blocks, and may include template strings. Required. + :vartype input: list[~azure.ai.projects.models.EvalItem] + :ivar range: The range of the score. Defaults to ``[0, 1]``. + :vartype range: list[int] + :ivar pass_threshold: The threshold for the score. + :vartype pass_threshold: int + """ + + type: Literal["score_model"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The object type, which is always ``score_model``. Required. Default value is \"score_model\".""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the grader. Required.""" + model: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The model to use for the evaluation. Required.""" + sampling_params: Optional["_models.EvalGraderScoreModelSamplingParams"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Info about the correlation for the analysis sample. Required.""" + """The sampling parameters for the model.""" + input: list["_models.EvalItem"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The input messages evaluated by the grader. Supports text, output text, input image, and input + audio content blocks, and may include template strings. Required.""" + range: Optional[list[int]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The range of the score. Defaults to ``[0, 1]``.""" + pass_threshold: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The threshold for the score.""" @overload def __init__( self, *, - id: str, # pylint: disable=redefined-builtin - type: str, - features: dict[str, Any], - correlation_info: dict[str, Any], + name: str, + model: str, + input: list["_models.EvalItem"], + sampling_params: Optional["_models.EvalGraderScoreModelSamplingParams"] = None, + range: Optional[list[int]] = None, + pass_threshold: Optional[int] = None, ) -> None: ... @overload @@ -5247,38 +7286,44 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type: Literal["score_model"] = "score_model" -class EvaluationResultSample(InsightSample, discriminator="EvaluationResultSample"): - """A sample from the evaluation result. +class EvalGraderScoreModelSamplingParams(_Model): + """EvalGraderScoreModelSamplingParams. - :ivar id: The unique identifier for the analysis sample. Required. - :vartype id: str - :ivar features: Features to help with additional filtering of data in UX. Required. - :vartype features: dict[str, any] - :ivar correlation_info: Info about the correlation for the analysis sample. Required. - :vartype correlation_info: dict[str, any] - :ivar type: Evaluation Result Sample Type. Required. A sample from the evaluation result. - :vartype type: str or ~azure.ai.projects.models.EVALUATION_RESULT_SAMPLE - :ivar evaluation_result: Evaluation result for the analysis sample. Required. - :vartype evaluation_result: ~azure.ai.projects.models.EvalResult + :ivar seed: + :vartype seed: int + :ivar top_p: + :vartype top_p: int + :ivar temperature: + :vartype temperature: int + :ivar max_completions_tokens: + :vartype max_completions_tokens: int + :ivar reasoning_effort: Is one of the following types: Literal["none"], Literal["minimal"], + Literal["low"], Literal["medium"], Literal["high"], Literal["xhigh"] + :vartype reasoning_effort: str or str or str or str or str or str """ - type: Literal[SampleType.EVALUATION_RESULT_SAMPLE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Evaluation Result Sample Type. Required. A sample from the evaluation result.""" - evaluation_result: "_models.EvalResult" = rest_field( - name="evaluationResult", visibility=["read", "create", "update", "delete", "query"] + seed: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + top_p: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + temperature: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + max_completions_tokens: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + reasoning_effort: Optional[Literal["none", "minimal", "low", "medium", "high", "xhigh"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Evaluation result for the analysis sample. Required.""" + """Is one of the following types: Literal[\"none\"], Literal[\"minimal\"], Literal[\"low\"], + Literal[\"medium\"], Literal[\"high\"], Literal[\"xhigh\"]""" @overload def __init__( self, *, - id: str, # pylint: disable=redefined-builtin - features: dict[str, Any], - correlation_info: dict[str, Any], - evaluation_result: "_models.EvalResult", + seed: Optional[int] = None, + top_p: Optional[int] = None, + temperature: Optional[int] = None, + max_completions_tokens: Optional[int] = None, + reasoning_effort: Optional[Literal["none", "minimal", "low", "medium", "high", "xhigh"]] = None, ) -> None: ... @overload @@ -5290,65 +7335,49 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = SampleType.EVALUATION_RESULT_SAMPLE # type: ignore -class EvaluationRule(_Model): - """Evaluation rule model. - - :ivar id: Unique identifier for the evaluation rule. Required. - :vartype id: str - :ivar display_name: Display Name for the evaluation rule. - :vartype display_name: str - :ivar description: Description for the evaluation rule. - :vartype description: str - :ivar action: Definition of the evaluation rule action. Required. - :vartype action: ~azure.ai.projects.models.EvaluationRuleAction - :ivar filter: Filter condition of the evaluation rule. - :vartype filter: ~azure.ai.projects.models.EvaluationRuleFilter - :ivar event_type: Event type that the evaluation rule applies to. Required. Known values are: - "responseCompleted" and "manual". - :vartype event_type: str or ~azure.ai.projects.models.EvaluationRuleEventType - :ivar enabled: Indicates whether the evaluation rule is enabled. Default is true. Required. - :vartype enabled: bool - :ivar system_data: System metadata for the evaluation rule. Required. - :vartype system_data: dict[str, str] - """ +class EvalGraderStringCheck(_Model): + """StringCheckGrader. - id: str = rest_field(visibility=["read"]) - """Unique identifier for the evaluation rule. Required.""" - display_name: Optional[str] = rest_field( - name="displayName", visibility=["read", "create", "update", "delete", "query"] - ) - """Display Name for the evaluation rule.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Description for the evaluation rule.""" - action: "_models.EvaluationRuleAction" = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Definition of the evaluation rule action. Required.""" - filter: Optional["_models.EvaluationRuleFilter"] = rest_field( + :ivar type: The object type, which is always ``string_check``. Required. Default value is + "string_check". + :vartype type: str + :ivar name: The name of the grader. Required. + :vartype name: str + :ivar input: The input text. This may include template strings. Required. + :vartype input: str + :ivar reference: The reference text. This may include template strings. Required. + :vartype reference: str + :ivar operation: The string check operation to perform. One of ``eq``, ``ne``, ``like``, or + ``ilike``. Required. Is one of the following types: Literal["eq"], Literal["ne"], + Literal["like"], Literal["ilike"] + :vartype operation: str or str or str or str + """ + + type: Literal["string_check"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The object type, which is always ``string_check``. Required. Default value is \"string_check\".""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the grader. Required.""" + input: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The input text. This may include template strings. Required.""" + reference: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The reference text. This may include template strings. Required.""" + operation: Literal["eq", "ne", "like", "ilike"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Filter condition of the evaluation rule.""" - event_type: Union[str, "_models.EvaluationRuleEventType"] = rest_field( - name="eventType", visibility=["read", "create", "update", "delete", "query"] - ) - """Event type that the evaluation rule applies to. Required. Known values are: - \"responseCompleted\" and \"manual\".""" - enabled: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Indicates whether the evaluation rule is enabled. Default is true. Required.""" - system_data: dict[str, str] = rest_field(name="systemData", visibility=["read"]) - """System metadata for the evaluation rule. Required.""" + """The string check operation to perform. One of ``eq``, ``ne``, ``like``, or ``ilike``. Required. + Is one of the following types: Literal[\"eq\"], Literal[\"ne\"], Literal[\"like\"], + Literal[\"ilike\"]""" @overload def __init__( self, *, - action: "_models.EvaluationRuleAction", - event_type: Union[str, "_models.EvaluationRuleEventType"], - enabled: bool, - display_name: Optional[str] = None, - description: Optional[str] = None, - filter: Optional["_models.EvaluationRuleFilter"] = None, # pylint: disable=redefined-builtin + name: str, + input: str, + reference: str, + operation: Literal["eq", "ne", "like", "ilike"], ) -> None: ... @overload @@ -5360,23 +7389,83 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type: Literal["string_check"] = "string_check" -class EvaluationRuleFilter(_Model): - """Evaluation filter model. - - :ivar agent_name: Filter by agent name. Required. - :vartype agent_name: str - """ +class EvalGraderTextSimilarity(_Model): + """TextSimilarityGrader. - agent_name: str = rest_field(name="agentName", visibility=["read", "create", "update", "delete", "query"]) - """Filter by agent name. Required.""" + :ivar type: The type of grader. Required. Default value is "text_similarity". + :vartype type: str + :ivar name: The name of the grader. Required. + :vartype name: str + :ivar input: The text being graded. Required. + :vartype input: str + :ivar reference: The text being graded against. Required. + :vartype reference: str + :ivar evaluation_metric: The evaluation metric to use. One of ``cosine``, ``fuzzy_match``, + ``bleu``, ``gleu``, ``meteor``, ``rouge_1``, ``rouge_2``, ``rouge_3``, ``rouge_4``, + ``rouge_5``, or ``rouge_l``. Required. Is one of the following types: Literal["cosine"], + Literal["fuzzy_match"], Literal["bleu"], Literal["gleu"], Literal["meteor"], + Literal["rouge_1"], Literal["rouge_2"], Literal["rouge_3"], Literal["rouge_4"], + Literal["rouge_5"], Literal["rouge_l"] + :vartype evaluation_metric: str or str or str or str or str or str or str or str or str or str + or str + :ivar pass_threshold: The threshold for the score. Required. + :vartype pass_threshold: int + """ + + type: Literal["text_similarity"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The type of grader. Required. Default value is \"text_similarity\".""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the grader. Required.""" + input: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The text being graded. Required.""" + reference: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The text being graded against. Required.""" + evaluation_metric: Literal[ + "cosine", + "fuzzy_match", + "bleu", + "gleu", + "meteor", + "rouge_1", + "rouge_2", + "rouge_3", + "rouge_4", + "rouge_5", + "rouge_l", + ] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The evaluation metric to use. One of ``cosine``, ``fuzzy_match``, ``bleu``, ``gleu``, + ``meteor``, ``rouge_1``, ``rouge_2``, ``rouge_3``, ``rouge_4``, ``rouge_5``, or ``rouge_l``. + Required. Is one of the following types: Literal[\"cosine\"], Literal[\"fuzzy_match\"], + Literal[\"bleu\"], Literal[\"gleu\"], Literal[\"meteor\"], Literal[\"rouge_1\"], + Literal[\"rouge_2\"], Literal[\"rouge_3\"], Literal[\"rouge_4\"], Literal[\"rouge_5\"], + Literal[\"rouge_l\"]""" + pass_threshold: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The threshold for the score. Required.""" @overload def __init__( self, *, - agent_name: str, + name: str, + input: str, + reference: str, + evaluation_metric: Literal[ + "cosine", + "fuzzy_match", + "bleu", + "gleu", + "meteor", + "rouge_1", + "rouge_2", + "rouge_3", + "rouge_4", + "rouge_5", + "rouge_l", + ], + pass_threshold: int, ) -> None: ... @overload @@ -5388,39 +7477,43 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type: Literal["text_similarity"] = "text_similarity" -class EvaluationRunClusterInsightRequest(InsightRequest, discriminator="EvaluationRunClusterInsight"): - """Insights on set of Evaluation Results. +class EvalItem(_Model): + """Eval message object. - :ivar type: The type of insights request. Required. Insights on an Evaluation run result. - :vartype type: str or ~azure.ai.projects.models.EVALUATION_RUN_CLUSTER_INSIGHT - :ivar eval_id: Evaluation Id for the insights. Required. - :vartype eval_id: str - :ivar run_ids: List of evaluation run IDs for the insights. Required. - :vartype run_ids: list[str] - :ivar model_configuration: Configuration of the model used in the insight generation. - :vartype model_configuration: ~azure.ai.projects.models.InsightModelConfiguration + :ivar role: The role of the message input. One of ``user``, ``assistant``, ``system``, or + ``developer``. Required. Is one of the following types: Literal["user"], Literal["assistant"], + Literal["system"], Literal["developer"] + :vartype role: str or str or str or str + :ivar content: Required. Is either a "_types.EvalItemContentItem" type or a + ["_types.EvalItemContentItem"] type. + :vartype content: str or ~azure.ai.projects.models.EvalItemContentItemObject or list[str or + ~azure.ai.projects.models.EvalItemContentItemObject] + :ivar type: The type of the message input. Always ``message``. Default value is "message". + :vartype type: str """ - type: Literal[InsightType.EVALUATION_RUN_CLUSTER_INSIGHT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The type of insights request. Required. Insights on an Evaluation run result.""" - eval_id: str = rest_field(name="evalId", visibility=["read", "create", "update", "delete", "query"]) - """Evaluation Id for the insights. Required.""" - run_ids: list[str] = rest_field(name="runIds", visibility=["read", "create", "update", "delete", "query"]) - """List of evaluation run IDs for the insights. Required.""" - model_configuration: Optional["_models.InsightModelConfiguration"] = rest_field( - name="modelConfiguration", visibility=["read", "create", "update", "delete", "query"] + role: Literal["user", "assistant", "system", "developer"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Configuration of the model used in the insight generation.""" + """The role of the message input. One of ``user``, ``assistant``, ``system``, or ``developer``. + Required. Is one of the following types: Literal[\"user\"], Literal[\"assistant\"], + Literal[\"system\"], Literal[\"developer\"]""" + content: "_types.EvalItemContent" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required. Is either a \"_types.EvalItemContentItem\" type or a [\"_types.EvalItemContentItem\"] + type.""" + type: Optional[Literal["message"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The type of the message input. Always ``message``. Default value is \"message\".""" @overload def __init__( self, *, - eval_id: str, - run_ids: list[str], - model_configuration: Optional["_models.InsightModelConfiguration"] = None, + role: Literal["user", "assistant", "system", "developer"], + content: "_types.EvalItemContent", + type: Optional[Literal["message"]] = None, ) -> None: ... @overload @@ -5432,30 +7525,30 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = InsightType.EVALUATION_RUN_CLUSTER_INSIGHT # type: ignore -class EvaluationRunClusterInsightResult(InsightResult, discriminator="EvaluationRunClusterInsight"): - """Insights from the evaluation run cluster analysis. +class EvalItemContentItemObject(_Model): + """Eval content item. - :ivar type: The type of insights result. Required. Insights on an Evaluation run result. - :vartype type: str or ~azure.ai.projects.models.EVALUATION_RUN_CLUSTER_INSIGHT - :ivar cluster_insight: Required. - :vartype cluster_insight: ~azure.ai.projects.models.ClusterInsightResult + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + InputAudio, EvalItemInputImage, EvalItemContentItemObjectInputTextContent, + EvalItemContentOutputText + + :ivar type: Required. Known values are: "input_text", "output_text", "input_image", and + "input_audio". + :vartype type: str or ~azure.ai.projects.models.EvalItemContentItemObjectType """ - type: Literal[InsightType.EVALUATION_RUN_CLUSTER_INSIGHT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The type of insights result. Required. Insights on an Evaluation run result.""" - cluster_insight: "_models.ClusterInsightResult" = rest_field( - name="clusterInsight", visibility=["read", "create", "update", "delete", "query"] - ) - """Required.""" + __mapping__: dict[str, _Model] = {} + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """Required. Known values are: \"input_text\", \"output_text\", \"input_image\", and + \"input_audio\".""" @overload def __init__( self, *, - cluster_insight: "_models.ClusterInsightResult", + type: str, ) -> None: ... @overload @@ -5467,33 +7560,29 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = InsightType.EVALUATION_RUN_CLUSTER_INSIGHT # type: ignore - -class ScheduleTask(_Model): - """Schedule task model. - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - EvaluationScheduleTask, InsightScheduleTask +class EvalItemContentItemObjectInputTextContent( + EvalItemContentItemObject, discriminator="input_text" +): # pylint: disable=name-too-long + """Input text. - :ivar type: Type of the task. Required. Known values are: "Evaluation" and "Insight". - :vartype type: str or ~azure.ai.projects.models.ScheduleTaskType - :ivar configuration: Configuration for the task. - :vartype configuration: dict[str, str] + :ivar type: The type of the input item. Always ``input_text``. Required. INPUT_TEXT. + :vartype type: str or ~azure.ai.projects.models.INPUT_TEXT + :ivar text: The text input to the model. Required. + :vartype text: str """ - __mapping__: dict[str, _Model] = {} - type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) - """Type of the task. Required. Known values are: \"Evaluation\" and \"Insight\".""" - configuration: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Configuration for the task.""" + type: Literal[EvalItemContentItemObjectType.INPUT_TEXT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the input item. Always ``input_text``. Required. INPUT_TEXT.""" + text: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The text input to the model. Required.""" @overload def __init__( self, *, - type: str, - configuration: Optional[dict[str, str]] = None, + text: str, ) -> None: ... @overload @@ -5505,35 +7594,28 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = EvalItemContentItemObjectType.INPUT_TEXT # type: ignore -class EvaluationScheduleTask(ScheduleTask, discriminator="Evaluation"): - """Evaluation task for the schedule. +class EvalItemContentOutputText(EvalItemContentItemObject, discriminator="output_text"): + """Output text. - :ivar configuration: Configuration for the task. - :vartype configuration: dict[str, str] - :ivar type: Required. Evaluation task. - :vartype type: str or ~azure.ai.projects.models.EVALUATION - :ivar eval_id: Identifier of the evaluation group. Required. - :vartype eval_id: str - :ivar eval_run: The evaluation run payload. Required. - :vartype eval_run: any + :ivar type: The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT. + :vartype type: str or ~azure.ai.projects.models.OUTPUT_TEXT + :ivar text: The text output from the model. Required. + :vartype text: str """ - type: Literal[ScheduleTaskType.EVALUATION] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. Evaluation task.""" - eval_id: str = rest_field(name="evalId", visibility=["read", "create", "update", "delete", "query"]) - """Identifier of the evaluation group. Required.""" - eval_run: Any = rest_field(name="evalRun", visibility=["read", "create", "update", "delete", "query"]) - """The evaluation run payload. Required.""" + type: Literal[EvalItemContentItemObjectType.OUTPUT_TEXT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT.""" + text: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The text output from the model. Required.""" @overload def __init__( self, *, - eval_id: str, - eval_run: Any, - configuration: Optional[dict[str, str]] = None, + text: str, ) -> None: ... @overload @@ -5545,60 +7627,35 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ScheduleTaskType.EVALUATION # type: ignore + self.type = EvalItemContentItemObjectType.OUTPUT_TEXT # type: ignore -class EvaluationTaxonomy(_Model): - """Evaluation Taxonomy Definition. +class EvalItemInputImage(EvalItemContentItemObject, discriminator="input_image"): + """Input image. - :ivar id: Asset ID, a unique identifier for the asset. - :vartype id: str - :ivar name: The name of the resource. Required. - :vartype name: str - :ivar version: The version of the resource. Required. - :vartype version: str - :ivar description: The asset description text. - :vartype description: str - :ivar tags: Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar taxonomy_input: Input configuration for the evaluation taxonomy. Required. - :vartype taxonomy_input: ~azure.ai.projects.models.EvaluationTaxonomyInput - :ivar taxonomy_categories: List of taxonomy categories. - :vartype taxonomy_categories: list[~azure.ai.projects.models.TaxonomyCategory] - :ivar properties: Additional properties for the evaluation taxonomy. - :vartype properties: dict[str, str] + :ivar type: The type of the image input. Always ``input_image``. Required. INPUT_IMAGE. + :vartype type: str or ~azure.ai.projects.models.INPUT_IMAGE + :ivar image_url: The URL of the image input. Required. + :vartype image_url: str + :ivar detail: The detail level of the image to be sent to the model. One of ``high``, ``low``, + or ``auto``. Defaults to ``auto``. + :vartype detail: str """ - id: Optional[str] = rest_field(visibility=["read"]) - """Asset ID, a unique identifier for the asset.""" - name: str = rest_field(visibility=["read"]) - """The name of the resource. Required.""" - version: str = rest_field(visibility=["read"]) - """The version of the resource. Required.""" - description: Optional[str] = rest_field(visibility=["create", "update"]) - """The asset description text.""" - tags: Optional[dict[str, str]] = rest_field(visibility=["create", "update"]) - """Tag dictionary. Tags can be added, removed, and updated.""" - taxonomy_input: "_models.EvaluationTaxonomyInput" = rest_field( - name="taxonomyInput", visibility=["read", "create", "update", "delete", "query"] - ) - """Input configuration for the evaluation taxonomy. Required.""" - taxonomy_categories: Optional[list["_models.TaxonomyCategory"]] = rest_field( - name="taxonomyCategories", visibility=["read", "create", "update", "delete", "query"] - ) - """List of taxonomy categories.""" - properties: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Additional properties for the evaluation taxonomy.""" + type: Literal[EvalItemContentItemObjectType.INPUT_IMAGE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the image input. Always ``input_image``. Required. INPUT_IMAGE.""" + image_url: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The URL of the image input. Required.""" + detail: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The detail level of the image to be sent to the model. One of ``high``, ``low``, or ``auto``. + Defaults to ``auto``.""" @overload def __init__( self, *, - taxonomy_input: "_models.EvaluationTaxonomyInput", - description: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - taxonomy_categories: Optional[list["_models.TaxonomyCategory"]] = None, - properties: Optional[dict[str, str]] = None, + image_url: str, + detail: Optional[str] = None, ) -> None: ... @overload @@ -5610,44 +7667,39 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = EvalItemContentItemObjectType.INPUT_IMAGE # type: ignore -class EvaluatorGenerationArtifacts(_Model): - """Service-managed provenance artifacts produced by an evaluator generation job. Present only on - EvaluatorVersion resources created via the generation pipeline. The combined-JSONL Foundry - Dataset is read-only and resolves to a versioned dataset in a service-reserved namespace. +class EvalResult(_Model): + """Result of the evaluation. - :ivar dataset: Reference to the single Foundry Dataset (one combined JSONL file, - version-aligned to ``EvaluatorVersion.version``) holding all artifacts produced by the - generation pipeline. Each row in the JSONL carries a ``kind`` field discriminating its content - (e.g. ``spec``, ``tools``, ``context``). Required. - :vartype dataset: ~azure.ai.projects.models.DatasetReference - :ivar kinds: The kinds of rows present in ``dataset``. Always contains ``"spec"`` (the - generated evaluation specification, a Markdown document describing what the evaluator - measures). May additionally contain ``"tools"`` (when the generation pipeline produced or - inferred OpenAI tool schemas) and/or ``"context"`` (when supplementary materials such as file - uploads or trace samples were used during generation). Required. - :vartype kinds: list[str] + :ivar name: name of the check. Required. + :vartype name: str + :ivar type: type of the check. Required. + :vartype type: str + :ivar score: score. Required. + :vartype score: float + :ivar passed: indicates if the check passed or failed. Required. + :vartype passed: bool """ - dataset: "_models.DatasetReference" = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Reference to the single Foundry Dataset (one combined JSONL file, version-aligned to - ``EvaluatorVersion.version``) holding all artifacts produced by the generation pipeline. Each - row in the JSONL carries a ``kind`` field discriminating its content (e.g. ``spec``, ``tools``, - ``context``). Required.""" - kinds: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The kinds of rows present in ``dataset``. Always contains ``\"spec\"`` (the generated - evaluation specification, a Markdown document describing what the evaluator measures). May - additionally contain ``\"tools\"`` (when the generation pipeline produced or inferred OpenAI - tool schemas) and/or ``\"context\"`` (when supplementary materials such as file uploads or - trace samples were used during generation). Required.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """name of the check. Required.""" + type: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """type of the check. Required.""" + score: float = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """score. Required.""" + passed: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """indicates if the check passed or failed. Required.""" @overload def __init__( self, *, - dataset: "_models.DatasetReference", - kinds: list[str], + name: str, + type: str, + score: float, + passed: bool, ) -> None: ... @overload @@ -5661,61 +7713,80 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class EvaluatorGenerationInputs(_Model): - """Caller-supplied inputs for an evaluator generation job. +class EvalRunOutputItemResult(_Model): + """EvalRunOutputItemResult. - :ivar name: Display name for this generation job. Required. + :ivar name: The name of the grader. Required. :vartype name: str - :ivar sources: Source materials for generation — agent descriptions, prompts, traces, or - datasets. Each entry is an ``EvaluatorGenerationJobSource`` variant discriminated by ``type``. - Required. - :vartype sources: list[~azure.ai.projects.models.EvaluatorGenerationJobSource] - :ivar category: Category determines the rubric generation focus: 'quality' (default) produces - quality-focused rubric criteria, 'safety' produces policy-derived safety rubric criteria. Both - use the same rubric structure. Singular because quality and safety generation are mutually - exclusive pipelines — the output EvaluatorVersion.categories is an array (e.g., ['agents', - 'quality']). Known values are: "quality", "safety", and "agents". - :vartype category: str or ~azure.ai.projects.models.EvaluatorCategory - :ivar model: The LLM model to use for rubric generation (e.g., 'gpt-4o'). Required — users must - provide their own model rather than relying on service-owned capacity. Required. - :vartype model: str - :ivar evaluator_name: The evaluator name to create or update. If an evaluator with this name - already exists, the service retrieves the latest version's criteria as context for improvement. - Required. - :vartype evaluator_name: str + :ivar type: The grader type (for example, "string-check-grader"). + :vartype type: str + :ivar score: The numeric score produced by the grader. Required. + :vartype score: int + :ivar passed: Whether the grader considered the output a pass. Required. + :vartype passed: bool + :ivar sample: Optional sample or intermediate data produced by the grader. + :vartype sample: dict[str, any] + :ivar status: The evaluation status for this result item. Values: "completed", "errored", + "skipped". Null if not provided by evaluator. When status is skipped, passed/score can be + ignored. Known values are: "completed", "errored", and "skipped". + :vartype status: str or ~azure.ai.projects.models.EvalRunOutputItemResultStatus + :ivar metric: The name of the metric (e.g., "fluency", "f1_score"). + :vartype metric: str + :ivar label: The label associated with the test criteria metric (e.g., "pass", "fail", "good", + "bad"). + :vartype label: str + :ivar threshold: The threshold used to determine pass/fail for this test criteria, if it is + numerical. + :vartype threshold: float + :ivar reason: The reason for the test criteria metric. + :vartype reason: str + :ivar properties: Additional details about the test criteria metric. + :vartype properties: dict[str, str] """ name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Display name for this generation job. Required.""" - sources: list["_models.EvaluatorGenerationJobSource"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Source materials for generation — agent descriptions, prompts, traces, or datasets. Each entry - is an ``EvaluatorGenerationJobSource`` variant discriminated by ``type``. Required.""" - category: Optional[Union[str, "_models.EvaluatorCategory"]] = rest_field( + """The name of the grader. Required.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The grader type (for example, \"string-check-grader\").""" + score: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The numeric score produced by the grader. Required.""" + passed: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Whether the grader considered the output a pass. Required.""" + sample: Optional[dict[str, Any]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional sample or intermediate data produced by the grader.""" + status: Optional[Union[str, "_models.EvalRunOutputItemResultStatus"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Category determines the rubric generation focus: 'quality' (default) produces quality-focused - rubric criteria, 'safety' produces policy-derived safety rubric criteria. Both use the same - rubric structure. Singular because quality and safety generation are mutually exclusive - pipelines — the output EvaluatorVersion.categories is an array (e.g., ['agents', 'quality']). - Known values are: \"quality\", \"safety\", and \"agents\".""" - model: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The LLM model to use for rubric generation (e.g., 'gpt-4o'). Required — users must provide - their own model rather than relying on service-owned capacity. Required.""" - evaluator_name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The evaluator name to create or update. If an evaluator with this name already exists, the - service retrieves the latest version's criteria as context for improvement. Required.""" + """The evaluation status for this result item. Values: \"completed\", \"errored\", \"skipped\". + Null if not provided by evaluator. When status is skipped, passed/score can be ignored. Known + values are: \"completed\", \"errored\", and \"skipped\".""" + metric: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the metric (e.g., \"fluency\", \"f1_score\").""" + label: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The label associated with the test criteria metric (e.g., \"pass\", \"fail\", \"good\", + \"bad\").""" + threshold: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The threshold used to determine pass/fail for this test criteria, if it is numerical.""" + reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The reason for the test criteria metric.""" + properties: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Additional details about the test criteria metric.""" @overload def __init__( self, *, name: str, - sources: list["_models.EvaluatorGenerationJobSource"], - model: str, - evaluator_name: str, - category: Optional[Union[str, "_models.EvaluatorCategory"]] = None, + score: int, + passed: bool, + type: Optional[str] = None, + sample: Optional[dict[str, Any]] = None, + status: Optional[Union[str, "_models.EvalRunOutputItemResultStatus"]] = None, + metric: Optional[str] = None, + label: Optional[str] = None, + threshold: Optional[float] = None, + reason: Optional[str] = None, + properties: Optional[dict[str, str]] = None, ) -> None: ... @overload @@ -5729,57 +7800,49 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class EvaluatorGenerationJob(_Model): - """Evaluator Generation Job resource — a long-running job that generates rubric-based evaluator - definitions from source materials. On success, the result is the persisted EvaluatorVersion. +class EvalRunResultCompareItem(_Model): + """Metric comparison for a treatment against the baseline. - :ivar id: Server-assigned unique identifier. Required. - :vartype id: str - :ivar inputs: Caller-supplied inputs. - :vartype inputs: ~azure.ai.projects.models.EvaluatorGenerationInputs - :ivar result: Result produced on success. - :vartype result: ~azure.ai.projects.models.EvaluatorVersion - :ivar status: Current lifecycle status. Required. Known values are: "queued", "in_progress", - "succeeded", "failed", and "cancelled". - :vartype status: str or ~azure.ai.projects.models.JobStatus - :ivar error: Error details — populated only on failure. - :vartype error: ~azure.ai.projects.models.ApiError - :ivar created_at: The timestamp when the job was created, represented in Unix time (seconds - since January 1, 1970). Required. - :vartype created_at: ~datetime.datetime - :ivar finished_at: The timestamp when the job finished, represented in Unix time (seconds since - January 1, 1970). - :vartype finished_at: ~datetime.datetime - :ivar usage: Token consumption summary. Populated when the job reaches a terminal state. - :vartype usage: ~azure.ai.projects.models.EvaluatorGenerationTokenUsage + :ivar treatment_run_id: The treatment run ID. Required. + :vartype treatment_run_id: str + :ivar treatment_run_summary: Summary statistics of the treatment run. Required. + :vartype treatment_run_summary: ~azure.ai.projects.models.EvalRunResultSummary + :ivar delta_estimate: Estimated difference between treatment and baseline. Required. + :vartype delta_estimate: float + :ivar p_value: P-value for the treatment effect. Required. + :vartype p_value: float + :ivar treatment_effect: Type of treatment effect. Required. Known values are: "TooFewSamples", + "Inconclusive", "Changed", "Improved", and "Degraded". + :vartype treatment_effect: str or ~azure.ai.projects.models.TreatmentEffectType """ - id: str = rest_field(visibility=["read"]) - """Server-assigned unique identifier. Required.""" - inputs: Optional["_models.EvaluatorGenerationInputs"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + treatment_run_id: str = rest_field( + name="treatmentRunId", visibility=["read", "create", "update", "delete", "query"] ) - """Caller-supplied inputs.""" - result: Optional["_models.EvaluatorVersion"] = rest_field(visibility=["read"]) - """Result produced on success.""" - status: Union[str, "_models.JobStatus"] = rest_field(visibility=["read"]) - """Current lifecycle status. Required. Known values are: \"queued\", \"in_progress\", - \"succeeded\", \"failed\", and \"cancelled\".""" - error: Optional["_models.ApiError"] = rest_field(visibility=["read"]) - """Error details — populated only on failure.""" - created_at: datetime.datetime = rest_field(visibility=["read"], format="unix-timestamp") - """The timestamp when the job was created, represented in Unix time (seconds since January 1, - 1970). Required.""" - finished_at: Optional[datetime.datetime] = rest_field(visibility=["read"], format="unix-timestamp") - """The timestamp when the job finished, represented in Unix time (seconds since January 1, 1970).""" - usage: Optional["_models.EvaluatorGenerationTokenUsage"] = rest_field(visibility=["read"]) - """Token consumption summary. Populated when the job reaches a terminal state.""" + """The treatment run ID. Required.""" + treatment_run_summary: "_models.EvalRunResultSummary" = rest_field( + name="treatmentRunSummary", visibility=["read", "create", "update", "delete", "query"] + ) + """Summary statistics of the treatment run. Required.""" + delta_estimate: float = rest_field(name="deltaEstimate", visibility=["read", "create", "update", "delete", "query"]) + """Estimated difference between treatment and baseline. Required.""" + p_value: float = rest_field(name="pValue", visibility=["read", "create", "update", "delete", "query"]) + """P-value for the treatment effect. Required.""" + treatment_effect: Union[str, "_models.TreatmentEffectType"] = rest_field( + name="treatmentEffect", visibility=["read", "create", "update", "delete", "query"] + ) + """Type of treatment effect. Required. Known values are: \"TooFewSamples\", \"Inconclusive\", + \"Changed\", \"Improved\", and \"Degraded\".""" @overload def __init__( self, *, - inputs: Optional["_models.EvaluatorGenerationInputs"] = None, + treatment_run_id: str, + treatment_run_summary: "_models.EvalRunResultSummary", + delta_estimate: float, + p_value: float, + treatment_effect: Union[str, "_models.TreatmentEffectType"], ) -> None: ... @overload @@ -5793,35 +7856,50 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class EvaluatorGenerationTokenUsage(_Model): - """Token consumption summary for an evaluator generation job. Populated when the job reaches a - terminal state. +class EvalRunResultComparison(_Model): + """Comparison results for treatment runs against the baseline. - :ivar input_tokens: Number of input (prompt) tokens consumed. Required. - :vartype input_tokens: int - :ivar output_tokens: Number of output (completion) tokens generated. Required. - :vartype output_tokens: int - :ivar total_tokens: Total tokens consumed (input + output). Required. - :vartype total_tokens: int + :ivar testing_criteria: Name of the testing criteria. Required. + :vartype testing_criteria: str + :ivar metric: Metric being evaluated. Required. + :vartype metric: str + :ivar evaluator: Name of the evaluator for this testing criteria. Required. + :vartype evaluator: str + :ivar baseline_run_summary: Summary statistics of the baseline run. Required. + :vartype baseline_run_summary: ~azure.ai.projects.models.EvalRunResultSummary + :ivar compare_items: List of comparison results for each treatment run. Required. + :vartype compare_items: list[~azure.ai.projects.models.EvalRunResultCompareItem] """ - input_tokens: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Number of input (prompt) tokens consumed. Required.""" - output_tokens: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Number of output (completion) tokens generated. Required.""" - total_tokens: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Total tokens consumed (input + output). Required.""" + testing_criteria: str = rest_field( + name="testingCriteria", visibility=["read", "create", "update", "delete", "query"] + ) + """Name of the testing criteria. Required.""" + metric: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Metric being evaluated. Required.""" + evaluator: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the evaluator for this testing criteria. Required.""" + baseline_run_summary: "_models.EvalRunResultSummary" = rest_field( + name="baselineRunSummary", visibility=["read", "create", "update", "delete", "query"] + ) + """Summary statistics of the baseline run. Required.""" + compare_items: list["_models.EvalRunResultCompareItem"] = rest_field( + name="compareItems", visibility=["read", "create", "update", "delete", "query"] + ) + """List of comparison results for each treatment run. Required.""" @overload def __init__( self, *, - input_tokens: int, - output_tokens: int, - total_tokens: int, - ) -> None: ... - - @overload + testing_criteria: str, + metric: str, + evaluator: str, + baseline_run_summary: "_models.EvalRunResultSummary", + compare_items: list["_models.EvalRunResultCompareItem"], + ) -> None: ... + + @overload def __init__(self, mapping: Mapping[str, Any]) -> None: """ :param mapping: raw JSON to initialize the model. @@ -5832,52 +7910,38 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class EvaluatorMetric(_Model): - """Evaluator Metric. +class EvalRunResultSummary(_Model): + """Summary statistics of a metric in an evaluation run. - :ivar type: Type of the metric. Known values are: "ordinal", "continuous", and "boolean". - :vartype type: str or ~azure.ai.projects.models.EvaluatorMetricType - :ivar desirable_direction: It indicates whether a higher value is better or a lower value is - better for this metric. Known values are: "increase", "decrease", and "neutral". - :vartype desirable_direction: str or ~azure.ai.projects.models.EvaluatorMetricDirection - :ivar min_value: Minimum value for the metric. - :vartype min_value: float - :ivar max_value: Maximum value for the metric. If not specified, it is assumed to be unbounded. - :vartype max_value: float - :ivar threshold: Default pass/fail threshold for this metric. - :vartype threshold: float - :ivar is_primary: Indicates if this metric is primary when there are multiple metrics. - :vartype is_primary: bool + :ivar run_id: The evaluation run ID. Required. + :vartype run_id: str + :ivar sample_count: Number of samples in the evaluation run. Required. + :vartype sample_count: int + :ivar average: Average value of the metric in the evaluation run. Required. + :vartype average: float + :ivar standard_deviation: Standard deviation of the metric in the evaluation run. Required. + :vartype standard_deviation: float """ - type: Optional[Union[str, "_models.EvaluatorMetricType"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Type of the metric. Known values are: \"ordinal\", \"continuous\", and \"boolean\".""" - desirable_direction: Optional[Union[str, "_models.EvaluatorMetricDirection"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + run_id: str = rest_field(name="runId", visibility=["read", "create", "update", "delete", "query"]) + """The evaluation run ID. Required.""" + sample_count: int = rest_field(name="sampleCount", visibility=["read", "create", "update", "delete", "query"]) + """Number of samples in the evaluation run. Required.""" + average: float = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Average value of the metric in the evaluation run. Required.""" + standard_deviation: float = rest_field( + name="standardDeviation", visibility=["read", "create", "update", "delete", "query"] ) - """It indicates whether a higher value is better or a lower value is better for this metric. Known - values are: \"increase\", \"decrease\", and \"neutral\".""" - min_value: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Minimum value for the metric.""" - max_value: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Maximum value for the metric. If not specified, it is assumed to be unbounded.""" - threshold: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Default pass/fail threshold for this metric.""" - is_primary: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Indicates if this metric is primary when there are multiple metrics.""" + """Standard deviation of the metric in the evaluation run. Required.""" @overload def __init__( self, *, - type: Optional[Union[str, "_models.EvaluatorMetricType"]] = None, - desirable_direction: Optional[Union[str, "_models.EvaluatorMetricDirection"]] = None, - min_value: Optional[float] = None, - max_value: Optional[float] = None, - threshold: Optional[float] = None, - is_primary: Optional[bool] = None, + run_id: str, + sample_count: int, + average: float, + standard_deviation: float, ) -> None: ... @overload @@ -5891,88 +7955,37 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class EvaluatorVersion(_Model): - """Evaluator Definition. +class EvaluationComparisonInsightRequest(InsightRequest, discriminator="EvaluationComparison"): + """Evaluation Comparison Request. - :ivar display_name: Display Name for evaluator. It helps to find the evaluator easily in AI - Foundry. It does not need to be unique. - :vartype display_name: str - :ivar metadata: Metadata about the evaluator. - :vartype metadata: dict[str, str] - :ivar evaluator_type: The type of the evaluator. Required. Known values are: "builtin" and - "custom". - :vartype evaluator_type: str or ~azure.ai.projects.models.EvaluatorType - :ivar categories: The categories of the evaluator. Required. - :vartype categories: list[str or ~azure.ai.projects.models.EvaluatorCategory] - :ivar definition: Definition of the evaluator. Required. - :vartype definition: ~azure.ai.projects.models.EvaluatorDefinition - :ivar generation_artifacts: Provenance artifacts from the generation pipeline. Read-only; - present only on evaluator versions created via an EvaluatorGenerationJob. Each artifact - resolves to a versioned Foundry Dataset. - :vartype generation_artifacts: ~azure.ai.projects.models.EvaluatorGenerationArtifacts - :ivar created_by: Creator of the evaluator. Required. - :vartype created_by: str - :ivar created_at: Creation date/time of the evaluator. Required. - :vartype created_at: ~datetime.datetime - :ivar modified_at: Last modified date/time of the evaluator. Required. - :vartype modified_at: ~datetime.datetime - :ivar id: Asset ID, a unique identifier for the asset. - :vartype id: str - :ivar name: The name of the resource. Required. - :vartype name: str - :ivar version: The version of the resource. Required. - :vartype version: str - :ivar description: The asset description text. - :vartype description: str - :ivar tags: Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] + :ivar type: The type of request. Required. Evaluation Comparison. + :vartype type: str or ~azure.ai.projects.models.EVALUATION_COMPARISON + :ivar eval_id: Identifier for the evaluation. Required. + :vartype eval_id: str + :ivar baseline_run_id: The baseline run ID for comparison. Required. + :vartype baseline_run_id: str + :ivar treatment_run_ids: List of treatment run IDs for comparison. Required. + :vartype treatment_run_ids: list[str] """ - display_name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Display Name for evaluator. It helps to find the evaluator easily in AI Foundry. It does not - need to be unique.""" - metadata: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Metadata about the evaluator.""" - evaluator_type: Union[str, "_models.EvaluatorType"] = rest_field(visibility=["read", "create"]) - """The type of the evaluator. Required. Known values are: \"builtin\" and \"custom\".""" - categories: list[Union[str, "_models.EvaluatorCategory"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + type: Literal[InsightType.EVALUATION_COMPARISON] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of request. Required. Evaluation Comparison.""" + eval_id: str = rest_field(name="evalId", visibility=["read", "create", "update", "delete", "query"]) + """Identifier for the evaluation. Required.""" + baseline_run_id: str = rest_field(name="baselineRunId", visibility=["read", "create", "update", "delete", "query"]) + """The baseline run ID for comparison. Required.""" + treatment_run_ids: list[str] = rest_field( + name="treatmentRunIds", visibility=["read", "create", "update", "delete", "query"] ) - """The categories of the evaluator. Required.""" - definition: "_models.EvaluatorDefinition" = rest_field(visibility=["read", "create"]) - """Definition of the evaluator. Required.""" - generation_artifacts: Optional["_models.EvaluatorGenerationArtifacts"] = rest_field(visibility=["read"]) - """Provenance artifacts from the generation pipeline. Read-only; present only on evaluator - versions created via an EvaluatorGenerationJob. Each artifact resolves to a versioned Foundry - Dataset.""" - created_by: str = rest_field(visibility=["read"]) - """Creator of the evaluator. Required.""" - created_at: datetime.datetime = rest_field(visibility=["read"], format="rfc3339") - """Creation date/time of the evaluator. Required.""" - modified_at: datetime.datetime = rest_field(visibility=["read"], format="rfc3339") - """Last modified date/time of the evaluator. Required.""" - id: Optional[str] = rest_field(visibility=["read"]) - """Asset ID, a unique identifier for the asset.""" - name: str = rest_field(visibility=["read"]) - """The name of the resource. Required.""" - version: str = rest_field(visibility=["read"]) - """The version of the resource. Required.""" - description: Optional[str] = rest_field(visibility=["create", "update"]) - """The asset description text.""" - tags: Optional[dict[str, str]] = rest_field(visibility=["create", "update"]) - """Tag dictionary. Tags can be added, removed, and updated.""" + """List of treatment run IDs for comparison. Required.""" @overload def __init__( self, *, - evaluator_type: Union[str, "_models.EvaluatorType"], - categories: list[Union[str, "_models.EvaluatorCategory"]], - definition: "_models.EvaluatorDefinition", - display_name: Optional[str] = None, - metadata: Optional[dict[str, str]] = None, - description: Optional[str] = None, - tags: Optional[dict[str, str]] = None, + eval_id: str, + baseline_run_id: str, + treatment_run_ids: list[str], ) -> None: ... @overload @@ -5984,27 +7997,35 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = InsightType.EVALUATION_COMPARISON # type: ignore -class FabricDataAgentToolParameters(_Model): - """The fabric data agent tool parameters. +class EvaluationComparisonInsightResult(InsightResult, discriminator="EvaluationComparison"): + """Insights from the evaluation comparison. - :ivar project_connections: The project connections attached to this tool. There can be a - maximum of 1 connection resource attached to the tool. - :vartype project_connections: list[~azure.ai.projects.models.ToolProjectConnection] + :ivar type: The type of insights result. Required. Evaluation Comparison. + :vartype type: str or ~azure.ai.projects.models.EVALUATION_COMPARISON + :ivar comparisons: Comparison results for each treatment run against the baseline. Required. + :vartype comparisons: list[~azure.ai.projects.models.EvalRunResultComparison] + :ivar method: The statistical method used for comparison. Required. + :vartype method: str """ - project_connections: Optional[list["_models.ToolProjectConnection"]] = rest_field( + type: Literal[InsightType.EVALUATION_COMPARISON] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of insights result. Required. Evaluation Comparison.""" + comparisons: list["_models.EvalRunResultComparison"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The project connections attached to this tool. There can be a maximum of 1 connection resource - attached to the tool.""" + """Comparison results for each treatment run against the baseline. Required.""" + method: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The statistical method used for comparison. Required.""" @overload def __init__( self, *, - project_connections: Optional[list["_models.ToolProjectConnection"]] = None, + comparisons: list["_models.EvalRunResultComparison"], + method: str, ) -> None: ... @overload @@ -6016,58 +8037,29 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = InsightType.EVALUATION_COMPARISON # type: ignore -class FabricIQPreviewTool(Tool, discriminator="fabric_iq_preview"): - """A FabricIQ server-side tool. +class EvaluationCriterion(_Model): + """LLM-as-judge evaluation criterion applied to a single task. - :ivar type: The object type, which is always 'fabric_iq_preview'. Required. FABRIC_IQ_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.FABRIC_IQ_PREVIEW - :ivar project_connection_id: The ID of the FabricIQ project connection. Required. - :vartype project_connection_id: str - :ivar server_label: (Optional) The label of the FabricIQ MCP server to connect to. - :vartype server_label: str - :ivar server_url: (Optional) The URL of the FabricIQ MCP server. If not provided, the URL from - the project connection will be used. - :vartype server_url: str - :ivar require_approval: (Optional) Whether the agent requires approval before executing - actions. Default is always. Is either a MCPToolRequireApproval type or a str type. - :vartype require_approval: ~azure.ai.projects.models.MCPToolRequireApproval or str - :ivar name: Optional user-defined name for this tool or configuration. + :ivar name: Criterion name (referenced in evaluation result rows). Required. :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str + :ivar instruction: Natural-language instruction passed to the judge LLM. Required. + :vartype instruction: str """ - type: Literal[ToolType.FABRIC_IQ_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The object type, which is always 'fabric_iq_preview'. Required. FABRIC_IQ_PREVIEW.""" - project_connection_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The ID of the FabricIQ project connection. Required.""" - server_label: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """(Optional) The label of the FabricIQ MCP server to connect to.""" - server_url: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """(Optional) The URL of the FabricIQ MCP server. If not provided, the URL from the project - connection will be used.""" - require_approval: Optional[Union["_models.MCPToolRequireApproval", str]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """(Optional) Whether the agent requires approval before executing actions. Default is always. Is - either a MCPToolRequireApproval type or a str type.""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Criterion name (referenced in evaluation result rows). Required.""" + instruction: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Natural-language instruction passed to the judge LLM. Required.""" @overload def __init__( self, *, - project_connection_id: str, - server_label: Optional[str] = None, - server_url: Optional[str] = None, - require_approval: Optional[Union["_models.MCPToolRequireApproval", str]] = None, - name: Optional[str] = None, - description: Optional[str] = None, + name: str, + instruction: str, ) -> None: ... @overload @@ -6079,31 +8071,1681 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.FABRIC_IQ_PREVIEW # type: ignore -class FieldMapping(_Model): - """Field mapping configuration class. +class EvaluationDatasetReference(_Model): + """Reference to a dataset by name and version. - :ivar content_fields: List of fields with text content. Required. - :vartype content_fields: list[str] - :ivar filepath_field: Path of file to be used as a source of text content. - :vartype filepath_field: str - :ivar title_field: Field containing the title of the document. - :vartype title_field: str - :ivar url_field: Field containing the url of the document. - :vartype url_field: str - :ivar vector_fields: List of fields with vector content. - :vartype vector_fields: list[str] - :ivar metadata_fields: List of fields with metadata content. - :vartype metadata_fields: list[str] + :ivar name: Dataset name. Required. + :vartype name: str + :ivar version: Dataset version. If not provided, resolves to the latest version. + :vartype version: str + :ivar schema_file_name: Name of the schema file within the dataset's blob folder (e.g., + "a3f2b1c4_schema.json"). Optional — if not provided, schema is inferred at runtime from the + data. Only applicable for uri_folder datasets. + :vartype schema_file_name: str """ - content_fields: list[str] = rest_field(name="contentFields", visibility=["create"]) - """List of fields with text content. Required.""" - filepath_field: Optional[str] = rest_field(name="filepathField", visibility=["create"]) - """Path of file to be used as a source of text content.""" - title_field: Optional[str] = rest_field(name="titleField", visibility=["create"]) + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Dataset name. Required.""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Dataset version. If not provided, resolves to the latest version.""" + schema_file_name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the schema file within the dataset's blob folder (e.g., \"a3f2b1c4_schema.json\"). + Optional — if not provided, schema is inferred at runtime from the data. Only applicable for + uri_folder datasets.""" + + @overload + def __init__( + self, + *, + name: str, + version: Optional[str] = None, + schema_file_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class InsightSample(_Model): + """A sample from the analysis. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + EvaluationResultSample + + :ivar id: The unique identifier for the analysis sample. Required. + :vartype id: str + :ivar type: Sample type. Required. "EvaluationResultSample" + :vartype type: str or ~azure.ai.projects.models.SampleType + :ivar features: Features to help with additional filtering of data in UX. Required. + :vartype features: dict[str, any] + :ivar correlation_info: Info about the correlation for the analysis sample. Required. + :vartype correlation_info: dict[str, any] + """ + + __mapping__: dict[str, _Model] = {} + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique identifier for the analysis sample. Required.""" + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """Sample type. Required. \"EvaluationResultSample\"""" + features: dict[str, Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Features to help with additional filtering of data in UX. Required.""" + correlation_info: dict[str, Any] = rest_field( + name="correlationInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Info about the correlation for the analysis sample. Required.""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + type: str, + features: dict[str, Any], + correlation_info: dict[str, Any], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluationResultSample(InsightSample, discriminator="EvaluationResultSample"): + """A sample from the evaluation result. + + :ivar id: The unique identifier for the analysis sample. Required. + :vartype id: str + :ivar features: Features to help with additional filtering of data in UX. Required. + :vartype features: dict[str, any] + :ivar correlation_info: Info about the correlation for the analysis sample. Required. + :vartype correlation_info: dict[str, any] + :ivar type: Evaluation Result Sample Type. Required. A sample from the evaluation result. + :vartype type: str or ~azure.ai.projects.models.EVALUATION_RESULT_SAMPLE + :ivar evaluation_result: Evaluation result for the analysis sample. Required. + :vartype evaluation_result: ~azure.ai.projects.models.EvalResult + """ + + type: Literal[SampleType.EVALUATION_RESULT_SAMPLE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Evaluation Result Sample Type. Required. A sample from the evaluation result.""" + evaluation_result: "_models.EvalResult" = rest_field( + name="evaluationResult", visibility=["read", "create", "update", "delete", "query"] + ) + """Evaluation result for the analysis sample. Required.""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + features: dict[str, Any], + correlation_info: dict[str, Any], + evaluation_result: "_models.EvalResult", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = SampleType.EVALUATION_RESULT_SAMPLE # type: ignore + + +class EvaluationRule(_Model): + """Evaluation rule model. + + :ivar id: Unique identifier for the evaluation rule. Required. + :vartype id: str + :ivar display_name: Display Name for the evaluation rule. + :vartype display_name: str + :ivar description: Description for the evaluation rule. + :vartype description: str + :ivar action: Definition of the evaluation rule action. Required. + :vartype action: ~azure.ai.projects.models.EvaluationRuleAction + :ivar filter: Filter condition of the evaluation rule. + :vartype filter: ~azure.ai.projects.models.EvaluationRuleFilter + :ivar event_type: Event type that the evaluation rule applies to. Required. Known values are: + "responseCompleted" and "manual". + :vartype event_type: str or ~azure.ai.projects.models.EvaluationRuleEventType + :ivar enabled: Indicates whether the evaluation rule is enabled. Default is true. Required. + :vartype enabled: bool + :ivar system_data: System metadata for the evaluation rule. Required. + :vartype system_data: dict[str, str] + """ + + id: str = rest_field(visibility=["read"]) + """Unique identifier for the evaluation rule. Required.""" + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) + """Display Name for the evaluation rule.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Description for the evaluation rule.""" + action: "_models.EvaluationRuleAction" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Definition of the evaluation rule action. Required.""" + filter: Optional["_models.EvaluationRuleFilter"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Filter condition of the evaluation rule.""" + event_type: Union[str, "_models.EvaluationRuleEventType"] = rest_field( + name="eventType", visibility=["read", "create", "update", "delete", "query"] + ) + """Event type that the evaluation rule applies to. Required. Known values are: + \"responseCompleted\" and \"manual\".""" + enabled: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Indicates whether the evaluation rule is enabled. Default is true. Required.""" + system_data: dict[str, str] = rest_field(name="systemData", visibility=["read"]) + """System metadata for the evaluation rule. Required.""" + + @overload + def __init__( + self, + *, + action: "_models.EvaluationRuleAction", + event_type: Union[str, "_models.EvaluationRuleEventType"], + enabled: bool, + display_name: Optional[str] = None, + description: Optional[str] = None, + filter: Optional["_models.EvaluationRuleFilter"] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluationRuleFilter(_Model): + """Evaluation filter model. + + :ivar agent_name: Filter by agent name. Required. + :vartype agent_name: str + """ + + agent_name: str = rest_field(name="agentName", visibility=["read", "create", "update", "delete", "query"]) + """Filter by agent name. Required.""" + + @overload + def __init__( + self, + *, + agent_name: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluationRunClusterInsightRequest(InsightRequest, discriminator="EvaluationRunClusterInsight"): + """Insights on set of Evaluation Results. + + :ivar type: The type of insights request. Required. Insights on an Evaluation run result. + :vartype type: str or ~azure.ai.projects.models.EVALUATION_RUN_CLUSTER_INSIGHT + :ivar eval_id: Evaluation Id for the insights. Required. + :vartype eval_id: str + :ivar run_ids: List of evaluation run IDs for the insights. Required. + :vartype run_ids: list[str] + :ivar model_configuration: Configuration of the model used in the insight generation. + :vartype model_configuration: ~azure.ai.projects.models.InsightModelConfiguration + """ + + type: Literal[InsightType.EVALUATION_RUN_CLUSTER_INSIGHT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of insights request. Required. Insights on an Evaluation run result.""" + eval_id: str = rest_field(name="evalId", visibility=["read", "create", "update", "delete", "query"]) + """Evaluation Id for the insights. Required.""" + run_ids: list[str] = rest_field(name="runIds", visibility=["read", "create", "update", "delete", "query"]) + """List of evaluation run IDs for the insights. Required.""" + model_configuration: Optional["_models.InsightModelConfiguration"] = rest_field( + name="modelConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Configuration of the model used in the insight generation.""" + + @overload + def __init__( + self, + *, + eval_id: str, + run_ids: list[str], + model_configuration: Optional["_models.InsightModelConfiguration"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = InsightType.EVALUATION_RUN_CLUSTER_INSIGHT # type: ignore + + +class EvaluationRunClusterInsightResult(InsightResult, discriminator="EvaluationRunClusterInsight"): + """Insights from the evaluation run cluster analysis. + + :ivar type: The type of insights result. Required. Insights on an Evaluation run result. + :vartype type: str or ~azure.ai.projects.models.EVALUATION_RUN_CLUSTER_INSIGHT + :ivar cluster_insight: Required. + :vartype cluster_insight: ~azure.ai.projects.models.ClusterInsightResult + """ + + type: Literal[InsightType.EVALUATION_RUN_CLUSTER_INSIGHT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of insights result. Required. Insights on an Evaluation run result.""" + cluster_insight: "_models.ClusterInsightResult" = rest_field( + name="clusterInsight", visibility=["read", "create", "update", "delete", "query"] + ) + """Required.""" + + @overload + def __init__( + self, + *, + cluster_insight: "_models.ClusterInsightResult", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = InsightType.EVALUATION_RUN_CLUSTER_INSIGHT # type: ignore + + +class ScheduleTask(_Model): + """Schedule task model. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + EvaluationScheduleTask, InsightScheduleTask + + :ivar type: Type of the task. Required. Known values are: "Evaluation" and "Insight". + :vartype type: str or ~azure.ai.projects.models.ScheduleTaskType + :ivar configuration: Configuration for the task. + :vartype configuration: dict[str, str] + """ + + __mapping__: dict[str, _Model] = {} + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """Type of the task. Required. Known values are: \"Evaluation\" and \"Insight\".""" + configuration: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Configuration for the task.""" + + @overload + def __init__( + self, + *, + type: str, + configuration: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluationScheduleTask(ScheduleTask, discriminator="Evaluation"): + """Evaluation task for the schedule. + + :ivar configuration: Configuration for the task. + :vartype configuration: dict[str, str] + :ivar type: Required. Evaluation task. + :vartype type: str or ~azure.ai.projects.models.EVALUATION + :ivar eval_id: Identifier of the evaluation group. Required. + :vartype eval_id: str + :ivar eval_run: The evaluation run payload. Required. + :vartype eval_run: any + """ + + type: Literal[ScheduleTaskType.EVALUATION] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. Evaluation task.""" + eval_id: str = rest_field(name="evalId", visibility=["read", "create", "update", "delete", "query"]) + """Identifier of the evaluation group. Required.""" + eval_run: Any = rest_field(name="evalRun", visibility=["read", "create", "update", "delete", "query"]) + """The evaluation run payload. Required.""" + + @overload + def __init__( + self, + *, + eval_id: str, + eval_run: Any, + configuration: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ScheduleTaskType.EVALUATION # type: ignore + + +class EvaluationSuiteDataGenerationOptions(_Model): + """Options for dataset generation within an evaluation suite generation job. + + :ivar type: The data generation type. Defaults to 'simple_qna' if not specified. Known values + are: "simple_qna", "traces", "tool_use", and "task". + :vartype type: str or ~azure.ai.projects.models.EvaluationDataGenerationType + :ivar max_samples: Maximum number of samples to generate. Valid range: 15-1000. + :vartype max_samples: int + """ + + type: Optional[Union[str, "_models.EvaluationDataGenerationType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The data generation type. Defaults to 'simple_qna' if not specified. Known values are: + \"simple_qna\", \"traces\", \"tool_use\", and \"task\".""" + max_samples: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Maximum number of samples to generate. Valid range: 15-1000.""" + + @overload + def __init__( + self, + *, + type: Optional[Union[str, "_models.EvaluationDataGenerationType"]] = None, + max_samples: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluationSuiteGenerationJob(_Model): + """Evaluation suite generation job resource — a long-running job that generates testing criteria + and optionally a dataset from source materials. On success, the result is the persisted + EvaluationSuiteVersion. + + :ivar id: Server-assigned unique identifier. Required. + :vartype id: str + :ivar inputs: Caller-supplied inputs. + :vartype inputs: ~azure.ai.projects.models.EvaluationSuiteGenerationJobInputs + :ivar result: Result produced on success. + :vartype result: ~azure.ai.projects.models.EvaluationSuiteVersion + :ivar status: Current lifecycle status. Required. Known values are: "queued", "in_progress", + "succeeded", "failed", and "cancelled". + :vartype status: str or ~azure.ai.projects.models.JobStatus + :ivar error: Error details — populated only on failure. + :vartype error: ~azure.ai.projects.models.ApiError + :ivar created_at: The timestamp when the job was created, represented in Unix time. Required. + :vartype created_at: ~datetime.datetime + :ivar finished_at: The timestamp when the job finished, represented in Unix time. + :vartype finished_at: ~datetime.datetime + :ivar usage: Token consumption summary. Populated on terminal states. + :vartype usage: ~azure.ai.projects.models.EvaluationSuiteGenerationTokenUsage + """ + + id: str = rest_field(visibility=["read"]) + """Server-assigned unique identifier. Required.""" + inputs: Optional["_models.EvaluationSuiteGenerationJobInputs"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Caller-supplied inputs.""" + result: Optional["_models.EvaluationSuiteVersion"] = rest_field(visibility=["read"]) + """Result produced on success.""" + status: Union[str, "_models.JobStatus"] = rest_field(visibility=["read"]) + """Current lifecycle status. Required. Known values are: \"queued\", \"in_progress\", + \"succeeded\", \"failed\", and \"cancelled\".""" + error: Optional["_models.ApiError"] = rest_field(visibility=["read"]) + """Error details — populated only on failure.""" + created_at: datetime.datetime = rest_field(visibility=["read"], format="unix-timestamp") + """The timestamp when the job was created, represented in Unix time. Required.""" + finished_at: Optional[datetime.datetime] = rest_field(visibility=["read"], format="unix-timestamp") + """The timestamp when the job finished, represented in Unix time.""" + usage: Optional["_models.EvaluationSuiteGenerationTokenUsage"] = rest_field(visibility=["read"]) + """Token consumption summary. Populated on terminal states.""" + + @overload + def __init__( + self, + *, + inputs: Optional["_models.EvaluationSuiteGenerationJobInputs"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluationSuiteGenerationJobInputs(_Model): + """Caller-supplied inputs for an evaluation suite generation job. + + :ivar evaluation_suite_name: The evaluation suite name to create. Required. + :vartype evaluation_suite_name: str + :ivar sources: Source materials for generation — agent context, prompts, traces, or datasets. + Required. + :vartype sources: list[~azure.ai.projects.models.EvaluationSuiteJobSource] + :ivar generation_model: The LLM model to use for rubric and data generation (e.g., 'gpt-4o'). + Required. + :vartype generation_model: str + :ivar category: Category determines the generation focus. Default: quality. Known values are: + "quality" and "safety". + :vartype category: str or ~azure.ai.projects.models.EvaluationSuiteGenerationCategory + :ivar initialization_parameters: Optional initialization parameters applied to all generated + evaluators. For example, deployment_name for LLM judge model, default threshold. + :vartype initialization_parameters: dict[str, any] + :ivar data_generation_options: Data generation options. Controls how the evaluation dataset is + generated. If omitted, defaults are used (simple_qna, 100 max_samples). + :vartype data_generation_options: + ~azure.ai.projects.models.EvaluationSuiteDataGenerationOptions + """ + + evaluation_suite_name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The evaluation suite name to create. Required.""" + sources: list["_models.EvaluationSuiteJobSource"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Source materials for generation — agent context, prompts, traces, or datasets. Required.""" + generation_model: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The LLM model to use for rubric and data generation (e.g., 'gpt-4o'). Required.""" + category: Optional[Union[str, "_models.EvaluationSuiteGenerationCategory"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Category determines the generation focus. Default: quality. Known values are: \"quality\" and + \"safety\".""" + initialization_parameters: Optional[dict[str, Any]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Optional initialization parameters applied to all generated evaluators. For example, + deployment_name for LLM judge model, default threshold.""" + data_generation_options: Optional["_models.EvaluationSuiteDataGenerationOptions"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Data generation options. Controls how the evaluation dataset is generated. If omitted, defaults + are used (simple_qna, 100 max_samples).""" + + @overload + def __init__( + self, + *, + evaluation_suite_name: str, + sources: list["_models.EvaluationSuiteJobSource"], + generation_model: str, + category: Optional[Union[str, "_models.EvaluationSuiteGenerationCategory"]] = None, + initialization_parameters: Optional[dict[str, Any]] = None, + data_generation_options: Optional["_models.EvaluationSuiteDataGenerationOptions"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluationSuiteGenerationTokenUsage(_Model): + """Token usage summary for an evaluation suite generation job. + + :ivar input_tokens: Number of input tokens consumed. + :vartype input_tokens: int + :ivar output_tokens: Number of output tokens consumed. + :vartype output_tokens: int + :ivar total_tokens: Total tokens consumed. + :vartype total_tokens: int + """ + + input_tokens: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Number of input tokens consumed.""" + output_tokens: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Number of output tokens consumed.""" + total_tokens: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Total tokens consumed.""" + + @overload + def __init__( + self, + *, + input_tokens: Optional[int] = None, + output_tokens: Optional[int] = None, + total_tokens: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluationSuiteRunRequest(_Model): + """Request body for running an evaluation from a suite. + + :ivar evaluation_name: Name for the evaluation. Default: '{suiteName}-runs'. + :vartype evaluation_name: str + :ivar evaluation_suite_version: Evaluation suite version to run. Default: latest. + :vartype evaluation_suite_version: str + :ivar evaluation_level: Overrides the suite's default evaluation level. If omitted, uses the + level from the suite. Known values are: "turn" and "conversation". + :vartype evaluation_level: str or ~azure.ai.projects.models.EvaluationLevel + """ + + evaluation_name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name for the evaluation. Default: '{suiteName}-runs'.""" + evaluation_suite_version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Evaluation suite version to run. Default: latest.""" + evaluation_level: Optional[Union[str, "_models.EvaluationLevel"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Overrides the suite's default evaluation level. If omitted, uses the level from the suite. + Known values are: \"turn\" and \"conversation\".""" + + @overload + def __init__( + self, + *, + evaluation_name: Optional[str] = None, + evaluation_suite_version: Optional[str] = None, + evaluation_level: Optional[Union[str, "_models.EvaluationLevel"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluationSuiteRunResponse(_Model): + """Response from running an evaluation suite. + + :ivar evaluation_suite_name: The evaluation suite name used. Required. + :vartype evaluation_suite_name: str + :ivar evaluation_suite_version: The evaluation suite version resolved. Required. + :vartype evaluation_suite_version: str + :ivar results: The run results. Currently a single-element array; will support multiple runs in + the future. Required. + :vartype results: list[~azure.ai.projects.models.EvaluationSuiteRunResult] + """ + + evaluation_suite_name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The evaluation suite name used. Required.""" + evaluation_suite_version: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The evaluation suite version resolved. Required.""" + results: list["_models.EvaluationSuiteRunResult"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The run results. Currently a single-element array; will support multiple runs in the future. + Required.""" + + @overload + def __init__( + self, + *, + evaluation_suite_name: str, + evaluation_suite_version: str, + results: list["_models.EvaluationSuiteRunResult"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluationSuiteRunResult(_Model): + """Result of a single evaluation run within a suite execution. + + :ivar eval_id: The evaluation ID created. Required. + :vartype eval_id: str + :ivar run_id: The eval run ID created. Required. + :vartype run_id: str + :ivar status: Status of the run. Required. Known values are: "queued", "in_progress", + "succeeded", "failed", and "cancelled". + :vartype status: str or ~azure.ai.projects.models.JobStatus + :ivar created_at: Timestamp when the run was created. Required. + :vartype created_at: ~datetime.datetime + """ + + eval_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The evaluation ID created. Required.""" + run_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The eval run ID created. Required.""" + status: Union[str, "_models.JobStatus"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Status of the run. Required. Known values are: \"queued\", \"in_progress\", \"succeeded\", + \"failed\", and \"cancelled\".""" + created_at: datetime.datetime = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="unix-timestamp" + ) + """Timestamp when the run was created. Required.""" + + @overload + def __init__( + self, + *, + eval_id: str, + run_id: str, + status: Union[str, "_models.JobStatus"], + created_at: datetime.datetime, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluationSuiteVersion(_Model): + """An evaluation suite bundles testing criteria — an optional dataset, one or more evaluator + configs with thresholds and init params — into a reusable, named artifact that can gate agent + changes across batch, scheduled, continuous, and CI/CD evals. + + :ivar display_name: Human-readable display name. Does not need to be unique. Shown in Foundry + portal list views and eval reports. + :vartype display_name: str + :ivar subtype: Subtype of the evaluation suite. Known values are: "default" and "benchmark". + :vartype subtype: str or ~azure.ai.projects.models.EvaluationSuiteSubtype + :ivar dataset: Dataset reference for evaluation. Optional — omit for evaluator-only suites + where data comes from live production traces or is provided at run time. The referenced dataset + must exist in the project's dataset registry. + :vartype dataset: ~azure.ai.projects.models.EvaluationDatasetReference + :ivar testing_criteria: Testing criteria — the evaluator configurations for this suite. + Supports all grader types: azure_ai_evaluator, string_check, label_model, score_model, + text_similarity, python, etc. At least one entry is required. Required. + :vartype testing_criteria: list[~azure.ai.projects.models.EvalGraderLabelModel or + ~azure.ai.projects.models.EvalGraderStringCheck or + ~azure.ai.projects.models.EvalGraderTextSimilarity or + ~azure.ai.projects.models.EvalGraderPython or ~azure.ai.projects.models.EvalGraderScoreModel or + ~azure.ai.projects.models.TestingCriterionAzureAIEvaluator] + :ivar target: Target for this evaluation suite. Uses the existing Target discriminated type + from eval runs. Supports azure_ai_agent, azure_ai_model, azure_ai_assistant. Optional — allows + suites to exist without a target. + :vartype target: ~azure.ai.projects.models.EvaluationTarget + :ivar input_messages: How to send dataset rows to the target (agent or model). Supports + template type (prompt with column placeholders) and item_reference type (column containing + pre-built messages). Is either a CreateEvalResponsesRunDataSourceInputMessagesTemplate type or + a CreateEvalCompletionsRunDataSourceInputMessagesItemReference type. + :vartype input_messages: + ~azure.ai.projects.models.CreateEvalResponsesRunDataSourceInputMessagesTemplate or + ~azure.ai.projects.models.CreateEvalCompletionsRunDataSourceInputMessagesItemReference + :ivar evaluation_level: Default evaluation level for this suite. Can be overridden at run time. + Known values are: "turn" and "conversation". + :vartype evaluation_level: str or ~azure.ai.projects.models.EvaluationLevel + :ivar name: The name of the resource. Required. + :vartype name: str + :ivar version: The version of the resource. Required. + :vartype version: str + :ivar description: The asset description text. + :vartype description: str + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + """ + + display_name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Human-readable display name. Does not need to be unique. Shown in Foundry portal list views and + eval reports.""" + subtype: Optional[Union[str, "_models.EvaluationSuiteSubtype"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Subtype of the evaluation suite. Known values are: \"default\" and \"benchmark\".""" + dataset: Optional["_models.EvaluationDatasetReference"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Dataset reference for evaluation. Optional — omit for evaluator-only suites where data comes + from live production traces or is provided at run time. The referenced dataset must exist in + the project's dataset registry.""" + testing_criteria: list[ + Union[ + "_models.EvalGraderLabelModel", + "_models.EvalGraderStringCheck", + "_models.EvalGraderTextSimilarity", + "_models.EvalGraderPython", + "_models.EvalGraderScoreModel", + "_models.TestingCriterionAzureAIEvaluator", + ] + ] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Testing criteria — the evaluator configurations for this suite. Supports all grader types: + azure_ai_evaluator, string_check, label_model, score_model, text_similarity, python, etc. At + least one entry is required. Required.""" + target: Optional["_models.EvaluationTarget"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Target for this evaluation suite. Uses the existing Target discriminated type from eval runs. + Supports azure_ai_agent, azure_ai_model, azure_ai_assistant. Optional — allows suites to exist + without a target.""" + input_messages: Optional[ + Union[ + "_models.CreateEvalResponsesRunDataSourceInputMessagesTemplate", + "_models.CreateEvalCompletionsRunDataSourceInputMessagesItemReference", + ] + ] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """How to send dataset rows to the target (agent or model). Supports template type (prompt with + column placeholders) and item_reference type (column containing pre-built messages). Is either + a CreateEvalResponsesRunDataSourceInputMessagesTemplate type or a + CreateEvalCompletionsRunDataSourceInputMessagesItemReference type.""" + evaluation_level: Optional[Union[str, "_models.EvaluationLevel"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Default evaluation level for this suite. Can be overridden at run time. Known values are: + \"turn\" and \"conversation\".""" + name: str = rest_field(visibility=["read"]) + """The name of the resource. Required.""" + version: str = rest_field(visibility=["read"]) + """The version of the resource. Required.""" + description: Optional[str] = rest_field(visibility=["create", "update"]) + """The asset description text.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["create", "update"]) + """Tag dictionary. Tags can be added, removed, and updated.""" + + @overload + def __init__( + self, + *, + testing_criteria: list[ + Union[ + "_models.EvalGraderLabelModel", + "_models.EvalGraderStringCheck", + "_models.EvalGraderTextSimilarity", + "_models.EvalGraderPython", + "_models.EvalGraderScoreModel", + "_models.TestingCriterionAzureAIEvaluator", + ] + ], + display_name: Optional[str] = None, + subtype: Optional[Union[str, "_models.EvaluationSuiteSubtype"]] = None, + dataset: Optional["_models.EvaluationDatasetReference"] = None, + target: Optional["_models.EvaluationTarget"] = None, + input_messages: Optional[ + Union[ + "_models.CreateEvalResponsesRunDataSourceInputMessagesTemplate", + "_models.CreateEvalCompletionsRunDataSourceInputMessagesItemReference", + ] + ] = None, + evaluation_level: Optional[Union[str, "_models.EvaluationLevel"]] = None, + description: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluationSuiteVersionInputMessagesTemplate1(_Model): # pylint: disable=name-too-long + """EvaluationSuiteVersionInputMessagesTemplate1. + + :ivar role: Required. + :vartype role: str + :ivar content: Required. + :vartype content: str + """ + + role: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + content: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + + @overload + def __init__( + self, + *, + role: str, + content: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluationTaxonomy(_Model): + """Evaluation Taxonomy Definition. + + :ivar id: Asset ID, a unique identifier for the asset. + :vartype id: str + :ivar name: The name of the resource. Required. + :vartype name: str + :ivar version: The version of the resource. Required. + :vartype version: str + :ivar description: The asset description text. + :vartype description: str + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar taxonomy_input: Input configuration for the evaluation taxonomy. Required. + :vartype taxonomy_input: ~azure.ai.projects.models.EvaluationTaxonomyInput + :ivar taxonomy_categories: List of taxonomy categories. + :vartype taxonomy_categories: list[~azure.ai.projects.models.TaxonomyCategory] + :ivar properties: Additional properties for the evaluation taxonomy. + :vartype properties: dict[str, str] + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Asset ID, a unique identifier for the asset.""" + name: str = rest_field(visibility=["read"]) + """The name of the resource. Required.""" + version: str = rest_field(visibility=["read"]) + """The version of the resource. Required.""" + description: Optional[str] = rest_field(visibility=["create", "update"]) + """The asset description text.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["create", "update"]) + """Tag dictionary. Tags can be added, removed, and updated.""" + taxonomy_input: "_models.EvaluationTaxonomyInput" = rest_field( + name="taxonomyInput", visibility=["read", "create", "update", "delete", "query"] + ) + """Input configuration for the evaluation taxonomy. Required.""" + taxonomy_categories: Optional[list["_models.TaxonomyCategory"]] = rest_field( + name="taxonomyCategories", visibility=["read", "create", "update", "delete", "query"] + ) + """List of taxonomy categories.""" + properties: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Additional properties for the evaluation taxonomy.""" + + @overload + def __init__( + self, + *, + taxonomy_input: "_models.EvaluationTaxonomyInput", + description: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + taxonomy_categories: Optional[list["_models.TaxonomyCategory"]] = None, + properties: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluatorCredentialRequest(_Model): + """Request body for getting evaluator credentials. + + :ivar blob_uri: The blob URI for the evaluator storage. Example: + ``https://account.blob.core.windows.net:443/container``. Required. + :vartype blob_uri: str + """ + + blob_uri: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The blob URI for the evaluator storage. Example: + ``https://account.blob.core.windows.net:443/container``. Required.""" + + @overload + def __init__( + self, + *, + blob_uri: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluatorGenerationArtifacts(_Model): + """Service-managed provenance artifacts produced by an evaluator generation job. Present only on + EvaluatorVersion resources created via the generation pipeline. The combined-JSONL Foundry + Dataset is read-only and resolves to a versioned dataset in a service-reserved namespace. + + :ivar dataset: Reference to the single Foundry Dataset (one combined JSONL file, + version-aligned to ``EvaluatorVersion.version``) holding all artifacts produced by the + generation pipeline. Each row in the JSONL carries a ``kind`` field discriminating its content + (e.g. ``spec``, ``tools``, ``context``). Required. + :vartype dataset: ~azure.ai.projects.models.DatasetReference + :ivar kinds: The kinds of rows present in ``dataset``. Always contains ``"spec"`` (the + generated evaluation specification, a Markdown document describing what the evaluator + measures). May additionally contain ``"tools"`` (when the generation pipeline produced or + inferred OpenAI tool schemas) and/or ``"context"`` (when supplementary materials such as file + uploads or trace samples were used during generation). Required. + :vartype kinds: list[str] + """ + + dataset: "_models.DatasetReference" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Reference to the single Foundry Dataset (one combined JSONL file, version-aligned to + ``EvaluatorVersion.version``) holding all artifacts produced by the generation pipeline. Each + row in the JSONL carries a ``kind`` field discriminating its content (e.g. ``spec``, ``tools``, + ``context``). Required.""" + kinds: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The kinds of rows present in ``dataset``. Always contains ``\"spec\"`` (the generated + evaluation specification, a Markdown document describing what the evaluator measures). May + additionally contain ``\"tools\"`` (when the generation pipeline produced or inferred OpenAI + tool schemas) and/or ``\"context\"`` (when supplementary materials such as file uploads or + trace samples were used during generation). Required.""" + + @overload + def __init__( + self, + *, + dataset: "_models.DatasetReference", + kinds: list[str], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluatorGenerationInputs(_Model): + """Caller-supplied inputs for an evaluator generation job. + + :ivar sources: Source materials for generation — agent descriptions, prompts, traces, or + datasets. Each entry is an ``EvaluatorGenerationJobSource`` variant discriminated by ``type``. + Required. + :vartype sources: list[~azure.ai.projects.models.EvaluatorGenerationJobSource] + :ivar model: The LLM model to use for rubric generation (e.g., 'gpt-4o'). Required — users must + provide their own model rather than relying on service-owned capacity. Required. + :vartype model: str + :ivar evaluator_name: The evaluator name (immutable identifier). 1-256 characters; allowed + characters are ASCII letters, digits, underscore (``_``), period (``.``), tilde (``~``), and + hyphen (``-``). The prefix ``builtin.`` is reserved for system-managed evaluators and is + rejected by the service. If an evaluator with this name already exists in the project (and is + rubric-subtype), the service creates a new version under the same name and uses the prior + version's ``dimensions`` as context for incremental improvement (foundation of the post-//build + adaptive loop). Old versions remain queryable via ``get_version(name, version)``. If the + existing evaluator is not a rubric-subtype evaluator (built-in, prompt-based, code-based), the + request is rejected with ``400 Bad Request``. Required. + :vartype evaluator_name: str + :ivar evaluator_display_name: Optional human-friendly display name for the resulting evaluator. + Surfaced as ``EvaluatorVersion.display_name`` on the persisted evaluator. When omitted, the + service uses ``evaluator_name`` as the display name. The ``evaluator_`` prefix disambiguates + this from the immutable ``evaluator_name`` identifier. + :vartype evaluator_display_name: str + :ivar evaluator_description: Optional human-friendly description for the resulting evaluator. + Surfaced as ``EvaluatorVersion.description`` on the persisted evaluator. Typically collected + from the UI alongside ``evaluator_display_name``. The ``evaluator_`` prefix disambiguates this + from any other description fields on related models. + :vartype evaluator_description: str + """ + + sources: list["_models.EvaluatorGenerationJobSource"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Source materials for generation — agent descriptions, prompts, traces, or datasets. Each entry + is an ``EvaluatorGenerationJobSource`` variant discriminated by ``type``. Required.""" + model: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The LLM model to use for rubric generation (e.g., 'gpt-4o'). Required — users must provide + their own model rather than relying on service-owned capacity. Required.""" + evaluator_name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The evaluator name (immutable identifier). 1-256 characters; allowed characters are ASCII + letters, digits, underscore (``_``), period (``.``), tilde (``~``), and hyphen (``-``). The + prefix ``builtin.`` is reserved for system-managed evaluators and is rejected by the service. + If an evaluator with this name already exists in the project (and is rubric-subtype), the + service creates a new version under the same name and uses the prior version's ``dimensions`` + as context for incremental improvement (foundation of the post-//build adaptive loop). Old + versions remain queryable via ``get_version(name, version)``. If the existing evaluator is not + a rubric-subtype evaluator (built-in, prompt-based, code-based), the request is rejected with + ``400 Bad Request``. Required.""" + evaluator_display_name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional human-friendly display name for the resulting evaluator. Surfaced as + ``EvaluatorVersion.display_name`` on the persisted evaluator. When omitted, the service uses + ``evaluator_name`` as the display name. The ``evaluator_`` prefix disambiguates this from the + immutable ``evaluator_name`` identifier.""" + evaluator_description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional human-friendly description for the resulting evaluator. Surfaced as + ``EvaluatorVersion.description`` on the persisted evaluator. Typically collected from the UI + alongside ``evaluator_display_name``. The ``evaluator_`` prefix disambiguates this from any + other description fields on related models.""" + + @overload + def __init__( + self, + *, + sources: list["_models.EvaluatorGenerationJobSource"], + model: str, + evaluator_name: str, + evaluator_display_name: Optional[str] = None, + evaluator_description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluatorGenerationJob(_Model): + """Evaluator Generation Job resource — a long-running job that generates rubric-based evaluator + definitions from source materials. On success, the result is the persisted EvaluatorVersion. + + :ivar id: Server-assigned unique identifier. Required. + :vartype id: str + :ivar inputs: Caller-supplied inputs. + :vartype inputs: ~azure.ai.projects.models.EvaluatorGenerationInputs + :ivar result: Result produced on success. + :vartype result: ~azure.ai.projects.models.EvaluatorVersion + :ivar status: Current lifecycle status. Required. Known values are: "queued", "in_progress", + "succeeded", "failed", and "cancelled". + :vartype status: str or ~azure.ai.projects.models.JobStatus + :ivar error: Error details — populated only on failure. + :vartype error: ~azure.ai.projects.models.ApiError + :ivar created_at: The timestamp when the job was created, represented in Unix time (seconds + since January 1, 1970). Required. + :vartype created_at: ~datetime.datetime + :ivar finished_at: The timestamp when the job finished, represented in Unix time (seconds since + January 1, 1970). + :vartype finished_at: ~datetime.datetime + :ivar usage: Token consumption summary. Populated when the job reaches a terminal state. + :vartype usage: ~azure.ai.projects.models.EvaluatorGenerationTokenUsage + """ + + id: str = rest_field(visibility=["read"]) + """Server-assigned unique identifier. Required.""" + inputs: Optional["_models.EvaluatorGenerationInputs"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Caller-supplied inputs.""" + result: Optional["_models.EvaluatorVersion"] = rest_field(visibility=["read"]) + """Result produced on success.""" + status: Union[str, "_models.JobStatus"] = rest_field(visibility=["read"]) + """Current lifecycle status. Required. Known values are: \"queued\", \"in_progress\", + \"succeeded\", \"failed\", and \"cancelled\".""" + error: Optional["_models.ApiError"] = rest_field(visibility=["read"]) + """Error details — populated only on failure.""" + created_at: datetime.datetime = rest_field(visibility=["read"], format="unix-timestamp") + """The timestamp when the job was created, represented in Unix time (seconds since January 1, + 1970). Required.""" + finished_at: Optional[datetime.datetime] = rest_field(visibility=["read"], format="unix-timestamp") + """The timestamp when the job finished, represented in Unix time (seconds since January 1, 1970).""" + usage: Optional["_models.EvaluatorGenerationTokenUsage"] = rest_field(visibility=["read"]) + """Token consumption summary. Populated when the job reaches a terminal state.""" + + @overload + def __init__( + self, + *, + inputs: Optional["_models.EvaluatorGenerationInputs"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluatorGenerationTokenUsage(_Model): + """Token consumption summary for an evaluator generation job. Populated when the job reaches a + terminal state. + + :ivar input_tokens: Number of input (prompt) tokens consumed. Required. + :vartype input_tokens: int + :ivar output_tokens: Number of output (completion) tokens generated. Required. + :vartype output_tokens: int + :ivar total_tokens: Total tokens consumed (input + output). Required. + :vartype total_tokens: int + """ + + input_tokens: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Number of input (prompt) tokens consumed. Required.""" + output_tokens: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Number of output (completion) tokens generated. Required.""" + total_tokens: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Total tokens consumed (input + output). Required.""" + + @overload + def __init__( + self, + *, + input_tokens: int, + output_tokens: int, + total_tokens: int, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluatorMetric(_Model): + """Evaluator Metric. + + :ivar type: Type of the metric. Known values are: "ordinal", "continuous", and "boolean". + :vartype type: str or ~azure.ai.projects.models.EvaluatorMetricType + :ivar desirable_direction: It indicates whether a higher value is better or a lower value is + better for this metric. Known values are: "increase", "decrease", and "neutral". + :vartype desirable_direction: str or ~azure.ai.projects.models.EvaluatorMetricDirection + :ivar min_value: Minimum value for the metric. + :vartype min_value: float + :ivar max_value: Maximum value for the metric. If not specified, it is assumed to be unbounded. + :vartype max_value: float + :ivar threshold: Default pass/fail threshold for this metric. + :vartype threshold: float + :ivar is_primary: Indicates if this metric is primary when there are multiple metrics. + :vartype is_primary: bool + """ + + type: Optional[Union[str, "_models.EvaluatorMetricType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Type of the metric. Known values are: \"ordinal\", \"continuous\", and \"boolean\".""" + desirable_direction: Optional[Union[str, "_models.EvaluatorMetricDirection"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """It indicates whether a higher value is better or a lower value is better for this metric. Known + values are: \"increase\", \"decrease\", and \"neutral\".""" + min_value: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Minimum value for the metric.""" + max_value: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Maximum value for the metric. If not specified, it is assumed to be unbounded.""" + threshold: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Default pass/fail threshold for this metric.""" + is_primary: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Indicates if this metric is primary when there are multiple metrics.""" + + @overload + def __init__( + self, + *, + type: Optional[Union[str, "_models.EvaluatorMetricType"]] = None, + desirable_direction: Optional[Union[str, "_models.EvaluatorMetricDirection"]] = None, + min_value: Optional[float] = None, + max_value: Optional[float] = None, + threshold: Optional[float] = None, + is_primary: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluatorVersion(_Model): + """Evaluator Definition. + + :ivar display_name: Display Name for evaluator. It helps to find the evaluator easily in AI + Foundry. It does not need to be unique. + :vartype display_name: str + :ivar metadata: Metadata about the evaluator. + :vartype metadata: dict[str, str] + :ivar evaluator_type: The type of the evaluator. Required. Known values are: "builtin" and + "custom". + :vartype evaluator_type: str or ~azure.ai.projects.models.EvaluatorType + :ivar categories: The categories of the evaluator. Required. + :vartype categories: list[str or ~azure.ai.projects.models.EvaluatorCategory] + :ivar definition: Definition of the evaluator. Required. + :vartype definition: ~azure.ai.projects.models.EvaluatorDefinition + :ivar generation_artifacts: Provenance artifacts from the generation pipeline. Read-only; + present only on evaluator versions created via an EvaluatorGenerationJob. Each artifact + resolves to a versioned Foundry Dataset. + :vartype generation_artifacts: ~azure.ai.projects.models.EvaluatorGenerationArtifacts + :ivar created_by: Creator of the evaluator. Required. + :vartype created_by: str + :ivar created_at: Creation date/time of the evaluator. Required. + :vartype created_at: ~datetime.datetime + :ivar modified_at: Last modified date/time of the evaluator. Required. + :vartype modified_at: ~datetime.datetime + :ivar id: Asset ID, a unique identifier for the asset. + :vartype id: str + :ivar name: The name of the resource. Required. + :vartype name: str + :ivar version: The version of the resource. Required. + :vartype version: str + :ivar description: The asset description text. + :vartype description: str + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + """ + + display_name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Display Name for evaluator. It helps to find the evaluator easily in AI Foundry. It does not + need to be unique.""" + metadata: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Metadata about the evaluator.""" + evaluator_type: Union[str, "_models.EvaluatorType"] = rest_field(visibility=["read", "create"]) + """The type of the evaluator. Required. Known values are: \"builtin\" and \"custom\".""" + categories: list[Union[str, "_models.EvaluatorCategory"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The categories of the evaluator. Required.""" + definition: "_models.EvaluatorDefinition" = rest_field(visibility=["read", "create"]) + """Definition of the evaluator. Required.""" + generation_artifacts: Optional["_models.EvaluatorGenerationArtifacts"] = rest_field(visibility=["read"]) + """Provenance artifacts from the generation pipeline. Read-only; present only on evaluator + versions created via an EvaluatorGenerationJob. Each artifact resolves to a versioned Foundry + Dataset.""" + created_by: str = rest_field(visibility=["read"]) + """Creator of the evaluator. Required.""" + created_at: datetime.datetime = rest_field(visibility=["read"], format="rfc3339") + """Creation date/time of the evaluator. Required.""" + modified_at: datetime.datetime = rest_field(visibility=["read"], format="rfc3339") + """Last modified date/time of the evaluator. Required.""" + id: Optional[str] = rest_field(visibility=["read"]) + """Asset ID, a unique identifier for the asset.""" + name: str = rest_field(visibility=["read"]) + """The name of the resource. Required.""" + version: str = rest_field(visibility=["read"]) + """The version of the resource. Required.""" + description: Optional[str] = rest_field(visibility=["create", "update"]) + """The asset description text.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["create", "update"]) + """Tag dictionary. Tags can be added, removed, and updated.""" + + @overload + def __init__( + self, + *, + evaluator_type: Union[str, "_models.EvaluatorType"], + categories: list[Union[str, "_models.EvaluatorCategory"]], + definition: "_models.EvaluatorDefinition", + display_name: Optional[str] = None, + metadata: Optional[dict[str, str]] = None, + description: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ExternalAgentDefinition(AgentDefinition, discriminator="external"): + """The external agent definition. Represents a third-party agent hosted outside Foundry (for + example, on GCP or AWS). Registration is metadata-only: Foundry records the agent definition to + light up observability experiences (traces, evaluations) over customer-emitted OpenTelemetry + data. + + :ivar rai_config: Configuration for Responsible AI (RAI) content filtering and safety features. + :vartype rai_config: ~azure.ai.projects.models.RaiConfig + :ivar kind: Required. EXTERNAL. + :vartype kind: str or ~azure.ai.projects.models.EXTERNAL + :ivar otel_agent_id: The OpenTelemetry agent identifier used to attribute customer-emitted + spans to this Foundry agent. Spans must include the attribute ``gen_ai.agent.id = + `` to appear under this registration. Defaults to the top-level agent name when + omitted. Provide an explicit value only for migration scenarios where the running external + agent already emits a stable id that differs from the Foundry agent name. The resolved value is + always echoed on read. + :vartype otel_agent_id: str + """ + + kind: Literal[AgentKind.EXTERNAL] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. EXTERNAL.""" + otel_agent_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The OpenTelemetry agent identifier used to attribute customer-emitted spans to this Foundry + agent. Spans must include the attribute ``gen_ai.agent.id = `` to appear under + this registration. Defaults to the top-level agent name when omitted. Provide an explicit value + only for migration scenarios where the running external agent already emits a stable id that + differs from the Foundry agent name. The resolved value is always echoed on read.""" + + @overload + def __init__( + self, + *, + rai_config: Optional["_models.RaiConfig"] = None, + otel_agent_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.kind = AgentKind.EXTERNAL # type: ignore + + +class FabricDataAgentToolCall(OutputItem, discriminator="fabric_dataagent_preview_call"): + """A Fabric data agent tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. FABRIC_DATAAGENT_PREVIEW_CALL. + :vartype type: str or ~azure.ai.projects.models.FABRIC_DATAAGENT_PREVIEW_CALL + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.projects.models.ToolCallStatus + """ + + type: Literal[OutputItemType.FABRIC_DATAAGENT_PREVIEW_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. FABRIC_DATAAGENT_PREVIEW_CALL.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the tool call generated by the model. Required.""" + arguments: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A JSON string of the arguments to pass to the tool. Required.""" + status: Union[str, "_models.ToolCallStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + + @overload + def __init__( + self, + *, + call_id: str, + arguments: str, + status: Union[str, "_models.ToolCallStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = OutputItemType.FABRIC_DATAAGENT_PREVIEW_CALL # type: ignore + + +class FabricDataAgentToolCallOutput(OutputItem, discriminator="fabric_dataagent_preview_call_output"): + """The output of a Fabric data agent tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. FABRIC_DATAAGENT_PREVIEW_CALL_OUTPUT. + :vartype type: str or ~azure.ai.projects.models.FABRIC_DATAAGENT_PREVIEW_CALL_OUTPUT + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the Fabric data agent tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: dict[str, any] or str or list[any] + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.projects.models.ToolCallStatus + """ + + type: Literal[OutputItemType.FABRIC_DATAAGENT_PREVIEW_CALL_OUTPUT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. FABRIC_DATAAGENT_PREVIEW_CALL_OUTPUT.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the tool call generated by the model. Required.""" + output: Optional["_types.ToolCallOutputContent"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The output from the Fabric data agent tool call. Is one of the following types: {str: Any}, + str, [Any]""" + status: Union[str, "_models.ToolCallStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + + @overload + def __init__( + self, + *, + call_id: str, + status: Union[str, "_models.ToolCallStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + output: Optional["_types.ToolCallOutputContent"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = OutputItemType.FABRIC_DATAAGENT_PREVIEW_CALL_OUTPUT # type: ignore + + +class FabricDataAgentToolParameters(_Model): + """The fabric data agent tool parameters. + + :ivar project_connections: The project connections attached to this tool. There can be a + maximum of 1 connection resource attached to the tool. + :vartype project_connections: list[~azure.ai.projects.models.ToolProjectConnection] + """ + + project_connections: Optional[list["_models.ToolProjectConnection"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The project connections attached to this tool. There can be a maximum of 1 connection resource + attached to the tool.""" + + @overload + def __init__( + self, + *, + project_connections: Optional[list["_models.ToolProjectConnection"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FabricIQPreviewTool(Tool, discriminator="fabric_iq_preview"): + """A FabricIQ server-side tool. + + :ivar type: The object type, which is always 'fabric_iq_preview'. Required. FABRIC_IQ_PREVIEW. + :vartype type: str or ~azure.ai.projects.models.FABRIC_IQ_PREVIEW + :ivar project_connection_id: The ID of the FabricIQ project connection. Required. + :vartype project_connection_id: str + :ivar server_label: (Optional) The label of the FabricIQ MCP server to connect to. + :vartype server_label: str + :ivar server_url: (Optional) The URL of the FabricIQ MCP server. If not provided, the URL from + the project connection will be used. + :vartype server_url: str + :ivar require_approval: (Optional) Whether the agent requires approval before executing + actions. Default is always. Is either a MCPToolRequireApproval type or a str type. + :vartype require_approval: ~azure.ai.projects.models.MCPToolRequireApproval or str + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] + """ + + type: Literal[ToolType.FABRIC_IQ_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The object type, which is always 'fabric_iq_preview'. Required. FABRIC_IQ_PREVIEW.""" + project_connection_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ID of the FabricIQ project connection. Required.""" + server_label: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """(Optional) The label of the FabricIQ MCP server to connect to.""" + server_url: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """(Optional) The URL of the FabricIQ MCP server. If not provided, the URL from the project + connection will be used.""" + require_approval: Optional[Union["_models.MCPToolRequireApproval", str]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """(Optional) Whether the agent requires approval before executing actions. Default is always. Is + either a MCPToolRequireApproval type or a str type.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional user-defined name for this tool or configuration.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional user-defined description for this tool or configuration.""" + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: + exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at + runtime.""" + + @overload + def __init__( + self, + *, + project_connection_id: str, + server_label: Optional[str] = None, + server_url: Optional[str] = None, + require_approval: Optional[Union["_models.MCPToolRequireApproval", str]] = None, + name: Optional[str] = None, + description: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ToolType.FABRIC_IQ_PREVIEW # type: ignore + + +class FieldMapping(_Model): + """Field mapping configuration class. + + :ivar content_fields: List of fields with text content. Required. + :vartype content_fields: list[str] + :ivar filepath_field: Path of file to be used as a source of text content. + :vartype filepath_field: str + :ivar title_field: Field containing the title of the document. + :vartype title_field: str + :ivar url_field: Field containing the url of the document. + :vartype url_field: str + :ivar vector_fields: List of fields with vector content. + :vartype vector_fields: list[str] + :ivar metadata_fields: List of fields with metadata content. + :vartype metadata_fields: list[str] + """ + + content_fields: list[str] = rest_field(name="contentFields", visibility=["create"]) + """List of fields with text content. Required.""" + filepath_field: Optional[str] = rest_field(name="filepathField", visibility=["create"]) + """Path of file to be used as a source of text content.""" + title_field: Optional[str] = rest_field(name="titleField", visibility=["create"]) """Field containing the title of the document.""" url_field: Optional[str] = rest_field(name="urlField", visibility=["create"]) """Field containing the url of the document.""" @@ -6116,12 +9758,3084 @@ class FieldMapping(_Model): def __init__( self, *, - content_fields: list[str], - filepath_field: Optional[str] = None, - title_field: Optional[str] = None, - url_field: Optional[str] = None, - vector_fields: Optional[list[str]] = None, - metadata_fields: Optional[list[str]] = None, + content_fields: list[str], + filepath_field: Optional[str] = None, + title_field: Optional[str] = None, + url_field: Optional[str] = None, + vector_fields: Optional[list[str]] = None, + metadata_fields: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FileCitationBody(Annotation, discriminator="file_citation"): + """File citation. + + :ivar type: The type of the file citation. Always ``file_citation``. Required. FILE_CITATION. + :vartype type: str or ~azure.ai.projects.models.FILE_CITATION + :ivar file_id: The ID of the file. Required. + :vartype file_id: str + :ivar index: The index of the file in the list of files. Required. + :vartype index: int + :ivar filename: The filename of the file cited. Required. + :vartype filename: str + """ + + type: Literal[AnnotationType.FILE_CITATION] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the file citation. Always ``file_citation``. Required. FILE_CITATION.""" + file_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ID of the file. Required.""" + index: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The index of the file in the list of files. Required.""" + filename: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The filename of the file cited. Required.""" + + @overload + def __init__( + self, + *, + file_id: str, + index: int, + filename: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = AnnotationType.FILE_CITATION # type: ignore + + +class FileDataGenerationJobOutput(DataGenerationJobOutput, discriminator="file"): + """Azure OpenAI file output for a data generation job. + + :ivar type: Azure OpenAI file output. Required. The generated data is an Azure OpenAI File. + :vartype type: str or ~azure.ai.projects.models.FILE + :ivar id: The id of the output Azure OpenAI file. Required. + :vartype id: str + :ivar filename: The filename of the output Azure OpenAI file. Required. + :vartype filename: str + """ + + type: Literal[DataGenerationJobOutputType.FILE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Azure OpenAI file output. Required. The generated data is an Azure OpenAI File.""" + id: str = rest_field(visibility=["read"]) + """The id of the output Azure OpenAI file. Required.""" + filename: str = rest_field(visibility=["read"]) + """The filename of the output Azure OpenAI file. Required.""" + + @overload + def __init__( + self, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = DataGenerationJobOutputType.FILE # type: ignore + + +class FileDataGenerationJobSource(DataGenerationJobSource, discriminator="file"): + """File source for data generation jobs — Azure OpenAI file input. + + :ivar description: Optional description of what this source represents — helps the pipeline + interpret its content (e.g., 'Company refund policy document' or 'Describes the agent's core + capabilities'). + :vartype description: str + :ivar type: The source type for this job, which is File. Required. File source — Azure OpenAI + file. + :vartype type: str or ~azure.ai.projects.models.FILE + :ivar id: Input Azure Open AI file id used for data generation. Required. + :vartype id: str + """ + + type: Literal[DataGenerationJobSourceType.FILE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The source type for this job, which is File. Required. File source — Azure OpenAI file.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Input Azure Open AI file id used for data generation. Required.""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = DataGenerationJobSourceType.FILE # type: ignore + + +class FileDatasetVersion(DatasetVersion, discriminator="uri_file"): + """FileDatasetVersion Definition. + + :ivar data_uri: URI of the data (`example `_). + Required. + :vartype data_uri: str + :ivar is_reference: Indicates if the dataset holds a reference to the storage, or the dataset + manages storage itself. If true, the underlying data will not be deleted when the dataset + version is deleted. + :vartype is_reference: bool + :ivar connection_name: The Azure Storage Account connection name. Required if + startPendingUploadVersion was not called before creating the Dataset. + :vartype connection_name: str + :ivar id: Asset ID, a unique identifier for the asset. + :vartype id: str + :ivar name: The name of the resource. Required. + :vartype name: str + :ivar version: The version of the resource. Required. + :vartype version: str + :ivar description: The asset description text. + :vartype description: str + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar type: Dataset type. Required. URI file. + :vartype type: str or ~azure.ai.projects.models.URI_FILE + """ + + type: Literal[DatasetType.URI_FILE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Dataset type. Required. URI file.""" + + @overload + def __init__( + self, + *, + data_uri: str, + connection_name: Optional[str] = None, + description: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = DatasetType.URI_FILE # type: ignore + + +class FilePath(Annotation, discriminator="file_path"): + """File path. + + :ivar type: The type of the file path. Always ``file_path``. Required. FILE_PATH. + :vartype type: str or ~azure.ai.projects.models.FILE_PATH + :ivar file_id: The ID of the file. Required. + :vartype file_id: str + :ivar index: The index of the file in the list of files. Required. + :vartype index: int + """ + + type: Literal[AnnotationType.FILE_PATH] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the file path. Always ``file_path``. Required. FILE_PATH.""" + file_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ID of the file. Required.""" + index: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The index of the file in the list of files. Required.""" + + @overload + def __init__( + self, + *, + file_id: str, + index: int, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = AnnotationType.FILE_PATH # type: ignore + + +class FileSearchTool(Tool, discriminator="file_search"): + """File search. + + :ivar type: The type of the file search tool. Always ``file_search``. Required. FILE_SEARCH. + :vartype type: str or ~azure.ai.projects.models.FILE_SEARCH + :ivar vector_store_ids: The IDs of the vector stores to search. Required. + :vartype vector_store_ids: list[str] + :ivar max_num_results: The maximum number of results to return. This number should be between 1 + and 50 inclusive. + :vartype max_num_results: int + :ivar ranking_options: Ranking options for search. + :vartype ranking_options: ~azure.ai.projects.models.RankingOptions + :ivar filters: Is either a ComparisonFilter type or a CompoundFilter type. + :vartype filters: ~azure.ai.projects.models.ComparisonFilter or + ~azure.ai.projects.models.CompoundFilter + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] + """ + + type: Literal[ToolType.FILE_SEARCH] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the file search tool. Always ``file_search``. Required. FILE_SEARCH.""" + vector_store_ids: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The IDs of the vector stores to search. Required.""" + max_num_results: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The maximum number of results to return. This number should be between 1 and 50 inclusive.""" + ranking_options: Optional["_models.RankingOptions"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Ranking options for search.""" + filters: Optional["_types.Filters"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Is either a ComparisonFilter type or a CompoundFilter type.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional user-defined name for this tool or configuration.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional user-defined description for this tool or configuration.""" + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: + exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at + runtime.""" + + @overload + def __init__( + self, + *, + vector_store_ids: list[str], + max_num_results: Optional[int] = None, + ranking_options: Optional["_models.RankingOptions"] = None, + filters: Optional["_types.Filters"] = None, + name: Optional[str] = None, + description: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ToolType.FILE_SEARCH # type: ignore + + +class FileSearchToolCallResults(_Model): + """FileSearchToolCallResults. + + :ivar file_id: + :vartype file_id: str + :ivar text: + :vartype text: str + :ivar filename: + :vartype filename: str + :ivar attributes: + :vartype attributes: ~azure.ai.projects.models.VectorStoreFileAttributes + :ivar score: + :vartype score: float + """ + + file_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + text: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + filename: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + attributes: Optional["_models.VectorStoreFileAttributes"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + score: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + + @overload + def __init__( + self, + *, + file_id: Optional[str] = None, + text: Optional[str] = None, + filename: Optional[str] = None, + attributes: Optional["_models.VectorStoreFileAttributes"] = None, + score: Optional[float] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VersionSelectionRule(_Model): + """VersionSelectionRule. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + FixedRatioVersionSelectionRule + + :ivar type: Required. "FixedRatio" + :vartype type: str or ~azure.ai.projects.models.VersionSelectorType + :ivar agent_version: The agent version to route traffic to. Required. + :vartype agent_version: str + """ + + __mapping__: dict[str, _Model] = {} + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """Required. \"FixedRatio\"""" + agent_version: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The agent version to route traffic to. Required.""" + + @overload + def __init__( + self, + *, + type: str, + agent_version: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FixedRatioVersionSelectionRule(VersionSelectionRule, discriminator="FixedRatio"): + """FixedRatioVersionSelectionRule. + + :ivar agent_version: The agent version to route traffic to. Required. + :vartype agent_version: str + :ivar type: Required. FIXED_RATIO. + :vartype type: str or ~azure.ai.projects.models.FIXED_RATIO + :ivar traffic_percentage: The percentage of traffic to route to the version. Must be between 0 + and 100. Required. + :vartype traffic_percentage: int + """ + + type: Literal[VersionSelectorType.FIXED_RATIO] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. FIXED_RATIO.""" + traffic_percentage: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The percentage of traffic to route to the version. Must be between 0 and 100. Required.""" + + @overload + def __init__( + self, + *, + agent_version: str, + traffic_percentage: int, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = VersionSelectorType.FIXED_RATIO # type: ignore + + +class FolderDatasetVersion(DatasetVersion, discriminator="uri_folder"): + """FileDatasetVersion Definition. + + :ivar data_uri: URI of the data (`example `_). + Required. + :vartype data_uri: str + :ivar is_reference: Indicates if the dataset holds a reference to the storage, or the dataset + manages storage itself. If true, the underlying data will not be deleted when the dataset + version is deleted. + :vartype is_reference: bool + :ivar connection_name: The Azure Storage Account connection name. Required if + startPendingUploadVersion was not called before creating the Dataset. + :vartype connection_name: str + :ivar id: Asset ID, a unique identifier for the asset. + :vartype id: str + :ivar name: The name of the resource. Required. + :vartype name: str + :ivar version: The version of the resource. Required. + :vartype version: str + :ivar description: The asset description text. + :vartype description: str + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar type: Dataset type. Required. URI folder. + :vartype type: str or ~azure.ai.projects.models.URI_FOLDER + """ + + type: Literal[DatasetType.URI_FOLDER] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Dataset type. Required. URI folder.""" + + @overload + def __init__( + self, + *, + data_uri: str, + connection_name: Optional[str] = None, + description: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = DatasetType.URI_FOLDER # type: ignore + + +class FoundryModelWarning(_Model): + """A warning associated with a model. + + :ivar code: The warning code. Known values are: "RuntimeDependentArtifact" and + "UnclassifiedArtifact". + :vartype code: str or ~azure.ai.projects.models.FoundryModelWarningCode + :ivar message: The warning message. + :vartype message: str + """ + + code: Optional[Union[str, "_models.FoundryModelWarningCode"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The warning code. Known values are: \"RuntimeDependentArtifact\" and \"UnclassifiedArtifact\".""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The warning message.""" + + @overload + def __init__( + self, + *, + code: Optional[Union[str, "_models.FoundryModelWarningCode"]] = None, + message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FunctionShellAction(_Model): + """Shell exec action. + + :ivar commands: Required. + :vartype commands: list[str] + :ivar timeout_ms: Required. + :vartype timeout_ms: int + :ivar max_output_length: Required. + :vartype max_output_length: int + """ + + commands: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + timeout_ms: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + max_output_length: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + + @overload + def __init__( + self, + *, + commands: list[str], + timeout_ms: int, + max_output_length: int, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FunctionShellCallOutputContent(_Model): + """Shell call output content. + + :ivar stdout: The standard output that was captured. Required. + :vartype stdout: str + :ivar stderr: The standard error output that was captured. Required. + :vartype stderr: str + :ivar outcome: Shell call outcome. Required. + :vartype outcome: ~azure.ai.projects.models.FunctionShellCallOutputOutcome + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + + stdout: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The standard output that was captured. Required.""" + stderr: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The standard error output that was captured. Required.""" + outcome: "_models.FunctionShellCallOutputOutcome" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Shell call outcome. Required.""" + created_by: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The identifier of the actor that created the item.""" + + @overload + def __init__( + self, + *, + stdout: str, + stderr: str, + outcome: "_models.FunctionShellCallOutputOutcome", + created_by: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FunctionShellCallOutputOutcome(_Model): + """Shell call outcome. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + FunctionShellCallOutputExitOutcome, FunctionShellCallOutputTimeoutOutcome + + :ivar type: Required. Known values are: "timeout" and "exit". + :vartype type: str or ~azure.ai.projects.models.FunctionShellCallOutputOutcomeType + """ + + __mapping__: dict[str, _Model] = {} + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """Required. Known values are: \"timeout\" and \"exit\".""" + + @overload + def __init__( + self, + *, + type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FunctionShellCallOutputExitOutcome(FunctionShellCallOutputOutcome, discriminator="exit"): + """Shell call exit outcome. + + :ivar type: The outcome type. Always ``exit``. Required. EXIT. + :vartype type: str or ~azure.ai.projects.models.EXIT + :ivar exit_code: Exit code from the shell process. Required. + :vartype exit_code: int + """ + + type: Literal[FunctionShellCallOutputOutcomeType.EXIT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The outcome type. Always ``exit``. Required. EXIT.""" + exit_code: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Exit code from the shell process. Required.""" + + @overload + def __init__( + self, + *, + exit_code: int, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = FunctionShellCallOutputOutcomeType.EXIT # type: ignore + + +class FunctionShellCallOutputTimeoutOutcome(FunctionShellCallOutputOutcome, discriminator="timeout"): + """Shell call timeout outcome. + + :ivar type: The outcome type. Always ``timeout``. Required. TIMEOUT. + :vartype type: str or ~azure.ai.projects.models.TIMEOUT + """ + + type: Literal[FunctionShellCallOutputOutcomeType.TIMEOUT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The outcome type. Always ``timeout``. Required. TIMEOUT.""" + + @overload + def __init__( + self, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = FunctionShellCallOutputOutcomeType.TIMEOUT # type: ignore + + +class FunctionShellToolParam(Tool, discriminator="shell"): + """Shell tool. + + :ivar type: The type of the shell tool. Always ``shell``. Required. SHELL. + :vartype type: str or ~azure.ai.projects.models.SHELL + :ivar environment: + :vartype environment: ~azure.ai.projects.models.FunctionShellToolParamEnvironment + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] + """ + + type: Literal[ToolType.SHELL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the shell tool. Always ``shell``. Required. SHELL.""" + environment: Optional["_models.FunctionShellToolParamEnvironment"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional user-defined name for this tool or configuration.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional user-defined description for this tool or configuration.""" + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: + exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at + runtime.""" + + @overload + def __init__( + self, + *, + environment: Optional["_models.FunctionShellToolParamEnvironment"] = None, + name: Optional[str] = None, + description: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ToolType.SHELL # type: ignore + + +class FunctionShellToolParamEnvironmentContainerReferenceParam( + FunctionShellToolParamEnvironment, discriminator="container_reference" +): # pylint: disable=name-too-long + """FunctionShellToolParamEnvironmentContainerReferenceParam. + + :ivar type: References a container created with the /v1/containers endpoint. Required. + CONTAINER_REFERENCE. + :vartype type: str or ~azure.ai.projects.models.CONTAINER_REFERENCE + :ivar container_id: The ID of the referenced container. Required. + :vartype container_id: str + """ + + type: Literal[FunctionShellToolParamEnvironmentType.CONTAINER_REFERENCE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """References a container created with the /v1/containers endpoint. Required. CONTAINER_REFERENCE.""" + container_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ID of the referenced container. Required.""" + + @overload + def __init__( + self, + *, + container_id: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = FunctionShellToolParamEnvironmentType.CONTAINER_REFERENCE # type: ignore + + +class FunctionShellToolParamEnvironmentLocalEnvironmentParam( + FunctionShellToolParamEnvironment, discriminator="local" +): # pylint: disable=name-too-long + """FunctionShellToolParamEnvironmentLocalEnvironmentParam. + + :ivar type: Use a local computer environment. Required. LOCAL. + :vartype type: str or ~azure.ai.projects.models.LOCAL + :ivar skills: An optional list of skills. + :vartype skills: list[~azure.ai.projects.models.LocalSkillParam] + """ + + type: Literal[FunctionShellToolParamEnvironmentType.LOCAL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Use a local computer environment. Required. LOCAL.""" + skills: Optional[list["_models.LocalSkillParam"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """An optional list of skills.""" + + @overload + def __init__( + self, + *, + skills: Optional[list["_models.LocalSkillParam"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = FunctionShellToolParamEnvironmentType.LOCAL # type: ignore + + +class FunctionTool(Tool, discriminator="function"): + """Function. + + :ivar type: The type of the function tool. Always ``function``. Required. FUNCTION. + :vartype type: str or ~azure.ai.projects.models.FUNCTION + :ivar name: The name of the function to call. Required. + :vartype name: str + :ivar description: + :vartype description: str + :ivar parameters: Required. + :vartype parameters: dict[str, any] + :ivar strict: Required. + :vartype strict: bool + """ + + type: Literal[ToolType.FUNCTION] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the function tool. Always ``function``. Required. FUNCTION.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the function to call. Required.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + parameters: dict[str, Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + strict: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + + @overload + def __init__( + self, + *, + name: str, + parameters: dict[str, Any], + strict: bool, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ToolType.FUNCTION # type: ignore + + +class RoutineTrigger(_Model): + """Base model for a routine trigger. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + GitHubIssueOpenedRoutineTrigger, ScheduleRoutineTrigger, TimerRoutineTrigger + + :ivar type: The trigger type. Required. Known values are: "github_issue_opened", "schedule", + and "timer". + :vartype type: str or ~azure.ai.projects.models.RoutineTriggerType + """ + + __mapping__: dict[str, _Model] = {} + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """The trigger type. Required. Known values are: \"github_issue_opened\", \"schedule\", and + \"timer\".""" + + @overload + def __init__( + self, + *, + type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GitHubIssueOpenedRoutineTrigger(RoutineTrigger, discriminator="github_issue_opened"): + """A GitHub issue-opened routine trigger. + + :ivar type: The trigger type. Required. A GitHub issue-opened trigger. + :vartype type: str or ~azure.ai.projects.models.GITHUB_ISSUE_OPENED + :ivar connection_id: The workspace connection identifier that resolves the GitHub configuration + for the trigger. Required. + :vartype connection_id: str + :ivar assignee: The GitHub assignee or organization filter that scopes which issues can fire + the trigger. Required. + :vartype assignee: str + :ivar repository: The GitHub repository filter that scopes which issues can fire the trigger. + Required. + :vartype repository: str + """ + + type: Literal[RoutineTriggerType.GITHUB_ISSUE_OPENED] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The trigger type. Required. A GitHub issue-opened trigger.""" + connection_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The workspace connection identifier that resolves the GitHub configuration for the trigger. + Required.""" + assignee: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The GitHub assignee or organization filter that scopes which issues can fire the trigger. + Required.""" + repository: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The GitHub repository filter that scopes which issues can fire the trigger. Required.""" + + @overload + def __init__( + self, + *, + connection_id: str, + assignee: str, + repository: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = RoutineTriggerType.GITHUB_ISSUE_OPENED # type: ignore + + +class TelemetryEndpointAuth(_Model): + """Authentication configuration for a telemetry endpoint. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + HeaderTelemetryEndpointAuth + + :ivar type: The authentication type. Required. "header" + :vartype type: str or ~azure.ai.projects.models.TelemetryEndpointAuthType + """ + + __mapping__: dict[str, _Model] = {} + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """The authentication type. Required. \"header\"""" + + @overload + def __init__( + self, + *, + type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class HeaderTelemetryEndpointAuth(TelemetryEndpointAuth, discriminator="header"): + """Header-based secret authentication for a telemetry endpoint. The resolved secret value is + injected as an HTTP header. + + :ivar type: The authentication type, always 'header' for header-based secret authentication. + Required. Header-based secret authentication. + :vartype type: str or ~azure.ai.projects.models.HEADER + :ivar header_name: The name of the HTTP header to inject the secret value into. Required. + :vartype header_name: str + :ivar secret_id: The identifier of the secret store or connection. Required. + :vartype secret_id: str + :ivar secret_key: The key within the secret to retrieve the authentication value. Required. + :vartype secret_key: str + """ + + type: Literal[TelemetryEndpointAuthType.HEADER] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The authentication type, always 'header' for header-based secret authentication. Required. + Header-based secret authentication.""" + header_name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the HTTP header to inject the secret value into. Required.""" + secret_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The identifier of the secret store or connection. Required.""" + secret_key: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The key within the secret to retrieve the authentication value. Required.""" + + @overload + def __init__( + self, + *, + header_name: str, + secret_id: str, + secret_key: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = TelemetryEndpointAuthType.HEADER # type: ignore + + +class HostedAgentDefinition(AgentDefinition, discriminator="hosted"): + """The hosted agent definition. + + :ivar rai_config: Configuration for Responsible AI (RAI) content filtering and safety features. + :vartype rai_config: ~azure.ai.projects.models.RaiConfig + :ivar kind: Required. HOSTED. + :vartype kind: str or ~azure.ai.projects.models.HOSTED + :ivar tools: An array of tools the hosted agent's model may call while generating a response. + You can specify which tool to use by setting the ``tool_choice`` parameter. + :vartype tools: list[~azure.ai.projects.models.Tool] + :ivar container_protocol_versions: The protocols that the agent supports for ingress + communication of the containers. + :vartype container_protocol_versions: list[~azure.ai.projects.models.ProtocolVersionRecord] + :ivar cpu: The CPU configuration for the hosted agent. Required. + :vartype cpu: str + :ivar memory: The memory configuration for the hosted agent. Required. + :vartype memory: str + :ivar environment_variables: Environment variables to set in the hosted agent container. + :vartype environment_variables: dict[str, str] + :ivar image: The image ID for the agent, applicable to image-based hosted agents. + :vartype image: str + :ivar container_configuration: Container-based deployment configuration. Provide this for + image-based deployments. Mutually exclusive with code_configuration — the service validates + that exactly one is set. + :vartype container_configuration: ~azure.ai.projects.models.ContainerConfiguration + :ivar protocol_versions: The protocols that the agent supports for ingress communication. + :vartype protocol_versions: list[~azure.ai.projects.models.ProtocolVersionRecord] + :ivar code_configuration: Code-based deployment configuration. Provide this for code-based + deployments. Mutually exclusive with container_configuration — the service validates that + exactly one is set. + :vartype code_configuration: ~azure.ai.projects.models.CodeConfiguration + :ivar telemetry_config: Optional customer-supplied telemetry configuration for exporting + container logs, traces, and metrics. + :vartype telemetry_config: ~azure.ai.projects.models.TelemetryConfig + """ + + kind: Literal[AgentKind.HOSTED] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. HOSTED.""" + tools: Optional[list["_models.Tool"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """An array of tools the hosted agent's model may call while generating a response. You can + specify which tool to use by setting the ``tool_choice`` parameter.""" + container_protocol_versions: Optional[list["_models.ProtocolVersionRecord"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The protocols that the agent supports for ingress communication of the containers.""" + cpu: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The CPU configuration for the hosted agent. Required.""" + memory: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The memory configuration for the hosted agent. Required.""" + environment_variables: Optional[dict[str, str]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Environment variables to set in the hosted agent container.""" + image: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The image ID for the agent, applicable to image-based hosted agents.""" + container_configuration: Optional["_models.ContainerConfiguration"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Container-based deployment configuration. Provide this for image-based deployments. Mutually + exclusive with code_configuration — the service validates that exactly one is set.""" + protocol_versions: Optional[list["_models.ProtocolVersionRecord"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The protocols that the agent supports for ingress communication.""" + code_configuration: Optional["_models.CodeConfiguration"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Code-based deployment configuration. Provide this for code-based deployments. Mutually + exclusive with container_configuration — the service validates that exactly one is set.""" + telemetry_config: Optional["_models.TelemetryConfig"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Optional customer-supplied telemetry configuration for exporting container logs, traces, and + metrics.""" + + @overload + def __init__( + self, + *, + cpu: str, + memory: str, + rai_config: Optional["_models.RaiConfig"] = None, + tools: Optional[list["_models.Tool"]] = None, + container_protocol_versions: Optional[list["_models.ProtocolVersionRecord"]] = None, + environment_variables: Optional[dict[str, str]] = None, + image: Optional[str] = None, + container_configuration: Optional["_models.ContainerConfiguration"] = None, + protocol_versions: Optional[list["_models.ProtocolVersionRecord"]] = None, + code_configuration: Optional["_models.CodeConfiguration"] = None, + telemetry_config: Optional["_models.TelemetryConfig"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.kind = AgentKind.HOSTED # type: ignore + + +class HourlyRecurrenceSchedule(RecurrenceSchedule, discriminator="Hourly"): + """Hourly recurrence schedule. + + :ivar type: Required. Hourly recurrence pattern. + :vartype type: str or ~azure.ai.projects.models.HOURLY + """ + + type: Literal[RecurrenceType.HOURLY] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. Hourly recurrence pattern.""" + + @overload + def __init__( + self, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = RecurrenceType.HOURLY # type: ignore + + +class HumanEvaluationPreviewRuleAction(EvaluationRuleAction, discriminator="humanEvaluationPreview"): + """Evaluation rule action for human evaluation. + + :ivar type: Required. Human evaluation preview. + :vartype type: str or ~azure.ai.projects.models.HUMAN_EVALUATION_PREVIEW + :ivar template_id: Human evaluation template Id. Required. + :vartype template_id: str + """ + + type: Literal[EvaluationRuleActionType.HUMAN_EVALUATION_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. Human evaluation preview.""" + template_id: str = rest_field(name="templateId", visibility=["read", "create", "update", "delete", "query"]) + """Human evaluation template Id. Required.""" + + @overload + def __init__( + self, + *, + template_id: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = EvaluationRuleActionType.HUMAN_EVALUATION_PREVIEW # type: ignore + + +class HybridSearchOptions(_Model): + """HybridSearchOptions. + + :ivar embedding_weight: The weight of the embedding in the reciprocal ranking fusion. Required. + :vartype embedding_weight: int + :ivar text_weight: The weight of the text in the reciprocal ranking fusion. Required. + :vartype text_weight: int + """ + + embedding_weight: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The weight of the embedding in the reciprocal ranking fusion. Required.""" + text_weight: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The weight of the text in the reciprocal ranking fusion. Required.""" + + @overload + def __init__( + self, + *, + embedding_weight: int, + text_weight: int, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ImageGenTool(Tool, discriminator="image_generation"): + """Image generation tool. + + :ivar type: The type of the image generation tool. Always ``image_generation``. Required. + IMAGE_GENERATION. + :vartype type: str or ~azure.ai.projects.models.IMAGE_GENERATION + :ivar model: Is one of the following types: Literal["gpt-image-1"], + Literal["gpt-image-1-mini"], Literal["gpt-image-1.5"], str + :vartype model: str or str or str or str + :ivar quality: The quality of the generated image. One of ``low``, ``medium``, ``high``, or + ``auto``. Default: ``auto``. Is one of the following types: Literal["low"], Literal["medium"], + Literal["high"], Literal["auto"] + :vartype quality: str or str or str or str + :ivar size: The size of the generated image. One of ``1024x1024``, ``1024x1536``, + ``1536x1024``, or ``auto``. Default: ``auto``. Is one of the following types: + Literal["1024x1024"], Literal["1024x1536"], Literal["1536x1024"], Literal["auto"] + :vartype size: str or str or str or str + :ivar output_format: The output format of the generated image. One of ``png``, ``webp``, or + ``jpeg``. Default: ``png``. Is one of the following types: Literal["png"], Literal["webp"], + Literal["jpeg"] + :vartype output_format: str or str or str + :ivar output_compression: Compression level for the output image. Default: 100. + :vartype output_compression: int + :ivar moderation: Moderation level for the generated image. Default: ``auto``. Is either a + Literal["auto"] type or a Literal["low"] type. + :vartype moderation: str or str + :ivar background: Background type for the generated image. One of ``transparent``, ``opaque``, + or ``auto``. Default: ``auto``. Is one of the following types: Literal["transparent"], + Literal["opaque"], Literal["auto"] + :vartype background: str or str or str + :ivar input_fidelity: Known values are: "high" and "low". + :vartype input_fidelity: str or ~azure.ai.projects.models.InputFidelity + :ivar input_image_mask: Optional mask for inpainting. Contains ``image_url`` (string, optional) + and ``file_id`` (string, optional). + :vartype input_image_mask: ~azure.ai.projects.models.ImageGenToolInputImageMask + :ivar partial_images: Number of partial images to generate in streaming mode, from 0 (default + value) to 3. + :vartype partial_images: int + :ivar action: Whether to generate a new image or edit an existing image. Default: ``auto``. + Known values are: "generate", "edit", and "auto". + :vartype action: str or ~azure.ai.projects.models.ImageGenAction + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] + """ + + type: Literal[ToolType.IMAGE_GENERATION] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the image generation tool. Always ``image_generation``. Required. IMAGE_GENERATION.""" + model: Optional[Union[Literal["gpt-image-1"], Literal["gpt-image-1-mini"], Literal["gpt-image-1.5"], str]] = ( + rest_field(visibility=["read", "create", "update", "delete", "query"]) + ) + """Is one of the following types: Literal[\"gpt-image-1\"], Literal[\"gpt-image-1-mini\"], + Literal[\"gpt-image-1.5\"], str""" + quality: Optional[Literal["low", "medium", "high", "auto"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The quality of the generated image. One of ``low``, ``medium``, ``high``, or ``auto``. Default: + ``auto``. Is one of the following types: Literal[\"low\"], Literal[\"medium\"], + Literal[\"high\"], Literal[\"auto\"]""" + size: Optional[Literal["1024x1024", "1024x1536", "1536x1024", "auto"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The size of the generated image. One of ``1024x1024``, ``1024x1536``, ``1536x1024``, or + ``auto``. Default: ``auto``. Is one of the following types: Literal[\"1024x1024\"], + Literal[\"1024x1536\"], Literal[\"1536x1024\"], Literal[\"auto\"]""" + output_format: Optional[Literal["png", "webp", "jpeg"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The output format of the generated image. One of ``png``, ``webp``, or ``jpeg``. Default: + ``png``. Is one of the following types: Literal[\"png\"], Literal[\"webp\"], Literal[\"jpeg\"]""" + output_compression: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Compression level for the output image. Default: 100.""" + moderation: Optional[Literal["auto", "low"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Moderation level for the generated image. Default: ``auto``. Is either a Literal[\"auto\"] type + or a Literal[\"low\"] type.""" + background: Optional[Literal["transparent", "opaque", "auto"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Background type for the generated image. One of ``transparent``, ``opaque``, or ``auto``. + Default: ``auto``. Is one of the following types: Literal[\"transparent\"], + Literal[\"opaque\"], Literal[\"auto\"]""" + input_fidelity: Optional[Union[str, "_models.InputFidelity"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Known values are: \"high\" and \"low\".""" + input_image_mask: Optional["_models.ImageGenToolInputImageMask"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Optional mask for inpainting. Contains ``image_url`` (string, optional) and ``file_id`` + (string, optional).""" + partial_images: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Number of partial images to generate in streaming mode, from 0 (default value) to 3.""" + action: Optional[Union[str, "_models.ImageGenAction"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Whether to generate a new image or edit an existing image. Default: ``auto``. Known values are: + \"generate\", \"edit\", and \"auto\".""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional user-defined name for this tool or configuration.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional user-defined description for this tool or configuration.""" + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: + exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at + runtime.""" + + @overload + def __init__( + self, + *, + model: Optional[ + Union[Literal["gpt-image-1"], Literal["gpt-image-1-mini"], Literal["gpt-image-1.5"], str] + ] = None, + quality: Optional[Literal["low", "medium", "high", "auto"]] = None, + size: Optional[Literal["1024x1024", "1024x1536", "1536x1024", "auto"]] = None, + output_format: Optional[Literal["png", "webp", "jpeg"]] = None, + output_compression: Optional[int] = None, + moderation: Optional[Literal["auto", "low"]] = None, + background: Optional[Literal["transparent", "opaque", "auto"]] = None, + input_fidelity: Optional[Union[str, "_models.InputFidelity"]] = None, + input_image_mask: Optional["_models.ImageGenToolInputImageMask"] = None, + partial_images: Optional[int] = None, + action: Optional[Union[str, "_models.ImageGenAction"]] = None, + name: Optional[str] = None, + description: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ToolType.IMAGE_GENERATION # type: ignore + + +class ImageGenToolInputImageMask(_Model): + """ImageGenToolInputImageMask. + + :ivar image_url: + :vartype image_url: str + :ivar file_id: + :vartype file_id: str + """ + + image_url: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + file_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + + @overload + def __init__( + self, + *, + image_url: Optional[str] = None, + file_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class InlineSkillParam(ContainerSkill, discriminator="inline"): + """InlineSkillParam. + + :ivar type: Defines an inline skill for this request. Required. INLINE. + :vartype type: str or ~azure.ai.projects.models.INLINE + :ivar name: The name of the skill. Required. + :vartype name: str + :ivar description: The description of the skill. Required. + :vartype description: str + :ivar source: Inline skill payload. Required. + :vartype source: ~azure.ai.projects.models.InlineSkillSourceParam + """ + + type: Literal[ContainerSkillType.INLINE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Defines an inline skill for this request. Required. INLINE.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the skill. Required.""" + description: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description of the skill. Required.""" + source: "_models.InlineSkillSourceParam" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Inline skill payload. Required.""" + + @overload + def __init__( + self, + *, + name: str, + description: str, + source: "_models.InlineSkillSourceParam", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ContainerSkillType.INLINE # type: ignore + + +class InlineSkillSourceParam(_Model): + """Inline skill payload. + + :ivar type: The type of the inline skill source. Must be ``base64``. Required. Default value is + "base64". + :vartype type: str + :ivar media_type: The media type of the inline skill payload. Must be ``application/zip``. + Required. Default value is "application/zip". + :vartype media_type: str + :ivar data: Base64-encoded skill zip bundle. Required. + :vartype data: str + """ + + type: Literal["base64"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The type of the inline skill source. Must be ``base64``. Required. Default value is \"base64\".""" + media_type: Literal["application/zip"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The media type of the inline skill payload. Must be ``application/zip``. Required. Default + value is \"application/zip\".""" + data: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Base64-encoded skill zip bundle. Required.""" + + @overload + def __init__( + self, + *, + data: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type: Literal["base64"] = "base64" + self.media_type: Literal["application/zip"] = "application/zip" + + +class InputAudio(EvalItemContentItemObject, discriminator="input_audio"): + """Input audio. + + :ivar type: The type of the input item. Always ``input_audio``. Required. INPUT_AUDIO. + :vartype type: str or ~azure.ai.projects.models.INPUT_AUDIO + :ivar input_audio: Required. + :vartype input_audio: ~azure.ai.projects.models.InputAudioInputAudio + """ + + type: Literal[EvalItemContentItemObjectType.INPUT_AUDIO] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the input item. Always ``input_audio``. Required. INPUT_AUDIO.""" + input_audio: "_models.InputAudioInputAudio" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + + @overload + def __init__( + self, + *, + input_audio: "_models.InputAudioInputAudio", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = EvalItemContentItemObjectType.INPUT_AUDIO # type: ignore + + +class InputAudioInputAudio(_Model): + """InputAudioInputAudio. + + :ivar data: Required. + :vartype data: str + :ivar format: Required. Is either a Literal["mp3"] type or a Literal["wav"] type. + :vartype format: str or str + """ + + data: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + format: Literal["mp3", "wav"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required. Is either a Literal[\"mp3\"] type or a Literal[\"wav\"] type.""" + + @overload + def __init__( + self, + *, + data: str, + format: Literal["mp3", "wav"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Insight(_Model): + """The response body for cluster insights. + + :ivar insight_id: The unique identifier for the insights report. Required. + :vartype insight_id: str + :ivar metadata: Metadata about the insights report. Required. + :vartype metadata: ~azure.ai.projects.models.InsightsMetadata + :ivar state: The current state of the insights. Required. Known values are: "NotStarted", + "Running", "Succeeded", "Failed", and "Canceled". + :vartype state: str or ~azure.ai.projects.models.OperationState + :ivar display_name: User friendly display name for the insight. Required. + :vartype display_name: str + :ivar request: Request for the insights analysis. Required. + :vartype request: ~azure.ai.projects.models.InsightRequest + :ivar result: The result of the insights report. + :vartype result: ~azure.ai.projects.models.InsightResult + """ + + insight_id: str = rest_field(name="id", visibility=["read"]) + """The unique identifier for the insights report. Required.""" + metadata: "_models.InsightsMetadata" = rest_field(visibility=["read"]) + """Metadata about the insights report. Required.""" + state: Union[str, "_models.OperationState"] = rest_field(visibility=["read"]) + """The current state of the insights. Required. Known values are: \"NotStarted\", \"Running\", + \"Succeeded\", \"Failed\", and \"Canceled\".""" + display_name: str = rest_field(name="displayName", visibility=["read", "create", "update", "delete", "query"]) + """User friendly display name for the insight. Required.""" + request: "_models.InsightRequest" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Request for the insights analysis. Required.""" + result: Optional["_models.InsightResult"] = rest_field(visibility=["read"]) + """The result of the insights report.""" + + @overload + def __init__( + self, + *, + display_name: str, + request: "_models.InsightRequest", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class InsightCluster(_Model): + """A cluster of analysis samples. + + :ivar id: The id of the analysis cluster. Required. + :vartype id: str + :ivar label: Label for the cluster. Required. + :vartype label: str + :ivar suggestion: Suggestion for the cluster. Required. + :vartype suggestion: str + :ivar suggestion_title: The title of the suggestion for the cluster. Required. + :vartype suggestion_title: str + :ivar description: Description of the analysis cluster. Required. + :vartype description: str + :ivar weight: The weight of the analysis cluster. This indicate number of samples in the + cluster. Required. + :vartype weight: int + :ivar sub_clusters: List of subclusters within this cluster. Empty if no subclusters exist. + :vartype sub_clusters: list[~azure.ai.projects.models.InsightCluster] + :ivar samples: List of samples that belong to this cluster. Empty if samples are part of + subclusters. + :vartype samples: list[~azure.ai.projects.models.InsightSample] + """ + + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The id of the analysis cluster. Required.""" + label: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Label for the cluster. Required.""" + suggestion: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Suggestion for the cluster. Required.""" + suggestion_title: str = rest_field( + name="suggestionTitle", visibility=["read", "create", "update", "delete", "query"] + ) + """The title of the suggestion for the cluster. Required.""" + description: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Description of the analysis cluster. Required.""" + weight: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The weight of the analysis cluster. This indicate number of samples in the cluster. Required.""" + sub_clusters: Optional[list["_models.InsightCluster"]] = rest_field( + name="subClusters", visibility=["read", "create", "update", "delete", "query"] + ) + """List of subclusters within this cluster. Empty if no subclusters exist.""" + samples: Optional[list["_models.InsightSample"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """List of samples that belong to this cluster. Empty if samples are part of subclusters.""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + label: str, + suggestion: str, + suggestion_title: str, + description: str, + weight: int, + sub_clusters: Optional[list["_models.InsightCluster"]] = None, + samples: Optional[list["_models.InsightSample"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class InsightModelConfiguration(_Model): + """Configuration of the model used in the insight generation. + + :ivar model_deployment_name: The model deployment to be evaluated. Accepts either the + deployment name alone or with the connection name as '{connectionName}/'. + Required. + :vartype model_deployment_name: str + """ + + model_deployment_name: str = rest_field( + name="modelDeploymentName", visibility=["read", "create", "update", "delete", "query"] + ) + """The model deployment to be evaluated. Accepts either the deployment name alone or with the + connection name as '{connectionName}/'. Required.""" + + @overload + def __init__( + self, + *, + model_deployment_name: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class InsightScheduleTask(ScheduleTask, discriminator="Insight"): + """Insight task for the schedule. + + :ivar configuration: Configuration for the task. + :vartype configuration: dict[str, str] + :ivar type: Required. Insight task. + :vartype type: str or ~azure.ai.projects.models.INSIGHT + :ivar insight: The insight payload. Required. + :vartype insight: ~azure.ai.projects.models.Insight + """ + + type: Literal[ScheduleTaskType.INSIGHT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. Insight task.""" + insight: "_models.Insight" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The insight payload. Required.""" + + @overload + def __init__( + self, + *, + insight: "_models.Insight", + configuration: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ScheduleTaskType.INSIGHT # type: ignore + + +class InsightsMetadata(_Model): + """Metadata about the insights. + + :ivar created_at: The timestamp when the insights were created. Required. + :vartype created_at: ~datetime.datetime + :ivar completed_at: The timestamp when the insights were completed. + :vartype completed_at: ~datetime.datetime + """ + + created_at: datetime.datetime = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp when the insights were created. Required.""" + completed_at: Optional[datetime.datetime] = rest_field( + name="completedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp when the insights were completed.""" + + @overload + def __init__( + self, + *, + created_at: datetime.datetime, + completed_at: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class InsightSummary(_Model): + """Summary of the error cluster analysis. + + :ivar sample_count: Total number of samples analyzed. Required. + :vartype sample_count: int + :ivar unique_subcluster_count: Total number of unique subcluster labels. Required. + :vartype unique_subcluster_count: int + :ivar unique_cluster_count: Total number of unique clusters. Required. + :vartype unique_cluster_count: int + :ivar method: Method used for clustering. Required. + :vartype method: str + :ivar usage: Token usage while performing clustering analysis. Required. + :vartype usage: ~azure.ai.projects.models.ClusterTokenUsage + """ + + sample_count: int = rest_field(name="sampleCount", visibility=["read", "create", "update", "delete", "query"]) + """Total number of samples analyzed. Required.""" + unique_subcluster_count: int = rest_field( + name="uniqueSubclusterCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Total number of unique subcluster labels. Required.""" + unique_cluster_count: int = rest_field( + name="uniqueClusterCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Total number of unique clusters. Required.""" + method: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Method used for clustering. Required.""" + usage: "_models.ClusterTokenUsage" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Token usage while performing clustering analysis. Required.""" + + @overload + def __init__( + self, + *, + sample_count: int, + unique_subcluster_count: int, + unique_cluster_count: int, + method: str, + usage: "_models.ClusterTokenUsage", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RoutineDispatchPayload(_Model): + """Base model for a manual dispatch payload. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + InvokeAgentInvocationsApiDispatchPayload, InvokeAgentResponsesApiDispatchPayload + + :ivar type: The manual dispatch payload type. Required. Known values are: + "invoke_agent_responses_api" and "invoke_agent_invocations_api". + :vartype type: str or ~azure.ai.projects.models.RoutineDispatchPayloadType + """ + + __mapping__: dict[str, _Model] = {} + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """The manual dispatch payload type. Required. Known values are: \"invoke_agent_responses_api\" + and \"invoke_agent_invocations_api\".""" + + @overload + def __init__( + self, + *, + type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class InvokeAgentInvocationsApiDispatchPayload(RoutineDispatchPayload, discriminator="invoke_agent_invocations_api"): + """A manual payload used to test an invocations API routine dispatch. + + :ivar type: The manual dispatch payload type. Required. A manual payload for an invocations API + routine dispatch. + :vartype type: str or ~azure.ai.projects.models.INVOKE_AGENT_INVOCATIONS_API + :ivar input: The raw input sent to the downstream invocations target. + :vartype input: str + """ + + type: Literal[RoutineDispatchPayloadType.INVOKE_AGENT_INVOCATIONS_API] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The manual dispatch payload type. Required. A manual payload for an invocations API routine + dispatch.""" + input: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The raw input sent to the downstream invocations target.""" + + @overload + def __init__( + self, + *, + input: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = RoutineDispatchPayloadType.INVOKE_AGENT_INVOCATIONS_API # type: ignore + + +class RoutineAction(_Model): + """Base model for a routine action. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + InvokeAgentInvocationsApiRoutineAction, InvokeAgentResponsesApiRoutineAction + + :ivar type: The action type. Required. Known values are: "invoke_agent_responses_api" and + "invoke_agent_invocations_api". + :vartype type: str or ~azure.ai.projects.models.RoutineActionType + """ + + __mapping__: dict[str, _Model] = {} + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """The action type. Required. Known values are: \"invoke_agent_responses_api\" and + \"invoke_agent_invocations_api\".""" + + @overload + def __init__( + self, + *, + type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class InvokeAgentInvocationsApiRoutineAction(RoutineAction, discriminator="invoke_agent_invocations_api"): + """Dispatches a routine through the raw invocations API. + + :ivar type: The action type. Required. Dispatches through the raw invocations API. + :vartype type: str or ~azure.ai.projects.models.INVOKE_AGENT_INVOCATIONS_API + :ivar agent_endpoint_id: The endpoint-scoped agent identifier for invocations API dispatch. + Required. + :vartype agent_endpoint_id: str + :ivar session_id: An optional existing hosted-agent session identifier to continue during the + downstream dispatch. + :vartype session_id: str + """ + + type: Literal[RoutineActionType.INVOKE_AGENT_INVOCATIONS_API] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The action type. Required. Dispatches through the raw invocations API.""" + agent_endpoint_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The endpoint-scoped agent identifier for invocations API dispatch. Required.""" + session_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """An optional existing hosted-agent session identifier to continue during the downstream + dispatch.""" + + @overload + def __init__( + self, + *, + agent_endpoint_id: str, + session_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = RoutineActionType.INVOKE_AGENT_INVOCATIONS_API # type: ignore + + +class InvokeAgentResponsesApiDispatchPayload(RoutineDispatchPayload, discriminator="invoke_agent_responses_api"): + """A manual payload used to test a responses API routine dispatch. + + :ivar type: The manual dispatch payload type. Required. A manual payload for a responses API + routine dispatch. + :vartype type: str or ~azure.ai.projects.models.INVOKE_AGENT_RESPONSES_API + :ivar input: The user input sent to the downstream responses target. + :vartype input: str + """ + + type: Literal[RoutineDispatchPayloadType.INVOKE_AGENT_RESPONSES_API] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The manual dispatch payload type. Required. A manual payload for a responses API routine + dispatch.""" + input: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The user input sent to the downstream responses target.""" + + @overload + def __init__( + self, + *, + input: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = RoutineDispatchPayloadType.INVOKE_AGENT_RESPONSES_API # type: ignore + + +class InvokeAgentResponsesApiRoutineAction(RoutineAction, discriminator="invoke_agent_responses_api"): + """Dispatches a routine through the responses API. Exactly one of agent_name or agent_endpoint_id + must be provided. + + :ivar type: The action type. Required. Dispatches through the responses API. + :vartype type: str or ~azure.ai.projects.models.INVOKE_AGENT_RESPONSES_API + :ivar agent_name: The project-scoped agent name for responses API dispatch. + :vartype agent_name: str + :ivar agent_endpoint_id: The endpoint-scoped agent identifier for responses API dispatch. + :vartype agent_endpoint_id: str + :ivar conversation_id: An optional existing conversation identifier to continue during the + downstream dispatch. + :vartype conversation_id: str + """ + + type: Literal[RoutineActionType.INVOKE_AGENT_RESPONSES_API] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The action type. Required. Dispatches through the responses API.""" + agent_name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The project-scoped agent name for responses API dispatch.""" + agent_endpoint_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The endpoint-scoped agent identifier for responses API dispatch.""" + conversation_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """An optional existing conversation identifier to continue during the downstream dispatch.""" + + @overload + def __init__( + self, + *, + agent_name: Optional[str] = None, + agent_endpoint_id: Optional[str] = None, + conversation_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = RoutineActionType.INVOKE_AGENT_RESPONSES_API # type: ignore + + +class KeyPressAction(ComputerAction, discriminator="keypress"): + """KeyPress. + + :ivar type: Specifies the event type. For a keypress action, this property is always set to + ``keypress``. Required. KEYPRESS. + :vartype type: str or ~azure.ai.projects.models.KEYPRESS + :ivar keys_property: The combination of keys the model is requesting to be pressed. This is an + array of strings, each representing a key. Required. + :vartype keys_property: list[str] + """ + + type: Literal[ComputerActionType.KEYPRESS] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Specifies the event type. For a keypress action, this property is always set to ``keypress``. + Required. KEYPRESS.""" + keys_property: list[str] = rest_field( + name="keys", visibility=["read", "create", "update", "delete", "query"], original_tsp_name="keys" + ) + """The combination of keys the model is requesting to be pressed. This is an array of strings, + each representing a key. Required.""" + + @overload + def __init__( + self, + *, + keys_property: list[str], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ComputerActionType.KEYPRESS # type: ignore + + +class LocalEnvironmentResource(FunctionShellCallEnvironment, discriminator="local"): + """Local Environment. + + :ivar type: The environment type. Always ``local``. Required. LOCAL. + :vartype type: str or ~azure.ai.projects.models.LOCAL + """ + + type: Literal[FunctionShellCallEnvironmentType.LOCAL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The environment type. Always ``local``. Required. LOCAL.""" + + @overload + def __init__( + self, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = FunctionShellCallEnvironmentType.LOCAL # type: ignore + + +class LocalShellExecAction(_Model): + """Local shell exec action. + + :ivar type: The type of the local shell action. Always ``exec``. Required. Default value is + "exec". + :vartype type: str + :ivar command: The command to run. Required. + :vartype command: list[str] + :ivar timeout_ms: + :vartype timeout_ms: int + :ivar working_directory: + :vartype working_directory: str + :ivar env: Environment variables to set for the command. Required. + :vartype env: dict[str, str] + :ivar user: + :vartype user: str + """ + + type: Literal["exec"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The type of the local shell action. Always ``exec``. Required. Default value is \"exec\".""" + command: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The command to run. Required.""" + timeout_ms: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + working_directory: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + env: dict[str, str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Environment variables to set for the command. Required.""" + user: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + + @overload + def __init__( + self, + *, + command: list[str], + env: dict[str, str], + timeout_ms: Optional[int] = None, + working_directory: Optional[str] = None, + user: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type: Literal["exec"] = "exec" + + +class LocalShellToolParam(Tool, discriminator="local_shell"): + """Local shell tool. + + :ivar type: The type of the local shell tool. Always ``local_shell``. Required. LOCAL_SHELL. + :vartype type: str or ~azure.ai.projects.models.LOCAL_SHELL + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] + """ + + type: Literal[ToolType.LOCAL_SHELL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the local shell tool. Always ``local_shell``. Required. LOCAL_SHELL.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional user-defined name for this tool or configuration.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional user-defined description for this tool or configuration.""" + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: + exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at + runtime.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + description: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ToolType.LOCAL_SHELL # type: ignore + + +class LocalSkillParam(_Model): + """LocalSkillParam. + + :ivar name: The name of the skill. Required. + :vartype name: str + :ivar description: The description of the skill. Required. + :vartype description: str + :ivar path: The path to the directory containing the skill. Required. + :vartype path: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the skill. Required.""" + description: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description of the skill. Required.""" + path: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The path to the directory containing the skill. Required.""" + + @overload + def __init__( + self, + *, + name: str, + description: str, + path: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LogProb(_Model): + """Log probability. + + :ivar token: Required. + :vartype token: str + :ivar logprob: Required. + :vartype logprob: int + :ivar bytes: Required. + :vartype bytes: list[int] + :ivar top_logprobs: Required. + :vartype top_logprobs: list[~azure.ai.projects.models.TopLogProb] + """ + + token: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + logprob: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + bytes: list[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + top_logprobs: list["_models.TopLogProb"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + + @overload + def __init__( + self, + *, + token: str, + logprob: int, + bytes: list[int], + top_logprobs: list["_models.TopLogProb"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LoraConfig(_Model): + """Adapter-specific metadata for LoRA models. Drives serving engine configuration at deployment + time. + + :ivar rank: LoRA rank (r). Positive integer. Common values: 8, 16, 32, 64. + :vartype rank: int + :ivar alpha: LoRA scaling factor (α). Positive integer; typically 2× the rank. + :vartype alpha: int + :ivar target_modules: Model layers modified by the adapter (e.g., q_proj, v_proj). + Auto-detected from adapter_config.json if omitted. + :vartype target_modules: list[str] + :ivar dropout: Dropout rate used during training. Informational — not used at serving time. + :vartype dropout: float + """ + + rank: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """LoRA rank (r). Positive integer. Common values: 8, 16, 32, 64.""" + alpha: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """LoRA scaling factor (α). Positive integer; typically 2× the rank.""" + target_modules: Optional[list[str]] = rest_field( + name="targetModules", visibility=["read", "create", "update", "delete", "query"] + ) + """Model layers modified by the adapter (e.g., q_proj, v_proj). Auto-detected from + adapter_config.json if omitted.""" + dropout: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Dropout rate used during training. Informational — not used at serving time.""" + + @overload + def __init__( + self, + *, + rank: Optional[int] = None, + alpha: Optional[int] = None, + target_modules: Optional[list[str]] = None, + dropout: Optional[float] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedAgentIdentityBlueprintReference(AgentBlueprintReference, discriminator="ManagedAgentIdentityBlueprint"): + """ManagedAgentIdentityBlueprintReference. + + :ivar type: Required. MANAGED_AGENT_IDENTITY_BLUEPRINT. + :vartype type: str or ~azure.ai.projects.models.MANAGED_AGENT_IDENTITY_BLUEPRINT + :ivar blueprint_id: The ID of the managed blueprint. Required. + :vartype blueprint_id: str + """ + + type: Literal[AgentBlueprintReferenceType.MANAGED_AGENT_IDENTITY_BLUEPRINT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. MANAGED_AGENT_IDENTITY_BLUEPRINT.""" + blueprint_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ID of the managed blueprint. Required.""" + + @overload + def __init__( + self, + *, + blueprint_id: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = AgentBlueprintReferenceType.MANAGED_AGENT_IDENTITY_BLUEPRINT # type: ignore + + +class ManagedAzureAISearchIndex(Index, discriminator="ManagedAzureSearch"): + """Managed Azure AI Search Index Definition. + + :ivar id: Asset ID, a unique identifier for the asset. + :vartype id: str + :ivar name: The name of the resource. Required. + :vartype name: str + :ivar version: The version of the resource. Required. + :vartype version: str + :ivar description: The asset description text. + :vartype description: str + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar type: Type of index. Required. Managed Azure Search. + :vartype type: str or ~azure.ai.projects.models.MANAGED_AZURE_SEARCH + :ivar vector_store_id: Vector store id of managed index. Required. + :vartype vector_store_id: str + """ + + type: Literal[IndexType.MANAGED_AZURE_SEARCH] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of index. Required. Managed Azure Search.""" + vector_store_id: str = rest_field(name="vectorStoreId", visibility=["create"]) + """Vector store id of managed index. Required.""" + + @overload + def __init__( + self, + *, + vector_store_id: str, + description: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = IndexType.MANAGED_AZURE_SEARCH # type: ignore + + +class MCPListToolsTool(_Model): + """MCP list tools tool. + + :ivar name: The name of the tool. Required. + :vartype name: str + :ivar description: + :vartype description: str + :ivar input_schema: The JSON schema describing the tool's input. Required. + :vartype input_schema: ~azure.ai.projects.models.MCPListToolsToolInputSchema + :ivar annotations: + :vartype annotations: ~azure.ai.projects.models.MCPListToolsToolAnnotations + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the tool. Required.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + input_schema: "_models.MCPListToolsToolInputSchema" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The JSON schema describing the tool's input. Required.""" + annotations: Optional["_models.MCPListToolsToolAnnotations"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + name: str, + input_schema: "_models.MCPListToolsToolInputSchema", + description: Optional[str] = None, + annotations: Optional["_models.MCPListToolsToolAnnotations"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MCPListToolsToolAnnotations(_Model): + """MCPListToolsToolAnnotations.""" + + +class MCPListToolsToolInputSchema(_Model): + """MCPListToolsToolInputSchema.""" + + +class MCPTool(Tool, discriminator="mcp"): + """MCP tool. + + :ivar type: The type of the MCP tool. Always ``mcp``. Required. MCP. + :vartype type: str or ~azure.ai.projects.models.MCP + :ivar server_label: A label for this MCP server, used to identify it in tool calls. Required. + :vartype server_label: str + :ivar server_url: The URL for the MCP server. One of ``server_url`` or ``connector_id`` must be + provided. + :vartype server_url: str + :ivar connector_id: Identifier for service connectors, like those available in ChatGPT. One of + ``server_url`` or ``connector_id`` must be provided. Learn more about service connectors `here + `_. Currently supported ``connector_id`` values are: + + * Dropbox: `connector_dropbox` + * Gmail: `connector_gmail` + * Google Calendar: `connector_googlecalendar` + * Google Drive: `connector_googledrive` + * Microsoft Teams: `connector_microsoftteams` + * Outlook Calendar: `connector_outlookcalendar` + * Outlook Email: `connector_outlookemail` + * SharePoint: `connector_sharepoint`. Is one of the following types: + Literal["connector_dropbox"], Literal["connector_gmail"], Literal["connector_googlecalendar"], + Literal["connector_googledrive"], Literal["connector_microsoftteams"], + Literal["connector_outlookcalendar"], Literal["connector_outlookemail"], + Literal["connector_sharepoint"] + :vartype connector_id: str or str or str or str or str or str or str or str + :ivar authorization: An OAuth access token that can be used with a remote MCP server, either + with a custom MCP server URL or a service connector. Your application must handle the OAuth + authorization flow and provide the token here. + :vartype authorization: str + :ivar server_description: Optional description of the MCP server, used to provide more context. + :vartype server_description: str + :ivar headers: + :vartype headers: dict[str, str] + :ivar allowed_tools: Is either a [str] type or a MCPToolFilter type. + :vartype allowed_tools: list[str] or ~azure.ai.projects.models.MCPToolFilter + :ivar require_approval: Is one of the following types: MCPToolRequireApproval, + Literal["always"], Literal["never"] + :vartype require_approval: ~azure.ai.projects.models.MCPToolRequireApproval or str or str + :ivar project_connection_id: The connection ID in the project for the MCP server. The + connection stores authentication and other connection details needed to connect to the MCP + server. + :vartype project_connection_id: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] + """ + + type: Literal[ToolType.MCP] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the MCP tool. Always ``mcp``. Required. MCP.""" + server_label: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A label for this MCP server, used to identify it in tool calls. Required.""" + server_url: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The URL for the MCP server. One of ``server_url`` or ``connector_id`` must be provided.""" + connector_id: Optional[ + Literal[ + "connector_dropbox", + "connector_gmail", + "connector_googlecalendar", + "connector_googledrive", + "connector_microsoftteams", + "connector_outlookcalendar", + "connector_outlookemail", + "connector_sharepoint", + ] + ] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Identifier for service connectors, like those available in ChatGPT. One of ``server_url`` or + ``connector_id`` must be provided. Learn more about service connectors `here + `_. Currently supported ``connector_id`` values are: + + * Dropbox: `connector_dropbox` + * Gmail: `connector_gmail` + * Google Calendar: `connector_googlecalendar` + * Google Drive: `connector_googledrive` + * Microsoft Teams: `connector_microsoftteams` + * Outlook Calendar: `connector_outlookcalendar` + * Outlook Email: `connector_outlookemail` + * SharePoint: `connector_sharepoint`. Is one of the following types: + Literal[\"connector_dropbox\"], Literal[\"connector_gmail\"], + Literal[\"connector_googlecalendar\"], Literal[\"connector_googledrive\"], + Literal[\"connector_microsoftteams\"], Literal[\"connector_outlookcalendar\"], + Literal[\"connector_outlookemail\"], Literal[\"connector_sharepoint\"]""" + authorization: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """An OAuth access token that can be used with a remote MCP server, either with a custom MCP + server URL or a service connector. Your application must handle the OAuth authorization flow + and provide the token here.""" + server_description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional description of the MCP server, used to provide more context.""" + headers: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + allowed_tools: Optional[Union[list[str], "_models.MCPToolFilter"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Is either a [str] type or a MCPToolFilter type.""" + require_approval: Optional[Union["_models.MCPToolRequireApproval", Literal["always"], Literal["never"]]] = ( + rest_field(visibility=["read", "create", "update", "delete", "query"]) + ) + """Is one of the following types: MCPToolRequireApproval, Literal[\"always\"], Literal[\"never\"]""" + project_connection_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The connection ID in the project for the MCP server. The connection stores authentication and + other connection details needed to connect to the MCP server.""" + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: + exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at + runtime.""" + + @overload + def __init__( + self, + *, + server_label: str, + server_url: Optional[str] = None, + connector_id: Optional[ + Literal[ + "connector_dropbox", + "connector_gmail", + "connector_googlecalendar", + "connector_googledrive", + "connector_microsoftteams", + "connector_outlookcalendar", + "connector_outlookemail", + "connector_sharepoint", + ] + ] = None, + authorization: Optional[str] = None, + server_description: Optional[str] = None, + headers: Optional[dict[str, str]] = None, + allowed_tools: Optional[Union[list[str], "_models.MCPToolFilter"]] = None, + require_approval: Optional[Union["_models.MCPToolRequireApproval", Literal["always"], Literal["never"]]] = None, + project_connection_id: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ToolType.MCP # type: ignore + + +class MCPToolFilter(_Model): + """MCP tool filter. + + :ivar tool_names: MCP allowed tools. + :vartype tool_names: list[str] + :ivar read_only: Indicates whether or not a tool modifies data or is read-only. If an MCP + server is `annotated with `readOnlyHint` + `_, + it will match this filter. + :vartype read_only: bool + """ + + tool_names: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """MCP allowed tools.""" + read_only: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Indicates whether or not a tool modifies data or is read-only. If an MCP server is `annotated + with `readOnlyHint` + `_, + it will match this filter.""" + + @overload + def __init__( + self, + *, + tool_names: Optional[list[str]] = None, + read_only: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MCPToolRequireApproval(_Model): + """MCPToolRequireApproval. + + :ivar always: + :vartype always: ~azure.ai.projects.models.MCPToolFilter + :ivar never: + :vartype never: ~azure.ai.projects.models.MCPToolFilter + """ + + always: Optional["_models.MCPToolFilter"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + never: Optional["_models.MCPToolFilter"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + + @overload + def __init__( + self, + *, + always: Optional["_models.MCPToolFilter"] = None, + never: Optional["_models.MCPToolFilter"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MemoryCommandToolCall(OutputItem, discriminator="memory_command_preview_call"): + """A memory command tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. MEMORY_COMMAND_PREVIEW_CALL. + :vartype type: str or ~azure.ai.projects.models.MEMORY_COMMAND_PREVIEW_CALL + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool, including ``action`` + (``remember`` or ``forget``) and ``content``. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.projects.models.ToolCallStatus + """ + + type: Literal[OutputItemType.MEMORY_COMMAND_PREVIEW_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. MEMORY_COMMAND_PREVIEW_CALL.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the tool call generated by the model. Required.""" + arguments: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A JSON string of the arguments to pass to the tool, including ``action`` (``remember`` or + ``forget``) and ``content``. Required.""" + status: Union[str, "_models.ToolCallStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + + @overload + def __init__( + self, + *, + call_id: str, + arguments: str, + status: Union[str, "_models.ToolCallStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = OutputItemType.MEMORY_COMMAND_PREVIEW_CALL # type: ignore + + +class MemoryCommandToolCallOutput(OutputItem, discriminator="memory_command_preview_call_output"): + """The output of a memory command tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. MEMORY_COMMAND_PREVIEW_CALL_OUTPUT. + :vartype type: str or ~azure.ai.projects.models.MEMORY_COMMAND_PREVIEW_CALL_OUTPUT + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.projects.models.ToolCallStatus + """ + + type: Literal[OutputItemType.MEMORY_COMMAND_PREVIEW_CALL_OUTPUT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. MEMORY_COMMAND_PREVIEW_CALL_OUTPUT.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the tool call generated by the model. Required.""" + status: Union[str, "_models.ToolCallStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + + @overload + def __init__( + self, + *, + call_id: str, + status: Union[str, "_models.ToolCallStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = OutputItemType.MEMORY_COMMAND_PREVIEW_CALL_OUTPUT # type: ignore + + +class MemoryOperation(_Model): + """Represents a single memory operation (create, update, or delete) performed on a memory item. + + :ivar kind: The type of memory operation being performed. Required. Known values are: "create", + "update", and "delete". + :vartype kind: str or ~azure.ai.projects.models.MemoryOperationKind + :ivar memory_item: The memory item to create, update, or delete. Required. + :vartype memory_item: ~azure.ai.projects.models.MemoryItem + """ + + kind: Union[str, "_models.MemoryOperationKind"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of memory operation being performed. Required. Known values are: \"create\", + \"update\", and \"delete\".""" + memory_item: "_models.MemoryItem" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The memory item to create, update, or delete. Required.""" + + @overload + def __init__( + self, + *, + kind: Union[str, "_models.MemoryOperationKind"], + memory_item: "_models.MemoryItem", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MemorySearchItem(_Model): + """A retrieved memory item from memory search. + + :ivar memory_item: Retrieved memory item. Required. + :vartype memory_item: ~azure.ai.projects.models.MemoryItem + """ + + memory_item: "_models.MemoryItem" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Retrieved memory item. Required.""" + + @overload + def __init__( + self, + *, + memory_item: "_models.MemoryItem", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MemorySearchOptions(_Model): + """Memory search options. + + :ivar max_memories: Maximum number of memory items to return. + :vartype max_memories: int + """ + + max_memories: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Maximum number of memory items to return.""" + + @overload + def __init__( + self, + *, + max_memories: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MemorySearchPreviewTool(Tool, discriminator="memory_search_preview"): + """A tool for integrating memories into the agent. + + :ivar type: The type of the tool. Always ``memory_search_preview``. Required. + MEMORY_SEARCH_PREVIEW. + :vartype type: str or ~azure.ai.projects.models.MEMORY_SEARCH_PREVIEW + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] + :ivar memory_store_name: The name of the memory store to use. Required. + :vartype memory_store_name: str + :ivar scope: The namespace used to group and isolate memories, such as a user ID. Limits which + memories can be retrieved or updated. Use special variable ``{{$userId}}`` to scope memories to + the current signed-in user. Required. + :vartype scope: str + :ivar search_options: Options for searching the memory store. + :vartype search_options: ~azure.ai.projects.models.MemorySearchOptions + :ivar update_delay: Time to wait before updating memories after inactivity (seconds). Default + 300. + :vartype update_delay: int + """ + + type: Literal[ToolType.MEMORY_SEARCH_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the tool. Always ``memory_search_preview``. Required. MEMORY_SEARCH_PREVIEW.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional user-defined name for this tool or configuration.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional user-defined description for this tool or configuration.""" + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: + exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at + runtime.""" + memory_store_name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the memory store to use. Required.""" + scope: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The namespace used to group and isolate memories, such as a user ID. Limits which memories can + be retrieved or updated. Use special variable ``{{$userId}}`` to scope memories to the current + signed-in user. Required.""" + search_options: Optional["_models.MemorySearchOptions"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Options for searching the memory store.""" + update_delay: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Time to wait before updating memories after inactivity (seconds). Default 300.""" + + @overload + def __init__( + self, + *, + memory_store_name: str, + scope: str, + name: Optional[str] = None, + description: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, + search_options: Optional["_models.MemorySearchOptions"] = None, + update_delay: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ToolType.MEMORY_SEARCH_PREVIEW # type: ignore + + +class MemorySearchToolCall(OutputItem, discriminator="memory_search_call"): + """A memory search tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. MEMORY_SEARCH_CALL. + :vartype type: str or ~azure.ai.projects.models.MEMORY_SEARCH_CALL + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.projects.models.ToolCallStatus + :ivar memories: The results returned from the memory search. + :vartype memories: list[~azure.ai.projects.models.MemoryItem] + """ + + type: Literal[OutputItemType.MEMORY_SEARCH_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. MEMORY_SEARCH_CALL.""" + status: Union[str, "_models.ToolCallStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + memories: Optional[list["_models.MemoryItem"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The results returned from the memory search.""" + + @overload + def __init__( + self, + *, + status: Union[str, "_models.ToolCallStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + memories: Optional[list["_models.MemoryItem"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = OutputItemType.MEMORY_SEARCH_CALL # type: ignore + + +class MemoryStoreDefinition(_Model): + """Base definition for memory store configurations. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + MemoryStoreDefaultDefinition + + :ivar kind: The kind of the memory store. Required. "default" + :vartype kind: str or ~azure.ai.projects.models.MemoryStoreKind + """ + + __mapping__: dict[str, _Model] = {} + kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) + """The kind of the memory store. Required. \"default\"""" + + @overload + def __init__( + self, + *, + kind: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MemoryStoreDefaultDefinition(MemoryStoreDefinition, discriminator="default"): + """Default memory store implementation. + + :ivar kind: The kind of the memory store. Required. The default memory store implementation. + :vartype kind: str or ~azure.ai.projects.models.DEFAULT + :ivar chat_model: The name or identifier of the chat completion model deployment used for + memory processing. Required. + :vartype chat_model: str + :ivar embedding_model: The name or identifier of the embedding model deployment used for memory + processing. Required. + :vartype embedding_model: str + :ivar options: Default memory store options. + :vartype options: ~azure.ai.projects.models.MemoryStoreDefaultOptions + """ + + kind: Literal[MemoryStoreKind.DEFAULT] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The kind of the memory store. Required. The default memory store implementation.""" + chat_model: str = rest_field(visibility=["read", "create"]) + """The name or identifier of the chat completion model deployment used for memory processing. + Required.""" + embedding_model: str = rest_field(visibility=["read", "create"]) + """The name or identifier of the embedding model deployment used for memory processing. Required.""" + options: Optional["_models.MemoryStoreDefaultOptions"] = rest_field(visibility=["read", "create"]) + """Default memory store options.""" + + @overload + def __init__( + self, + *, + chat_model: str, + embedding_model: str, + options: Optional["_models.MemoryStoreDefaultOptions"] = None, ) -> None: ... @overload @@ -6133,29 +12847,50 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.kind = MemoryStoreKind.DEFAULT # type: ignore -class FileDataGenerationJobOutput(DataGenerationJobOutput, discriminator="file"): - """Azure OpenAI file output for a data generation job. +class MemoryStoreDefaultOptions(_Model): + """Default memory store configurations. - :ivar type: Azure OpenAI file output. Required. The generated data is an Azure OpenAI File. - :vartype type: str or ~azure.ai.projects.models.FILE - :ivar id: The id of the output Azure OpenAI file. Required. - :vartype id: str - :ivar filename: The filename of the output Azure OpenAI file. Required. - :vartype filename: str + :ivar user_profile_enabled: Whether to enable user profile extraction and storage. Default is + true. Required. + :vartype user_profile_enabled: bool + :ivar user_profile_details: Specific categories or types of user profile information to extract + and store. + :vartype user_profile_details: str + :ivar chat_summary_enabled: Whether to enable chat summary extraction and storage. Default is + true. Required. + :vartype chat_summary_enabled: bool + :ivar procedural_memory_enabled: Whether to enable procedural memory extraction and storage. + Default is true. + :vartype procedural_memory_enabled: bool + :ivar default_ttl_seconds: The default time-to-live for memories in seconds. A value of 0 + indicates that memories do not expire. + :vartype default_ttl_seconds: int """ - type: Literal[DataGenerationJobOutputType.FILE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Azure OpenAI file output. Required. The generated data is an Azure OpenAI File.""" - id: str = rest_field(visibility=["read"]) - """The id of the output Azure OpenAI file. Required.""" - filename: str = rest_field(visibility=["read"]) - """The filename of the output Azure OpenAI file. Required.""" + user_profile_enabled: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Whether to enable user profile extraction and storage. Default is true. Required.""" + user_profile_details: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specific categories or types of user profile information to extract and store.""" + chat_summary_enabled: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Whether to enable chat summary extraction and storage. Default is true. Required.""" + procedural_memory_enabled: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Whether to enable procedural memory extraction and storage. Default is true.""" + default_ttl_seconds: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The default time-to-live for memories in seconds. A value of 0 indicates that memories do not + expire.""" @overload def __init__( self, + *, + user_profile_enabled: bool, + chat_summary_enabled: bool, + user_profile_details: Optional[str] = None, + procedural_memory_enabled: Optional[bool] = None, + default_ttl_seconds: Optional[int] = None, ) -> None: ... @overload @@ -6167,34 +12902,41 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = DataGenerationJobOutputType.FILE # type: ignore -class FileDataGenerationJobSource(DataGenerationJobSource, discriminator="file"): - """File source for data generation jobs — Azure OpenAI file input. +class MemoryStoreDeleteScopeResult(_Model): + """Response for deleting memories from a scope. - :ivar description: Optional description of what this source represents — helps the pipeline - interpret its content (e.g., 'Company refund policy document' or 'Describes the agent's core - capabilities'). - :vartype description: str - :ivar type: The source type for this job, which is File. Required. File source — Azure OpenAI - file. - :vartype type: str or ~azure.ai.projects.models.FILE - :ivar id: Input Azure Open AI file id used for data generation. Required. - :vartype id: str + :ivar object: The object type. Always 'memory_store.scope.deleted'. Required. + MEMORY_STORE_SCOPE_DELETED. + :vartype object: str or ~azure.ai.projects.models.MEMORY_STORE_SCOPE_DELETED + :ivar name: The name of the memory store. Required. + :vartype name: str + :ivar scope: The scope from which memories were deleted. Required. + :vartype scope: str + :ivar deleted: Whether the deletion operation was successful. Required. + :vartype deleted: bool """ - type: Literal[DataGenerationJobSourceType.FILE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The source type for this job, which is File. Required. File source — Azure OpenAI file.""" - id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Input Azure Open AI file id used for data generation. Required.""" + object: Literal[MemoryStoreObjectType.MEMORY_STORE_SCOPE_DELETED] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The object type. Always 'memory_store.scope.deleted'. Required. MEMORY_STORE_SCOPE_DELETED.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the memory store. Required.""" + scope: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The scope from which memories were deleted. Required.""" + deleted: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Whether the deletion operation was successful. Required.""" @overload def __init__( self, *, - id: str, # pylint: disable=redefined-builtin - description: Optional[str] = None, + object: Literal[MemoryStoreObjectType.MEMORY_STORE_SCOPE_DELETED], + name: str, + scope: str, + deleted: bool, ) -> None: ... @overload @@ -6206,47 +12948,65 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = DataGenerationJobSourceType.FILE # type: ignore -class FileDatasetVersion(DatasetVersion, discriminator="uri_file"): - """FileDatasetVersion Definition. +class MemoryStoreDetails(_Model): + """A memory store that can store and retrieve user memories. - :ivar data_uri: URI of the data (`example `_). - Required. - :vartype data_uri: str - :ivar is_reference: Indicates if the dataset holds a reference to the storage, or the dataset - manages storage itself. If true, the underlying data will not be deleted when the dataset - version is deleted. - :vartype is_reference: bool - :ivar connection_name: The Azure Storage Account connection name. Required if - startPendingUploadVersion was not called before creating the Dataset. - :vartype connection_name: str - :ivar id: Asset ID, a unique identifier for the asset. + :ivar object: The object type, which is always 'memory_store'. Required. MEMORY_STORE. + :vartype object: str or ~azure.ai.projects.models.MEMORY_STORE + :ivar id: The unique identifier of the memory store. Required. :vartype id: str - :ivar name: The name of the resource. Required. + :ivar created_at: The Unix timestamp (seconds) when the memory store was created. Required. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The Unix timestamp (seconds) when the memory store was last updated. + Required. + :vartype updated_at: ~datetime.datetime + :ivar name: The name of the memory store. Required. :vartype name: str - :ivar version: The version of the resource. Required. - :vartype version: str - :ivar description: The asset description text. + :ivar description: A human-readable description of the memory store. :vartype description: str - :ivar tags: Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar type: Dataset type. Required. URI file. - :vartype type: str or ~azure.ai.projects.models.URI_FILE + :ivar metadata: Arbitrary key-value metadata to associate with the memory store. + :vartype metadata: dict[str, str] + :ivar definition: The definition of the memory store. Required. + :vartype definition: ~azure.ai.projects.models.MemoryStoreDefinition """ - type: Literal[DatasetType.URI_FILE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Dataset type. Required. URI file.""" + object: Literal[MemoryStoreObjectType.MEMORY_STORE] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The object type, which is always 'memory_store'. Required. MEMORY_STORE.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique identifier of the memory store. Required.""" + created_at: datetime.datetime = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="unix-timestamp" + ) + """The Unix timestamp (seconds) when the memory store was created. Required.""" + updated_at: datetime.datetime = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="unix-timestamp" + ) + """The Unix timestamp (seconds) when the memory store was last updated. Required.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the memory store. Required.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A human-readable description of the memory store.""" + metadata: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Arbitrary key-value metadata to associate with the memory store.""" + definition: "_models.MemoryStoreDefinition" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The definition of the memory store. Required.""" @overload def __init__( self, *, - data_uri: str, - connection_name: Optional[str] = None, + object: Literal[MemoryStoreObjectType.MEMORY_STORE], + id: str, # pylint: disable=redefined-builtin + created_at: datetime.datetime, + updated_at: datetime.datetime, + name: str, + definition: "_models.MemoryStoreDefinition", description: Optional[str] = None, - tags: Optional[dict[str, str]] = None, + metadata: Optional[dict[str, str]] = None, ) -> None: ... @overload @@ -6258,57 +13018,52 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = DatasetType.URI_FILE # type: ignore -class FileSearchTool(Tool, discriminator="file_search"): - """File search. +class MemoryStoreOperationUsage(_Model): + """Usage statistics of a memory store operation. - :ivar type: The type of the file search tool. Always ``file_search``. Required. FILE_SEARCH. - :vartype type: str or ~azure.ai.projects.models.FILE_SEARCH - :ivar vector_store_ids: The IDs of the vector stores to search. Required. - :vartype vector_store_ids: list[str] - :ivar max_num_results: The maximum number of results to return. This number should be between 1 - and 50 inclusive. - :vartype max_num_results: int - :ivar ranking_options: Ranking options for search. - :vartype ranking_options: ~azure.ai.projects.models.RankingOptions - :ivar filters: Is either a ComparisonFilter type or a CompoundFilter type. - :vartype filters: ~azure.ai.projects.models.ComparisonFilter or - ~azure.ai.projects.models.CompoundFilter - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str + :ivar embedding_tokens: The number of embedding tokens. Required. + :vartype embedding_tokens: int + :ivar input_tokens: The number of input tokens. Required. + :vartype input_tokens: int + :ivar input_tokens_details: A detailed breakdown of the input tokens. Required. + :vartype input_tokens_details: ~azure.ai.projects.models.ResponseUsageInputTokensDetails + :ivar output_tokens: The number of output tokens. Required. + :vartype output_tokens: int + :ivar output_tokens_details: A detailed breakdown of the output tokens. Required. + :vartype output_tokens_details: ~azure.ai.projects.models.ResponseUsageOutputTokensDetails + :ivar total_tokens: The total number of tokens used. Required. + :vartype total_tokens: int """ - type: Literal[ToolType.FILE_SEARCH] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The type of the file search tool. Always ``file_search``. Required. FILE_SEARCH.""" - vector_store_ids: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The IDs of the vector stores to search. Required.""" - max_num_results: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The maximum number of results to return. This number should be between 1 and 50 inclusive.""" - ranking_options: Optional["_models.RankingOptions"] = rest_field( + embedding_tokens: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of embedding tokens. Required.""" + input_tokens: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of input tokens. Required.""" + input_tokens_details: "_models.ResponseUsageInputTokensDetails" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Ranking options for search.""" - filters: Optional["_types.Filters"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Is either a ComparisonFilter type or a CompoundFilter type.""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" + """A detailed breakdown of the input tokens. Required.""" + output_tokens: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of output tokens. Required.""" + output_tokens_details: "_models.ResponseUsageOutputTokensDetails" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """A detailed breakdown of the output tokens. Required.""" + total_tokens: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The total number of tokens used. Required.""" @overload def __init__( self, *, - vector_store_ids: list[str], - max_num_results: Optional[int] = None, - ranking_options: Optional["_models.RankingOptions"] = None, - filters: Optional["_types.Filters"] = None, - name: Optional[str] = None, - description: Optional[str] = None, + embedding_tokens: int, + input_tokens: int, + input_tokens_details: "_models.ResponseUsageInputTokensDetails", + output_tokens: int, + output_tokens_details: "_models.ResponseUsageOutputTokensDetails", + total_tokens: int, ) -> None: ... @overload @@ -6320,33 +13075,35 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.FILE_SEARCH # type: ignore -class VersionSelectionRule(_Model): - """VersionSelectionRule. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - FixedRatioVersionSelectionRule +class MemoryStoreSearchResult(_Model): + """Memory search response. - :ivar type: Required. "FixedRatio" - :vartype type: str or ~azure.ai.projects.models.VersionSelectorType - :ivar agent_version: The agent version to route traffic to. Required. - :vartype agent_version: str + :ivar search_id: The unique ID of this search request. Use this value as previous_search_id in + subsequent requests to perform incremental searches. Required. + :vartype search_id: str + :ivar memories: Related memory items found during the search operation. Required. + :vartype memories: list[~azure.ai.projects.models.MemorySearchItem] + :ivar usage: Usage statistics associated with the memory search operation. Required. + :vartype usage: ~azure.ai.projects.models.MemoryStoreOperationUsage """ - __mapping__: dict[str, _Model] = {} - type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) - """Required. \"FixedRatio\"""" - agent_version: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The agent version to route traffic to. Required.""" + search_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of this search request. Use this value as previous_search_id in subsequent + requests to perform incremental searches. Required.""" + memories: list["_models.MemorySearchItem"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Related memory items found during the search operation. Required.""" + usage: "_models.MemoryStoreOperationUsage" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Usage statistics associated with the memory search operation. Required.""" @overload def __init__( self, *, - type: str, - agent_version: str, + search_id: str, + memories: list["_models.MemorySearchItem"], + usage: "_models.MemoryStoreOperationUsage", ) -> None: ... @overload @@ -6360,29 +13117,29 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FixedRatioVersionSelectionRule(VersionSelectionRule, discriminator="FixedRatio"): - """FixedRatioVersionSelectionRule. +class MemoryStoreUpdateCompletedResult(_Model): + """Memory update result. - :ivar agent_version: The agent version to route traffic to. Required. - :vartype agent_version: str - :ivar type: Required. FIXED_RATIO. - :vartype type: str or ~azure.ai.projects.models.FIXED_RATIO - :ivar traffic_percentage: The percentage of traffic to route to the version. Must be between 0 - and 100. Required. - :vartype traffic_percentage: int + :ivar memory_operations: A list of individual memory operations that were performed during the + update. Required. + :vartype memory_operations: list[~azure.ai.projects.models.MemoryOperation] + :ivar usage: Usage statistics associated with the memory update operation. Required. + :vartype usage: ~azure.ai.projects.models.MemoryStoreOperationUsage """ - type: Literal[VersionSelectorType.FIXED_RATIO] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. FIXED_RATIO.""" - traffic_percentage: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The percentage of traffic to route to the version. Must be between 0 and 100. Required.""" + memory_operations: list["_models.MemoryOperation"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """A list of individual memory operations that were performed during the update. Required.""" + usage: "_models.MemoryStoreOperationUsage" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Usage statistics associated with the memory update operation. Required.""" @overload def __init__( self, *, - agent_version: str, - traffic_percentage: int, + memory_operations: list["_models.MemoryOperation"], + usage: "_models.MemoryStoreOperationUsage", ) -> None: ... @overload @@ -6394,47 +13151,53 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = VersionSelectorType.FIXED_RATIO # type: ignore -class FolderDatasetVersion(DatasetVersion, discriminator="uri_folder"): - """FileDatasetVersion Definition. +class MemoryStoreUpdateResult(_Model): + """Provides the status of a memory store update operation. - :ivar data_uri: URI of the data (`example `_). - Required. - :vartype data_uri: str - :ivar is_reference: Indicates if the dataset holds a reference to the storage, or the dataset - manages storage itself. If true, the underlying data will not be deleted when the dataset - version is deleted. - :vartype is_reference: bool - :ivar connection_name: The Azure Storage Account connection name. Required if - startPendingUploadVersion was not called before creating the Dataset. - :vartype connection_name: str - :ivar id: Asset ID, a unique identifier for the asset. - :vartype id: str - :ivar name: The name of the resource. Required. - :vartype name: str - :ivar version: The version of the resource. Required. - :vartype version: str - :ivar description: The asset description text. - :vartype description: str - :ivar tags: Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar type: Dataset type. Required. URI folder. - :vartype type: str or ~azure.ai.projects.models.URI_FOLDER + :ivar update_id: The unique ID of this update request. Use this value as previous_update_id in + subsequent requests to perform incremental updates. Required. + :vartype update_id: str + :ivar status: The status of the memory update operation. One of "queued", "in_progress", + "completed", "failed", or "superseded". Required. Known values are: "queued", "in_progress", + "completed", "failed", and "superseded". + :vartype status: str or ~azure.ai.projects.models.MemoryStoreUpdateStatus + :ivar superseded_by: The update_id the operation was superseded by when status is "superseded". + :vartype superseded_by: str + :ivar result: The result of memory store update operation when status is "completed". + :vartype result: ~azure.ai.projects.models.MemoryStoreUpdateCompletedResult + :ivar error: Error object that describes the error when status is "failed". + :vartype error: ~azure.ai.projects.models.ApiError """ - type: Literal[DatasetType.URI_FOLDER] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Dataset type. Required. URI folder.""" + update_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of this update request. Use this value as previous_update_id in subsequent + requests to perform incremental updates. Required.""" + status: Union[str, "_models.MemoryStoreUpdateStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the memory update operation. One of \"queued\", \"in_progress\", \"completed\", + \"failed\", or \"superseded\". Required. Known values are: \"queued\", \"in_progress\", + \"completed\", \"failed\", and \"superseded\".""" + superseded_by: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The update_id the operation was superseded by when status is \"superseded\".""" + result: Optional["_models.MemoryStoreUpdateCompletedResult"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The result of memory store update operation when status is \"completed\".""" + error: Optional["_models.ApiError"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error object that describes the error when status is \"failed\".""" @overload def __init__( self, *, - data_uri: str, - connection_name: Optional[str] = None, - description: Optional[str] = None, - tags: Optional[dict[str, str]] = None, + update_id: str, + status: Union[str, "_models.MemoryStoreUpdateStatus"], + superseded_by: Optional[str] = None, + result: Optional["_models.MemoryStoreUpdateCompletedResult"] = None, + error: Optional["_models.ApiError"] = None, ) -> None: ... @overload @@ -6446,39 +13209,29 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = DatasetType.URI_FOLDER # type: ignore -class FunctionShellToolParam(Tool, discriminator="shell"): - """Shell tool. +class MessageContent(_Model): + """A content part that makes up an input or output item. - :ivar type: The type of the shell tool. Always ``shell``. Required. SHELL. - :vartype type: str or ~azure.ai.projects.models.SHELL - :ivar environment: - :vartype environment: ~azure.ai.projects.models.FunctionShellToolParamEnvironment - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + SummaryTextContent + + :ivar type: Required. Known values are: "input_text", "output_text", "text", "summary_text", + "reasoning_text", "refusal", "input_image", "computer_screenshot", and "input_file". + :vartype type: str or ~azure.ai.projects.models.MessageContentType """ - type: Literal[ToolType.SHELL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The type of the shell tool. Always ``shell``. Required. SHELL.""" - environment: Optional["_models.FunctionShellToolParamEnvironment"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" + __mapping__: dict[str, _Model] = {} + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """Required. Known values are: \"input_text\", \"output_text\", \"text\", \"summary_text\", + \"reasoning_text\", \"refusal\", \"input_image\", \"computer_screenshot\", and \"input_file\".""" @overload def __init__( self, *, - environment: Optional["_models.FunctionShellToolParamEnvironment"] = None, - name: Optional[str] = None, - description: Optional[str] = None, + type: str, ) -> None: ... @overload @@ -6490,31 +13243,52 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.SHELL # type: ignore -class FunctionShellToolParamEnvironmentContainerReferenceParam( - FunctionShellToolParamEnvironment, discriminator="container_reference" -): # pylint: disable=name-too-long - """FunctionShellToolParamEnvironmentContainerReferenceParam. +class MicrosoftFabricPreviewTool(Tool, discriminator="fabric_dataagent_preview"): + """The input definition information for a Microsoft Fabric tool as used to configure an agent. - :ivar type: References a container created with the /v1/containers endpoint. Required. - CONTAINER_REFERENCE. - :vartype type: str or ~azure.ai.projects.models.CONTAINER_REFERENCE - :ivar container_id: The ID of the referenced container. Required. - :vartype container_id: str + :ivar type: The object type, which is always 'fabric_dataagent_preview'. Required. + FABRIC_DATAAGENT_PREVIEW. + :vartype type: str or ~azure.ai.projects.models.FABRIC_DATAAGENT_PREVIEW + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] + :ivar fabric_dataagent_preview: The fabric data agent tool parameters. Required. + :vartype fabric_dataagent_preview: ~azure.ai.projects.models.FabricDataAgentToolParameters """ - type: Literal[FunctionShellToolParamEnvironmentType.CONTAINER_REFERENCE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """References a container created with the /v1/containers endpoint. Required. CONTAINER_REFERENCE.""" - container_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The ID of the referenced container. Required.""" + type: Literal[ToolType.FABRIC_DATAAGENT_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The object type, which is always 'fabric_dataagent_preview'. Required. + FABRIC_DATAAGENT_PREVIEW.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional user-defined name for this tool or configuration.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional user-defined description for this tool or configuration.""" + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: + exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at + runtime.""" + fabric_dataagent_preview: "_models.FabricDataAgentToolParameters" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The fabric data agent tool parameters. Required.""" @overload def __init__( self, *, - container_id: str, + fabric_dataagent_preview: "_models.FabricDataAgentToolParameters", + name: Optional[str] = None, + description: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @overload @@ -6526,32 +13300,24 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = FunctionShellToolParamEnvironmentType.CONTAINER_REFERENCE # type: ignore + self.type = ToolType.FABRIC_DATAAGENT_PREVIEW # type: ignore -class FunctionShellToolParamEnvironmentLocalEnvironmentParam( - FunctionShellToolParamEnvironment, discriminator="local" -): # pylint: disable=name-too-long - """FunctionShellToolParamEnvironmentLocalEnvironmentParam. +class ModelCredentialRequest(_Model): + """Request to fetch credentials for a model asset. - :ivar type: Use a local computer environment. Required. LOCAL. - :vartype type: str or ~azure.ai.projects.models.LOCAL - :ivar skills: An optional list of skills. - :vartype skills: list[~azure.ai.projects.models.LocalSkillParam] + :ivar blob_uri: Blob URI of the model asset to fetch credentials for. Required. + :vartype blob_uri: str """ - type: Literal[FunctionShellToolParamEnvironmentType.LOCAL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Use a local computer environment. Required. LOCAL.""" - skills: Optional[list["_models.LocalSkillParam"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """An optional list of skills.""" + blob_uri: str = rest_field(name="blobUri", visibility=["read", "create", "update", "delete", "query"]) + """Blob URI of the model asset to fetch credentials for. Required.""" @overload def __init__( self, *, - skills: Optional[list["_models.LocalSkillParam"]] = None, + blob_uri: str, ) -> None: ... @overload @@ -6563,42 +13329,47 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = FunctionShellToolParamEnvironmentType.LOCAL # type: ignore -class FunctionTool(Tool, discriminator="function"): - """Function. +class ModelDeployment(Deployment, discriminator="ModelDeployment"): + """Model Deployment Definition. - :ivar type: The type of the function tool. Always ``function``. Required. FUNCTION. - :vartype type: str or ~azure.ai.projects.models.FUNCTION - :ivar name: The name of the function to call. Required. + :ivar name: Name of the deployment. Required. :vartype name: str - :ivar description: - :vartype description: str - :ivar parameters: Required. - :vartype parameters: dict[str, any] - :ivar strict: Required. - :vartype strict: bool + :ivar type: The type of the deployment. Required. Model deployment. + :vartype type: str or ~azure.ai.projects.models.MODEL_DEPLOYMENT + :ivar model_name: Publisher-specific name of the deployed model. Required. + :vartype model_name: str + :ivar model_version: Publisher-specific version of the deployed model. Required. + :vartype model_version: str + :ivar model_publisher: Name of the deployed model's publisher. Required. + :vartype model_publisher: str + :ivar capabilities: Capabilities of deployed model. Required. + :vartype capabilities: dict[str, str] + :ivar sku: Sku of the model deployment. Required. + :vartype sku: ~azure.ai.projects.models.ModelDeploymentSku + :ivar connection_name: Name of the connection the deployment comes from. + :vartype connection_name: str """ - type: Literal[ToolType.FUNCTION] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The type of the function tool. Always ``function``. Required. FUNCTION.""" - name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The name of the function to call. Required.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - parameters: dict[str, Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Required.""" - strict: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Required.""" + type: Literal[DeploymentType.MODEL_DEPLOYMENT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the deployment. Required. Model deployment.""" + model_name: str = rest_field(name="modelName", visibility=["read"]) + """Publisher-specific name of the deployed model. Required.""" + model_version: str = rest_field(name="modelVersion", visibility=["read"]) + """Publisher-specific version of the deployed model. Required.""" + model_publisher: str = rest_field(name="modelPublisher", visibility=["read"]) + """Name of the deployed model's publisher. Required.""" + capabilities: dict[str, str] = rest_field(visibility=["read"]) + """Capabilities of deployed model. Required.""" + sku: "_models.ModelDeploymentSku" = rest_field(visibility=["read"]) + """Sku of the model deployment. Required.""" + connection_name: Optional[str] = rest_field(name="connectionName", visibility=["read"]) + """Name of the connection the deployment comes from.""" @overload def __init__( self, - *, - name: str, - parameters: dict[str, Any], - strict: bool, - description: Optional[str] = None, ) -> None: ... @overload @@ -6610,28 +13381,44 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.FUNCTION # type: ignore - + self.type = DeploymentType.MODEL_DEPLOYMENT # type: ignore -class TelemetryEndpointAuth(_Model): - """Authentication configuration for a telemetry endpoint. - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - HeaderTelemetryEndpointAuth +class ModelDeploymentSku(_Model): + """Sku information. - :ivar type: The authentication type. Required. "header" - :vartype type: str or ~azure.ai.projects.models.TelemetryEndpointAuthType + :ivar capacity: Sku capacity. Required. + :vartype capacity: int + :ivar family: Sku family. Required. + :vartype family: str + :ivar name: Sku name. Required. + :vartype name: str + :ivar size: Sku size. Required. + :vartype size: str + :ivar tier: Sku tier. Required. + :vartype tier: str """ - __mapping__: dict[str, _Model] = {} - type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) - """The authentication type. Required. \"header\"""" + capacity: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Sku capacity. Required.""" + family: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Sku family. Required.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Sku name. Required.""" + size: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Sku size. Required.""" + tier: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Sku tier. Required.""" @overload def __init__( self, *, - type: str, + capacity: int, + family: str, + name: str, + size: str, + tier: str, ) -> None: ... @overload @@ -6645,38 +13432,40 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class HeaderTelemetryEndpointAuth(TelemetryEndpointAuth, discriminator="header"): - """Header-based secret authentication for a telemetry endpoint. The resolved secret value is - injected as an HTTP header. +class ModelPendingUploadRequest(_Model): + """Represents a request for a pending upload of a model version. - :ivar type: The authentication type, always 'header' for header-based secret authentication. - Required. Header-based secret authentication. - :vartype type: str or ~azure.ai.projects.models.HEADER - :ivar header_name: The name of the HTTP header to inject the secret value into. Required. - :vartype header_name: str - :ivar secret_id: The identifier of the secret store or connection. Required. - :vartype secret_id: str - :ivar secret_key: The key within the secret to retrieve the authentication value. Required. - :vartype secret_key: str + :ivar pending_upload_id: If PendingUploadId is not provided, a random GUID will be used. + :vartype pending_upload_id: str + :ivar connection_name: Azure Storage Account connection name to use for generating temporary + SAS token. + :vartype connection_name: str + :ivar pending_upload_type: The type of pending upload. Only TemporaryBlobReference is supported + for models. Required. Temporary blob reference. + :vartype pending_upload_type: str or ~azure.ai.projects.models.TEMPORARY_BLOB_REFERENCE """ - type: Literal[TelemetryEndpointAuthType.HEADER] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The authentication type, always 'header' for header-based secret authentication. Required. - Header-based secret authentication.""" - header_name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The name of the HTTP header to inject the secret value into. Required.""" - secret_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The identifier of the secret store or connection. Required.""" - secret_key: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The key within the secret to retrieve the authentication value. Required.""" + pending_upload_id: Optional[str] = rest_field( + name="pendingUploadId", visibility=["read", "create", "update", "delete", "query"] + ) + """If PendingUploadId is not provided, a random GUID will be used.""" + connection_name: Optional[str] = rest_field( + name="connectionName", visibility=["read", "create", "update", "delete", "query"] + ) + """Azure Storage Account connection name to use for generating temporary SAS token.""" + pending_upload_type: Literal[PendingUploadType.TEMPORARY_BLOB_REFERENCE] = rest_field( + name="pendingUploadType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of pending upload. Only TemporaryBlobReference is supported for models. Required. + Temporary blob reference.""" @overload def __init__( self, *, - header_name: str, - secret_id: str, - secret_key: str, + pending_upload_type: Literal[PendingUploadType.TEMPORARY_BLOB_REFERENCE], + pending_upload_id: Optional[str] = None, + connection_name: Optional[str] = None, ) -> None: ... @overload @@ -6688,99 +13477,47 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = TelemetryEndpointAuthType.HEADER # type: ignore -class HostedAgentDefinition(AgentDefinition, discriminator="hosted"): - """The hosted agent definition. +class ModelPendingUploadResponse(_Model): + """Represents the response for a model pending upload request. - :ivar rai_config: Configuration for Responsible AI (RAI) content filtering and safety features. - :vartype rai_config: ~azure.ai.projects.models.RaiConfig - :ivar kind: Required. HOSTED. - :vartype kind: str or ~azure.ai.projects.models.HOSTED - :ivar tools: An array of tools the hosted agent's model may call while generating a response. - You can specify which tool to use by setting the ``tool_choice`` parameter. - :vartype tools: list[~azure.ai.projects.models.Tool] - :ivar container_protocol_versions: The protocols that the agent supports for ingress - communication of the containers. - :vartype container_protocol_versions: list[~azure.ai.projects.models.ProtocolVersionRecord] - :ivar cpu: The CPU configuration for the hosted agent. Required. - :vartype cpu: str - :ivar memory: The memory configuration for the hosted agent. Required. - :vartype memory: str - :ivar environment_variables: Environment variables to set in the hosted agent container. - :vartype environment_variables: dict[str, str] - :ivar image: The image ID for the agent, applicable to image-based hosted agents. - :vartype image: str - :ivar container_configuration: Container-based deployment configuration. Provide this for - image-based deployments. Mutually exclusive with code_configuration — the service validates - that exactly one is set. - :vartype container_configuration: ~azure.ai.projects.models.ContainerConfiguration - :ivar protocol_versions: The protocols that the agent supports for ingress communication. - :vartype protocol_versions: list[~azure.ai.projects.models.ProtocolVersionRecord] - :ivar code_configuration: Code-based deployment configuration. Provide this for code-based - deployments. Mutually exclusive with container_configuration — the service validates that - exactly one is set. - :vartype code_configuration: ~azure.ai.projects.models.CodeConfiguration - :ivar telemetry_config: Optional customer-supplied telemetry configuration for exporting - container logs, traces, and metrics. - :vartype telemetry_config: ~azure.ai.projects.models.TelemetryConfig + :ivar blob_reference: Container-level read, write, list SAS. Required. + :vartype blob_reference: ~azure.ai.projects.models.BlobReference + :ivar pending_upload_id: ID for this upload request. Required. + :vartype pending_upload_id: str + :ivar version: Version of asset to be created if user did not specify version when initially + creating upload. + :vartype version: str + :ivar pending_upload_type: The type of pending upload. Only TemporaryBlobReference is supported + for models. Required. Temporary blob reference. + :vartype pending_upload_type: str or ~azure.ai.projects.models.TEMPORARY_BLOB_REFERENCE """ - kind: Literal[AgentKind.HOSTED] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. HOSTED.""" - tools: Optional[list["_models.Tool"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """An array of tools the hosted agent's model may call while generating a response. You can - specify which tool to use by setting the ``tool_choice`` parameter.""" - container_protocol_versions: Optional[list["_models.ProtocolVersionRecord"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The protocols that the agent supports for ingress communication of the containers.""" - cpu: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The CPU configuration for the hosted agent. Required.""" - memory: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The memory configuration for the hosted agent. Required.""" - environment_variables: Optional[dict[str, str]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Environment variables to set in the hosted agent container.""" - image: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The image ID for the agent, applicable to image-based hosted agents.""" - container_configuration: Optional["_models.ContainerConfiguration"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Container-based deployment configuration. Provide this for image-based deployments. Mutually - exclusive with code_configuration — the service validates that exactly one is set.""" - protocol_versions: Optional[list["_models.ProtocolVersionRecord"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + blob_reference: "_models.BlobReference" = rest_field( + name="blobReference", visibility=["read", "create", "update", "delete", "query"] ) - """The protocols that the agent supports for ingress communication.""" - code_configuration: Optional["_models.CodeConfiguration"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + """Container-level read, write, list SAS. Required.""" + pending_upload_id: str = rest_field( + name="pendingUploadId", visibility=["read", "create", "update", "delete", "query"] ) - """Code-based deployment configuration. Provide this for code-based deployments. Mutually - exclusive with container_configuration — the service validates that exactly one is set.""" - telemetry_config: Optional["_models.TelemetryConfig"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + """ID for this upload request. Required.""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Version of asset to be created if user did not specify version when initially creating upload.""" + pending_upload_type: Literal[PendingUploadType.TEMPORARY_BLOB_REFERENCE] = rest_field( + name="pendingUploadType", visibility=["read", "create", "update", "delete", "query"] ) - """Optional customer-supplied telemetry configuration for exporting container logs, traces, and - metrics.""" + """The type of pending upload. Only TemporaryBlobReference is supported for models. Required. + Temporary blob reference.""" @overload def __init__( self, *, - cpu: str, - memory: str, - rai_config: Optional["_models.RaiConfig"] = None, - tools: Optional[list["_models.Tool"]] = None, - container_protocol_versions: Optional[list["_models.ProtocolVersionRecord"]] = None, - environment_variables: Optional[dict[str, str]] = None, - image: Optional[str] = None, - container_configuration: Optional["_models.ContainerConfiguration"] = None, - protocol_versions: Optional[list["_models.ProtocolVersionRecord"]] = None, - code_configuration: Optional["_models.CodeConfiguration"] = None, - telemetry_config: Optional["_models.TelemetryConfig"] = None, + blob_reference: "_models.BlobReference", + pending_upload_id: str, + pending_upload_type: Literal[PendingUploadType.TEMPORARY_BLOB_REFERENCE], + version: Optional[str] = None, ) -> None: ... @overload @@ -6792,22 +13529,39 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.kind = AgentKind.HOSTED # type: ignore -class HourlyRecurrenceSchedule(RecurrenceSchedule, discriminator="Hourly"): - """Hourly recurrence schedule. +class ModelSamplingParams(_Model): + """Represents a set of parameters used to control the sampling behavior of a language model during + text generation. - :ivar type: Required. Hourly recurrence pattern. - :vartype type: str or ~azure.ai.projects.models.HOURLY + :ivar temperature: The temperature parameter for sampling. Defaults to 1.0. + :vartype temperature: float + :ivar top_p: The top-p parameter for nucleus sampling. Defaults to 1.0. + :vartype top_p: float + :ivar seed: The random seed for reproducibility. Defaults to 42. + :vartype seed: int + :ivar max_completion_tokens: The maximum number of tokens allowed in the completion. + :vartype max_completion_tokens: int """ - type: Literal[RecurrenceType.HOURLY] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. Hourly recurrence pattern.""" + temperature: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The temperature parameter for sampling. Defaults to 1.0.""" + top_p: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The top-p parameter for nucleus sampling. Defaults to 1.0.""" + seed: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The random seed for reproducibility. Defaults to 42.""" + max_completion_tokens: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The maximum number of tokens allowed in the completion.""" @overload def __init__( self, + *, + temperature: Optional[float] = None, + top_p: Optional[float] = None, + seed: Optional[int] = None, + max_completion_tokens: Optional[int] = None, ) -> None: ... @overload @@ -6819,28 +13573,31 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = RecurrenceType.HOURLY # type: ignore -class HumanEvaluationPreviewRuleAction(EvaluationRuleAction, discriminator="humanEvaluationPreview"): - """Evaluation rule action for human evaluation. +class ModelSourceData(_Model): + """Source information for the model. - :ivar type: Required. Human evaluation preview. - :vartype type: str or ~azure.ai.projects.models.HUMAN_EVALUATION_PREVIEW - :ivar template_id: Human evaluation template Id. Required. - :vartype template_id: str + :ivar source_type: The source type of the model. Known values are: "LocalUpload" and + "TrainingJob". + :vartype source_type: str or ~azure.ai.projects.models.FoundryModelSourceType + :ivar job_id: The job ID that produced this model. + :vartype job_id: str """ - type: Literal[EvaluationRuleActionType.HUMAN_EVALUATION_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. Human evaluation preview.""" - template_id: str = rest_field(name="templateId", visibility=["read", "create", "update", "delete", "query"]) - """Human evaluation template Id. Required.""" + source_type: Optional[Union[str, "_models.FoundryModelSourceType"]] = rest_field( + name="sourceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The source type of the model. Known values are: \"LocalUpload\" and \"TrainingJob\".""" + job_id: Optional[str] = rest_field(name="jobId", visibility=["read", "create", "update", "delete", "query"]) + """The job ID that produced this model.""" @overload def __init__( self, *, - template_id: str, + source_type: Optional[Union[str, "_models.FoundryModelSourceType"]] = None, + job_id: Optional[str] = None, ) -> None: ... @overload @@ -6852,29 +13609,84 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = EvaluationRuleActionType.HUMAN_EVALUATION_PREVIEW # type: ignore -class HybridSearchOptions(_Model): - """HybridSearchOptions. +class ModelVersion(_Model): + """Model Version Definition. - :ivar embedding_weight: The weight of the embedding in the reciprocal ranking fusion. Required. - :vartype embedding_weight: int - :ivar text_weight: The weight of the text in the reciprocal ranking fusion. Required. - :vartype text_weight: int + :ivar system_data: System related metadata. + :vartype system_data: ~azure.ai.projects.models.SystemDataV3 + :ivar blob_uri: URI of the model artifact in blob storage. Required. + :vartype blob_uri: str + :ivar weight_type: The weight type of the model. Known values are: "FullWeight", "LoRA", and + "DraftModel". + :vartype weight_type: str or ~azure.ai.projects.models.FoundryModelWeightType + :ivar base_model: Base model asset ID. + :vartype base_model: str + :ivar source: The source of the model. + :vartype source: ~azure.ai.projects.models.ModelSourceData + :ivar lora_config: Adapter-specific configuration. Required when weight_type is lora; ignored + otherwise. May be auto-populated from adapter_config.json when present in the uploaded files — + user-provided values take precedence over auto-detected values. + :vartype lora_config: ~azure.ai.projects.models.LoraConfig + :ivar artifact_profile: The artifact profile of the model. + :vartype artifact_profile: ~azure.ai.projects.models.ArtifactProfile + :ivar warnings: Service-computed advisory warnings derived from the artifact profile. + :vartype warnings: list[~azure.ai.projects.models.FoundryModelWarning] + :ivar id: Asset ID, a unique identifier for the asset. + :vartype id: str + :ivar name: The name of the resource. Required. + :vartype name: str + :ivar version: The version of the resource. Required. + :vartype version: str + :ivar description: The asset description text. + :vartype description: str + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] """ - embedding_weight: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The weight of the embedding in the reciprocal ranking fusion. Required.""" - text_weight: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The weight of the text in the reciprocal ranking fusion. Required.""" + system_data: Optional["_models.SystemDataV3"] = rest_field(name="systemData", visibility=["read"]) + """System related metadata.""" + blob_uri: str = rest_field(name="blobUri", visibility=["read", "create", "update", "delete", "query"]) + """URI of the model artifact in blob storage. Required.""" + weight_type: Optional[Union[str, "_models.FoundryModelWeightType"]] = rest_field( + name="weightType", visibility=["read", "create", "update", "delete", "query"] + ) + """The weight type of the model. Known values are: \"FullWeight\", \"LoRA\", and \"DraftModel\".""" + base_model: Optional[str] = rest_field(name="baseModel", visibility=["read", "create"]) + """Base model asset ID.""" + source: Optional["_models.ModelSourceData"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The source of the model.""" + lora_config: Optional["_models.LoraConfig"] = rest_field(name="loraConfig", visibility=["read", "create"]) + """Adapter-specific configuration. Required when weight_type is lora; ignored otherwise. May be + auto-populated from adapter_config.json when present in the uploaded files — user-provided + values take precedence over auto-detected values.""" + artifact_profile: Optional["_models.ArtifactProfile"] = rest_field(name="artifactProfile", visibility=["read"]) + """The artifact profile of the model.""" + warnings: Optional[list["_models.FoundryModelWarning"]] = rest_field(visibility=["read"]) + """Service-computed advisory warnings derived from the artifact profile.""" + id: Optional[str] = rest_field(visibility=["read"]) + """Asset ID, a unique identifier for the asset.""" + name: str = rest_field(visibility=["read"]) + """The name of the resource. Required.""" + version: str = rest_field(visibility=["read"]) + """The version of the resource. Required.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update"]) + """The asset description text.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update"]) + """Tag dictionary. Tags can be added, removed, and updated.""" @overload def __init__( self, *, - embedding_weight: int, - text_weight: int, + blob_uri: str, + weight_type: Optional[Union[str, "_models.FoundryModelWeightType"]] = None, + base_model: Optional[str] = None, + source: Optional["_models.ModelSourceData"] = None, + lora_config: Optional["_models.LoraConfig"] = None, + description: Optional[str] = None, + tags: Optional[dict[str, str]] = None, ) -> None: ... @overload @@ -6888,130 +13700,27 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ImageGenTool(Tool, discriminator="image_generation"): - """Image generation tool. +class MonthlyRecurrenceSchedule(RecurrenceSchedule, discriminator="Monthly"): + """Monthly recurrence schedule. - :ivar type: The type of the image generation tool. Always ``image_generation``. Required. - IMAGE_GENERATION. - :vartype type: str or ~azure.ai.projects.models.IMAGE_GENERATION - :ivar model: Is one of the following types: Literal["gpt-image-1"], - Literal["gpt-image-1-mini"], Literal["gpt-image-1.5"], str - :vartype model: str or str or str or str - :ivar quality: The quality of the generated image. One of ``low``, ``medium``, ``high``, or - ``auto``. Default: ``auto``. Is one of the following types: Literal["low"], Literal["medium"], - Literal["high"], Literal["auto"] - :vartype quality: str or str or str or str - :ivar size: The size of the generated image. One of ``1024x1024``, ``1024x1536``, - ``1536x1024``, or ``auto``. Default: ``auto``. Is one of the following types: - Literal["1024x1024"], Literal["1024x1536"], Literal["1536x1024"], Literal["auto"] - :vartype size: str or str or str or str - :ivar output_format: The output format of the generated image. One of ``png``, ``webp``, or - ``jpeg``. Default: ``png``. Is one of the following types: Literal["png"], Literal["webp"], - Literal["jpeg"] - :vartype output_format: str or str or str - :ivar output_compression: Compression level for the output image. Default: 100. - :vartype output_compression: int - :ivar moderation: Moderation level for the generated image. Default: ``auto``. Is either a - Literal["auto"] type or a Literal["low"] type. - :vartype moderation: str or str - :ivar background: Background type for the generated image. One of ``transparent``, ``opaque``, - or ``auto``. Default: ``auto``. Is one of the following types: Literal["transparent"], - Literal["opaque"], Literal["auto"] - :vartype background: str or str or str - :ivar input_fidelity: Known values are: "high" and "low". - :vartype input_fidelity: str or ~azure.ai.projects.models.InputFidelity - :ivar input_image_mask: Optional mask for inpainting. Contains ``image_url`` (string, optional) - and ``file_id`` (string, optional). - :vartype input_image_mask: ~azure.ai.projects.models.ImageGenToolInputImageMask - :ivar partial_images: Number of partial images to generate in streaming mode, from 0 (default - value) to 3. - :vartype partial_images: int - :ivar action: Whether to generate a new image or edit an existing image. Default: ``auto``. - Known values are: "generate", "edit", and "auto". - :vartype action: str or ~azure.ai.projects.models.ImageGenAction - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str + :ivar type: Monthly recurrence type. Required. Monthly recurrence pattern. + :vartype type: str or ~azure.ai.projects.models.MONTHLY + :ivar days_of_month: Days of the month for the recurrence schedule. Required. + :vartype days_of_month: list[int] """ - type: Literal[ToolType.IMAGE_GENERATION] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The type of the image generation tool. Always ``image_generation``. Required. IMAGE_GENERATION.""" - model: Optional[Union[Literal["gpt-image-1"], Literal["gpt-image-1-mini"], Literal["gpt-image-1.5"], str]] = ( - rest_field(visibility=["read", "create", "update", "delete", "query"]) - ) - """Is one of the following types: Literal[\"gpt-image-1\"], Literal[\"gpt-image-1-mini\"], - Literal[\"gpt-image-1.5\"], str""" - quality: Optional[Literal["low", "medium", "high", "auto"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The quality of the generated image. One of ``low``, ``medium``, ``high``, or ``auto``. Default: - ``auto``. Is one of the following types: Literal[\"low\"], Literal[\"medium\"], - Literal[\"high\"], Literal[\"auto\"]""" - size: Optional[Literal["1024x1024", "1024x1536", "1536x1024", "auto"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The size of the generated image. One of ``1024x1024``, ``1024x1536``, ``1536x1024``, or - ``auto``. Default: ``auto``. Is one of the following types: Literal[\"1024x1024\"], - Literal[\"1024x1536\"], Literal[\"1536x1024\"], Literal[\"auto\"]""" - output_format: Optional[Literal["png", "webp", "jpeg"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The output format of the generated image. One of ``png``, ``webp``, or ``jpeg``. Default: - ``png``. Is one of the following types: Literal[\"png\"], Literal[\"webp\"], Literal[\"jpeg\"]""" - output_compression: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Compression level for the output image. Default: 100.""" - moderation: Optional[Literal["auto", "low"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Moderation level for the generated image. Default: ``auto``. Is either a Literal[\"auto\"] type - or a Literal[\"low\"] type.""" - background: Optional[Literal["transparent", "opaque", "auto"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Background type for the generated image. One of ``transparent``, ``opaque``, or ``auto``. - Default: ``auto``. Is one of the following types: Literal[\"transparent\"], - Literal[\"opaque\"], Literal[\"auto\"]""" - input_fidelity: Optional[Union[str, "_models.InputFidelity"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Known values are: \"high\" and \"low\".""" - input_image_mask: Optional["_models.ImageGenToolInputImageMask"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Optional mask for inpainting. Contains ``image_url`` (string, optional) and ``file_id`` - (string, optional).""" - partial_images: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Number of partial images to generate in streaming mode, from 0 (default value) to 3.""" - action: Optional[Union[str, "_models.ImageGenAction"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + type: Literal[RecurrenceType.MONTHLY] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Monthly recurrence type. Required. Monthly recurrence pattern.""" + days_of_month: list[int] = rest_field( + name="daysOfMonth", visibility=["read", "create", "update", "delete", "query"] ) - """Whether to generate a new image or edit an existing image. Default: ``auto``. Known values are: - \"generate\", \"edit\", and \"auto\".""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" + """Days of the month for the recurrence schedule. Required.""" @overload def __init__( self, *, - model: Optional[ - Union[Literal["gpt-image-1"], Literal["gpt-image-1-mini"], Literal["gpt-image-1.5"], str] - ] = None, - quality: Optional[Literal["low", "medium", "high", "auto"]] = None, - size: Optional[Literal["1024x1024", "1024x1536", "1536x1024", "auto"]] = None, - output_format: Optional[Literal["png", "webp", "jpeg"]] = None, - output_compression: Optional[int] = None, - moderation: Optional[Literal["auto", "low"]] = None, - background: Optional[Literal["transparent", "opaque", "auto"]] = None, - input_fidelity: Optional[Union[str, "_models.InputFidelity"]] = None, - input_image_mask: Optional["_models.ImageGenToolInputImageMask"] = None, - partial_images: Optional[int] = None, - action: Optional[Union[str, "_models.ImageGenAction"]] = None, - name: Optional[str] = None, - description: Optional[str] = None, + days_of_month: list[int], ) -> None: ... @overload @@ -7023,27 +13732,35 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.IMAGE_GENERATION # type: ignore + self.type = RecurrenceType.MONTHLY # type: ignore -class ImageGenToolInputImageMask(_Model): - """ImageGenToolInputImageMask. +class MoveParam(ComputerAction, discriminator="move"): + """Move. - :ivar image_url: - :vartype image_url: str - :ivar file_id: - :vartype file_id: str + :ivar type: Specifies the event type. For a move action, this property is always set to + ``move``. Required. MOVE. + :vartype type: str or ~azure.ai.projects.models.MOVE + :ivar x: The x-coordinate to move to. Required. + :vartype x: int + :ivar y: The y-coordinate to move to. Required. + :vartype y: int """ - image_url: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - file_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + type: Literal[ComputerActionType.MOVE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Specifies the event type. For a move action, this property is always set to ``move``. Required. + MOVE.""" + x: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The x-coordinate to move to. Required.""" + y: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The y-coordinate to move to. Required.""" @overload def __init__( self, *, - image_url: Optional[str] = None, - file_id: Optional[str] = None, + x: int, + y: int, ) -> None: ... @overload @@ -7055,37 +13772,22 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = ComputerActionType.MOVE # type: ignore -class InlineSkillParam(ContainerSkill, discriminator="inline"): - """InlineSkillParam. +class NoAuthenticationCredentials(BaseCredentials, discriminator="None"): + """Credentials that do not require authentication. - :ivar type: Defines an inline skill for this request. Required. INLINE. - :vartype type: str or ~azure.ai.projects.models.INLINE - :ivar name: The name of the skill. Required. - :vartype name: str - :ivar description: The description of the skill. Required. - :vartype description: str - :ivar source: Inline skill payload. Required. - :vartype source: ~azure.ai.projects.models.InlineSkillSourceParam + :ivar type: The credential type. Required. No credential. + :vartype type: str or ~azure.ai.projects.models.NONE """ - type: Literal[ContainerSkillType.INLINE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Defines an inline skill for this request. Required. INLINE.""" - name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The name of the skill. Required.""" - description: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The description of the skill. Required.""" - source: "_models.InlineSkillSourceParam" = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Inline skill payload. Required.""" + type: Literal[CredentialType.NONE] = rest_discriminator(name="type", visibility=["read"]) # type: ignore + """The credential type. Required. No credential.""" @overload def __init__( self, - *, - name: str, - description: str, - source: "_models.InlineSkillSourceParam", ) -> None: ... @overload @@ -7097,35 +13799,44 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ContainerSkillType.INLINE # type: ignore + self.type = CredentialType.NONE # type: ignore -class InlineSkillSourceParam(_Model): - """Inline skill payload. +class OAuthConsentRequestOutputItem(OutputItem, discriminator="oauth_consent_request"): + """Request from the service for the user to perform OAuth consent. - :ivar type: The type of the inline skill source. Must be ``base64``. Required. Default value is - "base64". - :vartype type: str - :ivar media_type: The media type of the inline skill payload. Must be ``application/zip``. - Required. Default value is "application/zip". - :vartype media_type: str - :ivar data: Base64-encoded skill zip bundle. Required. - :vartype data: str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: Required. + :vartype id: str + :ivar type: Required. OAUTH_CONSENT_REQUEST. + :vartype type: str or ~azure.ai.projects.models.OAUTH_CONSENT_REQUEST + :ivar consent_link: The link the user can use to perform OAuth consent. Required. + :vartype consent_link: str + :ivar server_label: The server label for the OAuth consent request. Required. + :vartype server_label: str """ - type: Literal["base64"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The type of the inline skill source. Must be ``base64``. Required. Default value is \"base64\".""" - media_type: Literal["application/zip"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The media type of the inline skill payload. Must be ``application/zip``. Required. Default - value is \"application/zip\".""" - data: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Base64-encoded skill zip bundle. Required.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + type: Literal[OutputItemType.OAUTH_CONSENT_REQUEST] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. OAUTH_CONSENT_REQUEST.""" + consent_link: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The link the user can use to perform OAuth consent. Required.""" + server_label: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The server label for the OAuth consent request. Required.""" @overload def __init__( self, *, - data: str, + id: str, # pylint: disable=redefined-builtin + consent_link: str, + server_label: str, + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, ) -> None: ... @overload @@ -7137,48 +13848,35 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type: Literal["base64"] = "base64" - self.media_type: Literal["application/zip"] = "application/zip" + self.type = OutputItemType.OAUTH_CONSENT_REQUEST # type: ignore -class Insight(_Model): - """The response body for cluster insights. +class OneTimeTrigger(Trigger, discriminator="OneTime"): + """One-time trigger. - :ivar insight_id: The unique identifier for the insights report. Required. - :vartype insight_id: str - :ivar metadata: Metadata about the insights report. Required. - :vartype metadata: ~azure.ai.projects.models.InsightsMetadata - :ivar state: The current state of the insights. Required. Known values are: "NotStarted", - "Running", "Succeeded", "Failed", and "Canceled". - :vartype state: str or ~azure.ai.projects.models.OperationState - :ivar display_name: User friendly display name for the insight. Required. - :vartype display_name: str - :ivar request: Request for the insights analysis. Required. - :vartype request: ~azure.ai.projects.models.InsightRequest - :ivar result: The result of the insights report. - :vartype result: ~azure.ai.projects.models.InsightResult + :ivar type: Required. One-time trigger. + :vartype type: str or ~azure.ai.projects.models.ONE_TIME + :ivar trigger_at: Date and time for the one-time trigger in ISO 8601 format. Required. + :vartype trigger_at: ~datetime.datetime + :ivar time_zone: Time zone for the one-time trigger. + :vartype time_zone: str """ - insight_id: str = rest_field(name="id", visibility=["read"]) - """The unique identifier for the insights report. Required.""" - metadata: "_models.InsightsMetadata" = rest_field(visibility=["read"]) - """Metadata about the insights report. Required.""" - state: Union[str, "_models.OperationState"] = rest_field(visibility=["read"]) - """The current state of the insights. Required. Known values are: \"NotStarted\", \"Running\", - \"Succeeded\", \"Failed\", and \"Canceled\".""" - display_name: str = rest_field(name="displayName", visibility=["read", "create", "update", "delete", "query"]) - """User friendly display name for the insight. Required.""" - request: "_models.InsightRequest" = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Request for the insights analysis. Required.""" - result: Optional["_models.InsightResult"] = rest_field(visibility=["read"]) - """The result of the insights report.""" + type: Literal[TriggerType.ONE_TIME] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. One-time trigger.""" + trigger_at: datetime.datetime = rest_field( + name="triggerAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Date and time for the one-time trigger in ISO 8601 format. Required.""" + time_zone: Optional[str] = rest_field(name="timeZone", visibility=["read", "create", "update", "delete", "query"]) + """Time zone for the one-time trigger.""" @overload def __init__( self, *, - display_name: str, - request: "_models.InsightRequest", + trigger_at: datetime.datetime, + time_zone: Optional[str] = None, ) -> None: ... @overload @@ -7190,66 +13888,30 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = TriggerType.ONE_TIME # type: ignore -class InsightCluster(_Model): - """A cluster of analysis samples. +class OpenApiAuthDetails(_Model): + """authentication details for OpenApiFunctionDefinition. - :ivar id: The id of the analysis cluster. Required. - :vartype id: str - :ivar label: Label for the cluster. Required. - :vartype label: str - :ivar suggestion: Suggestion for the cluster. Required. - :vartype suggestion: str - :ivar suggestion_title: The title of the suggestion for the cluster. Required. - :vartype suggestion_title: str - :ivar description: Description of the analysis cluster. Required. - :vartype description: str - :ivar weight: The weight of the analysis cluster. This indicate number of samples in the - cluster. Required. - :vartype weight: int - :ivar sub_clusters: List of subclusters within this cluster. Empty if no subclusters exist. - :vartype sub_clusters: list[~azure.ai.projects.models.InsightCluster] - :ivar samples: List of samples that belong to this cluster. Empty if samples are part of - subclusters. - :vartype samples: list[~azure.ai.projects.models.InsightSample] + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + OpenApiAnonymousAuthDetails, OpenApiManagedAuthDetails, OpenApiProjectConnectionAuthDetails + + :ivar type: The type of authentication, must be anonymous/project_connection/managed_identity. + Required. Known values are: "anonymous", "project_connection", and "managed_identity". + :vartype type: str or ~azure.ai.projects.models.OpenApiAuthType """ - id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The id of the analysis cluster. Required.""" - label: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Label for the cluster. Required.""" - suggestion: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Suggestion for the cluster. Required.""" - suggestion_title: str = rest_field( - name="suggestionTitle", visibility=["read", "create", "update", "delete", "query"] - ) - """The title of the suggestion for the cluster. Required.""" - description: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Description of the analysis cluster. Required.""" - weight: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The weight of the analysis cluster. This indicate number of samples in the cluster. Required.""" - sub_clusters: Optional[list["_models.InsightCluster"]] = rest_field( - name="subClusters", visibility=["read", "create", "update", "delete", "query"] - ) - """List of subclusters within this cluster. Empty if no subclusters exist.""" - samples: Optional[list["_models.InsightSample"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """List of samples that belong to this cluster. Empty if samples are part of subclusters.""" + __mapping__: dict[str, _Model] = {} + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """The type of authentication, must be anonymous/project_connection/managed_identity. Required. + Known values are: \"anonymous\", \"project_connection\", and \"managed_identity\".""" @overload def __init__( self, *, - id: str, # pylint: disable=redefined-builtin - label: str, - suggestion: str, - suggestion_title: str, - description: str, - weight: int, - sub_clusters: Optional[list["_models.InsightCluster"]] = None, - samples: Optional[list["_models.InsightSample"]] = None, + type: str, ) -> None: ... @overload @@ -7263,26 +13925,19 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class InsightModelConfiguration(_Model): - """Configuration of the model used in the insight generation. +class OpenApiAnonymousAuthDetails(OpenApiAuthDetails, discriminator="anonymous"): + """Security details for OpenApi anonymous authentication. - :ivar model_deployment_name: The model deployment to be evaluated. Accepts either the - deployment name alone or with the connection name as '{connectionName}/'. - Required. - :vartype model_deployment_name: str + :ivar type: The object type, which is always 'anonymous'. Required. ANONYMOUS. + :vartype type: str or ~azure.ai.projects.models.ANONYMOUS """ - model_deployment_name: str = rest_field( - name="modelDeploymentName", visibility=["read", "create", "update", "delete", "query"] - ) - """The model deployment to be evaluated. Accepts either the deployment name alone or with the - connection name as '{connectionName}/'. Required.""" + type: Literal[OpenApiAuthType.ANONYMOUS] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The object type, which is always 'anonymous'. Required. ANONYMOUS.""" @overload def __init__( self, - *, - model_deployment_name: str, ) -> None: ... @overload @@ -7294,30 +13949,50 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = OpenApiAuthType.ANONYMOUS # type: ignore -class InsightScheduleTask(ScheduleTask, discriminator="Insight"): - """Insight task for the schedule. +class OpenApiFunctionDefinition(_Model): + """The input definition information for an openapi function. - :ivar configuration: Configuration for the task. - :vartype configuration: dict[str, str] - :ivar type: Required. Insight task. - :vartype type: str or ~azure.ai.projects.models.INSIGHT - :ivar insight: The insight payload. Required. - :vartype insight: ~azure.ai.projects.models.Insight + :ivar name: The name of the function to be called. Required. + :vartype name: str + :ivar description: A description of what the function does, used by the model to choose when + and how to call the function. + :vartype description: str + :ivar spec: The openapi function shape, described as a JSON Schema object. Required. + :vartype spec: dict[str, any] + :ivar auth: Open API authentication details. Required. + :vartype auth: ~azure.ai.projects.models.OpenApiAuthDetails + :ivar default_params: List of OpenAPI spec parameters that will use user-provided defaults. + :vartype default_params: list[str] + :ivar functions: List of function definitions used by OpenApi tool. + :vartype functions: list[~azure.ai.projects.models.OpenApiFunctionDefinitionFunction] """ - type: Literal[ScheduleTaskType.INSIGHT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. Insight task.""" - insight: "_models.Insight" = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The insight payload. Required.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the function to be called. Required.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A description of what the function does, used by the model to choose when and how to call the + function.""" + spec: dict[str, Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The openapi function shape, described as a JSON Schema object. Required.""" + auth: "_models.OpenApiAuthDetails" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Open API authentication details. Required.""" + default_params: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """List of OpenAPI spec parameters that will use user-provided defaults.""" + functions: Optional[list["_models.OpenApiFunctionDefinitionFunction"]] = rest_field(visibility=["read"]) + """List of function definitions used by OpenApi tool.""" @overload def __init__( self, *, - insight: "_models.Insight", - configuration: Optional[dict[str, str]] = None, + name: str, + spec: dict[str, Any], + auth: "_models.OpenApiAuthDetails", + description: Optional[str] = None, + default_params: Optional[list[str]] = None, ) -> None: ... @overload @@ -7329,33 +14004,36 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ScheduleTaskType.INSIGHT # type: ignore -class InsightsMetadata(_Model): - """Metadata about the insights. +class OpenApiFunctionDefinitionFunction(_Model): + """OpenApiFunctionDefinitionFunction. - :ivar created_at: The timestamp when the insights were created. Required. - :vartype created_at: ~datetime.datetime - :ivar completed_at: The timestamp when the insights were completed. - :vartype completed_at: ~datetime.datetime + :ivar name: The name of the function to be called. Required. + :vartype name: str + :ivar description: A description of what the function does, used by the model to choose when + and how to call the function. + :vartype description: str + :ivar parameters: The parameters the functions accepts, described as a JSON Schema object. + Required. + :vartype parameters: dict[str, any] """ - created_at: datetime.datetime = rest_field( - name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" - ) - """The timestamp when the insights were created. Required.""" - completed_at: Optional[datetime.datetime] = rest_field( - name="completedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" - ) - """The timestamp when the insights were completed.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the function to be called. Required.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A description of what the function does, used by the model to choose when and how to call the + function.""" + parameters: dict[str, Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The parameters the functions accepts, described as a JSON Schema object. Required.""" @overload def __init__( self, *, - created_at: datetime.datetime, - completed_at: Optional[datetime.datetime] = None, + name: str, + parameters: dict[str, Any], + description: Optional[str] = None, ) -> None: ... @overload @@ -7369,45 +14047,27 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class InsightSummary(_Model): - """Summary of the error cluster analysis. +class OpenApiManagedAuthDetails(OpenApiAuthDetails, discriminator="managed_identity"): + """Security details for OpenApi managed_identity authentication. - :ivar sample_count: Total number of samples analyzed. Required. - :vartype sample_count: int - :ivar unique_subcluster_count: Total number of unique subcluster labels. Required. - :vartype unique_subcluster_count: int - :ivar unique_cluster_count: Total number of unique clusters. Required. - :vartype unique_cluster_count: int - :ivar method: Method used for clustering. Required. - :vartype method: str - :ivar usage: Token usage while performing clustering analysis. Required. - :vartype usage: ~azure.ai.projects.models.ClusterTokenUsage + :ivar type: The object type, which is always 'managed_identity'. Required. MANAGED_IDENTITY. + :vartype type: str or ~azure.ai.projects.models.MANAGED_IDENTITY + :ivar security_scheme: Connection auth security details. Required. + :vartype security_scheme: ~azure.ai.projects.models.OpenApiManagedSecurityScheme """ - sample_count: int = rest_field(name="sampleCount", visibility=["read", "create", "update", "delete", "query"]) - """Total number of samples analyzed. Required.""" - unique_subcluster_count: int = rest_field( - name="uniqueSubclusterCount", visibility=["read", "create", "update", "delete", "query"] - ) - """Total number of unique subcluster labels. Required.""" - unique_cluster_count: int = rest_field( - name="uniqueClusterCount", visibility=["read", "create", "update", "delete", "query"] + type: Literal[OpenApiAuthType.MANAGED_IDENTITY] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The object type, which is always 'managed_identity'. Required. MANAGED_IDENTITY.""" + security_scheme: "_models.OpenApiManagedSecurityScheme" = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Total number of unique clusters. Required.""" - method: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Method used for clustering. Required.""" - usage: "_models.ClusterTokenUsage" = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Token usage while performing clustering analysis. Required.""" + """Connection auth security details. Required.""" @overload def __init__( self, *, - sample_count: int, - unique_subcluster_count: int, - unique_cluster_count: int, - method: str, - usage: "_models.ClusterTokenUsage", + security_scheme: "_models.OpenApiManagedSecurityScheme", ) -> None: ... @overload @@ -7419,32 +14079,24 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = OpenApiAuthType.MANAGED_IDENTITY # type: ignore -class LocalShellToolParam(Tool, discriminator="local_shell"): - """Local shell tool. +class OpenApiManagedSecurityScheme(_Model): + """Security scheme for OpenApi managed_identity authentication. - :ivar type: The type of the local shell tool. Always ``local_shell``. Required. LOCAL_SHELL. - :vartype type: str or ~azure.ai.projects.models.LOCAL_SHELL - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str + :ivar audience: Authentication scope for managed_identity auth type. Required. + :vartype audience: str """ - type: Literal[ToolType.LOCAL_SHELL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The type of the local shell tool. Always ``local_shell``. Required. LOCAL_SHELL.""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" + audience: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Authentication scope for managed_identity auth type. Required.""" @overload def __init__( self, *, - name: Optional[str] = None, - description: Optional[str] = None, + audience: str, ) -> None: ... @overload @@ -7456,34 +14108,30 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.LOCAL_SHELL # type: ignore -class LocalSkillParam(_Model): - """LocalSkillParam. - - :ivar name: The name of the skill. Required. - :vartype name: str - :ivar description: The description of the skill. Required. - :vartype description: str - :ivar path: The path to the directory containing the skill. Required. - :vartype path: str - """ +class OpenApiProjectConnectionAuthDetails(OpenApiAuthDetails, discriminator="project_connection"): + """Security details for OpenApi project connection authentication. - name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The name of the skill. Required.""" - description: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The description of the skill. Required.""" - path: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The path to the directory containing the skill. Required.""" + :ivar type: The object type, which is always 'project_connection'. Required. + PROJECT_CONNECTION. + :vartype type: str or ~azure.ai.projects.models.PROJECT_CONNECTION + :ivar security_scheme: Project connection auth security details. Required. + :vartype security_scheme: ~azure.ai.projects.models.OpenApiProjectConnectionSecurityScheme + """ + + type: Literal[OpenApiAuthType.PROJECT_CONNECTION] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The object type, which is always 'project_connection'. Required. PROJECT_CONNECTION.""" + security_scheme: "_models.OpenApiProjectConnectionSecurityScheme" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Project connection auth security details. Required.""" @overload def __init__( self, *, - name: str, - description: str, - path: str, + security_scheme: "_models.OpenApiProjectConnectionSecurityScheme", ) -> None: ... @overload @@ -7495,27 +14143,24 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = OpenApiAuthType.PROJECT_CONNECTION # type: ignore -class ManagedAgentIdentityBlueprintReference(AgentBlueprintReference, discriminator="ManagedAgentIdentityBlueprint"): - """ManagedAgentIdentityBlueprintReference. +class OpenApiProjectConnectionSecurityScheme(_Model): + """Security scheme for OpenApi managed_identity authentication. - :ivar type: Required. MANAGED_AGENT_IDENTITY_BLUEPRINT. - :vartype type: str or ~azure.ai.projects.models.MANAGED_AGENT_IDENTITY_BLUEPRINT - :ivar blueprint_id: The ID of the managed blueprint. Required. - :vartype blueprint_id: str + :ivar project_connection_id: Project connection id for Project Connection auth type. Required. + :vartype project_connection_id: str """ - type: Literal[AgentBlueprintReferenceType.MANAGED_AGENT_IDENTITY_BLUEPRINT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. MANAGED_AGENT_IDENTITY_BLUEPRINT.""" - blueprint_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The ID of the managed blueprint. Required.""" + project_connection_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Project connection id for Project Connection auth type. Required.""" @overload def __init__( self, *, - blueprint_id: str, + project_connection_id: str, ) -> None: ... @overload @@ -7527,40 +14172,40 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = AgentBlueprintReferenceType.MANAGED_AGENT_IDENTITY_BLUEPRINT # type: ignore -class ManagedAzureAISearchIndex(Index, discriminator="ManagedAzureSearch"): - """Managed Azure AI Search Index Definition. +class OpenApiTool(Tool, discriminator="openapi"): + """The input definition information for an OpenAPI tool as used to configure an agent. - :ivar id: Asset ID, a unique identifier for the asset. - :vartype id: str - :ivar name: The name of the resource. Required. - :vartype name: str - :ivar version: The version of the resource. Required. - :vartype version: str - :ivar description: The asset description text. - :vartype description: str - :ivar tags: Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar type: Type of index. Required. Managed Azure Search. - :vartype type: str or ~azure.ai.projects.models.MANAGED_AZURE_SEARCH - :ivar vector_store_id: Vector store id of managed index. Required. - :vartype vector_store_id: str + :ivar type: The object type, which is always 'openapi'. Required. OPENAPI. + :vartype type: str or ~azure.ai.projects.models.OPENAPI + :ivar openapi: The openapi function definition. Required. + :vartype openapi: ~azure.ai.projects.models.OpenApiFunctionDefinition + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] """ - type: Literal[IndexType.MANAGED_AZURE_SEARCH] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Type of index. Required. Managed Azure Search.""" - vector_store_id: str = rest_field(name="vectorStoreId", visibility=["create"]) - """Vector store id of managed index. Required.""" + type: Literal[ToolType.OPENAPI] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The object type, which is always 'openapi'. Required. OPENAPI.""" + openapi: "_models.OpenApiFunctionDefinition" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The openapi function definition. Required.""" + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: + exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at + runtime.""" @overload def __init__( self, *, - vector_store_id: str, - description: Optional[str] = None, - tags: Optional[dict[str, str]] = None, + openapi: "_models.OpenApiFunctionDefinition", + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @overload @@ -7572,132 +14217,53 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = IndexType.MANAGED_AZURE_SEARCH # type: ignore - + self.type = ToolType.OPENAPI # type: ignore -class MCPTool(Tool, discriminator="mcp"): - """MCP tool. - :ivar type: The type of the MCP tool. Always ``mcp``. Required. MCP. - :vartype type: str or ~azure.ai.projects.models.MCP - :ivar server_label: A label for this MCP server, used to identify it in tool calls. Required. - :vartype server_label: str - :ivar server_url: The URL for the MCP server. One of ``server_url`` or ``connector_id`` must be - provided. - :vartype server_url: str - :ivar connector_id: Identifier for service connectors, like those available in ChatGPT. One of - ``server_url`` or ``connector_id`` must be provided. Learn more about service connectors `here - `_. Currently supported ``connector_id`` values are: +class OpenApiToolCall(OutputItem, discriminator="openapi_call"): + """An OpenAPI tool call. - * Dropbox: `connector_dropbox` - * Gmail: `connector_gmail` - * Google Calendar: `connector_googlecalendar` - * Google Drive: `connector_googledrive` - * Microsoft Teams: `connector_microsoftteams` - * Outlook Calendar: `connector_outlookcalendar` - * Outlook Email: `connector_outlookemail` - * SharePoint: `connector_sharepoint`. Is one of the following types: - Literal["connector_dropbox"], Literal["connector_gmail"], Literal["connector_googlecalendar"], - Literal["connector_googledrive"], Literal["connector_microsoftteams"], - Literal["connector_outlookcalendar"], Literal["connector_outlookemail"], - Literal["connector_sharepoint"] - :vartype connector_id: str or str or str or str or str or str or str or str - :ivar authorization: An OAuth access token that can be used with a remote MCP server, either - with a custom MCP server URL or a service connector. Your application must handle the OAuth - authorization flow and provide the token here. - :vartype authorization: str - :ivar server_description: Optional description of the MCP server, used to provide more context. - :vartype server_description: str - :ivar headers: - :vartype headers: dict[str, str] - :ivar allowed_tools: Is either a [str] type or a MCPToolFilter type. - :vartype allowed_tools: list[str] or ~azure.ai.projects.models.MCPToolFilter - :ivar require_approval: Is one of the following types: MCPToolRequireApproval, - Literal["always"], Literal["never"] - :vartype require_approval: ~azure.ai.projects.models.MCPToolRequireApproval or str or str - :ivar project_connection_id: The connection ID in the project for the MCP server. The - connection stores authentication and other connection details needed to connect to the MCP - server. - :vartype project_connection_id: str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. OPENAPI_CALL. + :vartype type: str or ~azure.ai.projects.models.OPENAPI_CALL + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the OpenAPI operation being called. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.projects.models.ToolCallStatus """ - type: Literal[ToolType.MCP] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The type of the MCP tool. Always ``mcp``. Required. MCP.""" - server_label: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """A label for this MCP server, used to identify it in tool calls. Required.""" - server_url: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The URL for the MCP server. One of ``server_url`` or ``connector_id`` must be provided.""" - connector_id: Optional[ - Literal[ - "connector_dropbox", - "connector_gmail", - "connector_googlecalendar", - "connector_googledrive", - "connector_microsoftteams", - "connector_outlookcalendar", - "connector_outlookemail", - "connector_sharepoint", - ] - ] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Identifier for service connectors, like those available in ChatGPT. One of ``server_url`` or - ``connector_id`` must be provided. Learn more about service connectors `here - `_. Currently supported ``connector_id`` values are: - - * Dropbox: `connector_dropbox` - * Gmail: `connector_gmail` - * Google Calendar: `connector_googlecalendar` - * Google Drive: `connector_googledrive` - * Microsoft Teams: `connector_microsoftteams` - * Outlook Calendar: `connector_outlookcalendar` - * Outlook Email: `connector_outlookemail` - * SharePoint: `connector_sharepoint`. Is one of the following types: - Literal[\"connector_dropbox\"], Literal[\"connector_gmail\"], - Literal[\"connector_googlecalendar\"], Literal[\"connector_googledrive\"], - Literal[\"connector_microsoftteams\"], Literal[\"connector_outlookcalendar\"], - Literal[\"connector_outlookemail\"], Literal[\"connector_sharepoint\"]""" - authorization: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """An OAuth access token that can be used with a remote MCP server, either with a custom MCP - server URL or a service connector. Your application must handle the OAuth authorization flow - and provide the token here.""" - server_description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional description of the MCP server, used to provide more context.""" - headers: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - allowed_tools: Optional[Union[list[str], "_models.MCPToolFilter"]] = rest_field( + type: Literal[OutputItemType.OPENAPI_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. OPENAPI_CALL.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the tool call generated by the model. Required.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the OpenAPI operation being called. Required.""" + arguments: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A JSON string of the arguments to pass to the tool. Required.""" + status: Union[str, "_models.ToolCallStatus"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Is either a [str] type or a MCPToolFilter type.""" - require_approval: Optional[Union["_models.MCPToolRequireApproval", Literal["always"], Literal["never"]]] = ( - rest_field(visibility=["read", "create", "update", "delete", "query"]) - ) - """Is one of the following types: MCPToolRequireApproval, Literal[\"always\"], Literal[\"never\"]""" - project_connection_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The connection ID in the project for the MCP server. The connection stores authentication and - other connection details needed to connect to the MCP server.""" + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" @overload def __init__( self, *, - server_label: str, - server_url: Optional[str] = None, - connector_id: Optional[ - Literal[ - "connector_dropbox", - "connector_gmail", - "connector_googlecalendar", - "connector_googledrive", - "connector_microsoftteams", - "connector_outlookcalendar", - "connector_outlookemail", - "connector_sharepoint", - ] - ] = None, - authorization: Optional[str] = None, - server_description: Optional[str] = None, - headers: Optional[dict[str, str]] = None, - allowed_tools: Optional[Union[list[str], "_models.MCPToolFilter"]] = None, - require_approval: Optional[Union["_models.MCPToolRequireApproval", Literal["always"], Literal["never"]]] = None, - project_connection_id: Optional[str] = None, + call_id: str, + name: str, + arguments: str, + status: Union[str, "_models.ToolCallStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, ) -> None: ... @overload @@ -7709,35 +14275,56 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.MCP # type: ignore + self.type = OutputItemType.OPENAPI_CALL # type: ignore -class MCPToolFilter(_Model): - """MCP tool filter. - - :ivar tool_names: MCP allowed tools. - :vartype tool_names: list[str] - :ivar read_only: Indicates whether or not a tool modifies data or is read-only. If an MCP - server is `annotated with `readOnlyHint` - `_, - it will match this filter. - :vartype read_only: bool - """ +class OpenApiToolCallOutput(OutputItem, discriminator="openapi_call_output"): + """The output of an OpenAPI tool call. - tool_names: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """MCP allowed tools.""" - read_only: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Indicates whether or not a tool modifies data or is read-only. If an MCP server is `annotated - with `readOnlyHint` - `_, - it will match this filter.""" + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. OPENAPI_CALL_OUTPUT. + :vartype type: str or ~azure.ai.projects.models.OPENAPI_CALL_OUTPUT + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the OpenAPI operation that was called. Required. + :vartype name: str + :ivar output: The output from the OpenAPI tool call. Is one of the following types: {str: Any}, + str, [Any] + :vartype output: dict[str, any] or str or list[any] + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.projects.models.ToolCallStatus + """ + + type: Literal[OutputItemType.OPENAPI_CALL_OUTPUT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. OPENAPI_CALL_OUTPUT.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the tool call generated by the model. Required.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the OpenAPI operation that was called. Required.""" + output: Optional["_types.ToolCallOutputContent"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The output from the OpenAPI tool call. Is one of the following types: {str: Any}, str, [Any]""" + status: Union[str, "_models.ToolCallStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" @overload def __init__( self, *, - tool_names: Optional[list[str]] = None, - read_only: Optional[bool] = None, + call_id: str, + name: str, + status: Union[str, "_models.ToolCallStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + output: Optional["_types.ToolCallOutputContent"] = None, ) -> None: ... @overload @@ -7749,26 +14336,52 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = OutputItemType.OPENAPI_CALL_OUTPUT # type: ignore -class MCPToolRequireApproval(_Model): - """MCPToolRequireApproval. +class OptimizationAgentDefinition(_Model): + """The agent definition being optimized. Identifies the Foundry agent and optional configuration + overrides. - :ivar always: - :vartype always: ~azure.ai.projects.models.MCPToolFilter - :ivar never: - :vartype never: ~azure.ai.projects.models.MCPToolFilter + :ivar agent_name: Registered Foundry agent name. Required — bare-model mode is not supported. + Required. + :vartype agent_name: str + :ivar agent_version: Pinned agent version. Defaults to latest if omitted. + :vartype agent_version: str + :ivar model: Model deployment name (e.g., 'gpt-4o'). Optional when agent_name is set — the + agent definition provides the model. + :vartype model: str + :ivar system_prompt: System prompt / instructions override. When set, used as the baseline + instructions for the agent. + :vartype system_prompt: str + :ivar skills: Optional named skills the optimizer may tune. Tool descriptions and parameters. + :vartype skills: list[~azure.ai.projects.models.OptimizationAgentSkill] """ - always: Optional["_models.MCPToolFilter"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - never: Optional["_models.MCPToolFilter"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + agent_name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Registered Foundry agent name. Required — bare-model mode is not supported. Required.""" + agent_version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Pinned agent version. Defaults to latest if omitted.""" + model: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Model deployment name (e.g., 'gpt-4o'). Optional when agent_name is set — the agent definition + provides the model.""" + system_prompt: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """System prompt / instructions override. When set, used as the baseline instructions for the + agent.""" + skills: Optional[list["_models.OptimizationAgentSkill"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Optional named skills the optimizer may tune. Tool descriptions and parameters.""" @overload def __init__( self, *, - always: Optional["_models.MCPToolFilter"] = None, - never: Optional["_models.MCPToolFilter"] = None, + agent_name: str, + agent_version: Optional[str] = None, + model: Optional[str] = None, + system_prompt: Optional[str] = None, + skills: Optional[list["_models.OptimizationAgentSkill"]] = None, ) -> None: ... @overload @@ -7782,30 +14395,26 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MemoryOperation(_Model): - """Represents a single memory operation (create, update, or delete) performed on a memory item. - - :ivar kind: The type of memory operation being performed. Required. Known values are: "create", - "update", and "delete". - :vartype kind: str or ~azure.ai.projects.models.MemoryOperationKind - :ivar memory_item: The memory item to create, update, or delete. Required. - :vartype memory_item: ~azure.ai.projects.models.MemoryItem - """ - - kind: Union[str, "_models.MemoryOperationKind"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The type of memory operation being performed. Required. Known values are: \"create\", - \"update\", and \"delete\".""" - memory_item: "_models.MemoryItem" = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The memory item to create, update, or delete. Required.""" +class OptimizationAgentSkill(_Model): + """A named skill on the agent that the optimizer may tune. + + :ivar name: Skill name (matches the tool name on the agent). Required. + :vartype name: str + :ivar description: Free-form description used as the seed when tuning skill descriptions. + :vartype description: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Skill name (matches the tool name on the agent). Required.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Free-form description used as the seed when tuning skill descriptions.""" @overload def __init__( self, *, - kind: Union[str, "_models.MemoryOperationKind"], - memory_item: "_models.MemoryItem", + name: str, + description: Optional[str] = None, ) -> None: ... @overload @@ -7819,21 +14428,108 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MemorySearchItem(_Model): - """A retrieved memory item from memory search. +class OptimizationCandidate(_Model): + """Aggregated evaluation result for a single candidate agent configuration across all tasks. - :ivar memory_item: Retrieved memory item. Required. - :vartype memory_item: ~azure.ai.projects.models.MemoryItem + :ivar candidate_id: Server-assigned candidate identifier. Use with ``GET /candidates/{id}`` + sub-endpoints. + :vartype candidate_id: str + :ivar name: Display name of the candidate (e.g., 'baseline', 'instruction-v2'). Required. + :vartype name: str + :ivar config: The agent configuration that produced this candidate. Required. + :vartype config: ~azure.ai.projects.models.OptimizationAgentDefinition + :ivar mutations: What was mutated from the baseline (e.g., {instructions: 'new prompt'}). + Required. + :vartype mutations: dict[str, any] + :ivar rationale: Strategy rationale — why this candidate was generated. Required. + :vartype rationale: str + :ivar avg_score: Average composite score across all tasks. Required. + :vartype avg_score: float + :ivar avg_tokens: Average token usage across all tasks. Required. + :vartype avg_tokens: float + :ivar pass_rate: Fraction of tasks that met the pass threshold. Required. + :vartype pass_rate: float + :ivar task_scores: Individual task-level scores. Required. + :vartype task_scores: list[~azure.ai.projects.models.OptimizationTaskResult] + :ivar is_pareto_optimal: Whether this candidate is on the Pareto frontier (score vs cost). + Required. + :vartype is_pareto_optimal: bool + :ivar sample_avg_score: Average score from sampled evaluation (null if full dataset was used). + :vartype sample_avg_score: float + :ivar sample_size: Number of tasks in the sample (null if full dataset was used). + :vartype sample_size: int + :ivar evaluation_type: 'sample' if scored on a subset, 'full' if re-evaluated on the full + dataset. + :vartype evaluation_type: str + :ivar strategy: Identifies the strategy that produced this candidate. Known values are: + "instruction", "model", and "skill". + :vartype strategy: str or ~azure.ai.projects.models.OptimizationStrategy + :ivar eval_id: Foundry evaluation identifier used to score this candidate. + :vartype eval_id: str + :ivar eval_run_id: Foundry evaluation run identifier for this candidate's scoring run. + :vartype eval_run_id: str """ - memory_item: "_models.MemoryItem" = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Retrieved memory item. Required.""" + candidate_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Server-assigned candidate identifier. Use with ``GET /candidates/{id}`` sub-endpoints.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Display name of the candidate (e.g., 'baseline', 'instruction-v2'). Required.""" + config: "_models.OptimizationAgentDefinition" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The agent configuration that produced this candidate. Required.""" + mutations: dict[str, Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """What was mutated from the baseline (e.g., {instructions: 'new prompt'}). Required.""" + rationale: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Strategy rationale — why this candidate was generated. Required.""" + avg_score: float = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Average composite score across all tasks. Required.""" + avg_tokens: float = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Average token usage across all tasks. Required.""" + pass_rate: float = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Fraction of tasks that met the pass threshold. Required.""" + task_scores: list["_models.OptimizationTaskResult"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Individual task-level scores. Required.""" + is_pareto_optimal: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Whether this candidate is on the Pareto frontier (score vs cost). Required.""" + sample_avg_score: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Average score from sampled evaluation (null if full dataset was used).""" + sample_size: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Number of tasks in the sample (null if full dataset was used).""" + evaluation_type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """'sample' if scored on a subset, 'full' if re-evaluated on the full dataset.""" + strategy: Optional[Union[str, "_models.OptimizationStrategy"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Identifies the strategy that produced this candidate. Known values are: \"instruction\", + \"model\", and \"skill\".""" + eval_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Foundry evaluation identifier used to score this candidate.""" + eval_run_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Foundry evaluation run identifier for this candidate's scoring run.""" @overload def __init__( self, *, - memory_item: "_models.MemoryItem", + name: str, + config: "_models.OptimizationAgentDefinition", + mutations: dict[str, Any], + rationale: str, + avg_score: float, + avg_tokens: float, + pass_rate: float, + task_scores: list["_models.OptimizationTaskResult"], + is_pareto_optimal: bool, + candidate_id: Optional[str] = None, + sample_avg_score: Optional[float] = None, + sample_size: Optional[int] = None, + evaluation_type: Optional[str] = None, + strategy: Optional[Union[str, "_models.OptimizationStrategy"]] = None, + eval_id: Optional[str] = None, + eval_run_id: Optional[str] = None, ) -> None: ... @overload @@ -7847,21 +14543,55 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MemorySearchOptions(_Model): - """Memory search options. +class OptimizationJob(_Model): + """Agent optimization job resource — a long-running job that optimizes an agent's configuration + (instructions, model, skills) to maximize evaluation scores. On success, the result contains + scored candidates. - :ivar max_memories: Maximum number of memory items to return. - :vartype max_memories: int + :ivar id: Server-assigned unique identifier. Required. + :vartype id: str + :ivar inputs: Caller-supplied inputs. + :vartype inputs: ~azure.ai.projects.models.OptimizationJobInputs + :ivar result: Result produced on success. + :vartype result: ~azure.ai.projects.models.OptimizationJobResult + :ivar status: Current lifecycle status. Required. Known values are: "queued", "in_progress", + "succeeded", "failed", and "cancelled". + :vartype status: str or ~azure.ai.projects.models.JobStatus + :ivar error: Error details — populated only on failure. + :vartype error: ~azure.ai.projects.models.ApiError + :ivar created_at: The timestamp when the job was created, represented in Unix time. Required. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The timestamp when the job was last updated, represented in Unix time. + :vartype updated_at: ~datetime.datetime + :ivar progress: Progress while in flight. Absent in terminal states. + :vartype progress: ~azure.ai.projects.models.OptimizationJobProgress """ - max_memories: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Maximum number of memory items to return.""" + id: str = rest_field(visibility=["read"]) + """Server-assigned unique identifier. Required.""" + inputs: Optional["_models.OptimizationJobInputs"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Caller-supplied inputs.""" + result: Optional["_models.OptimizationJobResult"] = rest_field(visibility=["read"]) + """Result produced on success.""" + status: Union[str, "_models.JobStatus"] = rest_field(visibility=["read"]) + """Current lifecycle status. Required. Known values are: \"queued\", \"in_progress\", + \"succeeded\", \"failed\", and \"cancelled\".""" + error: Optional["_models.ApiError"] = rest_field(visibility=["read"]) + """Error details — populated only on failure.""" + created_at: datetime.datetime = rest_field(visibility=["read"], format="unix-timestamp") + """The timestamp when the job was created, represented in Unix time. Required.""" + updated_at: Optional[datetime.datetime] = rest_field(visibility=["read"], format="unix-timestamp") + """The timestamp when the job was last updated, represented in Unix time.""" + progress: Optional["_models.OptimizationJobProgress"] = rest_field(visibility=["read"]) + """Progress while in flight. Absent in terminal states.""" @overload def __init__( self, *, - max_memories: Optional[int] = None, + inputs: Optional["_models.OptimizationJobInputs"] = None, ) -> None: ... @overload @@ -7875,58 +14605,68 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MemorySearchPreviewTool(Tool, discriminator="memory_search_preview"): - """A tool for integrating memories into the agent. +class OptimizationJobInputs(_Model): + """Caller-supplied inputs for an optimization job. - :ivar type: The type of the tool. Always ``memory_search_preview``. Required. - MEMORY_SEARCH_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.MEMORY_SEARCH_PREVIEW - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar memory_store_name: The name of the memory store to use. Required. - :vartype memory_store_name: str - :ivar scope: The namespace used to group and isolate memories, such as a user ID. Limits which - memories can be retrieved or updated. Use special variable ``{{$userId}}`` to scope memories to - the current signed-in user. Required. - :vartype scope: str - :ivar search_options: Options for searching the memory store. - :vartype search_options: ~azure.ai.projects.models.MemorySearchOptions - :ivar update_delay: Time to wait before updating memories after inactivity (seconds). Default - 300. - :vartype update_delay: int + :ivar agent: The agent (and pinned version) being optimized. Required. + :vartype agent: ~azure.ai.projects.models.OptimizationAgentDefinition + :ivar dataset: Inline evaluation dataset. Mutually exclusive with ``train_dataset_reference``. + :vartype dataset: list[~azure.ai.projects.models.DatasetItem] + :ivar train_dataset_reference: Reference to a registered training dataset. Mutually exclusive + with ``dataset``. + :vartype train_dataset_reference: ~azure.ai.projects.models.DatasetRef + :ivar validation_dataset_reference: Optional held-out validation dataset for measuring + generalization of the final candidate. + :vartype validation_dataset_reference: ~azure.ai.projects.models.DatasetRef + :ivar evaluators: Job-level evaluators (referenced by ``name``). Per-task ``criteria`` may + override. Default: ['task_adherence']. + :vartype evaluators: list[str] + :ivar criteria: Job-level evaluation criteria. Applied to all tasks unless overridden by + per-task ``criteria``. + :vartype criteria: list[~azure.ai.projects.models.EvaluationCriterion] + :ivar options: Tuning knobs and run-mode. + :vartype options: ~azure.ai.projects.models.OptimizationOptions """ - type: Literal[ToolType.MEMORY_SEARCH_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The type of the tool. Always ``memory_search_preview``. Required. MEMORY_SEARCH_PREVIEW.""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" - memory_store_name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The name of the memory store to use. Required.""" - scope: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The namespace used to group and isolate memories, such as a user ID. Limits which memories can - be retrieved or updated. Use special variable ``{{$userId}}`` to scope memories to the current - signed-in user. Required.""" - search_options: Optional["_models.MemorySearchOptions"] = rest_field( + agent: "_models.OptimizationAgentDefinition" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Options for searching the memory store.""" - update_delay: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Time to wait before updating memories after inactivity (seconds). Default 300.""" + """The agent (and pinned version) being optimized. Required.""" + dataset: Optional[list["_models.DatasetItem"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Inline evaluation dataset. Mutually exclusive with ``train_dataset_reference``.""" + train_dataset_reference: Optional["_models.DatasetRef"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Reference to a registered training dataset. Mutually exclusive with ``dataset``.""" + validation_dataset_reference: Optional["_models.DatasetRef"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Optional held-out validation dataset for measuring generalization of the final candidate.""" + evaluators: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Job-level evaluators (referenced by ``name``). Per-task ``criteria`` may override. Default: + ['task_adherence'].""" + criteria: Optional[list["_models.EvaluationCriterion"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Job-level evaluation criteria. Applied to all tasks unless overridden by per-task ``criteria``.""" + options: Optional["_models.OptimizationOptions"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Tuning knobs and run-mode.""" @overload def __init__( self, *, - memory_store_name: str, - scope: str, - name: Optional[str] = None, - description: Optional[str] = None, - search_options: Optional["_models.MemorySearchOptions"] = None, - update_delay: Optional[int] = None, + agent: "_models.OptimizationAgentDefinition", + dataset: Optional[list["_models.DatasetItem"]] = None, + train_dataset_reference: Optional["_models.DatasetRef"] = None, + validation_dataset_reference: Optional["_models.DatasetRef"] = None, + evaluators: Optional[list[str]] = None, + criteria: Optional[list["_models.EvaluationCriterion"]] = None, + options: Optional["_models.OptimizationOptions"] = None, ) -> None: ... @overload @@ -7938,28 +14678,52 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.MEMORY_SEARCH_PREVIEW # type: ignore - -class MemoryStoreDefinition(_Model): - """Base definition for memory store configurations. - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - MemoryStoreDefaultDefinition +class OptimizationJobProgress(_Model): + """In-flight progress; only populated while status is ``queued`` or ``in_progress``. - :ivar kind: The kind of the memory store. Required. "default" - :vartype kind: str or ~azure.ai.projects.models.MemoryStoreKind + :ivar current_strategy: Strategy currently being explored. Required. Known values are: + "instruction", "model", and "skill". + :vartype current_strategy: str or ~azure.ai.projects.models.OptimizationStrategy + :ivar current_iteration: 1-based current iteration index. Required. + :vartype current_iteration: int + :ivar tasks_completed: Tasks evaluated so far this iteration. Required. + :vartype tasks_completed: int + :ivar tasks_total: Total tasks scheduled this iteration. Required. + :vartype tasks_total: int + :ivar best_score: Best score observed so far across all candidates. Required. + :vartype best_score: float + :ivar elapsed_seconds: Wall-clock time elapsed since the job began executing. Required. + :vartype elapsed_seconds: float """ - __mapping__: dict[str, _Model] = {} - kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) - """The kind of the memory store. Required. \"default\"""" + current_strategy: Union[str, "_models.OptimizationStrategy"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Strategy currently being explored. Required. Known values are: \"instruction\", \"model\", and + \"skill\".""" + current_iteration: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """1-based current iteration index. Required.""" + tasks_completed: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Tasks evaluated so far this iteration. Required.""" + tasks_total: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Total tasks scheduled this iteration. Required.""" + best_score: float = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Best score observed so far across all candidates. Required.""" + elapsed_seconds: float = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Wall-clock time elapsed since the job began executing. Required.""" @overload def __init__( self, *, - kind: str, + current_strategy: Union[str, "_models.OptimizationStrategy"], + current_iteration: int, + tasks_completed: int, + tasks_total: int, + best_score: float, + elapsed_seconds: float, ) -> None: ... @overload @@ -7973,38 +14737,78 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MemoryStoreDefaultDefinition(MemoryStoreDefinition, discriminator="default"): - """Default memory store implementation. +class OptimizationJobResult(_Model): + """Terminal-state result body. Populated when ``status`` is ``succeeded`` or ``failed``. - :ivar kind: The kind of the memory store. Required. The default memory store implementation. - :vartype kind: str or ~azure.ai.projects.models.DEFAULT - :ivar chat_model: The name or identifier of the chat completion model deployment used for - memory processing. Required. - :vartype chat_model: str - :ivar embedding_model: The name or identifier of the embedding model deployment used for memory - processing. Required. - :vartype embedding_model: str - :ivar options: Default memory store options. - :vartype options: ~azure.ai.projects.models.MemoryStoreDefaultOptions + :ivar baseline: Evaluation scores for the original (un-optimized) agent configuration. + :vartype baseline: ~azure.ai.projects.models.OptimizationCandidate + :ivar best: The highest-scoring candidate found during optimization. + :vartype best: ~azure.ai.projects.models.OptimizationCandidate + :ivar candidates: All evaluated candidates including baseline. + :vartype candidates: list[~azure.ai.projects.models.OptimizationCandidate] + :ivar pareto_frontier: Candidates on the Pareto frontier (maximize score, minimize cost). + :vartype pareto_frontier: list[~azure.ai.projects.models.OptimizationCandidate] + :ivar validation_score: Score of the best candidate on the held-out validation dataset. Null + when no validation dataset was provided. + :vartype validation_score: ~azure.ai.projects.models.OptimizationCandidate + :ivar options: The options used for this optimization run. + :vartype options: ~azure.ai.projects.models.OptimizationOptions + :ivar sample_size: Number of tasks sampled during optimization iterations (null if sampling was + not used). + :vartype sample_size: int + :ivar warnings: Non-fatal warnings from the optimization run (e.g., strategy failures that were + skipped). + :vartype warnings: list[str] + :ivar all_strategies_failed: True when all optimization strategies failed — only the baseline + was evaluated. + :vartype all_strategies_failed: bool """ - kind: Literal[MemoryStoreKind.DEFAULT] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The kind of the memory store. Required. The default memory store implementation.""" - chat_model: str = rest_field(visibility=["read", "create"]) - """The name or identifier of the chat completion model deployment used for memory processing. - Required.""" - embedding_model: str = rest_field(visibility=["read", "create"]) - """The name or identifier of the embedding model deployment used for memory processing. Required.""" - options: Optional["_models.MemoryStoreDefaultOptions"] = rest_field(visibility=["read", "create"]) - """Default memory store options.""" + baseline: Optional["_models.OptimizationCandidate"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Evaluation scores for the original (un-optimized) agent configuration.""" + best: Optional["_models.OptimizationCandidate"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The highest-scoring candidate found during optimization.""" + candidates: Optional[list["_models.OptimizationCandidate"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """All evaluated candidates including baseline.""" + pareto_frontier: Optional[list["_models.OptimizationCandidate"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Candidates on the Pareto frontier (maximize score, minimize cost).""" + validation_score: Optional["_models.OptimizationCandidate"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Score of the best candidate on the held-out validation dataset. Null when no validation dataset + was provided.""" + options: Optional["_models.OptimizationOptions"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The options used for this optimization run.""" + sample_size: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Number of tasks sampled during optimization iterations (null if sampling was not used).""" + warnings: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Non-fatal warnings from the optimization run (e.g., strategy failures that were skipped).""" + all_strategies_failed: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """True when all optimization strategies failed — only the baseline was evaluated.""" @overload def __init__( self, *, - chat_model: str, - embedding_model: str, - options: Optional["_models.MemoryStoreDefaultOptions"] = None, + baseline: Optional["_models.OptimizationCandidate"] = None, + best: Optional["_models.OptimizationCandidate"] = None, + candidates: Optional[list["_models.OptimizationCandidate"]] = None, + pareto_frontier: Optional[list["_models.OptimizationCandidate"]] = None, + validation_score: Optional["_models.OptimizationCandidate"] = None, + options: Optional["_models.OptimizationOptions"] = None, + sample_size: Optional[int] = None, + warnings: Optional[list[str]] = None, + all_strategies_failed: Optional[bool] = None, ) -> None: ... @overload @@ -8016,37 +14820,97 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.kind = MemoryStoreKind.DEFAULT # type: ignore - -class MemoryStoreDefaultOptions(_Model): - """Default memory store configurations. - :ivar user_profile_enabled: Whether to enable user profile extraction and storage. Default is - true. Required. - :vartype user_profile_enabled: bool - :ivar user_profile_details: Specific categories or types of user profile information to extract - and store. - :vartype user_profile_details: str - :ivar chat_summary_enabled: Whether to enable chat summary extraction and storage. Default is - true. Required. - :vartype chat_summary_enabled: bool - """ +class OptimizationOptions(_Model): + """Tuning knobs and run-mode for an optimization job. - user_profile_enabled: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Whether to enable user profile extraction and storage. Default is true. Required.""" - user_profile_details: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Specific categories or types of user profile information to extract and store.""" - chat_summary_enabled: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Whether to enable chat summary extraction and storage. Default is true. Required.""" + :ivar strategies: Strategies to apply this run. Default: ['instruction']. + :vartype strategies: list[str or ~azure.ai.projects.models.OptimizationStrategy] + :ivar budget: Total candidate generation budget (number of candidates explored). Default: 10. + :vartype budget: int + :ivar max_iterations: Maximum optimization iterations per strategy. Default: 5. + :vartype max_iterations: int + :ivar tasks_per_iteration: Tasks sampled per iteration (mutation step input). Default: + service-decided (auto-computed). + :vartype tasks_per_iteration: int + :ivar max_reflection_tasks: Maximum tasks fed into the reflective-mutation LLM per iteration. + Default: 5. + :vartype max_reflection_tasks: int + :ivar min_improvement: Minimum score improvement between iterations to continue (plateau + detection). Default: 0.005. + :vartype min_improvement: float + :ivar pass_threshold: Composite score threshold for a task to be considered passing. Default: + 0.5. + :vartype pass_threshold: float + :ivar improvement_threshold: Target average score at which optimization stops early (quality + ceiling). Default: 0.95. + :vartype improvement_threshold: float + :ivar mode: Run mode. "optimize" + :vartype mode: str or ~azure.ai.projects.models.OptimizationMode + :ivar eval_model: Foundry deployment name to use as the LLM-as-judge evaluation model. + Required. + :vartype eval_model: str + :ivar reflection_model: Optional model deployment for strategy reflection (instruction + rewriting, skill generation). Falls back to ``eval_model`` if unset. + :vartype reflection_model: str + :ivar task_timeout_seconds: Per-task timeout for agent execution. Default: 300 seconds (5 + minutes). + :vartype task_timeout_seconds: int + :ivar keep_versions: If true, retain temporary candidate-evaluation agent versions for + inspection. Default: false. + :vartype keep_versions: bool + """ + + strategies: Optional[list[Union[str, "_models.OptimizationStrategy"]]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Strategies to apply this run. Default: ['instruction'].""" + budget: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Total candidate generation budget (number of candidates explored). Default: 10.""" + max_iterations: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Maximum optimization iterations per strategy. Default: 5.""" + tasks_per_iteration: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Tasks sampled per iteration (mutation step input). Default: service-decided (auto-computed).""" + max_reflection_tasks: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Maximum tasks fed into the reflective-mutation LLM per iteration. Default: 5.""" + min_improvement: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Minimum score improvement between iterations to continue (plateau detection). Default: 0.005.""" + pass_threshold: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Composite score threshold for a task to be considered passing. Default: 0.5.""" + improvement_threshold: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Target average score at which optimization stops early (quality ceiling). Default: 0.95.""" + mode: Optional[Union[str, "_models.OptimizationMode"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Run mode. \"optimize\"""" + eval_model: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Foundry deployment name to use as the LLM-as-judge evaluation model. Required.""" + reflection_model: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional model deployment for strategy reflection (instruction rewriting, skill generation). + Falls back to ``eval_model`` if unset.""" + task_timeout_seconds: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Per-task timeout for agent execution. Default: 300 seconds (5 minutes).""" + keep_versions: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """If true, retain temporary candidate-evaluation agent versions for inspection. Default: false.""" @overload def __init__( self, *, - user_profile_enabled: bool, - chat_summary_enabled: bool, - user_profile_details: Optional[str] = None, + strategies: Optional[list[Union[str, "_models.OptimizationStrategy"]]] = None, + budget: Optional[int] = None, + max_iterations: Optional[int] = None, + tasks_per_iteration: Optional[int] = None, + max_reflection_tasks: Optional[int] = None, + min_improvement: Optional[float] = None, + pass_threshold: Optional[float] = None, + improvement_threshold: Optional[float] = None, + mode: Optional[Union[str, "_models.OptimizationMode"]] = None, + eval_model: Optional[str] = None, + reflection_model: Optional[str] = None, + task_timeout_seconds: Optional[int] = None, + keep_versions: Optional[bool] = None, ) -> None: ... @overload @@ -8060,39 +14924,71 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MemoryStoreDeleteScopeResult(_Model): - """Response for deleting memories from a scope. +class OptimizationTaskResult(_Model): + """Per-task evaluation result for a single candidate. - :ivar object: The object type. Always 'memory_store.scope.deleted'. Required. - MEMORY_STORE_SCOPE_DELETED. - :vartype object: str or ~azure.ai.projects.models.MEMORY_STORE_SCOPE_DELETED - :ivar name: The name of the memory store. Required. - :vartype name: str - :ivar scope: The scope from which memories were deleted. Required. - :vartype scope: str - :ivar deleted: Whether the deletion operation was successful. Required. - :vartype deleted: bool + :ivar task_name: Task name (from the dataset). Required. + :vartype task_name: str + :ivar query: The user query / input for the task. + :vartype query: str + :ivar scores: Per-evaluator scores keyed by evaluator name. Required. + :vartype scores: dict[str, float] + :ivar composite_score: Composite score combining all evaluator scores. Required. + :vartype composite_score: float + :ivar tokens: Total tokens consumed during the agent run for this task. Required. + :vartype tokens: int + :ivar duration_seconds: Wall-clock seconds for this task's agent execution. Required. + :vartype duration_seconds: float + :ivar passed: Whether the task met the pass threshold. Required. + :vartype passed: bool + :ivar error_message: Error message if the task failed during execution. + :vartype error_message: str + :ivar rationales: Per-evaluator reasoning keyed by evaluator name. + :vartype rationales: dict[str, str] + :ivar response: Raw agent response text. + :vartype response: str + :ivar run_id: Identifier of the agent run that produced this result. + :vartype run_id: str """ - object: Literal[MemoryStoreObjectType.MEMORY_STORE_SCOPE_DELETED] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The object type. Always 'memory_store.scope.deleted'. Required. MEMORY_STORE_SCOPE_DELETED.""" - name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The name of the memory store. Required.""" - scope: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The scope from which memories were deleted. Required.""" - deleted: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Whether the deletion operation was successful. Required.""" + task_name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Task name (from the dataset). Required.""" + query: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The user query / input for the task.""" + scores: dict[str, float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Per-evaluator scores keyed by evaluator name. Required.""" + composite_score: float = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Composite score combining all evaluator scores. Required.""" + tokens: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Total tokens consumed during the agent run for this task. Required.""" + duration_seconds: float = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Wall-clock seconds for this task's agent execution. Required.""" + passed: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Whether the task met the pass threshold. Required.""" + error_message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error message if the task failed during execution.""" + rationales: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Per-evaluator reasoning keyed by evaluator name.""" + response: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Raw agent response text.""" + run_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Identifier of the agent run that produced this result.""" @overload def __init__( self, *, - object: Literal[MemoryStoreObjectType.MEMORY_STORE_SCOPE_DELETED], - name: str, - scope: str, - deleted: bool, + task_name: str, + scores: dict[str, float], + composite_score: float, + tokens: int, + duration_seconds: float, + passed: bool, + query: Optional[str] = None, + error_message: Optional[str] = None, + rationales: Optional[dict[str, str]] = None, + response: Optional[str] = None, + run_id: Optional[str] = None, ) -> None: ... @overload @@ -8106,63 +15002,40 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MemoryStoreDetails(_Model): - """A memory store that can store and retrieve user memories. +class TelemetryEndpoint(_Model): + """A telemetry export endpoint configuration. - :ivar object: The object type, which is always 'memory_store'. Required. MEMORY_STORE. - :vartype object: str or ~azure.ai.projects.models.MEMORY_STORE - :ivar id: The unique identifier of the memory store. Required. - :vartype id: str - :ivar created_at: The Unix timestamp (seconds) when the memory store was created. Required. - :vartype created_at: ~datetime.datetime - :ivar updated_at: The Unix timestamp (seconds) when the memory store was last updated. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + OtlpTelemetryEndpoint + + :ivar kind: The telemetry export endpoint kind. Required. "OTLP" + :vartype kind: str or ~azure.ai.projects.models.TelemetryEndpointKind + :ivar data: Data types to export to this endpoint. Use an empty array to export no data. Required. - :vartype updated_at: ~datetime.datetime - :ivar name: The name of the memory store. Required. - :vartype name: str - :ivar description: A human-readable description of the memory store. - :vartype description: str - :ivar metadata: Arbitrary key-value metadata to associate with the memory store. - :vartype metadata: dict[str, str] - :ivar definition: The definition of the memory store. Required. - :vartype definition: ~azure.ai.projects.models.MemoryStoreDefinition + :vartype data: list[str or ~azure.ai.projects.models.TelemetryDataKind] + :ivar auth: Optional authentication configuration. + :vartype auth: ~azure.ai.projects.models.TelemetryEndpointAuth """ - object: Literal[MemoryStoreObjectType.MEMORY_STORE] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The object type, which is always 'memory_store'. Required. MEMORY_STORE.""" - id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The unique identifier of the memory store. Required.""" - created_at: datetime.datetime = rest_field( - visibility=["read", "create", "update", "delete", "query"], format="unix-timestamp" + __mapping__: dict[str, _Model] = {} + kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) + """The telemetry export endpoint kind. Required. \"OTLP\"""" + data: list[Union[str, "_models.TelemetryDataKind"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """The Unix timestamp (seconds) when the memory store was created. Required.""" - updated_at: datetime.datetime = rest_field( - visibility=["read", "create", "update", "delete", "query"], format="unix-timestamp" + """Data types to export to this endpoint. Use an empty array to export no data. Required.""" + auth: Optional["_models.TelemetryEndpointAuth"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """The Unix timestamp (seconds) when the memory store was last updated. Required.""" - name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The name of the memory store. Required.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """A human-readable description of the memory store.""" - metadata: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Arbitrary key-value metadata to associate with the memory store.""" - definition: "_models.MemoryStoreDefinition" = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The definition of the memory store. Required.""" + """Optional authentication configuration.""" @overload def __init__( self, *, - object: Literal[MemoryStoreObjectType.MEMORY_STORE], - id: str, # pylint: disable=redefined-builtin - created_at: datetime.datetime, - updated_at: datetime.datetime, - name: str, - definition: "_models.MemoryStoreDefinition", - description: Optional[str] = None, - metadata: Optional[dict[str, str]] = None, + kind: str, + data: list[Union[str, "_models.TelemetryDataKind"]], + auth: Optional["_models.TelemetryEndpointAuth"] = None, ) -> None: ... @overload @@ -8176,50 +15049,43 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MemoryStoreOperationUsage(_Model): - """Usage statistics of a memory store operation. +class OtlpTelemetryEndpoint(TelemetryEndpoint, discriminator="OTLP"): + """An OTLP (OpenTelemetry Protocol) telemetry export endpoint. - :ivar embedding_tokens: The number of embedding tokens. Required. - :vartype embedding_tokens: int - :ivar input_tokens: The number of input tokens. Required. - :vartype input_tokens: int - :ivar input_tokens_details: A detailed breakdown of the input tokens. Required. - :vartype input_tokens_details: ~azure.ai.projects.models.ResponseUsageInputTokensDetails - :ivar output_tokens: The number of output tokens. Required. - :vartype output_tokens: int - :ivar output_tokens_details: A detailed breakdown of the output tokens. Required. - :vartype output_tokens_details: ~azure.ai.projects.models.ResponseUsageOutputTokensDetails - :ivar total_tokens: The total number of tokens used. Required. - :vartype total_tokens: int + :ivar data: Data types to export to this endpoint. Use an empty array to export no data. + Required. + :vartype data: list[str or ~azure.ai.projects.models.TelemetryDataKind] + :ivar auth: Optional authentication configuration. + :vartype auth: ~azure.ai.projects.models.TelemetryEndpointAuth + :ivar kind: The endpoint kind, always 'OTLP' for OpenTelemetry Protocol endpoints. Required. + OpenTelemetry Protocol (OTLP) endpoint. + :vartype kind: str or ~azure.ai.projects.models.OTLP + :ivar endpoint: The OTLP collector endpoint URL. Required. + :vartype endpoint: str + :ivar protocol: The transport protocol for the OTLP endpoint. Required. Known values are: + "Http" and "Grpc". + :vartype protocol: str or ~azure.ai.projects.models.TelemetryTransportProtocol """ - embedding_tokens: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The number of embedding tokens. Required.""" - input_tokens: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The number of input tokens. Required.""" - input_tokens_details: "_models.ResponseUsageInputTokensDetails" = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """A detailed breakdown of the input tokens. Required.""" - output_tokens: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The number of output tokens. Required.""" - output_tokens_details: "_models.ResponseUsageOutputTokensDetails" = rest_field( + kind: Literal[TelemetryEndpointKind.OTLP] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The endpoint kind, always 'OTLP' for OpenTelemetry Protocol endpoints. Required. OpenTelemetry + Protocol (OTLP) endpoint.""" + endpoint: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The OTLP collector endpoint URL. Required.""" + protocol: Union[str, "_models.TelemetryTransportProtocol"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """A detailed breakdown of the output tokens. Required.""" - total_tokens: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The total number of tokens used. Required.""" + """The transport protocol for the OTLP endpoint. Required. Known values are: \"Http\" and + \"Grpc\".""" @overload def __init__( self, *, - embedding_tokens: int, - input_tokens: int, - input_tokens_details: "_models.ResponseUsageInputTokensDetails", - output_tokens: int, - output_tokens_details: "_models.ResponseUsageOutputTokensDetails", - total_tokens: int, + data: list[Union[str, "_models.TelemetryDataKind"]], + endpoint: str, + protocol: Union[str, "_models.TelemetryTransportProtocol"], + auth: Optional["_models.TelemetryEndpointAuth"] = None, ) -> None: ... @overload @@ -8231,35 +15097,62 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.kind = TelemetryEndpointKind.OTLP # type: ignore -class MemoryStoreSearchResult(_Model): - """Memory search response. +class OutputItemApplyPatchToolCall(OutputItem, discriminator="apply_patch_call"): + """Apply patch tool call. - :ivar search_id: The unique ID of this search request. Use this value as previous_search_id in - subsequent requests to perform incremental searches. Required. - :vartype search_id: str - :ivar memories: Related memory items found during the search operation. Required. - :vartype memories: list[~azure.ai.projects.models.MemorySearchItem] - :ivar usage: Usage statistics associated with the memory search operation. Required. - :vartype usage: ~azure.ai.projects.models.MemoryStoreOperationUsage + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL. + :vartype type: str or ~azure.ai.projects.models.APPLY_PATCH_CALL + :ivar id: The unique ID of the apply patch tool call. Populated when this item is returned via + API. Required. + :vartype id: str + :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. + :vartype call_id: str + :ivar status: The status of the apply patch tool call. One of ``in_progress`` or ``completed``. + Required. Known values are: "in_progress" and "completed". + :vartype status: str or ~azure.ai.projects.models.ApplyPatchCallStatus + :ivar operation: Apply patch operation. Required. + :vartype operation: ~azure.ai.projects.models.ApplyPatchFileOperation + :ivar created_by: The ID of the entity that created this tool call. + :vartype created_by: str """ - search_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The unique ID of this search request. Use this value as previous_search_id in subsequent - requests to perform incremental searches. Required.""" - memories: list["_models.MemorySearchItem"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Related memory items found during the search operation. Required.""" - usage: "_models.MemoryStoreOperationUsage" = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Usage statistics associated with the memory search operation. Required.""" + type: Literal[OutputItemType.APPLY_PATCH_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the apply patch tool call. Populated when this item is returned via API. + Required.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the apply patch tool call generated by the model. Required.""" + status: Union[str, "_models.ApplyPatchCallStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the apply patch tool call. One of ``in_progress`` or ``completed``. Required. + Known values are: \"in_progress\" and \"completed\".""" + operation: "_models.ApplyPatchFileOperation" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Apply patch operation. Required.""" + created_by: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ID of the entity that created this tool call.""" @overload def __init__( self, *, - search_id: str, - memories: list["_models.MemorySearchItem"], - usage: "_models.MemoryStoreOperationUsage", + id: str, # pylint: disable=redefined-builtin + call_id: str, + status: Union[str, "_models.ApplyPatchCallStatus"], + operation: "_models.ApplyPatchFileOperation", + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + created_by: Optional[str] = None, ) -> None: ... @overload @@ -8271,31 +15164,60 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = OutputItemType.APPLY_PATCH_CALL # type: ignore -class MemoryStoreUpdateCompletedResult(_Model): - """Memory update result. +class OutputItemApplyPatchToolCallOutput(OutputItem, discriminator="apply_patch_call_output"): + """Apply patch tool call output. - :ivar memory_operations: A list of individual memory operations that were performed during the - update. Required. - :vartype memory_operations: list[~azure.ai.projects.models.MemoryOperation] - :ivar usage: Usage statistics associated with the memory update operation. Required. - :vartype usage: ~azure.ai.projects.models.MemoryStoreOperationUsage + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``apply_patch_call_output``. Required. + APPLY_PATCH_CALL_OUTPUT. + :vartype type: str or ~azure.ai.projects.models.APPLY_PATCH_CALL_OUTPUT + :ivar id: The unique ID of the apply patch tool call output. Populated when this item is + returned via API. Required. + :vartype id: str + :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. + :vartype call_id: str + :ivar status: The status of the apply patch tool call output. One of ``completed`` or + ``failed``. Required. Known values are: "completed" and "failed". + :vartype status: str or ~azure.ai.projects.models.ApplyPatchCallOutputStatus + :ivar output: + :vartype output: str + :ivar created_by: The ID of the entity that created this tool call output. + :vartype created_by: str """ - memory_operations: list["_models.MemoryOperation"] = rest_field( + type: Literal[OutputItemType.APPLY_PATCH_CALL_OUTPUT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the item. Always ``apply_patch_call_output``. Required. APPLY_PATCH_CALL_OUTPUT.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the apply patch tool call output. Populated when this item is returned via + API. Required.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the apply patch tool call generated by the model. Required.""" + status: Union[str, "_models.ApplyPatchCallOutputStatus"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """A list of individual memory operations that were performed during the update. Required.""" - usage: "_models.MemoryStoreOperationUsage" = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Usage statistics associated with the memory update operation. Required.""" + """The status of the apply patch tool call output. One of ``completed`` or ``failed``. Required. + Known values are: \"completed\" and \"failed\".""" + output: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + created_by: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ID of the entity that created this tool call output.""" @overload def __init__( self, *, - memory_operations: list["_models.MemoryOperation"], - usage: "_models.MemoryStoreOperationUsage", + id: str, # pylint: disable=redefined-builtin + call_id: str, + status: Union[str, "_models.ApplyPatchCallOutputStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + output: Optional[str] = None, + created_by: Optional[str] = None, ) -> None: ... @overload @@ -8307,53 +15229,67 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = OutputItemType.APPLY_PATCH_CALL_OUTPUT # type: ignore -class MemoryStoreUpdateResult(_Model): - """Provides the status of a memory store update operation. +class OutputItemCodeInterpreterToolCall(OutputItem, discriminator="code_interpreter_call"): + """Code interpreter tool call. - :ivar update_id: The unique ID of this update request. Use this value as previous_update_id in - subsequent requests to perform incremental updates. Required. - :vartype update_id: str - :ivar status: The status of the memory update operation. One of "queued", "in_progress", - "completed", "failed", or "superseded". Required. Known values are: "queued", "in_progress", - "completed", "failed", and "superseded". - :vartype status: str or ~azure.ai.projects.models.MemoryStoreUpdateStatus - :ivar superseded_by: The update_id the operation was superseded by when status is "superseded". - :vartype superseded_by: str - :ivar result: The result of memory store update operation when status is "completed". - :vartype result: ~azure.ai.projects.models.MemoryStoreUpdateCompletedResult - :ivar error: Error object that describes the error when status is "failed". - :vartype error: ~azure.ai.projects.models.ApiError + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the code interpreter tool call. Always ``code_interpreter_call``. + Required. CODE_INTERPRETER_CALL. + :vartype type: str or ~azure.ai.projects.models.CODE_INTERPRETER_CALL + :ivar id: The unique ID of the code interpreter tool call. Required. + :vartype id: str + :ivar status: The status of the code interpreter tool call. Valid values are ``in_progress``, + ``completed``, ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the + following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"], + Literal["interpreting"], Literal["failed"] + :vartype status: str or str or str or str or str + :ivar container_id: The ID of the container used to run the code. Required. + :vartype container_id: str + :ivar code: Required. + :vartype code: str + :ivar outputs: Required. + :vartype outputs: list[~azure.ai.projects.models.CodeInterpreterOutputLogs or + ~azure.ai.projects.models.CodeInterpreterOutputImage] """ - update_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The unique ID of this update request. Use this value as previous_update_id in subsequent - requests to perform incremental updates. Required.""" - status: Union[str, "_models.MemoryStoreUpdateStatus"] = rest_field( + type: Literal[OutputItemType.CODE_INTERPRETER_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the code interpreter tool call. Always ``code_interpreter_call``. Required. + CODE_INTERPRETER_CALL.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the code interpreter tool call. Required.""" + status: Literal["in_progress", "completed", "incomplete", "interpreting", "failed"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The status of the memory update operation. One of \"queued\", \"in_progress\", \"completed\", - \"failed\", or \"superseded\". Required. Known values are: \"queued\", \"in_progress\", - \"completed\", \"failed\", and \"superseded\".""" - superseded_by: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The update_id the operation was superseded by when status is \"superseded\".""" - result: Optional["_models.MemoryStoreUpdateCompletedResult"] = rest_field( + """The status of the code interpreter tool call. Valid values are ``in_progress``, ``completed``, + ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"], + Literal[\"interpreting\"], Literal[\"failed\"]""" + container_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ID of the container used to run the code. Required.""" + code: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + outputs: list[Union["_models.CodeInterpreterOutputLogs", "_models.CodeInterpreterOutputImage"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The result of memory store update operation when status is \"completed\".""" - error: Optional["_models.ApiError"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Error object that describes the error when status is \"failed\".""" + """Required.""" @overload def __init__( self, *, - update_id: str, - status: Union[str, "_models.MemoryStoreUpdateStatus"], - superseded_by: Optional[str] = None, - result: Optional["_models.MemoryStoreUpdateCompletedResult"] = None, - error: Optional["_models.ApiError"] = None, + id: str, # pylint: disable=redefined-builtin + status: Literal["in_progress", "completed", "incomplete", "interpreting", "failed"], + container_id: str, + code: str, + outputs: list[Union["_models.CodeInterpreterOutputLogs", "_models.CodeInterpreterOutputImage"]], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, ) -> None: ... @overload @@ -8365,41 +15301,44 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = OutputItemType.CODE_INTERPRETER_CALL # type: ignore -class MicrosoftFabricPreviewTool(Tool, discriminator="fabric_dataagent_preview"): - """The input definition information for a Microsoft Fabric tool as used to configure an agent. +class OutputItemCompactionBody(OutputItem, discriminator="compaction"): + """Compaction item. - :ivar type: The object type, which is always 'fabric_dataagent_preview'. Required. - FABRIC_DATAAGENT_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.FABRIC_DATAAGENT_PREVIEW - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar fabric_dataagent_preview: The fabric data agent tool parameters. Required. - :vartype fabric_dataagent_preview: ~azure.ai.projects.models.FabricDataAgentToolParameters + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``compaction``. Required. COMPACTION. + :vartype type: str or ~azure.ai.projects.models.COMPACTION + :ivar id: The unique ID of the compaction item. Required. + :vartype id: str + :ivar encrypted_content: The encrypted content that was produced by compaction. Required. + :vartype encrypted_content: str + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str """ - type: Literal[ToolType.FABRIC_DATAAGENT_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The object type, which is always 'fabric_dataagent_preview'. Required. - FABRIC_DATAAGENT_PREVIEW.""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" - fabric_dataagent_preview: "_models.FabricDataAgentToolParameters" = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The fabric data agent tool parameters. Required.""" + type: Literal[OutputItemType.COMPACTION] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the item. Always ``compaction``. Required. COMPACTION.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the compaction item. Required.""" + encrypted_content: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The encrypted content that was produced by compaction. Required.""" + created_by: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The identifier of the actor that created the item.""" @overload def __init__( self, *, - fabric_dataagent_preview: "_models.FabricDataAgentToolParameters", - name: Optional[str] = None, - description: Optional[str] = None, + id: str, # pylint: disable=redefined-builtin + encrypted_content: str, + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + created_by: Optional[str] = None, ) -> None: ... @overload @@ -8411,48 +15350,62 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.FABRIC_DATAAGENT_PREVIEW # type: ignore + self.type = OutputItemType.COMPACTION # type: ignore -class ModelDeployment(Deployment, discriminator="ModelDeployment"): - """Model Deployment Definition. - - :ivar name: Name of the deployment. Required. - :vartype name: str - :ivar type: The type of the deployment. Required. Model deployment. - :vartype type: str or ~azure.ai.projects.models.MODEL_DEPLOYMENT - :ivar model_name: Publisher-specific name of the deployed model. Required. - :vartype model_name: str - :ivar model_version: Publisher-specific version of the deployed model. Required. - :vartype model_version: str - :ivar model_publisher: Name of the deployed model's publisher. Required. - :vartype model_publisher: str - :ivar capabilities: Capabilities of deployed model. Required. - :vartype capabilities: dict[str, str] - :ivar sku: Sku of the model deployment. Required. - :vartype sku: ~azure.ai.projects.models.ModelDeploymentSku - :ivar connection_name: Name of the connection the deployment comes from. - :vartype connection_name: str - """ +class OutputItemComputerToolCall(OutputItem, discriminator="computer_call"): + """Computer tool call. - type: Literal[DeploymentType.MODEL_DEPLOYMENT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The type of the deployment. Required. Model deployment.""" - model_name: str = rest_field(name="modelName", visibility=["read"]) - """Publisher-specific name of the deployed model. Required.""" - model_version: str = rest_field(name="modelVersion", visibility=["read"]) - """Publisher-specific version of the deployed model. Required.""" - model_publisher: str = rest_field(name="modelPublisher", visibility=["read"]) - """Name of the deployed model's publisher. Required.""" - capabilities: dict[str, str] = rest_field(visibility=["read"]) - """Capabilities of deployed model. Required.""" - sku: "_models.ModelDeploymentSku" = rest_field(visibility=["read"]) - """Sku of the model deployment. Required.""" - connection_name: Optional[str] = rest_field(name="connectionName", visibility=["read"]) - """Name of the connection the deployment comes from.""" + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL. + :vartype type: str or ~azure.ai.projects.models.COMPUTER_CALL + :ivar id: The unique ID of the computer call. Required. + :vartype id: str + :ivar call_id: An identifier used when responding to the tool call with output. Required. + :vartype call_id: str + :ivar action: Required. + :vartype action: ~azure.ai.projects.models.ComputerAction + :ivar pending_safety_checks: The pending safety checks for the computer call. Required. + :vartype pending_safety_checks: list[~azure.ai.projects.models.ComputerCallSafetyCheckParam] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str + """ + + type: Literal[OutputItemType.COMPUTER_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the computer call. Required.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """An identifier used when responding to the tool call with output. Required.""" + action: "_models.ComputerAction" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + pending_safety_checks: list["_models.ComputerCallSafetyCheckParam"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The pending safety checks for the computer call. Required.""" + status: Literal["in_progress", "completed", "incomplete"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" @overload def __init__( self, + *, + id: str, # pylint: disable=redefined-builtin + call_id: str, + action: "_models.ComputerAction", + pending_safety_checks: list["_models.ComputerCallSafetyCheckParam"], + status: Literal["in_progress", "completed", "incomplete"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, ) -> None: ... @overload @@ -8464,44 +15417,50 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = DeploymentType.MODEL_DEPLOYMENT # type: ignore + self.type = OutputItemType.COMPUTER_CALL # type: ignore -class ModelDeploymentSku(_Model): - """Sku information. +class OutputItemCustomToolCall(OutputItem, discriminator="custom_tool_call"): + """Custom tool call. - :ivar capacity: Sku capacity. Required. - :vartype capacity: int - :ivar family: Sku family. Required. - :vartype family: str - :ivar name: Sku name. Required. + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the custom tool call. Always ``custom_tool_call``. Required. + CUSTOM_TOOL_CALL. + :vartype type: str or ~azure.ai.projects.models.CUSTOM_TOOL_CALL + :ivar id: The unique ID of the custom tool call in the OpenAI platform. + :vartype id: str + :ivar call_id: An identifier used to map this custom tool call to a tool call output. Required. + :vartype call_id: str + :ivar name: The name of the custom tool being called. Required. :vartype name: str - :ivar size: Sku size. Required. - :vartype size: str - :ivar tier: Sku tier. Required. - :vartype tier: str + :ivar input: The input for the custom tool call generated by the model. Required. + :vartype input: str """ - capacity: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Sku capacity. Required.""" - family: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Sku family. Required.""" + type: Literal[OutputItemType.CUSTOM_TOOL_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the custom tool call. Always ``custom_tool_call``. Required. CUSTOM_TOOL_CALL.""" + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the custom tool call in the OpenAI platform.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """An identifier used to map this custom tool call to a tool call output. Required.""" name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Sku name. Required.""" - size: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Sku size. Required.""" - tier: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Sku tier. Required.""" + """The name of the custom tool being called. Required.""" + input: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The input for the custom tool call generated by the model. Required.""" @overload def __init__( self, *, - capacity: int, - family: str, + call_id: str, name: str, - size: str, - tier: str, + input: str, + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin ) -> None: ... @overload @@ -8513,39 +15472,57 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = OutputItemType.CUSTOM_TOOL_CALL # type: ignore -class ModelSamplingParams(_Model): - """Represents a set of parameters used to control the sampling behavior of a language model during - text generation. +class OutputItemFileSearchToolCall(OutputItem, discriminator="file_search_call"): + """File search tool call. - :ivar temperature: The temperature parameter for sampling. Defaults to 1.0. - :vartype temperature: float - :ivar top_p: The top-p parameter for nucleus sampling. Defaults to 1.0. - :vartype top_p: float - :ivar seed: The random seed for reproducibility. Defaults to 42. - :vartype seed: int - :ivar max_completion_tokens: The maximum number of tokens allowed in the completion. - :vartype max_completion_tokens: int + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: The unique ID of the file search tool call. Required. + :vartype id: str + :ivar type: The type of the file search tool call. Always ``file_search_call``. Required. + FILE_SEARCH_CALL. + :vartype type: str or ~azure.ai.projects.models.FILE_SEARCH_CALL + :ivar status: The status of the file search tool call. One of ``in_progress``, ``searching``, + ``incomplete`` or ``failed``,. Required. Is one of the following types: Literal["in_progress"], + Literal["searching"], Literal["completed"], Literal["incomplete"], Literal["failed"] + :vartype status: str or str or str or str or str + :ivar queries: The queries used to search for files. Required. + :vartype queries: list[str] + :ivar results: + :vartype results: list[~azure.ai.projects.models.FileSearchToolCallResults] """ - temperature: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The temperature parameter for sampling. Defaults to 1.0.""" - top_p: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The top-p parameter for nucleus sampling. Defaults to 1.0.""" - seed: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The random seed for reproducibility. Defaults to 42.""" - max_completion_tokens: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The maximum number of tokens allowed in the completion.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the file search tool call. Required.""" + type: Literal[OutputItemType.FILE_SEARCH_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the file search tool call. Always ``file_search_call``. Required. FILE_SEARCH_CALL.""" + status: Literal["in_progress", "searching", "completed", "incomplete", "failed"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the file search tool call. One of ``in_progress``, ``searching``, ``incomplete`` + or ``failed``,. Required. Is one of the following types: Literal[\"in_progress\"], + Literal[\"searching\"], Literal[\"completed\"], Literal[\"incomplete\"], Literal[\"failed\"]""" + queries: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The queries used to search for files. Required.""" + results: Optional[list["_models.FileSearchToolCallResults"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) @overload def __init__( self, *, - temperature: Optional[float] = None, - top_p: Optional[float] = None, - seed: Optional[int] = None, - max_completion_tokens: Optional[int] = None, + id: str, # pylint: disable=redefined-builtin + status: Literal["in_progress", "searching", "completed", "incomplete", "failed"], + queries: list[str], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + results: Optional[list["_models.FileSearchToolCallResults"]] = None, ) -> None: ... @overload @@ -8557,29 +15534,66 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = OutputItemType.FILE_SEARCH_CALL # type: ignore -class MonthlyRecurrenceSchedule(RecurrenceSchedule, discriminator="Monthly"): - """Monthly recurrence schedule. +class OutputItemFunctionShellCall(OutputItem, discriminator="shell_call"): + """Shell tool call. - :ivar type: Monthly recurrence type. Required. Monthly recurrence pattern. - :vartype type: str or ~azure.ai.projects.models.MONTHLY - :ivar days_of_month: Days of the month for the recurrence schedule. Required. - :vartype days_of_month: list[int] + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``shell_call``. Required. SHELL_CALL. + :vartype type: str or ~azure.ai.projects.models.SHELL_CALL + :ivar id: The unique ID of the shell tool call. Populated when this item is returned via API. + Required. + :vartype id: str + :ivar call_id: The unique ID of the shell tool call generated by the model. Required. + :vartype call_id: str + :ivar action: The shell commands and limits that describe how to run the tool call. Required. + :vartype action: ~azure.ai.projects.models.FunctionShellAction + :ivar status: The status of the shell call. One of ``in_progress``, ``completed``, or + ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete". + :vartype status: str or ~azure.ai.projects.models.LocalShellCallStatus + :ivar environment: Required. + :vartype environment: ~azure.ai.projects.models.FunctionShellCallEnvironment + :ivar created_by: The ID of the entity that created this tool call. + :vartype created_by: str """ - type: Literal[RecurrenceType.MONTHLY] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Monthly recurrence type. Required. Monthly recurrence pattern.""" - days_of_month: list[int] = rest_field( - name="daysOfMonth", visibility=["read", "create", "update", "delete", "query"] + type: Literal[OutputItemType.SHELL_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the item. Always ``shell_call``. Required. SHELL_CALL.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the shell tool call. Populated when this item is returned via API. Required.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the shell tool call generated by the model. Required.""" + action: "_models.FunctionShellAction" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The shell commands and limits that describe how to run the tool call. Required.""" + status: Union[str, "_models.LocalShellCallStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Days of the month for the recurrence schedule. Required.""" + """The status of the shell call. One of ``in_progress``, ``completed``, or ``incomplete``. + Required. Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" + environment: "_models.FunctionShellCallEnvironment" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Required.""" + created_by: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ID of the entity that created this tool call.""" @overload def __init__( self, *, - days_of_month: list[int], + id: str, # pylint: disable=redefined-builtin + call_id: str, + action: "_models.FunctionShellAction", + status: Union[str, "_models.LocalShellCallStatus"], + environment: "_models.FunctionShellCallEnvironment", + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + created_by: Optional[str] = None, ) -> None: ... @overload @@ -8591,22 +15605,67 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = RecurrenceType.MONTHLY # type: ignore + self.type = OutputItemType.SHELL_CALL # type: ignore -class NoAuthenticationCredentials(BaseCredentials, discriminator="None"): - """Credentials that do not require authentication. +class OutputItemFunctionShellCallOutput(OutputItem, discriminator="shell_call_output"): + """Shell call output. - :ivar type: The credential type. Required. No credential. - :vartype type: str or ~azure.ai.projects.models.NONE + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the shell call output. Always ``shell_call_output``. Required. + SHELL_CALL_OUTPUT. + :vartype type: str or ~azure.ai.projects.models.SHELL_CALL_OUTPUT + :ivar id: The unique ID of the shell call output. Populated when this item is returned via API. + Required. + :vartype id: str + :ivar call_id: The unique ID of the shell tool call generated by the model. Required. + :vartype call_id: str + :ivar status: The status of the shell call output. One of ``in_progress``, ``completed``, or + ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete". + :vartype status: str or ~azure.ai.projects.models.LocalShellCallOutputStatusEnum + :ivar output: An array of shell call output contents. Required. + :vartype output: list[~azure.ai.projects.models.FunctionShellCallOutputContent] + :ivar max_output_length: Required. + :vartype max_output_length: int + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str """ - type: Literal[CredentialType.NONE] = rest_discriminator(name="type", visibility=["read"]) # type: ignore - """The credential type. Required. No credential.""" + type: Literal[OutputItemType.SHELL_CALL_OUTPUT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the shell call output. Always ``shell_call_output``. Required. SHELL_CALL_OUTPUT.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the shell call output. Populated when this item is returned via API. Required.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the shell tool call generated by the model. Required.""" + status: Union[str, "_models.LocalShellCallOutputStatusEnum"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the shell call output. One of ``in_progress``, ``completed``, or ``incomplete``. + Required. Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" + output: list["_models.FunctionShellCallOutputContent"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """An array of shell call output contents. Required.""" + max_output_length: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + created_by: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The identifier of the actor that created the item.""" @overload def __init__( self, + *, + id: str, # pylint: disable=redefined-builtin + call_id: str, + status: Union[str, "_models.LocalShellCallOutputStatusEnum"], + output: list["_models.FunctionShellCallOutputContent"], + max_output_length: int, + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + created_by: Optional[str] = None, ) -> None: ... @overload @@ -8618,35 +15677,61 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = CredentialType.NONE # type: ignore - + self.type = OutputItemType.SHELL_CALL_OUTPUT # type: ignore -class OneTimeTrigger(Trigger, discriminator="OneTime"): - """One-time trigger. - :ivar type: Required. One-time trigger. - :vartype type: str or ~azure.ai.projects.models.ONE_TIME - :ivar trigger_at: Date and time for the one-time trigger in ISO 8601 format. Required. - :vartype trigger_at: ~datetime.datetime - :ivar time_zone: Time zone for the one-time trigger. - :vartype time_zone: str - """ +class OutputItemFunctionToolCall(OutputItem, discriminator="function_call"): + """Function tool call. - type: Literal[TriggerType.ONE_TIME] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. One-time trigger.""" - trigger_at: datetime.datetime = rest_field( - name="triggerAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: The unique ID of the function tool call. + :vartype id: str + :ivar type: The type of the function tool call. Always ``function_call``. Required. + FUNCTION_CALL. + :vartype type: str or ~azure.ai.projects.models.FUNCTION_CALL + :ivar call_id: The unique ID of the function tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the function to run. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the function. Required. + :vartype arguments: str + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the function tool call.""" + type: Literal[OutputItemType.FUNCTION_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the function tool call. Always ``function_call``. Required. FUNCTION_CALL.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the function tool call generated by the model. Required.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the function to run. Required.""" + arguments: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A JSON string of the arguments to pass to the function. Required.""" + status: Optional[Literal["in_progress", "completed", "incomplete"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Date and time for the one-time trigger in ISO 8601 format. Required.""" - time_zone: Optional[str] = rest_field(name="timeZone", visibility=["read", "create", "update", "delete", "query"]) - """Time zone for the one-time trigger.""" + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Is one of the following types: Literal[\"in_progress\"], + Literal[\"completed\"], Literal[\"incomplete\"]""" @overload def __init__( self, *, - trigger_at: datetime.datetime, - time_zone: Optional[str] = None, + call_id: str, + name: str, + arguments: str, + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + status: Optional[Literal["in_progress", "completed", "incomplete"]] = None, ) -> None: ... @overload @@ -8658,30 +15743,50 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = TriggerType.ONE_TIME # type: ignore + self.type = OutputItemType.FUNCTION_CALL # type: ignore -class OpenApiAuthDetails(_Model): - """authentication details for OpenApiFunctionDefinition. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - OpenApiAnonymousAuthDetails, OpenApiManagedAuthDetails, OpenApiProjectConnectionAuthDetails +class OutputItemImageGenToolCall(OutputItem, discriminator="image_generation_call"): + """Image generation call. - :ivar type: The type of authentication, must be anonymous/project_connection/managed_identity. - Required. Known values are: "anonymous", "project_connection", and "managed_identity". - :vartype type: str or ~azure.ai.projects.models.OpenApiAuthType + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the image generation call. Always ``image_generation_call``. Required. + IMAGE_GENERATION_CALL. + :vartype type: str or ~azure.ai.projects.models.IMAGE_GENERATION_CALL + :ivar id: The unique ID of the image generation call. Required. + :vartype id: str + :ivar status: The status of the image generation call. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["generating"], Literal["failed"] + :vartype status: str or str or str or str + :ivar result: Required. + :vartype result: str """ - __mapping__: dict[str, _Model] = {} - type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) - """The type of authentication, must be anonymous/project_connection/managed_identity. Required. - Known values are: \"anonymous\", \"project_connection\", and \"managed_identity\".""" + type: Literal[OutputItemType.IMAGE_GENERATION_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the image generation call. Always ``image_generation_call``. Required. + IMAGE_GENERATION_CALL.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the image generation call. Required.""" + status: Literal["in_progress", "completed", "generating", "failed"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the image generation call. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"generating\"], Literal[\"failed\"]""" + result: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" @overload def __init__( self, *, - type: str, + id: str, # pylint: disable=redefined-builtin + status: Literal["in_progress", "completed", "generating", "failed"], + result: str, + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, ) -> None: ... @overload @@ -8693,21 +15798,54 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = OutputItemType.IMAGE_GENERATION_CALL # type: ignore -class OpenApiAnonymousAuthDetails(OpenApiAuthDetails, discriminator="anonymous"): - """Security details for OpenApi anonymous authentication. +class OutputItemLocalShellToolCall(OutputItem, discriminator="local_shell_call"): + """Local shell call. - :ivar type: The object type, which is always 'anonymous'. Required. ANONYMOUS. - :vartype type: str or ~azure.ai.projects.models.ANONYMOUS + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the local shell call. Always ``local_shell_call``. Required. + LOCAL_SHELL_CALL. + :vartype type: str or ~azure.ai.projects.models.LOCAL_SHELL_CALL + :ivar id: The unique ID of the local shell call. Required. + :vartype id: str + :ivar call_id: The unique ID of the local shell tool call generated by the model. Required. + :vartype call_id: str + :ivar action: Required. + :vartype action: ~azure.ai.projects.models.LocalShellExecAction + :ivar status: The status of the local shell call. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str """ - type: Literal[OpenApiAuthType.ANONYMOUS] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The object type, which is always 'anonymous'. Required. ANONYMOUS.""" + type: Literal[OutputItemType.LOCAL_SHELL_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the local shell call. Always ``local_shell_call``. Required. LOCAL_SHELL_CALL.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the local shell call. Required.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the local shell tool call generated by the model. Required.""" + action: "_models.LocalShellExecAction" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + status: Literal["in_progress", "completed", "incomplete"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the local shell call. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" @overload def __init__( self, + *, + id: str, # pylint: disable=redefined-builtin + call_id: str, + action: "_models.LocalShellExecAction", + status: Literal["in_progress", "completed", "incomplete"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, ) -> None: ... @overload @@ -8719,50 +15857,50 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = OpenApiAuthType.ANONYMOUS # type: ignore + self.type = OutputItemType.LOCAL_SHELL_CALL # type: ignore -class OpenApiFunctionDefinition(_Model): - """The input definition information for an openapi function. +class OutputItemMcpApprovalRequest(OutputItem, discriminator="mcp_approval_request"): + """MCP approval request. - :ivar name: The name of the function to be called. Required. + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``mcp_approval_request``. Required. + MCP_APPROVAL_REQUEST. + :vartype type: str or ~azure.ai.projects.models.MCP_APPROVAL_REQUEST + :ivar id: The unique ID of the approval request. Required. + :vartype id: str + :ivar server_label: The label of the MCP server making the request. Required. + :vartype server_label: str + :ivar name: The name of the tool to run. Required. :vartype name: str - :ivar description: A description of what the function does, used by the model to choose when - and how to call the function. - :vartype description: str - :ivar spec: The openapi function shape, described as a JSON Schema object. Required. - :vartype spec: dict[str, any] - :ivar auth: Open API authentication details. Required. - :vartype auth: ~azure.ai.projects.models.OpenApiAuthDetails - :ivar default_params: List of OpenAPI spec parameters that will use user-provided defaults. - :vartype default_params: list[str] - :ivar functions: List of function definitions used by OpenApi tool. - :vartype functions: list[~azure.ai.projects.models.OpenApiFunctionDefinitionFunction] + :ivar arguments: A JSON string of arguments for the tool. Required. + :vartype arguments: str """ + type: Literal[OutputItemType.MCP_APPROVAL_REQUEST] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the item. Always ``mcp_approval_request``. Required. MCP_APPROVAL_REQUEST.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the approval request. Required.""" + server_label: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The label of the MCP server making the request. Required.""" name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The name of the function to be called. Required.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """A description of what the function does, used by the model to choose when and how to call the - function.""" - spec: dict[str, Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The openapi function shape, described as a JSON Schema object. Required.""" - auth: "_models.OpenApiAuthDetails" = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Open API authentication details. Required.""" - default_params: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """List of OpenAPI spec parameters that will use user-provided defaults.""" - functions: Optional[list["_models.OpenApiFunctionDefinitionFunction"]] = rest_field(visibility=["read"]) - """List of function definitions used by OpenApi tool.""" + """The name of the tool to run. Required.""" + arguments: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A JSON string of arguments for the tool. Required.""" @overload def __init__( self, *, + id: str, # pylint: disable=redefined-builtin + server_label: str, name: str, - spec: dict[str, Any], - auth: "_models.OpenApiAuthDetails", - description: Optional[str] = None, - default_params: Optional[list[str]] = None, + arguments: str, + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, ) -> None: ... @overload @@ -8774,36 +15912,48 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = OutputItemType.MCP_APPROVAL_REQUEST # type: ignore -class OpenApiFunctionDefinitionFunction(_Model): - """OpenApiFunctionDefinitionFunction. +class OutputItemMcpListTools(OutputItem, discriminator="mcp_list_tools"): + """MCP list tools. - :ivar name: The name of the function to be called. Required. - :vartype name: str - :ivar description: A description of what the function does, used by the model to choose when - and how to call the function. - :vartype description: str - :ivar parameters: The parameters the functions accepts, described as a JSON Schema object. - Required. - :vartype parameters: dict[str, any] + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS. + :vartype type: str or ~azure.ai.projects.models.MCP_LIST_TOOLS + :ivar id: The unique ID of the list. Required. + :vartype id: str + :ivar server_label: The label of the MCP server. Required. + :vartype server_label: str + :ivar tools: The tools available on the server. Required. + :vartype tools: list[~azure.ai.projects.models.MCPListToolsTool] + :ivar error: + :vartype error: str """ - name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The name of the function to be called. Required.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """A description of what the function does, used by the model to choose when and how to call the - function.""" - parameters: dict[str, Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The parameters the functions accepts, described as a JSON Schema object. Required.""" + type: Literal[OutputItemType.MCP_LIST_TOOLS] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the list. Required.""" + server_label: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The label of the MCP server. Required.""" + tools: list["_models.MCPListToolsTool"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The tools available on the server. Required.""" + error: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @overload def __init__( self, *, - name: str, - parameters: dict[str, Any], - description: Optional[str] = None, + id: str, # pylint: disable=redefined-builtin + server_label: str, + tools: list["_models.MCPListToolsTool"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + error: Optional[str] = None, ) -> None: ... @overload @@ -8815,29 +15965,72 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = OutputItemType.MCP_LIST_TOOLS # type: ignore -class OpenApiManagedAuthDetails(OpenApiAuthDetails, discriminator="managed_identity"): - """Security details for OpenApi managed_identity authentication. - - :ivar type: The object type, which is always 'managed_identity'. Required. MANAGED_IDENTITY. - :vartype type: str or ~azure.ai.projects.models.MANAGED_IDENTITY - :ivar security_scheme: Connection auth security details. Required. - :vartype security_scheme: ~azure.ai.projects.models.OpenApiManagedSecurityScheme - """ +class OutputItemMcpToolCall(OutputItem, discriminator="mcp_call"): + """MCP tool call. - type: Literal[OpenApiAuthType.MANAGED_IDENTITY] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The object type, which is always 'managed_identity'. Required. MANAGED_IDENTITY.""" - security_scheme: "_models.OpenApiManagedSecurityScheme" = rest_field( + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``mcp_call``. Required. MCP_CALL. + :vartype type: str or ~azure.ai.projects.models.MCP_CALL + :ivar id: The unique ID of the tool call. Required. + :vartype id: str + :ivar server_label: The label of the MCP server running the tool. Required. + :vartype server_label: str + :ivar name: The name of the tool that was run. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments passed to the tool. Required. + :vartype arguments: str + :ivar output: + :vartype output: str + :ivar error: + :vartype error: dict[str, any] + :ivar status: The status of the tool call. One of ``in_progress``, ``completed``, + ``incomplete``, ``calling``, or ``failed``. Known values are: "in_progress", "completed", + "incomplete", "calling", and "failed". + :vartype status: str or ~azure.ai.projects.models.MCPToolCallStatus + :ivar approval_request_id: + :vartype approval_request_id: str + """ + + type: Literal[OutputItemType.MCP_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the item. Always ``mcp_call``. Required. MCP_CALL.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the tool call. Required.""" + server_label: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The label of the MCP server running the tool. Required.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the tool that was run. Required.""" + arguments: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A JSON string of the arguments passed to the tool. Required.""" + output: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + error: Optional[dict[str, Any]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + status: Optional[Union[str, "_models.MCPToolCallStatus"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Connection auth security details. Required.""" + """The status of the tool call. One of ``in_progress``, ``completed``, ``incomplete``, + ``calling``, or ``failed``. Known values are: \"in_progress\", \"completed\", \"incomplete\", + \"calling\", and \"failed\".""" + approval_request_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @overload def __init__( self, *, - security_scheme: "_models.OpenApiManagedSecurityScheme", + id: str, # pylint: disable=redefined-builtin + server_label: str, + name: str, + arguments: str, + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + output: Optional[str] = None, + error: Optional[dict[str, Any]] = None, + status: Optional[Union[str, "_models.MCPToolCallStatus"]] = None, + approval_request_id: Optional[str] = None, ) -> None: ... @overload @@ -8849,24 +16042,57 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = OpenApiAuthType.MANAGED_IDENTITY # type: ignore + self.type = OutputItemType.MCP_CALL # type: ignore -class OpenApiManagedSecurityScheme(_Model): - """Security scheme for OpenApi managed_identity authentication. +class OutputItemOutputMessage(OutputItem, discriminator="output_message"): + """Output message. - :ivar audience: Authentication scope for managed_identity auth type. Required. - :vartype audience: str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: The unique ID of the output message. Required. + :vartype id: str + :ivar type: The type of the output message. Always ``message``. Required. OUTPUT_MESSAGE. + :vartype type: str or ~azure.ai.projects.models.OUTPUT_MESSAGE + :ivar role: The role of the output message. Always ``assistant``. Required. Default value is + "assistant". + :vartype role: str + :ivar content: The content of the output message. Required. + :vartype content: list[~azure.ai.projects.models.OutputMessageContent] + :ivar status: The status of the message input. One of ``in_progress``, ``completed``, or + ``incomplete``. Populated when input items are returned via API. Required. Is one of the + following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str """ - audience: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Authentication scope for managed_identity auth type. Required.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the output message. Required.""" + type: Literal[OutputItemType.OUTPUT_MESSAGE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the output message. Always ``message``. Required. OUTPUT_MESSAGE.""" + role: Literal["assistant"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The role of the output message. Always ``assistant``. Required. Default value is \"assistant\".""" + content: list["_models.OutputMessageContent"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The content of the output message. Required.""" + status: Literal["in_progress", "completed", "incomplete"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the message input. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when input items are returned via API. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" @overload def __init__( self, *, - audience: str, + id: str, # pylint: disable=redefined-builtin + content: list["_models.OutputMessageContent"], + status: Literal["in_progress", "completed", "incomplete"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, ) -> None: ... @overload @@ -8878,30 +16104,62 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = OutputItemType.OUTPUT_MESSAGE # type: ignore + self.role: Literal["assistant"] = "assistant" -class OpenApiProjectConnectionAuthDetails(OpenApiAuthDetails, discriminator="project_connection"): - """Security details for OpenApi project connection authentication. - - :ivar type: The object type, which is always 'project_connection'. Required. - PROJECT_CONNECTION. - :vartype type: str or ~azure.ai.projects.models.PROJECT_CONNECTION - :ivar security_scheme: Project connection auth security details. Required. - :vartype security_scheme: ~azure.ai.projects.models.OpenApiProjectConnectionSecurityScheme - """ +class OutputItemReasoningItem(OutputItem, discriminator="reasoning"): + """Reasoning. - type: Literal[OpenApiAuthType.PROJECT_CONNECTION] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The object type, which is always 'project_connection'. Required. PROJECT_CONNECTION.""" - security_scheme: "_models.OpenApiProjectConnectionSecurityScheme" = rest_field( + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the object. Always ``reasoning``. Required. REASONING. + :vartype type: str or ~azure.ai.projects.models.REASONING + :ivar id: The unique identifier of the reasoning content. Required. + :vartype id: str + :ivar encrypted_content: + :vartype encrypted_content: str + :ivar summary: Reasoning summary content. Required. + :vartype summary: list[~azure.ai.projects.models.SummaryTextContent] + :ivar content: Reasoning text content. + :vartype content: list[~azure.ai.projects.models.ReasoningTextContent] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str + """ + + type: Literal[OutputItemType.REASONING] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the object. Always ``reasoning``. Required. REASONING.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique identifier of the reasoning content. Required.""" + encrypted_content: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + summary: list["_models.SummaryTextContent"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Reasoning summary content. Required.""" + content: Optional[list["_models.ReasoningTextContent"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Project connection auth security details. Required.""" + """Reasoning text content.""" + status: Optional[Literal["in_progress", "completed", "incomplete"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Is one of the following types: Literal[\"in_progress\"], + Literal[\"completed\"], Literal[\"incomplete\"]""" @overload def __init__( self, *, - security_scheme: "_models.OpenApiProjectConnectionSecurityScheme", + id: str, # pylint: disable=redefined-builtin + summary: list["_models.SummaryTextContent"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + encrypted_content: Optional[str] = None, + content: Optional[list["_models.ReasoningTextContent"]] = None, + status: Optional[Literal["in_progress", "completed", "incomplete"]] = None, ) -> None: ... @overload @@ -8913,24 +16171,59 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = OpenApiAuthType.PROJECT_CONNECTION # type: ignore + self.type = OutputItemType.REASONING # type: ignore -class OpenApiProjectConnectionSecurityScheme(_Model): - """Security scheme for OpenApi managed_identity authentication. +class OutputItemWebSearchToolCall(OutputItem, discriminator="web_search_call"): + """Web search tool call. - :ivar project_connection_id: Project connection id for Project Connection auth type. Required. - :vartype project_connection_id: str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: The unique ID of the web search tool call. Required. + :vartype id: str + :ivar type: The type of the web search tool call. Always ``web_search_call``. Required. + WEB_SEARCH_CALL. + :vartype type: str or ~azure.ai.projects.models.WEB_SEARCH_CALL + :ivar status: The status of the web search tool call. Required. Is one of the following types: + Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["failed"] + :vartype status: str or str or str or str + :ivar action: An object describing the specific action taken in this web search call. Includes + details on how the model used the web (search, open_page, find_in_page). Required. Is one of + the following types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind + :vartype action: ~azure.ai.projects.models.WebSearchActionSearch or + ~azure.ai.projects.models.WebSearchActionOpenPage or + ~azure.ai.projects.models.WebSearchActionFind """ - project_connection_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Project connection id for Project Connection auth type. Required.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the web search tool call. Required.""" + type: Literal[OutputItemType.WEB_SEARCH_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the web search tool call. Always ``web_search_call``. Required. WEB_SEARCH_CALL.""" + status: Literal["in_progress", "searching", "completed", "failed"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the web search tool call. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"searching\"], Literal[\"completed\"], Literal[\"failed\"]""" + action: Union["_models.WebSearchActionSearch", "_models.WebSearchActionOpenPage", "_models.WebSearchActionFind"] = ( + rest_field(visibility=["read", "create", "update", "delete", "query"]) + ) + """An object describing the specific action taken in this web search call. Includes details on how + the model used the web (search, open_page, find_in_page). Required. Is one of the following + types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind""" @overload def __init__( self, *, - project_connection_id: str, + id: str, # pylint: disable=redefined-builtin + status: Literal["in_progress", "searching", "completed", "failed"], + action: Union[ + "_models.WebSearchActionSearch", "_models.WebSearchActionOpenPage", "_models.WebSearchActionFind" + ], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, ) -> None: ... @overload @@ -8942,29 +16235,28 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = OutputItemType.WEB_SEARCH_CALL # type: ignore -class OpenApiTool(Tool, discriminator="openapi"): - """The input definition information for an OpenAPI tool as used to configure an agent. +class OutputMessageContent(_Model): + """OutputMessageContent. - :ivar type: The object type, which is always 'openapi'. Required. OPENAPI. - :vartype type: str or ~azure.ai.projects.models.OPENAPI - :ivar openapi: The openapi function definition. Required. - :vartype openapi: ~azure.ai.projects.models.OpenApiFunctionDefinition + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + OutputMessageContentOutputTextContent, OutputMessageContentRefusalContent + + :ivar type: Required. Known values are: "output_text" and "refusal". + :vartype type: str or ~azure.ai.projects.models.OutputMessageContentType """ - type: Literal[ToolType.OPENAPI] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The object type, which is always 'openapi'. Required. OPENAPI.""" - openapi: "_models.OpenApiFunctionDefinition" = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The openapi function definition. Required.""" + __mapping__: dict[str, _Model] = {} + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """Required. Known values are: \"output_text\" and \"refusal\".""" @overload def __init__( self, *, - openapi: "_models.OpenApiFunctionDefinition", + type: str, ) -> None: ... @overload @@ -8976,43 +16268,37 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.OPENAPI # type: ignore - -class TelemetryEndpoint(_Model): - """A telemetry export endpoint configuration. - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - OtlpTelemetryEndpoint +class OutputMessageContentOutputTextContent(OutputMessageContent, discriminator="output_text"): + """Output text. - :ivar kind: The telemetry export endpoint kind. Required. "OTLP" - :vartype kind: str or ~azure.ai.projects.models.TelemetryEndpointKind - :ivar data: Data types to export to this endpoint. Use an empty array to export no data. - Required. - :vartype data: list[str or ~azure.ai.projects.models.TelemetryDataKind] - :ivar auth: Optional authentication configuration. - :vartype auth: ~azure.ai.projects.models.TelemetryEndpointAuth + :ivar type: The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT. + :vartype type: str or ~azure.ai.projects.models.OUTPUT_TEXT + :ivar text: The text output from the model. Required. + :vartype text: str + :ivar annotations: The annotations of the text output. Required. + :vartype annotations: list[~azure.ai.projects.models.Annotation] + :ivar logprobs: Required. + :vartype logprobs: list[~azure.ai.projects.models.LogProb] """ - __mapping__: dict[str, _Model] = {} - kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) - """The telemetry export endpoint kind. Required. \"OTLP\"""" - data: list[Union[str, "_models.TelemetryDataKind"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Data types to export to this endpoint. Use an empty array to export no data. Required.""" - auth: Optional["_models.TelemetryEndpointAuth"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Optional authentication configuration.""" + type: Literal[OutputMessageContentType.OUTPUT_TEXT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT.""" + text: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The text output from the model. Required.""" + annotations: list["_models.Annotation"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The annotations of the text output. Required.""" + logprobs: list["_models.LogProb"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" @overload def __init__( self, *, - kind: str, - data: list[Union[str, "_models.TelemetryDataKind"]], - auth: Optional["_models.TelemetryEndpointAuth"] = None, + text: str, + annotations: list["_models.Annotation"], + logprobs: list["_models.LogProb"], ) -> None: ... @overload @@ -9024,45 +16310,28 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = OutputMessageContentType.OUTPUT_TEXT # type: ignore -class OtlpTelemetryEndpoint(TelemetryEndpoint, discriminator="OTLP"): - """An OTLP (OpenTelemetry Protocol) telemetry export endpoint. +class OutputMessageContentRefusalContent(OutputMessageContent, discriminator="refusal"): + """Refusal. - :ivar data: Data types to export to this endpoint. Use an empty array to export no data. - Required. - :vartype data: list[str or ~azure.ai.projects.models.TelemetryDataKind] - :ivar auth: Optional authentication configuration. - :vartype auth: ~azure.ai.projects.models.TelemetryEndpointAuth - :ivar kind: The endpoint kind, always 'OTLP' for OpenTelemetry Protocol endpoints. Required. - OpenTelemetry Protocol (OTLP) endpoint. - :vartype kind: str or ~azure.ai.projects.models.OTLP - :ivar endpoint: The OTLP collector endpoint URL. Required. - :vartype endpoint: str - :ivar protocol: The transport protocol for the OTLP endpoint. Required. Known values are: - "Http" and "Grpc". - :vartype protocol: str or ~azure.ai.projects.models.TelemetryTransportProtocol + :ivar type: The type of the refusal. Always ``refusal``. Required. REFUSAL. + :vartype type: str or ~azure.ai.projects.models.REFUSAL + :ivar refusal: The refusal explanation from the model. Required. + :vartype refusal: str """ - kind: Literal[TelemetryEndpointKind.OTLP] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The endpoint kind, always 'OTLP' for OpenTelemetry Protocol endpoints. Required. OpenTelemetry - Protocol (OTLP) endpoint.""" - endpoint: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The OTLP collector endpoint URL. Required.""" - protocol: Union[str, "_models.TelemetryTransportProtocol"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The transport protocol for the OTLP endpoint. Required. Known values are: \"Http\" and - \"Grpc\".""" + type: Literal[OutputMessageContentType.REFUSAL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the refusal. Always ``refusal``. Required. REFUSAL.""" + refusal: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The refusal explanation from the model. Required.""" @overload def __init__( self, *, - data: list[Union[str, "_models.TelemetryDataKind"]], - endpoint: str, - protocol: Union[str, "_models.TelemetryTransportProtocol"], - auth: Optional["_models.TelemetryEndpointAuth"] = None, + refusal: str, ) -> None: ... @overload @@ -9074,7 +16343,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.kind = TelemetryEndpointKind.OTLP # type: ignore + self.type = OutputMessageContentType.REFUSAL # type: ignore class PendingUploadRequest(_Model): @@ -9085,8 +16354,8 @@ class PendingUploadRequest(_Model): :ivar connection_name: Azure Storage Account connection name to use for generating temporary SAS token. :vartype connection_name: str - :ivar pending_upload_type: BlobReference is the only supported type. Required. Blob Reference - is the only supported type. + :ivar pending_upload_type: The type of pending upload. Required. Deprecated: the service never + read this value and silently ignored it. Use TemporaryBlobReference instead. :vartype pending_upload_type: str or ~azure.ai.projects.models.BLOB_REFERENCE """ @@ -9101,7 +16370,8 @@ class PendingUploadRequest(_Model): pending_upload_type: Literal[PendingUploadType.BLOB_REFERENCE] = rest_field( name="pendingUploadType", visibility=["read", "create", "update", "delete", "query"] ) - """BlobReference is the only supported type. Required. Blob Reference is the only supported type.""" + """The type of pending upload. Required. Deprecated: the service never read this value and + silently ignored it. Use TemporaryBlobReference instead.""" @overload def __init__( @@ -9133,8 +16403,8 @@ class PendingUploadResult(_Model): :ivar version: Version of asset to be created if user did not specify version when initially creating upload. :vartype version: str - :ivar pending_upload_type: BlobReference is the only supported type. Required. Blob Reference - is the only supported type. + :ivar pending_upload_type: The type of pending upload. Required. Deprecated: the service never + read this value and silently ignored it. Use TemporaryBlobReference instead. :vartype pending_upload_type: str or ~azure.ai.projects.models.BLOB_REFERENCE """ @@ -9151,7 +16421,8 @@ class PendingUploadResult(_Model): pending_upload_type: Literal[PendingUploadType.BLOB_REFERENCE] = rest_field( name="pendingUploadType", visibility=["read", "create", "update", "delete", "query"] ) - """BlobReference is the only supported type. Required. Blob Reference is the only supported type.""" + """The type of pending upload. Required. Deprecated: the service never read this value and + silently ignored it. Use TemporaryBlobReference instead.""" @overload def __init__( @@ -9174,6 +16445,48 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class ProceduralMemoryItem(MemoryItem, discriminator="procedural"): + """A memory item containing a procedure extracted from conversations. + + :ivar memory_id: The unique ID of the memory item. Required. + :vartype memory_id: str + :ivar updated_at: The last update time of the memory item. Required. + :vartype updated_at: ~datetime.datetime + :ivar scope: The namespace that logically groups and isolates memories, such as a user ID. + Required. + :vartype scope: str + :ivar content: The content of the memory. Required. + :vartype content: str + :ivar kind: The kind of the memory item. Required. Routine procedures extracted from + conversations. + :vartype kind: str or ~azure.ai.projects.models.PROCEDURAL + """ + + kind: Literal[MemoryItemKind.PROCEDURAL] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The kind of the memory item. Required. Routine procedures extracted from conversations.""" + + @overload + def __init__( + self, + *, + memory_id: str, + updated_at: datetime.datetime, + scope: str, + content: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.kind = MemoryItemKind.PROCEDURAL # type: ignore + + class PromptAgentDefinition(AgentDefinition, discriminator="prompt"): """The prompt agent definition. @@ -9394,6 +16707,47 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = DataGenerationJobSourceType.PROMPT # type: ignore +class PromptEvaluationSuiteJobSource(EvaluationSuiteJobSource, discriminator="prompt"): + """Prompt source for evaluation suite generation jobs — inline text provided by the user. + + :ivar description: Optional description of what this source represents — helps the pipeline + interpret its content (e.g., 'Company refund policy document' or 'Describes the agent's core + capabilities'). + :vartype description: str + :ivar type: The source type for this source, which is Prompt. Required. Prompt source — inline + text provided by the user. + :vartype type: str or ~azure.ai.projects.models.PROMPT + :ivar prompt: Inline prompt text (e.g., agent description, policy text, supplementary context). + Required. + :vartype prompt: str + """ + + type: Literal[EvaluationSuiteJobSourceType.PROMPT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The source type for this source, which is Prompt. Required. Prompt source — inline text + provided by the user.""" + prompt: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Inline prompt text (e.g., agent description, policy text, supplementary context). Required.""" + + @overload + def __init__( + self, + *, + prompt: str, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = EvaluationSuiteJobSourceType.PROMPT # type: ignore + + class PromptEvaluatorGenerationJobSource(EvaluatorGenerationJobSource, discriminator="prompt"): """Prompt source for evaluator generation jobs — inline text provided by the user. @@ -9442,7 +16796,7 @@ class ProtocolVersionRecord(_Model): """A record mapping for a single protocol and its version. :ivar protocol: The protocol type. Required. Known values are: "activity_protocol", - "responses", and "invocations". + "responses", "mcp", and "invocations". :vartype protocol: str or ~azure.ai.projects.models.AgentProtocol :ivar version: The version string for the protocol, e.g. 'v0.1.1'. Required. :vartype version: str @@ -9451,8 +16805,8 @@ class ProtocolVersionRecord(_Model): protocol: Union[str, "_models.AgentProtocol"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The protocol type. Required. Known values are: \"activity_protocol\", \"responses\", and - \"invocations\".""" + """The protocol type. Required. Known values are: \"activity_protocol\", \"responses\", \"mcp\", + and \"invocations\".""" version: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The version string for the protocol, e.g. 'v0.1.1'. Required.""" @@ -9599,6 +16953,41 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class ReasoningTextContent(_Model): + """Reasoning text. + + :ivar type: The type of the reasoning text. Always ``reasoning_text``. Required. Default value + is "reasoning_text". + :vartype type: str + :ivar text: The reasoning text from the model. Required. + :vartype text: str + """ + + type: Literal["reasoning_text"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The type of the reasoning text. Always ``reasoning_text``. Required. Default value is + \"reasoning_text\".""" + text: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The reasoning text from the model. Required.""" + + @overload + def __init__( + self, + *, + text: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type: Literal["reasoning_text"] = "reasoning_text" + + class RecurrenceTrigger(Trigger, discriminator="Recurrence"): """Recurrence based trigger. @@ -9683,7 +17072,7 @@ class RedTeam(_Model): :ivar status: Status of the red-team. It is set by service and is read-only. :vartype status: str :ivar target: Target configuration for the red-team run. Required. - :vartype target: ~azure.ai.projects.models.TargetConfig + :vartype target: ~azure.ai.projects.models.RedTeamTargetConfig """ name: str = rest_field(name="id", visibility=["read"]) @@ -9718,14 +17107,14 @@ class RedTeam(_Model): removed.""" status: Optional[str] = rest_field(visibility=["read"]) """Status of the red-team. It is set by service and is read-only.""" - target: "_models.TargetConfig" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + target: "_models.RedTeamTargetConfig" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Target configuration for the red-team run. Required.""" @overload def __init__( self, *, - target: "_models.TargetConfig", + target: "_models.RedTeamTargetConfig", display_name: Optional[str] = None, num_turns: Optional[int] = None, attack_strategies: Optional[list[Union[str, "_models.AttackStrategy"]]] = None, @@ -9747,21 +17136,113 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ResponseUsageInputTokensDetails(_Model): - """ResponseUsageInputTokensDetails. +class ResponseUsageInputTokensDetails(_Model): + """ResponseUsageInputTokensDetails. + + :ivar cached_tokens: Required. + :vartype cached_tokens: int + """ + + cached_tokens: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + + @overload + def __init__( + self, + *, + cached_tokens: int, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResponseUsageOutputTokensDetails(_Model): + """ResponseUsageOutputTokensDetails. + + :ivar reasoning_tokens: Required. + :vartype reasoning_tokens: int + """ + + reasoning_tokens: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + + @overload + def __init__( + self, + *, + reasoning_tokens: int, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Routine(_Model): + """A routine definition returned by the service. - :ivar cached_tokens: Required. - :vartype cached_tokens: int + :ivar name: The routine name. Required. + :vartype name: str + :ivar description: A human-readable description of the routine. + :vartype description: str + :ivar enabled: Whether the routine is enabled. Required. + :vartype enabled: bool + :ivar triggers: The triggers configured for the routine. Required. + :vartype triggers: dict[str, ~azure.ai.projects.models.RoutineTrigger] + :ivar action: The action executed when the routine fires. Required. + :vartype action: ~azure.ai.projects.models.RoutineAction + :ivar created_at: The time when the routine was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time when the routine was last updated. + :vartype updated_at: ~datetime.datetime """ - cached_tokens: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Required.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The routine name. Required.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A human-readable description of the routine.""" + enabled: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Whether the routine is enabled. Required.""" + triggers: dict[str, "_models.RoutineTrigger"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The triggers configured for the routine. Required.""" + action: "_models.RoutineAction" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The action executed when the routine fires. Required.""" + created_at: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="unix-timestamp" + ) + """The time when the routine was created.""" + updated_at: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="unix-timestamp" + ) + """The time when the routine was last updated.""" @overload def __init__( self, *, - cached_tokens: int, + name: str, + enabled: bool, + triggers: dict[str, "_models.RoutineTrigger"], + action: "_models.RoutineAction", + description: Optional[str] = None, + created_at: Optional[datetime.datetime] = None, + updated_at: Optional[datetime.datetime] = None, ) -> None: ... @overload @@ -9775,21 +17256,121 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ResponseUsageOutputTokensDetails(_Model): - """ResponseUsageOutputTokensDetails. +class RoutineRun(_Model): + """A single routine run returned from the run history API. - :ivar reasoning_tokens: Required. - :vartype reasoning_tokens: int + :ivar id: The MLflow run identifier for the routine attempt. Required. + :vartype id: str + :ivar status: The underlying MLflow run status. Required. + :vartype status: str + :ivar phase: The AgentExtensions lifecycle phase for the routine attempt. Known values are: + "queued", "dispatching", "completed", and "failed". + :vartype phase: str or ~azure.ai.projects.models.RoutineRunPhase + :ivar trigger_type: The trigger type that produced the routine attempt. Required. Known values + are: "github_issue_opened", "schedule", and "timer". + :vartype trigger_type: str or ~azure.ai.projects.models.RoutineTriggerType + :ivar attempt_source: The source path that created the routine attempt. Known values are: + "event_fire", "manual_dispatch", "queued_dispatch", "schedule_delivery", and "timer_delivery". + :vartype attempt_source: str or ~azure.ai.projects.models.RoutineAttemptSource + :ivar action_type: The action type dispatched for the routine attempt. Known values are: + "invoke_agent_responses_api" and "invoke_agent_invocations_api". + :vartype action_type: str or ~azure.ai.projects.models.RoutineActionType + :ivar triggered_at: The logical trigger time recorded for the routine attempt. + :vartype triggered_at: ~datetime.datetime + :ivar started_at: The time when the underlying run started. Required. + :vartype started_at: ~datetime.datetime + :ivar ended_at: The time when the underlying run reached a terminal state. + :vartype ended_at: ~datetime.datetime + :ivar dispatch_id: The dispatch identifier associated with the routine attempt. + :vartype dispatch_id: str + :ivar action_correlation_id: The downstream action correlation identifier, when available. + :vartype action_correlation_id: str + :ivar response_id: The downstream response or invocation identifier, when available. + :vartype response_id: str + :ivar task_id: The workspace task identifier linked to the routine attempt, when available. + :vartype task_id: str + :ivar error_type: The fully qualified error type captured for a failed attempt, when available. + :vartype error_type: str + :ivar error_message: The truncated failure message captured for a failed attempt, when + available. + :vartype error_message: str + :ivar diagnostics: Diagnostic data captured for the routine attempt. + :vartype diagnostics: ~azure.ai.projects.models.RoutineRunDiagnostics """ - reasoning_tokens: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Required.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The MLflow run identifier for the routine attempt. Required.""" + status: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The underlying MLflow run status. Required.""" + phase: Optional[Union[str, "_models.RoutineRunPhase"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The AgentExtensions lifecycle phase for the routine attempt. Known values are: \"queued\", + \"dispatching\", \"completed\", and \"failed\".""" + trigger_type: Union[str, "_models.RoutineTriggerType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The trigger type that produced the routine attempt. Required. Known values are: + \"github_issue_opened\", \"schedule\", and \"timer\".""" + attempt_source: Optional[Union[str, "_models.RoutineAttemptSource"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The source path that created the routine attempt. Known values are: \"event_fire\", + \"manual_dispatch\", \"queued_dispatch\", \"schedule_delivery\", and \"timer_delivery\".""" + action_type: Optional[Union[str, "_models.RoutineActionType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The action type dispatched for the routine attempt. Known values are: + \"invoke_agent_responses_api\" and \"invoke_agent_invocations_api\".""" + triggered_at: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="unix-timestamp" + ) + """The logical trigger time recorded for the routine attempt.""" + started_at: datetime.datetime = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="unix-timestamp" + ) + """The time when the underlying run started. Required.""" + ended_at: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="unix-timestamp" + ) + """The time when the underlying run reached a terminal state.""" + dispatch_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The dispatch identifier associated with the routine attempt.""" + action_correlation_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The downstream action correlation identifier, when available.""" + response_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The downstream response or invocation identifier, when available.""" + task_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The workspace task identifier linked to the routine attempt, when available.""" + error_type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The fully qualified error type captured for a failed attempt, when available.""" + error_message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The truncated failure message captured for a failed attempt, when available.""" + diagnostics: Optional["_models.RoutineRunDiagnostics"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Diagnostic data captured for the routine attempt.""" @overload def __init__( self, *, - reasoning_tokens: int, + id: str, # pylint: disable=redefined-builtin + status: str, + trigger_type: Union[str, "_models.RoutineTriggerType"], + started_at: datetime.datetime, + phase: Optional[Union[str, "_models.RoutineRunPhase"]] = None, + attempt_source: Optional[Union[str, "_models.RoutineAttemptSource"]] = None, + action_type: Optional[Union[str, "_models.RoutineActionType"]] = None, + triggered_at: Optional[datetime.datetime] = None, + ended_at: Optional[datetime.datetime] = None, + dispatch_id: Optional[str] = None, + action_correlation_id: Optional[str] = None, + response_id: Optional[str] = None, + task_id: Optional[str] = None, + error_type: Optional[str] = None, + error_message: Optional[str] = None, + diagnostics: Optional["_models.RoutineRunDiagnostics"] = None, ) -> None: ... @overload @@ -9803,48 +17384,31 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RubricBasedEvaluatorDefinition(EvaluatorDefinition, discriminator="rubrics"): - """Rubric-based evaluator definition — stores rubric criteria produced by the generate API. Used - for both quality and safety evaluators. +class RoutineRunDiagnostics(_Model): + """Generic diagnostics captured on a routine run. - :ivar init_parameters: The JSON schema (Draft 2020-12) for the evaluator's input parameters. - This includes parameters like type, properties, required. - :vartype init_parameters: dict[str, any] - :ivar data_schema: The JSON schema (Draft 2020-12) for the evaluator's input data. This - includes parameters like type, properties, required. - :vartype data_schema: dict[str, any] - :ivar metrics: List of output metrics produced by this evaluator. - :vartype metrics: dict[str, ~azure.ai.projects.models.EvaluatorMetric] - :ivar type: Required. Rubric-based evaluator definition. Stores rubric criteria for both - quality and safety evaluators. Can be created via the generate API or manually via - createVersion. - :vartype type: str or ~azure.ai.projects.models.RUBRICS - :ivar rubric_criteria: Rubric criteria — the scoring blueprint used by the LLM judge. Quality - evaluators include a non-editable residual criterion with rubric_id 'general_quality' - (always_applicable: true); safety evaluators include 'general_policy_compliance'. Both use the - same rubric structure. Required. - :vartype rubric_criteria: list[~azure.ai.projects.models.RubricCriterion] + :ivar parameters: MLflow parameters recorded on the run, keyed by parameter name. Required. + :vartype parameters: dict[str, str] + :ivar tags: MLflow tags recorded on the run, keyed by tag name. Required. + :vartype tags: dict[str, str] + :ivar metrics: Latest MLflow metric values recorded on the run, keyed by metric name. Required. + :vartype metrics: dict[str, float] """ - type: Literal[EvaluatorDefinitionType.RUBRICS] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. Rubric-based evaluator definition. Stores rubric criteria for both quality and safety - evaluators. Can be created via the generate API or manually via createVersion.""" - rubric_criteria: list["_models.RubricCriterion"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Rubric criteria — the scoring blueprint used by the LLM judge. Quality evaluators include a - non-editable residual criterion with rubric_id 'general_quality' (always_applicable: true); - safety evaluators include 'general_policy_compliance'. Both use the same rubric structure. - Required.""" + parameters: dict[str, str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """MLflow parameters recorded on the run, keyed by parameter name. Required.""" + tags: dict[str, str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """MLflow tags recorded on the run, keyed by tag name. Required.""" + metrics: dict[str, float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Latest MLflow metric values recorded on the run, keyed by metric name. Required.""" @overload def __init__( self, *, - rubric_criteria: list["_models.RubricCriterion"], - init_parameters: Optional[dict[str, Any]] = None, - data_schema: Optional[dict[str, Any]] = None, - metrics: Optional[dict[str, "_models.EvaluatorMetric"]] = None, + parameters: dict[str, str], + tags: dict[str, str], + metrics: dict[str, float], ) -> None: ... @overload @@ -9856,56 +17420,61 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = EvaluatorDefinitionType.RUBRICS # type: ignore -class RubricCriterion(_Model): - """A single rubric criterion — one measurable quality dimension in an evaluator's scoring - blueprint. - - :ivar rubric_id: Stable identifier for this rubric criterion (snake_case, e.g., - ``correct_resolution``). Required. Provided by the user when manually creating a rubric - evaluator or during human-in-the-loop review of a generated catalog; the generation pipeline - produces an initial value the user can edit. Editable when saving new versions. Required. - :vartype rubric_id: str - :ivar description: What this criterion measures (e.g., 'Correctly identifies the user's - reservation intent and pursues the appropriate workflow'). Required. - :vartype description: str - :ivar weight: Relative weight of this criterion (1-10). The generation pipeline assigns exactly - one criterion weight 8-10; all others use 1-6. User edits are not constrained by this - heuristic. Required. - :vartype weight: int - :ivar always_applicable: When true, the LLM judge always scores this criterion regardless of - relevance (skips applicability assessment). The service-generated general quality/policy - criterion has this set to true and is non-editable. Users may set this on their own custom - criteria. - :vartype always_applicable: bool - """ +class RubricBasedEvaluatorDefinition(EvaluatorDefinition, discriminator="rubric"): + """Rubric-based evaluator definition — stores dimensions produced by the generate API. Used for + both quality and safety evaluators. - rubric_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Stable identifier for this rubric criterion (snake_case, e.g., ``correct_resolution``). - Required. Provided by the user when manually creating a rubric evaluator or during - human-in-the-loop review of a generated catalog; the generation pipeline produces an initial - value the user can edit. Editable when saving new versions. Required.""" - description: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """What this criterion measures (e.g., 'Correctly identifies the user's reservation intent and - pursues the appropriate workflow'). Required.""" - weight: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Relative weight of this criterion (1-10). The generation pipeline assigns exactly one criterion - weight 8-10; all others use 1-6. User edits are not constrained by this heuristic. Required.""" - always_applicable: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """When true, the LLM judge always scores this criterion regardless of relevance (skips - applicability assessment). The service-generated general quality/policy criterion has this set - to true and is non-editable. Users may set this on their own custom criteria.""" + :ivar init_parameters: The JSON schema (Draft 2020-12) for the evaluator's input parameters. + This includes parameters like type, properties, required. + :vartype init_parameters: dict[str, any] + :ivar data_schema: The JSON schema (Draft 2020-12) for the evaluator's input data. This + includes parameters like type, properties, required. + :vartype data_schema: dict[str, any] + :ivar metrics: List of output metrics produced by this evaluator. + :vartype metrics: dict[str, ~azure.ai.projects.models.EvaluatorMetric] + :ivar type: Required. Rubric-based evaluator definition. Stores dimensions (the scoring + blueprint) for both quality and safety evaluators. Can be created via the generate API or + manually via createVersion. + :vartype type: str or ~azure.ai.projects.models.RUBRIC + :ivar dimensions: The set of dimensions — the scoring blueprint used by the LLM judge. Quality + evaluators include a non-editable residual dimension with dimension_id 'general_quality' + (always_applicable: true); safety evaluators include 'general_policy_compliance'. Both use the + same Dimension structure. Required. + :vartype dimensions: list[~azure.ai.projects.models.Dimension] + :ivar pass_threshold: Pass/fail threshold for the aggregate rubric score, on the same + normalized 0.0-1.0 scale as the emitted ``score``. When the runtime weighted average meets or + exceeds this value, the result is ``pass``. Defaults to 0.5 (equivalent to a raw 1-5 weighted + average of 3.0). The 'any dimension scored 1 → fail' rule still applies regardless of this + threshold. + :vartype pass_threshold: float + """ + + type: Literal[EvaluatorDefinitionType.RUBRIC] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. Rubric-based evaluator definition. Stores dimensions (the scoring blueprint) for both + quality and safety evaluators. Can be created via the generate API or manually via + createVersion.""" + dimensions: list["_models.Dimension"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The set of dimensions — the scoring blueprint used by the LLM judge. Quality evaluators include + a non-editable residual dimension with dimension_id 'general_quality' (always_applicable: + true); safety evaluators include 'general_policy_compliance'. Both use the same Dimension + structure. Required.""" + pass_threshold: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Pass/fail threshold for the aggregate rubric score, on the same normalized 0.0-1.0 scale as the + emitted ``score``. When the runtime weighted average meets or exceeds this value, the result is + ``pass``. Defaults to 0.5 (equivalent to a raw 1-5 weighted average of 3.0). The 'any dimension + scored 1 → fail' rule still applies regardless of this threshold.""" @overload def __init__( self, *, - rubric_id: str, - description: str, - weight: int, - always_applicable: Optional[bool] = None, + dimensions: list["_models.Dimension"], + init_parameters: Optional[dict[str, Any]] = None, + data_schema: Optional[dict[str, Any]] = None, + metrics: Optional[dict[str, "_models.EvaluatorMetric"]] = None, + pass_threshold: Optional[float] = None, ) -> None: ... @overload @@ -9917,6 +17486,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = EvaluatorDefinitionType.RUBRIC # type: ignore class SASCredentials(BaseCredentials, discriminator="SAS"): @@ -10028,6 +17598,46 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class ScheduleRoutineTrigger(RoutineTrigger, discriminator="schedule"): + """A recurring cron-based routine trigger. + + :ivar type: The trigger type. Required. A recurring cron-based trigger. + :vartype type: str or ~azure.ai.projects.models.SCHEDULE + :ivar cron_expression: A 5-field cron expression. The service enforces a minimum interval of + five minutes by default. Required. + :vartype cron_expression: str + :ivar time_zone: An IANA or Windows time zone identifier for the schedule. Required. + :vartype time_zone: str + """ + + type: Literal[RoutineTriggerType.SCHEDULE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The trigger type. Required. A recurring cron-based trigger.""" + cron_expression: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A 5-field cron expression. The service enforces a minimum interval of five minutes by default. + Required.""" + time_zone: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """An IANA or Windows time zone identifier for the schedule. Required.""" + + @overload + def __init__( + self, + *, + cron_expression: str, + time_zone: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = RoutineTriggerType.SCHEDULE # type: ignore + + class ScheduleRun(_Model): """Schedule run model. @@ -10079,6 +17689,85 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class ScreenshotParam(ComputerAction, discriminator="screenshot"): + """Screenshot. + + :ivar type: Specifies the event type. For a screenshot action, this property is always set to + ``screenshot``. Required. SCREENSHOT. + :vartype type: str or ~azure.ai.projects.models.SCREENSHOT + """ + + type: Literal[ComputerActionType.SCREENSHOT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Specifies the event type. For a screenshot action, this property is always set to + ``screenshot``. Required. SCREENSHOT.""" + + @overload + def __init__( + self, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ComputerActionType.SCREENSHOT # type: ignore + + +class ScrollParam(ComputerAction, discriminator="scroll"): + """Scroll. + + :ivar type: Specifies the event type. For a scroll action, this property is always set to + ``scroll``. Required. SCROLL. + :vartype type: str or ~azure.ai.projects.models.SCROLL + :ivar x: The x-coordinate where the scroll occurred. Required. + :vartype x: int + :ivar y: The y-coordinate where the scroll occurred. Required. + :vartype y: int + :ivar scroll_x: The horizontal scroll distance. Required. + :vartype scroll_x: int + :ivar scroll_y: The vertical scroll distance. Required. + :vartype scroll_y: int + """ + + type: Literal[ComputerActionType.SCROLL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Specifies the event type. For a scroll action, this property is always set to ``scroll``. + Required. SCROLL.""" + x: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The x-coordinate where the scroll occurred. Required.""" + y: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The y-coordinate where the scroll occurred. Required.""" + scroll_x: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The horizontal scroll distance. Required.""" + scroll_y: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The vertical scroll distance. Required.""" + + @overload + def __init__( + self, + *, + x: int, + y: int, + scroll_x: int, + scroll_y: int, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ComputerActionType.SCROLL # type: ignore + + class SessionDirectoryEntry(_Model): """A single entry in a directory listing. @@ -10169,17 +17858,127 @@ class SessionFileWriteResult(_Model): :vartype bytes_written: int """ - path: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The path where the file was written, relative to the session home directory. Required.""" - bytes_written: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Number of bytes written. Required.""" + path: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The path where the file was written, relative to the session home directory. Required.""" + bytes_written: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Number of bytes written. Required.""" + + @overload + def __init__( + self, + *, + path: str, + bytes_written: int, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SessionLogEvent(_Model): + """A single Server-Sent Event frame emitted by the hosted agent session log stream. + + Each frame contains an ``event`` field identifying the event type and a ``data`` + field carrying the payload as plain text. Although the current ``data`` payload + is JSON-formatted, its schema is not contractual — additional keys may appear + and the format may change over time. Clients should treat ``data`` as an + opaque string and optionally attempt JSON parsing. + + New event types may be added in the future. Clients should gracefully + ignore unrecognized event types. + + Wire format: + + .. code-block:: + + event: log + data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting server on port 18080"} + + event: log + data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} + + :ivar event: The SSE event type. Currently ``log``, but additional event types may be added in + the future. Clients should ignore unrecognized event types. Required. "log" + :vartype event: str or ~azure.ai.projects.models.SessionLogEventType + :ivar data: The event payload as plain text. Currently JSON-formatted but the schema is not + contractual and may change. Required. + :vartype data: str + """ + + event: Union[str, "_models.SessionLogEventType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The SSE event type. Currently ``log``, but additional event types may be added in the future. + Clients should ignore unrecognized event types. Required. \"log\"""" + data: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The event payload as plain text. Currently JSON-formatted but the schema is not contractual and + may change. Required.""" + + @overload + def __init__( + self, + *, + event: Union[str, "_models.SessionLogEventType"], + data: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SharepointGroundingToolCall(OutputItem, discriminator="sharepoint_grounding_preview_call"): + """A SharePoint grounding tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. SHAREPOINT_GROUNDING_PREVIEW_CALL. + :vartype type: str or ~azure.ai.projects.models.SHAREPOINT_GROUNDING_PREVIEW_CALL + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.projects.models.ToolCallStatus + """ + + type: Literal[OutputItemType.SHAREPOINT_GROUNDING_PREVIEW_CALL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. SHAREPOINT_GROUNDING_PREVIEW_CALL.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the tool call generated by the model. Required.""" + arguments: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A JSON string of the arguments to pass to the tool. Required.""" + status: Union[str, "_models.ToolCallStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" @overload def __init__( self, *, - path: str, - bytes_written: int, + call_id: str, + arguments: str, + status: Union[str, "_models.ToolCallStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, ) -> None: ... @overload @@ -10191,53 +17990,52 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = OutputItemType.SHAREPOINT_GROUNDING_PREVIEW_CALL # type: ignore -class SessionLogEvent(_Model): - """A single Server-Sent Event frame emitted by the hosted agent session log stream. - - Each frame contains an ``event`` field identifying the event type and a ``data`` - field carrying the payload as plain text. Although the current ``data`` payload - is JSON-formatted, its schema is not contractual — additional keys may appear - and the format may change over time. Clients should treat ``data`` as an - opaque string and optionally attempt JSON parsing. - - New event types may be added in the future. Clients should gracefully - ignore unrecognized event types. - - Wire format: - - .. code-block:: - - event: log - data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting server on port 18080"} - - event: log - data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} +class SharepointGroundingToolCallOutput(OutputItem, discriminator="sharepoint_grounding_preview_call_output"): + """The output of a SharePoint grounding tool call. - :ivar event: The SSE event type. Currently ``log``, but additional event types may be added in - the future. Clients should ignore unrecognized event types. Required. "log" - :vartype event: str or ~azure.ai.projects.models.SessionLogEventType - :ivar data: The event payload as plain text. Currently JSON-formatted but the schema is not - contractual and may change. Required. - :vartype data: str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. SHAREPOINT_GROUNDING_PREVIEW_CALL_OUTPUT. + :vartype type: str or ~azure.ai.projects.models.SHAREPOINT_GROUNDING_PREVIEW_CALL_OUTPUT + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the SharePoint grounding tool call. Is one of the following + types: {str: Any}, str, [Any] + :vartype output: dict[str, any] or str or list[any] + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.projects.models.ToolCallStatus """ - event: Union[str, "_models.SessionLogEventType"] = rest_field( + type: Literal[OutputItemType.SHAREPOINT_GROUNDING_PREVIEW_CALL_OUTPUT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. SHAREPOINT_GROUNDING_PREVIEW_CALL_OUTPUT.""" + call_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique ID of the tool call generated by the model. Required.""" + output: Optional["_types.ToolCallOutputContent"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The SSE event type. Currently ``log``, but additional event types may be added in the future. - Clients should ignore unrecognized event types. Required. \"log\"""" - data: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The event payload as plain text. Currently JSON-formatted but the schema is not contractual and - may change. Required.""" + """The output from the SharePoint grounding tool call. Is one of the following types: {str: Any}, + str, [Any]""" + status: Union[str, "_models.ToolCallStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" @overload def __init__( self, *, - event: Union[str, "_models.SessionLogEventType"], - data: str, + call_id: str, + status: Union[str, "_models.ToolCallStatus"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + output: Optional["_types.ToolCallOutputContent"] = None, ) -> None: ... @overload @@ -10249,6 +18047,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.type = OutputItemType.SHAREPOINT_GROUNDING_PREVIEW_CALL_OUTPUT # type: ignore class SharepointGroundingToolParameters(_Model): @@ -10293,6 +18092,10 @@ class SharepointPreviewTool(Tool, discriminator="sharepoint_grounding_preview"): :vartype name: str :ivar description: Optional user-defined description for this tool or configuration. :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar sharepoint_grounding_preview: The sharepoint grounding tool parameters. Required. :vartype sharepoint_grounding_preview: ~azure.ai.projects.models.SharepointGroundingToolParameters @@ -10305,6 +18108,12 @@ class SharepointPreviewTool(Tool, discriminator="sharepoint_grounding_preview"): """Optional user-defined name for this tool or configuration.""" description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Optional user-defined description for this tool or configuration.""" + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: + exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at + runtime.""" sharepoint_grounding_preview: "_models.SharepointGroundingToolParameters" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -10317,6 +18126,7 @@ def __init__( sharepoint_grounding_preview: "_models.SharepointGroundingToolParameters", name: Optional[str] = None, description: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @overload @@ -10657,6 +18467,127 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class StructuredOutputsOutputItem(OutputItem, discriminator="structured_outputs"): + """StructuredOutputsOutputItem. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. STRUCTURED_OUTPUTS. + :vartype type: str or ~azure.ai.projects.models.STRUCTURED_OUTPUTS + :ivar output: The structured output captured during the response. Required. + :vartype output: any + """ + + type: Literal[OutputItemType.STRUCTURED_OUTPUTS] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. STRUCTURED_OUTPUTS.""" + output: Any = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The structured output captured during the response. Required.""" + + @overload + def __init__( + self, + *, + output: Any, + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = OutputItemType.STRUCTURED_OUTPUTS # type: ignore + + +class SummaryTextContent(MessageContent, discriminator="summary_text"): + """Summary text. + + :ivar type: The type of the object. Always ``summary_text``. Required. SUMMARY_TEXT. + :vartype type: str or ~azure.ai.projects.models.SUMMARY_TEXT + :ivar text: A summary of the reasoning output from the model so far. Required. + :vartype text: str + """ + + type: Literal[MessageContentType.SUMMARY_TEXT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the object. Always ``summary_text``. Required. SUMMARY_TEXT.""" + text: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A summary of the reasoning output from the model so far. Required.""" + + @overload + def __init__( + self, + *, + text: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = MessageContentType.SUMMARY_TEXT # type: ignore + + +class SystemDataV3(_Model): + """System metadata for a resource. + + :ivar created_at: Timestamp of resource creation. + :vartype created_at: ~datetime.datetime + :ivar created_by: Identity that created the resource. + :vartype created_by: str + :ivar created_by_type: Type of identity that created the resource. + :vartype created_by_type: str + :ivar last_modified_at: Timestamp of last resource modification. + :vartype last_modified_at: ~datetime.datetime + """ + + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="unix-timestamp" + ) + """Timestamp of resource creation.""" + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) + """Identity that created the resource.""" + created_by_type: Optional[str] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) + """Type of identity that created the resource.""" + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="unix-timestamp" + ) + """Timestamp of last resource modification.""" + + @overload + def __init__( + self, + *, + created_at: Optional[datetime.datetime] = None, + created_by: Optional[str] = None, + created_by_type: Optional[str] = None, + last_modified_at: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class TaxonomyCategory(_Model): """Taxonomy category definition. @@ -10798,6 +18729,62 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class TestingCriterionAzureAIEvaluator(_Model): + """AzureAIEvaluatorGrader. + + :ivar type: The object type, which is always ``azure_ai_evaluator``. Required. Default value is + "azure_ai_evaluator". + :vartype type: str + :ivar name: The name of the grader. Required. + :vartype name: str + :ivar evaluator_name: The name of the evaluator. Required. + :vartype evaluator_name: str + :ivar evaluator_version: The version of the evaluator. Latest version if not specified. + :vartype evaluator_version: str + :ivar initialization_parameters: The initialization parameters for the evaluation. Must support + structured outputs. + :vartype initialization_parameters: any + :ivar data_mapping: The model to use for the evaluation. Must support structured outputs. + :vartype data_mapping: dict[str, str] + """ + + type: Literal["azure_ai_evaluator"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The object type, which is always ``azure_ai_evaluator``. Required. Default value is + \"azure_ai_evaluator\".""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the grader. Required.""" + evaluator_name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the evaluator. Required.""" + evaluator_version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The version of the evaluator. Latest version if not specified.""" + initialization_parameters: Optional[Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The initialization parameters for the evaluation. Must support structured outputs.""" + data_mapping: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The model to use for the evaluation. Must support structured outputs.""" + + @overload + def __init__( + self, + *, + name: str, + evaluator_name: str, + evaluator_version: Optional[str] = None, + initialization_parameters: Optional[Any] = None, + data_mapping: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type: Literal["azure_ai_evaluator"] = "azure_ai_evaluator" + + class TextResponseFormat(_Model): """An object specifying the format that the model must output. Configuring ``{ "type": "json_schema" }`` enables Structured Outputs, which ensures the model will match your supplied @@ -10943,6 +18930,48 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = TextResponseFormatConfigurationType.TEXT # type: ignore +class TimerRoutineTrigger(RoutineTrigger, discriminator="timer"): + """A one-shot timer routine trigger. + + :ivar type: The trigger type. Required. A one-shot timer trigger. + :vartype type: str or ~azure.ai.projects.models.TIMER + :ivar at: A future timer expression. Supported values include an ISO-8601 timestamp with an + explicit offset, a local timestamp paired with time_zone, or a positive duration from now. + Required. + :vartype at: str + :ivar time_zone: An optional IANA or Windows time zone identifier when the timer uses a local + timestamp. + :vartype time_zone: str + """ + + type: Literal[RoutineTriggerType.TIMER] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The trigger type. Required. A one-shot timer trigger.""" + at: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A future timer expression. Supported values include an ISO-8601 timestamp with an explicit + offset, a local timestamp paired with time_zone, or a positive duration from now. Required.""" + time_zone: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """An optional IANA or Windows time zone identifier when the timer uses a local timestamp.""" + + @overload + def __init__( + self, + *, + at: str, + time_zone: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = RoutineTriggerType.TIMER # type: ignore + + class ToolboxObject(_Model): """A toolbox that stores reusable tool definitions for agents. @@ -11022,6 +19051,10 @@ class ToolboxSearchPreviewTool(Tool, discriminator="toolbox_search_preview"): :vartype name: str :ivar description: Optional user-defined description for this tool or configuration. :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] """ type: Literal[ToolType.TOOLBOX_SEARCH_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -11030,6 +19063,12 @@ class ToolboxSearchPreviewTool(Tool, discriminator="toolbox_search_preview"): """Optional user-defined name for this tool or configuration.""" description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Optional user-defined description for this tool or configuration.""" + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: + exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at + runtime.""" @overload def __init__( @@ -11037,6 +19076,7 @@ def __init__( *, name: Optional[str] = None, description: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @overload @@ -11463,6 +19503,45 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = ToolChoiceParamType.WEB_SEARCH_PREVIEW_2025_03_11 # type: ignore +class ToolConfig(_Model): + """Per-tool configuration that controls tool visibility and search behavior. + + :ivar pin: When true, the tool is always included in agent context and visible in + ``tools/list``. When false (default), the tool is hidden from ``tools/list`` and only + discoverable via ``tool_search``. + :vartype pin: bool + :ivar additional_search_text: Additional text indexed for tool_search. Supplements the native + tool description to improve discoverability. Does not alter ``tools/list`` output. + :vartype additional_search_text: str + """ + + pin: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """When true, the tool is always included in agent context and visible in ``tools/list``. When + false (default), the tool is hidden from ``tools/list`` and only discoverable via + ``tool_search``.""" + additional_search_text: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Additional text indexed for tool_search. Supplements the native tool description to improve + discoverability. Does not alter ``tools/list`` output.""" + + @overload + def __init__( + self, + *, + pin: Optional[bool] = None, + additional_search_text: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class ToolDescription(_Model): """Description of a tool that can be used by an agent. @@ -11567,6 +19646,44 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = DataGenerationJobType.TOOL_USE # type: ignore +class TopLogProb(_Model): + """Top log probability. + + :ivar token: Required. + :vartype token: str + :ivar logprob: Required. + :vartype logprob: int + :ivar bytes: Required. + :vartype bytes: list[int] + """ + + token: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + logprob: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + bytes: list[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + + @overload + def __init__( + self, + *, + token: str, + logprob: int, + bytes: list[int], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class TracesDataGenerationJobOptions(DataGenerationJobOptions, discriminator="traces"): """The options for a data generation job with Traces type. @@ -11582,17 +19699,88 @@ class TracesDataGenerationJobOptions(DataGenerationJobOptions, discriminator="tr :vartype type: str or ~azure.ai.projects.models.TRACES """ - type: Literal[DataGenerationJobType.TRACES] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The data generation job type, which is Traces for this model. Required. Single turn query and - response from agent traces.""" + type: Literal[DataGenerationJobType.TRACES] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The data generation job type, which is Traces for this model. Required. Single turn query and + response from agent traces.""" + + @overload + def __init__( + self, + *, + max_samples: int, + train_split: Optional[float] = None, + model_options: Optional["_models.DataGenerationModelOptions"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = DataGenerationJobType.TRACES # type: ignore + + +class TracesDataGenerationJobSource(DataGenerationJobSource, discriminator="traces"): + """Traces source for data generation jobs — conversation traces from Application Insights. + + :ivar description: Optional description of what this source represents — helps the pipeline + interpret its content (e.g., 'Company refund policy document' or 'Describes the agent's core + capabilities'). + :vartype description: str + :ivar type: The source type for this source, which is Traces. Required. Traces source — + conversation traces from Application Insights. + :vartype type: str or ~azure.ai.projects.models.TRACES + :ivar agent_id: The unique agent ID used to filter traces. Provide either ``agent_id`` or + ``agent_name`` — at least one is required. + :vartype agent_id: str + :ivar agent_name: The agent name to fetch traces for. Provide either ``agent_id`` or + ``agent_name`` — at least one is required. + :vartype agent_name: str + :ivar agent_version: The agent version. If not specified, traces for ALL versions of the agent + are included within the time window. + :vartype agent_version: str + :ivar start_time: Start of the time window (Unix timestamp in seconds) for fetching traces. + Required. + :vartype start_time: ~datetime.datetime + :ivar end_time: End of the time window (Unix timestamp in seconds). Defaults to current time. + :vartype end_time: ~datetime.datetime + """ + + type: Literal[DataGenerationJobSourceType.TRACES] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The source type for this source, which is Traces. Required. Traces source — conversation traces + from Application Insights.""" + agent_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique agent ID used to filter traces. Provide either ``agent_id`` or ``agent_name`` — at + least one is required.""" + agent_name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The agent name to fetch traces for. Provide either ``agent_id`` or ``agent_name`` — at least + one is required.""" + agent_version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The agent version. If not specified, traces for ALL versions of the agent are included within + the time window.""" + start_time: datetime.datetime = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="unix-timestamp" + ) + """Start of the time window (Unix timestamp in seconds) for fetching traces. Required.""" + end_time: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="unix-timestamp" + ) + """End of the time window (Unix timestamp in seconds). Defaults to current time.""" @overload def __init__( self, *, - max_samples: int, - train_split: Optional[float] = None, - model_options: Optional["_models.DataGenerationModelOptions"] = None, + start_time: datetime.datetime, + description: Optional[str] = None, + agent_id: Optional[str] = None, + agent_name: Optional[str] = None, + agent_version: Optional[str] = None, + end_time: Optional[datetime.datetime] = None, ) -> None: ... @overload @@ -11604,11 +19792,12 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = DataGenerationJobType.TRACES # type: ignore + self.type = DataGenerationJobSourceType.TRACES # type: ignore -class TracesDataGenerationJobSource(DataGenerationJobSource, discriminator="traces"): - """Traces source for data generation jobs — conversation traces from Application Insights. +class TracesEvaluationSuiteJobSource(EvaluationSuiteJobSource, discriminator="traces"): + """Traces source for evaluation suite generation jobs — conversation traces from Application + Insights. :ivar description: Optional description of what this source represents — helps the pipeline interpret its content (e.g., 'Company refund policy document' or 'Describes the agent's core @@ -11617,55 +19806,53 @@ class TracesDataGenerationJobSource(DataGenerationJobSource, discriminator="trac :ivar type: The source type for this source, which is Traces. Required. Traces source — conversation traces from Application Insights. :vartype type: str or ~azure.ai.projects.models.TRACES - :ivar agent_id: The unique agent ID used to filter traces. Optional — when omitted, traces are - filtered by ``agent_name`` (and ``agent_version`` if specified). + :ivar agent_id: The unique agent ID used to filter traces. Provide either ``agent_id`` or + ``agent_name`` — at least one is required. :vartype agent_id: str - :ivar agent_name: The agent name to fetch traces for. Required. + :ivar agent_name: The agent name to fetch traces for. Provide either ``agent_id`` or + ``agent_name`` — at least one is required. :vartype agent_name: str :ivar agent_version: The agent version. If not specified, traces for ALL versions of the agent are included within the time window. :vartype agent_version: str :ivar start_time: Start of the time window (Unix timestamp in seconds) for fetching traces. + Required. :vartype start_time: ~datetime.datetime :ivar end_time: End of the time window (Unix timestamp in seconds). Defaults to current time. :vartype end_time: ~datetime.datetime - :ivar max_traces: Maximum number of traces to retrieve. - :vartype max_traces: int """ - type: Literal[DataGenerationJobSourceType.TRACES] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + type: Literal[EvaluationSuiteJobSourceType.TRACES] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The source type for this source, which is Traces. Required. Traces source — conversation traces from Application Insights.""" agent_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The unique agent ID used to filter traces. Optional — when omitted, traces are filtered by - ``agent_name`` (and ``agent_version`` if specified).""" - agent_name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The agent name to fetch traces for. Required.""" + """The unique agent ID used to filter traces. Provide either ``agent_id`` or ``agent_name`` — at + least one is required.""" + agent_name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The agent name to fetch traces for. Provide either ``agent_id`` or ``agent_name`` — at least + one is required.""" agent_version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The agent version. If not specified, traces for ALL versions of the agent are included within the time window.""" - start_time: Optional[datetime.datetime] = rest_field( + start_time: datetime.datetime = rest_field( visibility=["read", "create", "update", "delete", "query"], format="unix-timestamp" ) - """Start of the time window (Unix timestamp in seconds) for fetching traces.""" + """Start of the time window (Unix timestamp in seconds) for fetching traces. Required.""" end_time: Optional[datetime.datetime] = rest_field( visibility=["read", "create", "update", "delete", "query"], format="unix-timestamp" ) """End of the time window (Unix timestamp in seconds). Defaults to current time.""" - max_traces: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Maximum number of traces to retrieve.""" @overload def __init__( self, *, - agent_name: str, + start_time: datetime.datetime, description: Optional[str] = None, agent_id: Optional[str] = None, + agent_name: Optional[str] = None, agent_version: Optional[str] = None, - start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, - max_traces: Optional[int] = None, ) -> None: ... @overload @@ -11677,7 +19864,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = DataGenerationJobSourceType.TRACES # type: ignore + self.type = EvaluationSuiteJobSourceType.TRACES # type: ignore class TracesEvaluatorGenerationJobSource(EvaluatorGenerationJobSource, discriminator="traces"): @@ -11690,20 +19877,20 @@ class TracesEvaluatorGenerationJobSource(EvaluatorGenerationJobSource, discrimin :ivar type: The source type for this source, which is Traces. Required. Traces source — conversation traces from Application Insights. :vartype type: str or ~azure.ai.projects.models.TRACES - :ivar agent_id: The unique agent ID used to filter traces. Optional — when omitted, traces are - filtered by ``agent_name`` (and ``agent_version`` if specified). + :ivar agent_id: The unique agent ID used to filter traces. Provide either ``agent_id`` or + ``agent_name`` — at least one is required. :vartype agent_id: str - :ivar agent_name: The agent name to fetch traces for. Required. + :ivar agent_name: The agent name to fetch traces for. Provide either ``agent_id`` or + ``agent_name`` — at least one is required. :vartype agent_name: str :ivar agent_version: The agent version. If not specified, traces for ALL versions of the agent are included within the time window. :vartype agent_version: str :ivar start_time: Start of the time window (Unix timestamp in seconds) for fetching traces. + Required. :vartype start_time: ~datetime.datetime :ivar end_time: End of the time window (Unix timestamp in seconds). Defaults to current time. :vartype end_time: ~datetime.datetime - :ivar max_traces: Maximum number of traces to retrieve. - :vartype max_traces: int """ description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -11713,35 +19900,33 @@ class TracesEvaluatorGenerationJobSource(EvaluatorGenerationJobSource, discrimin """The source type for this source, which is Traces. Required. Traces source — conversation traces from Application Insights.""" agent_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The unique agent ID used to filter traces. Optional — when omitted, traces are filtered by - ``agent_name`` (and ``agent_version`` if specified).""" - agent_name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The agent name to fetch traces for. Required.""" + """The unique agent ID used to filter traces. Provide either ``agent_id`` or ``agent_name`` — at + least one is required.""" + agent_name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The agent name to fetch traces for. Provide either ``agent_id`` or ``agent_name`` — at least + one is required.""" agent_version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The agent version. If not specified, traces for ALL versions of the agent are included within the time window.""" - start_time: Optional[datetime.datetime] = rest_field( + start_time: datetime.datetime = rest_field( visibility=["read", "create", "update", "delete", "query"], format="unix-timestamp" ) - """Start of the time window (Unix timestamp in seconds) for fetching traces.""" + """Start of the time window (Unix timestamp in seconds) for fetching traces. Required.""" end_time: Optional[datetime.datetime] = rest_field( visibility=["read", "create", "update", "delete", "query"], format="unix-timestamp" ) """End of the time window (Unix timestamp in seconds). Defaults to current time.""" - max_traces: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Maximum number of traces to retrieve.""" @overload def __init__( self, *, - agent_name: str, + start_time: datetime.datetime, description: Optional[str] = None, agent_id: Optional[str] = None, + agent_name: Optional[str] = None, agent_version: Optional[str] = None, - start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, - max_traces: Optional[int] = None, ) -> None: ... @overload @@ -11756,6 +19941,74 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = EvaluatorGenerationJobSourceType.TRACES # type: ignore +class TypeParam(ComputerAction, discriminator="type"): + """Type. + + :ivar type: Specifies the event type. For a type action, this property is always set to + ``type``. Required. TYPE. + :vartype type: str or ~azure.ai.projects.models.TYPE + :ivar text: The text to type. Required. + :vartype text: str + """ + + type: Literal[ComputerActionType.TYPE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Specifies the event type. For a type action, this property is always set to ``type``. Required. + TYPE.""" + text: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The text to type. Required.""" + + @overload + def __init__( + self, + *, + text: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ComputerActionType.TYPE # type: ignore + + +class UpdateModelVersionRequest(_Model): + """Request body for updating a model version. Only description and tags can be modified. + + :ivar description: The asset description text. + :vartype description: str + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + """ + + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The asset description text.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Tag dictionary. Tags can be added, removed, and updated.""" + + @overload + def __init__( + self, + *, + description: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class UpdateToolboxRequest(_Model): """UpdateToolboxRequest. @@ -11786,6 +20039,55 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class UrlCitationBody(Annotation, discriminator="url_citation"): + """URL citation. + + :ivar type: The type of the URL citation. Always ``url_citation``. Required. URL_CITATION. + :vartype type: str or ~azure.ai.projects.models.URL_CITATION + :ivar url: The URL of the web resource. Required. + :vartype url: str + :ivar start_index: The index of the first character of the URL citation in the message. + Required. + :vartype start_index: int + :ivar end_index: The index of the last character of the URL citation in the message. Required. + :vartype end_index: int + :ivar title: The title of the web resource. Required. + :vartype title: str + """ + + type: Literal[AnnotationType.URL_CITATION] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the URL citation. Always ``url_citation``. Required. URL_CITATION.""" + url: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The URL of the web resource. Required.""" + start_index: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The index of the first character of the URL citation in the message. Required.""" + end_index: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The index of the last character of the URL citation in the message. Required.""" + title: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The title of the web resource. Required.""" + + @overload + def __init__( + self, + *, + url: str, + start_index: int, + end_index: int, + title: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = AnnotationType.URL_CITATION # type: ignore + + class UserProfileMemoryItem(MemoryItem, discriminator="user_profile"): """A memory item specifically containing user profile information extracted from conversations, such as preferences, interests, and personal details. @@ -11829,6 +20131,15 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = MemoryItemKind.USER_PROFILE # type: ignore +class VectorStoreFileAttributes(_Model): + """Set of 16 key-value pairs that can be attached to an object. This can be useful for storing + additional information about the object in a structured format, and querying for objects via + API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are + strings with a maximum length of 512 characters, booleans, or numbers. + + """ + + class VersionIndicator(_Model): """Version indicator determining which agent version backs the session. @@ -11925,6 +20236,184 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class WaitParam(ComputerAction, discriminator="wait"): + """Wait. + + :ivar type: Specifies the event type. For a wait action, this property is always set to + ``wait``. Required. WAIT. + :vartype type: str or ~azure.ai.projects.models.WAIT + """ + + type: Literal[ComputerActionType.WAIT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Specifies the event type. For a wait action, this property is always set to ``wait``. Required. + WAIT.""" + + @overload + def __init__( + self, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ComputerActionType.WAIT # type: ignore + + +class WebSearchActionFind(_Model): + """Find action. + + :ivar type: The action type. Required. Default value is "find_in_page". + :vartype type: str + :ivar url: The URL of the page searched for the pattern. Required. + :vartype url: str + :ivar pattern: The pattern or text to search for within the page. Required. + :vartype pattern: str + """ + + type: Literal["find_in_page"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The action type. Required. Default value is \"find_in_page\".""" + url: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The URL of the page searched for the pattern. Required.""" + pattern: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The pattern or text to search for within the page. Required.""" + + @overload + def __init__( + self, + *, + url: str, + pattern: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type: Literal["find_in_page"] = "find_in_page" + + +class WebSearchActionOpenPage(_Model): + """Open page action. + + :ivar type: The action type. Required. Default value is "open_page". + :vartype type: str + :ivar url: The URL opened by the model. + :vartype url: str + """ + + type: Literal["open_page"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The action type. Required. Default value is \"open_page\".""" + url: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The URL opened by the model.""" + + @overload + def __init__( + self, + *, + url: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type: Literal["open_page"] = "open_page" + + +class WebSearchActionSearch(_Model): + """Search action. + + :ivar type: The action type. Required. Default value is "search". + :vartype type: str + :ivar query: [DEPRECATED] The search query. Required. + :vartype query: str + :ivar queries: Search queries. + :vartype queries: list[str] + :ivar sources: Web search sources. + :vartype sources: list[~azure.ai.projects.models.WebSearchActionSearchSources] + """ + + type: Literal["search"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The action type. Required. Default value is \"search\".""" + query: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """[DEPRECATED] The search query. Required.""" + queries: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Search queries.""" + sources: Optional[list["_models.WebSearchActionSearchSources"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Web search sources.""" + + @overload + def __init__( + self, + *, + query: str, + queries: Optional[list[str]] = None, + sources: Optional[list["_models.WebSearchActionSearchSources"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type: Literal["search"] = "search" + + +class WebSearchActionSearchSources(_Model): + """WebSearchActionSearchSources. + + :ivar type: Required. Default value is "url". + :vartype type: str + :ivar url: Required. + :vartype url: str + """ + + type: Literal["url"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required. Default value is \"url\".""" + url: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + + @overload + def __init__( + self, + *, + url: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type: Literal["url"] = "url" + + class WebSearchApproximateLocation(_Model): """Web search approximate location. @@ -12070,6 +20559,10 @@ class WebSearchTool(Tool, discriminator="web_search"): :vartype name: str :ivar description: Optional user-defined description for this tool or configuration. :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar custom_search_configuration: The project connections attached to this tool. There can be a maximum of 1 connection resource attached to the tool. :vartype custom_search_configuration: ~azure.ai.projects.models.WebSearchConfiguration @@ -12094,6 +20587,12 @@ class WebSearchTool(Tool, discriminator="web_search"): """Optional user-defined name for this tool or configuration.""" description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Optional user-defined description for this tool or configuration.""" + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: + exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at + runtime.""" custom_search_configuration: Optional["_models.WebSearchConfiguration"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -12109,6 +20608,7 @@ def __init__( search_context_size: Optional[Literal["low", "medium", "high"]] = None, name: Optional[str] = None, description: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, custom_search_configuration: Optional["_models.WebSearchConfiguration"] = None, ) -> None: ... @@ -12186,6 +20686,71 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = RecurrenceType.WEEKLY # type: ignore +class WorkflowActionOutputItem(OutputItem, discriminator="workflow_action"): + """WorkflowActionOutputItem. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.projects.models.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. WORKFLOW_ACTION. + :vartype type: str or ~azure.ai.projects.models.WORKFLOW_ACTION + :ivar kind: The kind of CSDL action (e.g., 'SetVariable', 'InvokeAzureAgent'). Required. + :vartype kind: str + :ivar action_id: Unique identifier for the action. Required. + :vartype action_id: str + :ivar parent_action_id: ID of the parent action if this is a nested action. + :vartype parent_action_id: str + :ivar previous_action_id: ID of the previous action if this action follows another. + :vartype previous_action_id: str + :ivar status: Status of the action (e.g., 'in_progress', 'completed', 'failed', 'cancelled'). + Required. Is one of the following types: Literal["completed"], Literal["failed"], + Literal["in_progress"], Literal["cancelled"] + :vartype status: str or str or str or str + """ + + type: Literal[OutputItemType.WORKFLOW_ACTION] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. WORKFLOW_ACTION.""" + kind: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The kind of CSDL action (e.g., 'SetVariable', 'InvokeAzureAgent'). Required.""" + action_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Unique identifier for the action. Required.""" + parent_action_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """ID of the parent action if this is a nested action.""" + previous_action_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """ID of the previous action if this action follows another.""" + status: Literal["completed", "failed", "in_progress", "cancelled"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Status of the action (e.g., 'in_progress', 'completed', 'failed', 'cancelled'). Required. Is + one of the following types: Literal[\"completed\"], Literal[\"failed\"], + Literal[\"in_progress\"], Literal[\"cancelled\"]""" + + @overload + def __init__( + self, + *, + kind: str, + action_id: str, + status: Literal["completed", "failed", "in_progress", "cancelled"], + agent_reference: Optional["_models.AgentReference"] = None, + response_id: Optional[str] = None, + parent_action_id: Optional[str] = None, + previous_action_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = OutputItemType.WORKFLOW_ACTION # type: ignore + + class WorkflowAgentDefinition(AgentDefinition, discriminator="workflow"): """The workflow agent definition. @@ -12233,6 +20798,10 @@ class WorkIQPreviewTool(Tool, discriminator="work_iq_preview"): :vartype name: str :ivar description: Optional user-defined description for this tool or configuration. :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] """ type: Literal[ToolType.WORK_IQ_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -12243,6 +20812,12 @@ class WorkIQPreviewTool(Tool, discriminator="work_iq_preview"): """Optional user-defined name for this tool or configuration.""" description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Optional user-defined description for this tool or configuration.""" + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: + exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at + runtime.""" @overload def __init__( @@ -12251,6 +20826,7 @@ def __init__( project_connection_id: str, name: Optional[str] = None, description: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @overload diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_patch.py b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_patch.py index 03b2e81ab05d..725a3c1ee85e 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_patch.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_patch.py @@ -44,9 +44,10 @@ "evaluators": _FoundryFeaturesOptInKeys.EVALUATIONS_V1_PREVIEW.value, "insights": _FoundryFeaturesOptInKeys.INSIGHTS_V1_PREVIEW.value, "memory_stores": _FoundryFeaturesOptInKeys.MEMORY_STORES_V1_PREVIEW.value, + "models": _FoundryFeaturesOptInKeys.MODELS_V1_PREVIEW.value, "red_teams": _FoundryFeaturesOptInKeys.RED_TEAMS_V1_PREVIEW.value, + "routines": _FoundryFeaturesOptInKeys.ROUTINES_V1_PREVIEW.value, "schedules": _FoundryFeaturesOptInKeys.SCHEDULES_V1_PREVIEW.value, - "toolboxes": _FoundryFeaturesOptInKeys.TOOLBOXES_V1_PREVIEW.value, "skills": _FoundryFeaturesOptInKeys.SKILLS_V1_PREVIEW.value, "datasets": _FoundryFeaturesOptInKeys.DATA_GENERATION_JOBS_V1_PREVIEW.value, "agents": ",".join( diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/__init__.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/__init__.py index 1a1c0ffec86c..d6cf67b4d8cf 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/__init__.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/__init__.py @@ -19,6 +19,7 @@ from ._operations import DatasetsOperations # type: ignore from ._operations import DeploymentsOperations # type: ignore from ._operations import IndexesOperations # type: ignore +from ._operations import ToolboxesOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -32,6 +33,7 @@ "DatasetsOperations", "DeploymentsOperations", "IndexesOperations", + "ToolboxesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py index 72b85abdab2f..27784be73232 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py @@ -73,7 +73,7 @@ def build_agents_get_request(agent_name: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_agents_delete_request(agent_name: str, **kwargs: Any) -> HttpRequest: +def build_agents_delete_request(agent_name: str, *, force: Optional[bool] = None, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -89,6 +89,8 @@ def build_agents_delete_request(agent_name: str, **kwargs: Any) -> HttpRequest: _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + if force is not None: + _params["force"] = _SERIALIZER.query("force", force, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -215,7 +217,9 @@ def build_agents_get_version_request(agent_name: str, agent_version: str, **kwar return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_agents_delete_version_request(agent_name: str, agent_version: str, **kwargs: Any) -> HttpRequest: +def build_agents_delete_version_request( + agent_name: str, agent_version: str, *, force: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -232,6 +236,8 @@ def build_agents_delete_version_request(agent_name: str, agent_version: str, **k _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + if force is not None: + _params["force"] = _SERIALIZER.query("force", force, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -798,19 +804,18 @@ def build_indexes_create_or_update_request(name: str, version: str, **kwargs: An return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_agents_update_agent_from_code_request( # pylint: disable=name-too-long - agent_name: str, *, code_zip_sha256: str, **kwargs: Any -) -> HttpRequest: +def build_toolboxes_create_version_request(name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}" + _url = "/toolboxes/{name}/versions" path_format_arguments = { - "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -819,26 +824,148 @@ def build_beta_agents_update_agent_from_code_request( # pylint: disable=name-to _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["x-ms-code-zip-sha256"] = _SERIALIZER.header("code_zip_sha256", code_zip_sha256, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_agents_patch_agent_details_request( # pylint: disable=name-too-long - agent_name: str, **kwargs: Any +def build_toolboxes_get_request(name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/toolboxes/{name}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_toolboxes_list_request( + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + after: Optional[str] = None, + before: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/toolboxes" + + # Construct parameters + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if order is not None: + _params["order"] = _SERIALIZER.query("order", order, "str") + if after is not None: + _params["after"] = _SERIALIZER.query("after", after, "str") + if before is not None: + _params["before"] = _SERIALIZER.query("before", before, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_toolboxes_list_versions_request( + name: str, + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + after: Optional[str] = None, + before: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/toolboxes/{name}/versions" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if order is not None: + _params["order"] = _SERIALIZER.query("order", order, "str") + if after is not None: + _params["after"] = _SERIALIZER.query("after", after, "str") + if before is not None: + _params["before"] = _SERIALIZER.query("before", before, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_toolboxes_get_version_request(name: str, version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/toolboxes/{name}/versions/{version}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_toolboxes_update_request(name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}" + _url = "/toolboxes/{name}" path_format_arguments = { - "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -854,7 +981,44 @@ def build_beta_agents_patch_agent_details_request( # pylint: disable=name-too-l return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_agents_create_agent_version_from_code_request( # pylint: disable=name-too-long +def build_toolboxes_delete_request(name: str, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + # Construct URL + _url = "/toolboxes/{name}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_toolboxes_delete_version_request(name: str, version: str, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + # Construct URL + _url = "/toolboxes/{name}/versions/{version}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_beta_agents_update_agent_from_code_request( # pylint: disable=name-too-long agent_name: str, *, code_zip_sha256: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -864,7 +1028,7 @@ def build_beta_agents_create_agent_version_from_code_request( # pylint: disable accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/versions" + _url = "/agents/{agent_name}" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), } @@ -881,20 +1045,20 @@ def build_beta_agents_create_agent_version_from_code_request( # pylint: disable return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_agents_download_agent_version_code_request( # pylint: disable=name-too-long - agent_name: str, agent_version: str, **kwargs: Any +def build_beta_agents_patch_agent_details_request( # pylint: disable=name-too-long + agent_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - accept = _headers.pop("Accept", "application/zip") + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/versions/{agent_version}/code:download" + _url = "/agents/{agent_name}" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "agent_version": _SERIALIZER.url("agent_version", agent_version, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -903,13 +1067,42 @@ def build_beta_agents_download_agent_version_code_request( # pylint: disable=na _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_agents_create_agent_version_from_code_request( # pylint: disable=name-too-long + agent_name: str, *, code_zip_sha256: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/agents/{agent_name}/versions" + path_format_arguments = { + "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["x-ms-code-zip-sha256"] = _SERIALIZER.header("code_zip_sha256", code_zip_sha256, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_beta_agents_download_agent_code_request( # pylint: disable=name-too-long - agent_name: str, **kwargs: Any + agent_name: str, *, agent_version: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -926,6 +1119,8 @@ def build_beta_agents_download_agent_code_request( # pylint: disable=name-too-l _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + if agent_version is not None: + _params["agent_version"] = _SERIALIZER.query("agent_version", agent_version, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -1074,7 +1269,7 @@ def build_beta_agents_get_session_log_stream_request( # pylint: disable=name-to def build_beta_agents_upload_session_file_request( # pylint: disable=name-too-long - agent_name: str, agent_session_id: str, *, path: str, **kwargs: Any + agent_name: str, agent_session_id: str, *, path: str, user_isolation_key: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1098,13 +1293,15 @@ def build_beta_agents_upload_session_file_request( # pylint: disable=name-too-l # Construct headers _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + if user_isolation_key is not None: + _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_beta_agents_download_session_file_request( # pylint: disable=name-too-long - agent_name: str, agent_session_id: str, *, path: str, **kwargs: Any + agent_name: str, agent_session_id: str, *, path: str, user_isolation_key: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1126,13 +1323,15 @@ def build_beta_agents_download_session_file_request( # pylint: disable=name-too _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if user_isolation_key is not None: + _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_beta_agents_get_session_files_request( # pylint: disable=name-too-long - agent_name: str, agent_session_id: str, *, path: str, **kwargs: Any + agent_name: str, agent_session_id: str, *, path: str, user_isolation_key: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1154,14 +1353,23 @@ def build_beta_agents_get_session_files_request( # pylint: disable=name-too-lon _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if user_isolation_key is not None: + _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_beta_agents_delete_session_file_request( # pylint: disable=name-too-long - agent_name: str, agent_session_id: str, *, path: str, recursive: Optional[bool] = None, **kwargs: Any + agent_name: str, + agent_session_id: str, + *, + path: str, + recursive: Optional[bool] = None, + user_isolation_key: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) @@ -1180,37 +1388,41 @@ def build_beta_agents_delete_session_file_request( # pylint: disable=name-too-l _params["recursive"] = _SERIALIZER.query("recursive", recursive, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + if user_isolation_key is not None: + _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_evaluation_taxonomies_get_request( # pylint: disable=name-too-long - name: str, **kwargs: Any + +def build_beta_agents_create_optimization_job_request( # pylint: disable=name-too-long + *, operation_id: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/evaluationtaxonomies/{name}" - path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/agent_optimization_jobs" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if operation_id is not None: + _headers["Operation-Id"] = _SERIALIZER.header("operation_id", operation_id, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_evaluation_taxonomies_list_request( # pylint: disable=name-too-long - *, input_name: Optional[str] = None, input_type: Optional[str] = None, **kwargs: Any +def build_beta_agents_get_optimization_job_request( # pylint: disable=name-too-long + job_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1219,14 +1431,15 @@ def build_beta_evaluation_taxonomies_list_request( # pylint: disable=name-too-l accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/evaluationtaxonomies" + _url = "/agent_optimization_jobs/{jobId}" + path_format_arguments = { + "jobId": _SERIALIZER.url("job_id", job_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if input_name is not None: - _params["inputName"] = _SERIALIZER.query("input_name", input_name, "str") - if input_type is not None: - _params["inputType"] = _SERIALIZER.query("input_type", input_type, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1234,40 +1447,59 @@ def build_beta_evaluation_taxonomies_list_request( # pylint: disable=name-too-l return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_evaluation_taxonomies_delete_request( # pylint: disable=name-too-long - name: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - +def build_beta_agents_list_optimization_jobs_request( # pylint: disable=name-too-long + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + after: Optional[str] = None, + before: Optional[str] = None, + status: Optional[Union[str, _models.JobStatus]] = None, + agent_name: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - # Construct URL - _url = "/evaluationtaxonomies/{name}" - path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - } + accept = _headers.pop("Accept", "application/json") - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct URL + _url = "/agent_optimization_jobs" # Construct parameters + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if order is not None: + _params["order"] = _SERIALIZER.query("order", order, "str") + if after is not None: + _params["after"] = _SERIALIZER.query("after", after, "str") + if before is not None: + _params["before"] = _SERIALIZER.query("before", before, "str") + if status is not None: + _params["status"] = _SERIALIZER.query("status", status, "str") + if agent_name is not None: + _params["agent_name"] = _SERIALIZER.query("agent_name", agent_name, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_evaluation_taxonomies_create_request( # pylint: disable=name-too-long - name: str, **kwargs: Any +def build_beta_agents_cancel_optimization_job_request( # pylint: disable=name-too-long + job_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/evaluationtaxonomies/{name}" + _url = "/agent_optimization_jobs/{jobId}:cancel" path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), + "jobId": _SERIALIZER.url("job_id", job_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1276,27 +1508,21 @@ def build_beta_evaluation_taxonomies_create_request( # pylint: disable=name-too _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_evaluation_taxonomies_update_request( # pylint: disable=name-too-long - name: str, **kwargs: Any +def build_beta_agents_delete_optimization_job_request( # pylint: disable=name-too-long + job_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/evaluationtaxonomies/{name}" + _url = "/agent_optimization_jobs/{jobId}" path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), + "jobId": _SERIALIZER.url("job_id", job_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1304,19 +1530,16 @@ def build_beta_evaluation_taxonomies_update_request( # pylint: disable=name-too # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_beta_evaluators_list_versions_request( # pylint: disable=name-too-long - name: str, +def build_beta_agents_list_optimization_candidates_request( # pylint: disable=name-too-long + job_id: str, *, - type: Optional[Union[Literal["builtin"], Literal["custom"], Literal["all"], str]] = None, limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + after: Optional[str] = None, + before: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1326,19 +1549,23 @@ def build_beta_evaluators_list_versions_request( # pylint: disable=name-too-lon accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/evaluators/{name}/versions" + _url = "/agent_optimization_jobs/{jobId}/candidates" path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), + "jobId": _SERIALIZER.url("job_id", job_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if type is not None: - _params["type"] = _SERIALIZER.query("type", type, "str") if limit is not None: _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if order is not None: + _params["order"] = _SERIALIZER.query("order", order, "str") + if after is not None: + _params["after"] = _SERIALIZER.query("after", after, "str") + if before is not None: + _params["before"] = _SERIALIZER.query("before", before, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1346,11 +1573,8 @@ def build_beta_evaluators_list_versions_request( # pylint: disable=name-too-lon return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_evaluators_list_request( - *, - type: Optional[Union[Literal["builtin"], Literal["custom"], Literal["all"], str]] = None, - limit: Optional[int] = None, - **kwargs: Any +def build_beta_agents_get_optimization_candidate_request( # pylint: disable=name-too-long + job_id: str, candidate_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1359,14 +1583,16 @@ def build_beta_evaluators_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/evaluators" + _url = "/agent_optimization_jobs/{jobId}/candidates/{candidateId}" + path_format_arguments = { + "jobId": _SERIALIZER.url("job_id", job_id, "str"), + "candidateId": _SERIALIZER.url("candidate_id", candidate_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if type is not None: - _params["type"] = _SERIALIZER.query("type", type, "str") - if limit is not None: - _params["limit"] = _SERIALIZER.query("limit", limit, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1374,8 +1600,8 @@ def build_beta_evaluators_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_evaluators_get_version_request( # pylint: disable=name-too-long - name: str, version: str, **kwargs: Any +def build_beta_agents_get_optimization_candidate_config_request( # pylint: disable=name-too-long + job_id: str, candidate_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1384,10 +1610,10 @@ def build_beta_evaluators_get_version_request( # pylint: disable=name-too-long accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/evaluators/{name}/versions/{version}" + _url = "/agent_optimization_jobs/{jobId}/candidates/{candidateId}/config" path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - "version": _SERIALIZER.url("version", version, "str"), + "jobId": _SERIALIZER.url("job_id", job_id, "str"), + "candidateId": _SERIALIZER.url("candidate_id", candidate_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1401,17 +1627,20 @@ def build_beta_evaluators_get_version_request( # pylint: disable=name-too-long return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_evaluators_delete_version_request( # pylint: disable=name-too-long - name: str, version: str, **kwargs: Any +def build_beta_agents_get_optimization_candidate_results_request( # pylint: disable=name-too-long + job_id: str, candidate_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/evaluators/{name}/versions/{version}" + _url = "/agent_optimization_jobs/{jobId}/candidates/{candidateId}/results" path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - "version": _SERIALIZER.url("version", version, "str"), + "jobId": _SERIALIZER.url("job_id", job_id, "str"), + "candidateId": _SERIALIZER.url("candidate_id", candidate_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1419,21 +1648,23 @@ def build_beta_evaluators_delete_version_request( # pylint: disable=name-too-lo # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_evaluators_create_version_request( # pylint: disable=name-too-long +def build_beta_evaluation_taxonomies_get_request( # pylint: disable=name-too-long name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/evaluators/{name}/versions" + _url = "/evaluationtaxonomies/{name}" path_format_arguments = { "name": _SERIALIZER.url("name", name, "str"), } @@ -1444,15 +1675,58 @@ def build_beta_evaluators_create_version_request( # pylint: disable=name-too-lo _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_evaluators_update_version_request( # pylint: disable=name-too-long - name: str, version: str, **kwargs: Any +def build_beta_evaluation_taxonomies_list_request( # pylint: disable=name-too-long + *, input_name: Optional[str] = None, input_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/evaluationtaxonomies" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if input_name is not None: + _params["inputName"] = _SERIALIZER.query("input_name", input_name, "str") + if input_type is not None: + _params["inputType"] = _SERIALIZER.query("input_type", input_type, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_evaluation_taxonomies_delete_request( # pylint: disable=name-too-long + name: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + # Construct URL + _url = "/evaluationtaxonomies/{name}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_beta_evaluation_taxonomies_create_request( # pylint: disable=name-too-long + name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1462,10 +1736,9 @@ def build_beta_evaluators_update_version_request( # pylint: disable=name-too-lo accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/evaluators/{name}/versions/{version}" + _url = "/evaluationtaxonomies/{name}" path_format_arguments = { "name": _SERIALIZER.url("name", name, "str"), - "version": _SERIALIZER.url("version", version, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1478,11 +1751,11 @@ def build_beta_evaluators_update_version_request( # pylint: disable=name-too-lo _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_evaluators_create_generation_job_request( # pylint: disable=name-too-long - *, operation_id: Optional[str] = None, **kwargs: Any +def build_beta_evaluation_taxonomies_update_request( # pylint: disable=name-too-long + name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1492,23 +1765,30 @@ def build_beta_evaluators_create_generation_job_request( # pylint: disable=name accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/evaluator_generation_jobs" + _url = "/evaluationtaxonomies/{name}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if operation_id is not None: - _headers["Operation-Id"] = _SERIALIZER.header("operation_id", operation_id, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_evaluators_get_generation_job_request( # pylint: disable=name-too-long - job_id: str, **kwargs: Any +def build_beta_evaluators_list_versions_request( # pylint: disable=name-too-long + name: str, + *, + type: Optional[Union[Literal["builtin"], Literal["custom"], Literal["all"], str]] = None, + limit: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1517,15 +1797,19 @@ def build_beta_evaluators_get_generation_job_request( # pylint: disable=name-to accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/evaluator_generation_jobs/{jobId}" + _url = "/evaluators/{name}/versions" path_format_arguments = { - "jobId": _SERIALIZER.url("job_id", job_id, "str"), + "name": _SERIALIZER.url("name", name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if type is not None: + _params["type"] = _SERIALIZER.query("type", type, "str") + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1533,13 +1817,10 @@ def build_beta_evaluators_get_generation_job_request( # pylint: disable=name-to return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_evaluators_list_generation_jobs_request( # pylint: disable=name-too-long +def build_beta_evaluators_list_request( *, + type: Optional[Union[Literal["builtin"], Literal["custom"], Literal["all"], str]] = None, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - after: Optional[str] = None, - before: Optional[str] = None, - category: Optional[Union[str, _models.EvaluatorCategory]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1549,20 +1830,14 @@ def build_beta_evaluators_list_generation_jobs_request( # pylint: disable=name- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/evaluator_generation_jobs" + _url = "/evaluators" # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if type is not None: + _params["type"] = _SERIALIZER.query("type", type, "str") if limit is not None: _params["limit"] = _SERIALIZER.query("limit", limit, "int") - if order is not None: - _params["order"] = _SERIALIZER.query("order", order, "str") - if after is not None: - _params["after"] = _SERIALIZER.query("after", after, "str") - if before is not None: - _params["before"] = _SERIALIZER.query("before", before, "str") - if category is not None: - _params["category"] = _SERIALIZER.query("category", category, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1570,8 +1845,8 @@ def build_beta_evaluators_list_generation_jobs_request( # pylint: disable=name- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_evaluators_cancel_generation_job_request( # pylint: disable=name-too-long - job_id: str, **kwargs: Any +def build_beta_evaluators_get_version_request( # pylint: disable=name-too-long + name: str, version: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1580,9 +1855,10 @@ def build_beta_evaluators_cancel_generation_job_request( # pylint: disable=name accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/evaluator_generation_jobs/{jobId}:cancel" + _url = "/evaluators/{name}/versions/{version}" path_format_arguments = { - "jobId": _SERIALIZER.url("job_id", job_id, "str"), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1593,19 +1869,20 @@ def build_beta_evaluators_cancel_generation_job_request( # pylint: disable=name # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_evaluators_delete_generation_job_request( # pylint: disable=name-too-long - job_id: str, **kwargs: Any +def build_beta_evaluators_delete_version_request( # pylint: disable=name-too-long + name: str, version: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) # Construct URL - _url = "/evaluator_generation_jobs/{jobId}" + _url = "/evaluators/{name}/versions/{version}" path_format_arguments = { - "jobId": _SERIALIZER.url("job_id", job_id, "str"), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1616,7 +1893,9 @@ def build_beta_evaluators_delete_generation_job_request( # pylint: disable=name return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_beta_insights_generate_request(**kwargs: Any) -> HttpRequest: +def build_beta_evaluators_create_version_request( # pylint: disable=name-too-long + name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1625,18 +1904,17 @@ def build_beta_insights_generate_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/insights" - + _url = "/evaluators/{name}/versions" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if "Repeatability-Request-ID" not in _headers: - _headers["Repeatability-Request-ID"] = str(uuid.uuid4()) - if "Repeatability-First-Sent" not in _headers: - _headers["Repeatability-First-Sent"] = _SERIALIZER.serialize_data( - datetime.datetime.now(datetime.timezone.utc), "rfc-1123" - ) if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1644,72 +1922,69 @@ def build_beta_insights_generate_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_insights_get_request( - insight_id: str, *, include_coordinates: Optional[bool] = None, **kwargs: Any +def build_beta_evaluators_update_version_request( # pylint: disable=name-too-long + name: str, version: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/insights/{id}" + _url = "/evaluators/{name}/versions/{version}" path_format_arguments = { - "id": _SERIALIZER.url("insight_id", insight_id, "str"), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if include_coordinates is not None: - _params["includeCoordinates"] = _SERIALIZER.query("include_coordinates", include_coordinates, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_insights_list_request( - *, - type: Optional[Union[str, _models.InsightType]] = None, - eval_id: Optional[str] = None, - run_id: Optional[str] = None, - agent_name: Optional[str] = None, - include_coordinates: Optional[bool] = None, - **kwargs: Any +def build_beta_evaluators_pending_upload_request( # pylint: disable=name-too-long + name: str, version: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/insights" + _url = "/evaluators/{name}/versions/{version}/startPendingUpload" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if type is not None: - _params["type"] = _SERIALIZER.query("type", type, "str") - if eval_id is not None: - _params["evalId"] = _SERIALIZER.query("eval_id", eval_id, "str") - if run_id is not None: - _params["runId"] = _SERIALIZER.query("run_id", run_id, "str") - if agent_name is not None: - _params["agentName"] = _SERIALIZER.query("agent_name", agent_name, "str") - if include_coordinates is not None: - _params["includeCoordinates"] = _SERIALIZER.query("include_coordinates", include_coordinates, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_memory_stores_create_request(**kwargs: Any) -> HttpRequest: +def build_beta_evaluators_get_credentials_request( # pylint: disable=name-too-long + name: str, version: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1718,7 +1993,13 @@ def build_beta_memory_stores_create_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/memory_stores" + _url = "/evaluators/{name}/versions/{version}/credentials" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1731,7 +2012,9 @@ def build_beta_memory_stores_create_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_memory_stores_update_request(name: str, **kwargs: Any) -> HttpRequest: +def build_beta_evaluators_create_generation_job_request( # pylint: disable=name-too-long + *, operation_id: Optional[str] = None, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1740,17 +2023,14 @@ def build_beta_memory_stores_update_request(name: str, **kwargs: Any) -> HttpReq accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/memory_stores/{name}" - path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/evaluator_generation_jobs" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if operation_id is not None: + _headers["Operation-Id"] = _SERIALIZER.header("operation_id", operation_id, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1758,7 +2038,9 @@ def build_beta_memory_stores_update_request(name: str, **kwargs: Any) -> HttpReq return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_memory_stores_get_request(name: str, **kwargs: Any) -> HttpRequest: +def build_beta_evaluators_get_generation_job_request( # pylint: disable=name-too-long + job_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1766,9 +2048,9 @@ def build_beta_memory_stores_get_request(name: str, **kwargs: Any) -> HttpReques accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/memory_stores/{name}" + _url = "/evaluator_generation_jobs/{jobId}" path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), + "jobId": _SERIALIZER.url("job_id", job_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1782,12 +2064,13 @@ def build_beta_memory_stores_get_request(name: str, **kwargs: Any) -> HttpReques return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_memory_stores_list_request( +def build_beta_evaluators_list_generation_jobs_request( # pylint: disable=name-too-long *, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, after: Optional[str] = None, before: Optional[str] = None, + category: Optional[Union[str, _models.EvaluatorCategory]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1797,7 +2080,7 @@ def build_beta_memory_stores_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/memory_stores" + _url = "/evaluator_generation_jobs" # Construct parameters if limit is not None: @@ -1808,6 +2091,8 @@ def build_beta_memory_stores_list_request( _params["after"] = _SERIALIZER.query("after", after, "str") if before is not None: _params["before"] = _SERIALIZER.query("before", before, "str") + if category is not None: + _params["category"] = _SERIALIZER.query("category", category, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -1816,7 +2101,9 @@ def build_beta_memory_stores_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_memory_stores_delete_request(name: str, **kwargs: Any) -> HttpRequest: +def build_beta_evaluators_cancel_generation_job_request( # pylint: disable=name-too-long + job_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1824,9 +2111,9 @@ def build_beta_memory_stores_delete_request(name: str, **kwargs: Any) -> HttpReq accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/memory_stores/{name}" + _url = "/evaluator_generation_jobs/{jobId}:cancel" path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), + "jobId": _SERIALIZER.url("job_id", job_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1837,23 +2124,19 @@ def build_beta_memory_stores_delete_request(name: str, **kwargs: Any) -> HttpReq # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_memory_stores_search_memories_request( # pylint: disable=name-too-long - name: str, **kwargs: Any +def build_beta_evaluators_delete_generation_job_request( # pylint: disable=name-too-long + job_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/memory_stores/{name}:search_memories" + _url = "/evaluator_generation_jobs/{jobId}" path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), + "jobId": _SERIALIZER.url("job_id", job_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1861,26 +2144,20 @@ def build_beta_memory_stores_search_memories_request( # pylint: disable=name-to # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_beta_memory_stores_update_memories_request( # pylint: disable=name-too-long +def build_beta_evaluators_list_evaluation_suite_versions_request( # pylint: disable=name-too-long name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/memory_stores/{name}:update_memories" + _url = "/evaluation_suites/{name}/versions" path_format_arguments = { "name": _SERIALIZER.url("name", name, "str"), } @@ -1891,43 +2168,37 @@ def build_beta_memory_stores_update_memories_request( # pylint: disable=name-to _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_memory_stores_delete_scope_request( # pylint: disable=name-too-long - name: str, **kwargs: Any +def build_beta_evaluators_list_evaluation_suites_request( # pylint: disable=name-too-long + *, agent_name: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/memory_stores/{name}:delete_scope" - path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/evaluation_suites" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if agent_name is not None: + _params["agent_name"] = _SERIALIZER.query("agent_name", agent_name, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_red_teams_get_request(name: str, **kwargs: Any) -> HttpRequest: +def build_beta_evaluators_get_evaluation_suite_request( # pylint: disable=name-too-long + name: str, version: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1935,9 +2206,10 @@ def build_beta_red_teams_get_request(name: str, **kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/redTeams/runs/{name}" + _url = "/evaluation_suites/{name}/versions/{version}" path_format_arguments = { "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1951,26 +2223,30 @@ def build_beta_red_teams_get_request(name: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_red_teams_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) +def build_beta_evaluators_delete_evaluation_suite_request( # pylint: disable=name-too-long + name: str, version: str, **kwargs: Any +) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/redTeams/runs" + _url = "/evaluation_suites/{name}/versions/{version}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_beta_red_teams_create_request(**kwargs: Any) -> HttpRequest: +def build_beta_evaluators_create_or_update_evaluation_suite_request( # pylint: disable=name-too-long + name: str, version: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1979,7 +2255,13 @@ def build_beta_red_teams_create_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/redTeams/runs:run" + _url = "/evaluation_suites/{name}/versions/{version}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -1989,17 +2271,23 @@ def build_beta_red_teams_create_request(**kwargs: Any) -> HttpRequest: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_schedules_delete_request(schedule_id: str, **kwargs: Any) -> HttpRequest: +def build_beta_evaluators_create_evaluation_suite_request( # pylint: disable=name-too-long + name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/schedules/{id}" + _url = "/evaluation_suites/{name}/versions" path_format_arguments = { - "id": _SERIALIZER.url("schedule_id", schedule_id, "str"), + "name": _SERIALIZER.url("name", name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2007,20 +2295,28 @@ def build_beta_schedules_delete_request(schedule_id: str, **kwargs: Any) -> Http # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_schedules_get_request(schedule_id: str, **kwargs: Any) -> HttpRequest: + +def build_beta_evaluators_run_evaluation_suite_request( # pylint: disable=name-too-long + name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/schedules/{id}" + _url = "/evaluation_suites/{name}:run" path_format_arguments = { - "id": _SERIALIZER.url("schedule_id", schedule_id, "str"), + "name": _SERIALIZER.url("name", name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2029,50 +2325,52 @@ def build_beta_schedules_get_request(schedule_id: str, **kwargs: Any) -> HttpReq _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_schedules_list_request( - *, type: Optional[Union[str, _models.ScheduleTaskType]] = None, enabled: Optional[bool] = None, **kwargs: Any +def build_beta_evaluators_create_generation_suite_job_request( # pylint: disable=name-too-long + *, operation_id: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/schedules" + _url = "/evaluation_suite_generation_jobs" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if type is not None: - _params["type"] = _SERIALIZER.query("type", type, "str") - if enabled is not None: - _params["enabled"] = _SERIALIZER.query("enabled", enabled, "bool") # Construct headers + if operation_id is not None: + _headers["Operation-Id"] = _SERIALIZER.header("operation_id", operation_id, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_schedules_create_or_update_request( # pylint: disable=name-too-long - schedule_id: str, **kwargs: Any +def build_beta_evaluators_get_generation_suite_job_request( # pylint: disable=name-too-long + job_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/schedules/{id}" + _url = "/evaluation_suite_generation_jobs/{jobId}" path_format_arguments = { - "id": _SERIALIZER.url("schedule_id", schedule_id, "str"), + "jobId": _SERIALIZER.url("job_id", job_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2081,14 +2379,19 @@ def build_beta_schedules_create_or_update_request( # pylint: disable=name-too-l _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_schedules_get_run_request(schedule_id: str, run_id: str, **kwargs: Any) -> HttpRequest: +def build_beta_evaluators_list_generation_suite_jobs_request( # pylint: disable=name-too-long + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + after: Optional[str] = None, + before: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2096,29 +2399,27 @@ def build_beta_schedules_get_run_request(schedule_id: str, run_id: str, **kwargs accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/schedules/{schedule_id}/runs/{run_id}" - path_format_arguments = { - "schedule_id": _SERIALIZER.url("schedule_id", schedule_id, "str"), - "run_id": _SERIALIZER.url("run_id", run_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/evaluation_suite_generation_jobs" # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if order is not None: + _params["order"] = _SERIALIZER.query("order", order, "str") + if after is not None: + _params["after"] = _SERIALIZER.query("after", after, "str") + if before is not None: + _params["before"] = _SERIALIZER.query("before", before, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_schedules_list_runs_request( - schedule_id: str, - *, - type: Optional[Union[str, _models.ScheduleTaskType]] = None, - enabled: Optional[bool] = None, - **kwargs: Any +def build_beta_evaluators_cancel_generation_suite_job_request( # pylint: disable=name-too-long + job_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2127,40 +2428,32 @@ def build_beta_schedules_list_runs_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/schedules/{id}/runs" + _url = "/evaluation_suite_generation_jobs/{jobId}:cancel" path_format_arguments = { - "id": _SERIALIZER.url("schedule_id", schedule_id, "str"), + "jobId": _SERIALIZER.url("job_id", job_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if type is not None: - _params["type"] = _SERIALIZER.query("type", type, "str") - if enabled is not None: - _params["enabled"] = _SERIALIZER.query("enabled", enabled, "bool") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_toolboxes_create_version_request( # pylint: disable=name-too-long - name: str, **kwargs: Any +def build_beta_evaluators_delete_generation_suite_job_request( # pylint: disable=name-too-long + job_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/toolboxes/{name}/versions" + _url = "/evaluation_suite_generation_jobs/{jobId}" path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), + "jobId": _SERIALIZER.url("job_id", job_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2168,7 +2461,30 @@ def build_beta_toolboxes_create_version_request( # pylint: disable=name-too-lon # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_beta_insights_generate_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/insights" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + # Construct headers + if "Repeatability-Request-ID" not in _headers: + _headers["Repeatability-Request-ID"] = str(uuid.uuid4()) + if "Repeatability-First-Sent" not in _headers: + _headers["Repeatability-First-Sent"] = _SERIALIZER.serialize_data( + datetime.datetime.now(datetime.timezone.utc), "rfc-1123" + ) if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -2176,7 +2492,9 @@ def build_beta_toolboxes_create_version_request( # pylint: disable=name-too-lon return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_toolboxes_get_request(name: str, **kwargs: Any) -> HttpRequest: +def build_beta_insights_get_request( + insight_id: str, *, include_coordinates: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2184,14 +2502,16 @@ def build_beta_toolboxes_get_request(name: str, **kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/toolboxes/{name}" + _url = "/insights/{id}" path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), + "id": _SERIALIZER.url("insight_id", insight_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + if include_coordinates is not None: + _params["includeCoordinates"] = _SERIALIZER.query("include_coordinates", include_coordinates, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -2200,12 +2520,13 @@ def build_beta_toolboxes_get_request(name: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_toolboxes_list_request( +def build_beta_insights_list_request( *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - after: Optional[str] = None, - before: Optional[str] = None, + type: Optional[Union[str, _models.InsightType]] = None, + eval_id: Optional[str] = None, + run_id: Optional[str] = None, + agent_name: Optional[str] = None, + include_coordinates: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -2215,17 +2536,19 @@ def build_beta_toolboxes_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/toolboxes" + _url = "/insights" # Construct parameters - if limit is not None: - _params["limit"] = _SERIALIZER.query("limit", limit, "int") - if order is not None: - _params["order"] = _SERIALIZER.query("order", order, "str") - if after is not None: - _params["after"] = _SERIALIZER.query("after", after, "str") - if before is not None: - _params["before"] = _SERIALIZER.query("before", before, "str") + if type is not None: + _params["type"] = _SERIALIZER.query("type", type, "str") + if eval_id is not None: + _params["evalId"] = _SERIALIZER.query("eval_id", eval_id, "str") + if run_id is not None: + _params["runId"] = _SERIALIZER.query("run_id", run_id, "str") + if agent_name is not None: + _params["agentName"] = _SERIALIZER.query("agent_name", agent_name, "str") + if include_coordinates is not None: + _params["includeCoordinates"] = _SERIALIZER.query("include_coordinates", include_coordinates, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -2234,58 +2557,40 @@ def build_beta_toolboxes_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_toolboxes_list_versions_request( # pylint: disable=name-too-long - name: str, - *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - after: Optional[str] = None, - before: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: +def build_beta_memory_stores_create_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/toolboxes/{name}/versions" - path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/memory_stores" # Construct parameters - if limit is not None: - _params["limit"] = _SERIALIZER.query("limit", limit, "int") - if order is not None: - _params["order"] = _SERIALIZER.query("order", order, "str") - if after is not None: - _params["after"] = _SERIALIZER.query("after", after, "str") - if before is not None: - _params["before"] = _SERIALIZER.query("before", before, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_toolboxes_get_version_request(name: str, version: str, **kwargs: Any) -> HttpRequest: +def build_beta_memory_stores_update_request(name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/toolboxes/{name}/versions/{version}" + _url = "/memory_stores/{name}" path_format_arguments = { "name": _SERIALIZER.url("name", name, "str"), - "version": _SERIALIZER.url("version", version, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2294,21 +2599,22 @@ def build_beta_toolboxes_get_version_request(name: str, version: str, **kwargs: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_toolboxes_update_request(name: str, **kwargs: Any) -> HttpRequest: +def build_beta_memory_stores_get_request(name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/toolboxes/{name}" + _url = "/memory_stores/{name}" path_format_arguments = { "name": _SERIALIZER.url("name", name, "str"), } @@ -2319,42 +2625,56 @@ def build_beta_toolboxes_update_request(name: str, **kwargs: Any) -> HttpRequest _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_toolboxes_delete_request(name: str, **kwargs: Any) -> HttpRequest: +def build_beta_memory_stores_list_request( + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + after: Optional[str] = None, + before: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - # Construct URL - _url = "/toolboxes/{name}" - path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - } + accept = _headers.pop("Accept", "application/json") - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct URL + _url = "/memory_stores" # Construct parameters + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if order is not None: + _params["order"] = _SERIALIZER.query("order", order, "str") + if after is not None: + _params["after"] = _SERIALIZER.query("after", after, "str") + if before is not None: + _params["before"] = _SERIALIZER.query("before", before, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_toolboxes_delete_version_request( # pylint: disable=name-too-long - name: str, version: str, **kwargs: Any -) -> HttpRequest: + +def build_beta_memory_stores_delete_request(name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/toolboxes/{name}/versions/{version}" + _url = "/memory_stores/{name}" path_format_arguments = { "name": _SERIALIZER.url("name", name, "str"), - "version": _SERIALIZER.url("version", version, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2362,10 +2682,15 @@ def build_beta_toolboxes_delete_version_request( # pylint: disable=name-too-lon # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_skills_create_request(**kwargs: Any) -> HttpRequest: + +def build_beta_memory_stores_search_memories_request( # pylint: disable=name-too-long + name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2374,7 +2699,12 @@ def build_beta_skills_create_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/skills" + _url = "/memory_stores/{name}:search_memories" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -2387,36 +2717,47 @@ def build_beta_skills_create_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_skills_create_from_package_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_beta_memory_stores_update_memories_request( # pylint: disable=name-too-long + name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: str = kwargs.pop("content_type") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/skills:import" + _url = "/memory_stores/{name}:update_memories" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_skills_get_request(name: str, **kwargs: Any) -> HttpRequest: +def build_beta_memory_stores_delete_scope_request( # pylint: disable=name-too-long + name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/skills/{name}" + _url = "/memory_stores/{name}:delete_scope" path_format_arguments = { "name": _SERIALIZER.url("name", name, "str"), } @@ -2427,20 +2768,25 @@ def build_beta_skills_get_request(name: str, **kwargs: Any) -> HttpRequest: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_skills_download_request(name: str, **kwargs: Any) -> HttpRequest: +def build_beta_memory_stores_create_memory_request( # pylint: disable=name-too-long + name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - accept = _headers.pop("Accept", "application/zip") + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/skills/{name}:download" + _url = "/memory_stores/{name}/memories" path_format_arguments = { "name": _SERIALIZER.url("name", name, "str"), } @@ -2451,57 +2797,57 @@ def build_beta_skills_download_request(name: str, **kwargs: Any) -> HttpRequest: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_skills_list_request( - *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - after: Optional[str] = None, - before: Optional[str] = None, - **kwargs: Any +def build_beta_memory_stores_update_memory_request( # pylint: disable=name-too-long + name: str, memory_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/skills" + _url = "/memory_stores/{name}/memories/{memory_id}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + "memory_id": _SERIALIZER.url("memory_id", memory_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if limit is not None: - _params["limit"] = _SERIALIZER.query("limit", limit, "int") - if order is not None: - _params["order"] = _SERIALIZER.query("order", order, "str") - if after is not None: - _params["after"] = _SERIALIZER.query("after", after, "str") - if before is not None: - _params["before"] = _SERIALIZER.query("before", before, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_skills_update_request(name: str, **kwargs: Any) -> HttpRequest: +def build_beta_memory_stores_get_memory_request( # pylint: disable=name-too-long + name: str, memory_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/skills/{name}" + _url = "/memory_stores/{name}/memories/{memory_id}" path_format_arguments = { "name": _SERIALIZER.url("name", name, "str"), + "memory_id": _SERIALIZER.url("memory_id", memory_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2510,14 +2856,20 @@ def build_beta_skills_update_request(name: str, **kwargs: Any) -> HttpRequest: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_skills_delete_request(name: str, **kwargs: Any) -> HttpRequest: +def build_beta_memory_stores_list_memories_request( # pylint: disable=name-too-long + name: str, + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + after: Optional[str] = None, + before: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2525,7 +2877,7 @@ def build_beta_skills_delete_request(name: str, **kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/skills/{name}" + _url = "/memory_stores/{name}/memories" path_format_arguments = { "name": _SERIALIZER.url("name", name, "str"), } @@ -2533,16 +2885,24 @@ def build_beta_skills_delete_request(name: str, **kwargs: Any) -> HttpRequest: _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if order is not None: + _params["order"] = _SERIALIZER.query("order", order, "str") + if after is not None: + _params["after"] = _SERIALIZER.query("after", after, "str") + if before is not None: + _params["before"] = _SERIALIZER.query("before", before, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_datasets_get_generation_job_request( # pylint: disable=name-too-long - job_id: str, **kwargs: Any +def build_beta_memory_stores_delete_memory_request( # pylint: disable=name-too-long + name: str, memory_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2551,9 +2911,10 @@ def build_beta_datasets_get_generation_job_request( # pylint: disable=name-too- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/data_generation_jobs/{jobId}" + _url = "/memory_stores/{name}/memories/{memory_id}" path_format_arguments = { - "jobId": _SERIALIZER.url("job_id", job_id, "str"), + "name": _SERIALIZER.url("name", name, "str"), + "memory_id": _SERIALIZER.url("memory_id", memory_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2564,19 +2925,10 @@ def build_beta_datasets_get_generation_job_request( # pylint: disable=name-too- # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_datasets_list_generation_jobs_request( # pylint: disable=name-too-long - *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - after: Optional[str] = None, - before: Optional[str] = None, - scenario: Optional[Union[str, _models.DataGenerationJobScenario]] = None, - type: Optional[List[Union[str, _models.DataGenerationJobType]]] = None, - **kwargs: Any -) -> HttpRequest: +def build_beta_models_list_versions_request(name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2584,21 +2936,14 @@ def build_beta_datasets_list_generation_jobs_request( # pylint: disable=name-to accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/data_generation_jobs" + _url = "/models/{name}/versions" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if limit is not None: - _params["limit"] = _SERIALIZER.query("limit", limit, "int") - if order is not None: - _params["order"] = _SERIALIZER.query("order", order, "str") - if after is not None: - _params["after"] = _SERIALIZER.query("after", after, "str") - if before is not None: - _params["before"] = _SERIALIZER.query("before", before, "str") - if scenario is not None: - _params["scenario"] = _SERIALIZER.query("scenario", scenario, "str") - if type is not None: - _params["type"] = _SERIALIZER.query("type", type, "[str]", div=",") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -2607,35 +2952,26 @@ def build_beta_datasets_list_generation_jobs_request( # pylint: disable=name-to return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_datasets_create_generation_job_request( # pylint: disable=name-too-long - *, operation_id: Optional[str] = None, **kwargs: Any -) -> HttpRequest: +def build_beta_models_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/data_generation_jobs" + _url = "/models" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if operation_id is not None: - _headers["Operation-Id"] = _SERIALIZER.header("operation_id", operation_id, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_datasets_cancel_generation_job_request( # pylint: disable=name-too-long - job_id: str, **kwargs: Any -) -> HttpRequest: +def build_beta_models_get_request(name: str, version: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2643,9 +2979,10 @@ def build_beta_datasets_cancel_generation_job_request( # pylint: disable=name-t accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/data_generation_jobs/{jobId}:cancel" + _url = "/models/{name}/versions/{version}" path_format_arguments = { - "jobId": _SERIALIZER.url("job_id", job_id, "str"), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2656,19 +2993,18 @@ def build_beta_datasets_cancel_generation_job_request( # pylint: disable=name-t # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_datasets_delete_generation_job_request( # pylint: disable=name-too-long - job_id: str, **kwargs: Any -) -> HttpRequest: +def build_beta_models_delete_request(name: str, version: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) # Construct URL - _url = "/data_generation_jobs/{jobId}" + _url = "/models/{name}/versions/{version}" path_format_arguments = { - "jobId": _SERIALIZER.url("job_id", job_id, "str"), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2679,145 +3015,4800 @@ def build_beta_datasets_delete_generation_job_request( # pylint: disable=name-t return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -class BetaOperations: # pylint: disable=too-many-instance-attributes - """ - .. warning:: - **DO NOT** instantiate this class directly. +def build_beta_models_update_request(name: str, version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`beta` attribute. - """ + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + # Construct URL + _url = "/models/{name}/versions/{version}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } - self.agents = BetaAgentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.evaluation_taxonomies = BetaEvaluationTaxonomiesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.evaluators = BetaEvaluatorsOperations(self._client, self._config, self._serialize, self._deserialize) - self.insights = BetaInsightsOperations(self._client, self._config, self._serialize, self._deserialize) - self.memory_stores = BetaMemoryStoresOperations(self._client, self._config, self._serialize, self._deserialize) - self.red_teams = BetaRedTeamsOperations(self._client, self._config, self._serialize, self._deserialize) - self.schedules = BetaSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) - self.toolboxes = BetaToolboxesOperations(self._client, self._config, self._serialize, self._deserialize) - self.skills = BetaSkillsOperations(self._client, self._config, self._serialize, self._deserialize) - self.datasets = BetaDatasetsOperations(self._client, self._config, self._serialize, self._deserialize) + _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") -class AgentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`agents` attribute. - """ + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def get(self, agent_name: str, **kwargs: Any) -> _models.AgentDetails: - """Retrieves the agent. +def build_beta_models_create_async_request(name: str, version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - :param agent_name: The name of the agent to retrieve. Required. - :type agent_name: str - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + # Construct URL + _url = "/models/{name}/versions/{version}/createAsync" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } - cls: ClsType[_models.AgentDetails] = kwargs.pop("cls", None) + _url: str = _url.format(**path_format_arguments) # type: ignore - _request = build_agents_get_request( - agent_name=agent_name, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - response = pipeline_response.http_response + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.AgentDetails, response.json()) +def build_beta_models_pending_upload_request(name: str, version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") - return deserialized # type: ignore + # Construct URL + _url = "/models/{name}/versions/{version}/startPendingUpload" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } - @distributed_trace - def delete(self, agent_name: str, **kwargs: Any) -> _models.DeleteAgentResponse: - """Deletes an agent. + _url: str = _url.format(**path_format_arguments) # type: ignore - :param agent_name: The name of the agent to delete. Required. - :type agent_name: str - :return: DeleteAgentResponse. The DeleteAgentResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DeleteAgentResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - _headers = kwargs.pop("headers", {}) or {} + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_models_get_credentials_request( # pylint: disable=name-too-long + name: str, version: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/models/{name}/versions/{version}/credentials" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_red_teams_get_request(name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/redTeams/runs/{name}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_red_teams_list_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/redTeams/runs" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_red_teams_create_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/redTeams/runs:run" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_routines_create_or_update_request( # pylint: disable=name-too-long + routine_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/routines/{routine_name}" + path_format_arguments = { + "routine_name": _SERIALIZER.url("routine_name", routine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_routines_get_request(routine_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/routines/{routine_name}" + path_format_arguments = { + "routine_name": _SERIALIZER.url("routine_name", routine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_routines_enable_request(routine_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/routines/{routine_name}:enable" + path_format_arguments = { + "routine_name": _SERIALIZER.url("routine_name", routine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_routines_disable_request(routine_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/routines/{routine_name}:disable" + path_format_arguments = { + "routine_name": _SERIALIZER.url("routine_name", routine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_routines_list_request( + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + after: Optional[str] = None, + before: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/routines" + + # Construct parameters + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if order is not None: + _params["order"] = _SERIALIZER.query("order", order, "str") + if after is not None: + _params["after"] = _SERIALIZER.query("after", after, "str") + if before is not None: + _params["before"] = _SERIALIZER.query("before", before, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_routines_delete_request(routine_name: str, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + # Construct URL + _url = "/routines/{routine_name}" + path_format_arguments = { + "routine_name": _SERIALIZER.url("routine_name", routine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_beta_routines_list_runs_request( + routine_name: str, + *, + filter: Optional[str] = None, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + after: Optional[str] = None, + before: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/routines/{routine_name}/runs" + path_format_arguments = { + "routine_name": _SERIALIZER.url("routine_name", routine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if filter is not None: + _params["filter"] = _SERIALIZER.query("filter", filter, "str") + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if order is not None: + _params["order"] = _SERIALIZER.query("order", order, "str") + if after is not None: + _params["after"] = _SERIALIZER.query("after", after, "str") + if before is not None: + _params["before"] = _SERIALIZER.query("before", before, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_routines_dispatch_async_request( # pylint: disable=name-too-long + routine_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/routines/{routine_name}:dispatch_async" + path_format_arguments = { + "routine_name": _SERIALIZER.url("routine_name", routine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_schedules_delete_request(schedule_id: str, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + # Construct URL + _url = "/schedules/{id}" + path_format_arguments = { + "id": _SERIALIZER.url("schedule_id", schedule_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_beta_schedules_get_request(schedule_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/schedules/{id}" + path_format_arguments = { + "id": _SERIALIZER.url("schedule_id", schedule_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_schedules_list_request( + *, type: Optional[Union[str, _models.ScheduleTaskType]] = None, enabled: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/schedules" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if type is not None: + _params["type"] = _SERIALIZER.query("type", type, "str") + if enabled is not None: + _params["enabled"] = _SERIALIZER.query("enabled", enabled, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_schedules_create_or_update_request( # pylint: disable=name-too-long + schedule_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/schedules/{id}" + path_format_arguments = { + "id": _SERIALIZER.url("schedule_id", schedule_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_schedules_get_run_request(schedule_id: str, run_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/schedules/{schedule_id}/runs/{run_id}" + path_format_arguments = { + "schedule_id": _SERIALIZER.url("schedule_id", schedule_id, "str"), + "run_id": _SERIALIZER.url("run_id", run_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_schedules_list_runs_request( + schedule_id: str, + *, + type: Optional[Union[str, _models.ScheduleTaskType]] = None, + enabled: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/schedules/{id}/runs" + path_format_arguments = { + "id": _SERIALIZER.url("schedule_id", schedule_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if type is not None: + _params["type"] = _SERIALIZER.query("type", type, "str") + if enabled is not None: + _params["enabled"] = _SERIALIZER.query("enabled", enabled, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_skills_create_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/skills" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_skills_create_from_package_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: str = kwargs.pop("content_type") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/skills:import" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_skills_get_request(name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/skills/{name}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_skills_download_request(name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/zip") + + # Construct URL + _url = "/skills/{name}:download" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_skills_list_request( + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + after: Optional[str] = None, + before: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/skills" + + # Construct parameters + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if order is not None: + _params["order"] = _SERIALIZER.query("order", order, "str") + if after is not None: + _params["after"] = _SERIALIZER.query("after", after, "str") + if before is not None: + _params["before"] = _SERIALIZER.query("before", before, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_skills_update_request(name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/skills/{name}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_skills_delete_request(name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/skills/{name}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_datasets_get_generation_job_request( # pylint: disable=name-too-long + job_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data_generation_jobs/{jobId}" + path_format_arguments = { + "jobId": _SERIALIZER.url("job_id", job_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_datasets_list_generation_jobs_request( # pylint: disable=name-too-long + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + after: Optional[str] = None, + before: Optional[str] = None, + scenario: Optional[Union[str, _models.DataGenerationJobScenario]] = None, + type: Optional[List[Union[str, _models.DataGenerationJobType]]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data_generation_jobs" + + # Construct parameters + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if order is not None: + _params["order"] = _SERIALIZER.query("order", order, "str") + if after is not None: + _params["after"] = _SERIALIZER.query("after", after, "str") + if before is not None: + _params["before"] = _SERIALIZER.query("before", before, "str") + if scenario is not None: + _params["scenario"] = _SERIALIZER.query("scenario", scenario, "str") + if type is not None: + _params["type"] = _SERIALIZER.query("type", type, "[str]", div=",") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_datasets_create_generation_job_request( # pylint: disable=name-too-long + *, operation_id: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data_generation_jobs" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if operation_id is not None: + _headers["Operation-Id"] = _SERIALIZER.header("operation_id", operation_id, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_datasets_cancel_generation_job_request( # pylint: disable=name-too-long + job_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data_generation_jobs/{jobId}:cancel" + path_format_arguments = { + "jobId": _SERIALIZER.url("job_id", job_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_datasets_delete_generation_job_request( # pylint: disable=name-too-long + job_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + # Construct URL + _url = "/data_generation_jobs/{jobId}" + path_format_arguments = { + "jobId": _SERIALIZER.url("job_id", job_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +class BetaOperations: # pylint: disable=too-many-instance-attributes + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`beta` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + self.agents = BetaAgentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.evaluation_taxonomies = BetaEvaluationTaxonomiesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.evaluators = BetaEvaluatorsOperations(self._client, self._config, self._serialize, self._deserialize) + self.insights = BetaInsightsOperations(self._client, self._config, self._serialize, self._deserialize) + self.memory_stores = BetaMemoryStoresOperations(self._client, self._config, self._serialize, self._deserialize) + self.models = BetaModelsOperations(self._client, self._config, self._serialize, self._deserialize) + self.red_teams = BetaRedTeamsOperations(self._client, self._config, self._serialize, self._deserialize) + self.routines = BetaRoutinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.schedules = BetaSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.skills = BetaSkillsOperations(self._client, self._config, self._serialize, self._deserialize) + self.datasets = BetaDatasetsOperations(self._client, self._config, self._serialize, self._deserialize) + + +class AgentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`agents` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, agent_name: str, **kwargs: Any) -> _models.AgentDetails: + """Retrieves the agent. + + :param agent_name: The name of the agent to retrieve. Required. + :type agent_name: str + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AgentDetails] = kwargs.pop("cls", None) + + _request = build_agents_get_request( + agent_name=agent_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete(self, agent_name: str, *, force: Optional[bool] = None, **kwargs: Any) -> _models.DeleteAgentResponse: + """Deletes an agent. For hosted agents, if any version has active sessions, the request is + rejected with HTTP 409 unless ``force`` is set to true. When force is true, all associated + sessions are cascade-deleted along with the agent and its versions. + + :param agent_name: The name of the agent to delete. Required. + :type agent_name: str + :keyword force: For Hosted Agents, if true, force-deletes the agent even if its versions have + active sessions, cascading deletion to all associated sessions. This value is not relevant for + other Agent types. Defaults to false. Default value is None. + :paramtype force: bool + :return: DeleteAgentResponse. The DeleteAgentResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DeleteAgentResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DeleteAgentResponse] = kwargs.pop("cls", None) + + _request = build_agents_delete_request( + agent_name=agent_name, + force=force, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DeleteAgentResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + *, + kind: Optional[Union[str, _models.AgentKind]] = None, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.AgentDetails"]: + """Returns the list of all agents. + + :keyword kind: Filter agents by kind. If not provided, all agents are returned. Known values + are: "prompt", "hosted", "workflow", and "external". Default value is None. + :paramtype kind: str or ~azure.ai.projects.models.AgentKind + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of AgentDetails + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.AgentDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AgentDetails]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(_continuation_token=None): + + _request = build_agents_list_request( + kind=kind, + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.AgentDetails], + deserialized.get("data", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, iter(list_of_elem) + + def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def create_version( + self, + agent_name: str, + *, + definition: _models.AgentDefinition, + content_type: str = "application/json", + metadata: Optional[dict[str, str]] = None, + description: Optional[str] = None, + blueprint_reference: Optional[_models.AgentBlueprintReference] = None, + **kwargs: Any + ) -> _models.AgentVersionDetails: + """Create a new agent version. + + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :keyword definition: The agent definition. This can be a workflow, hosted agent, or a simple + agent definition. Required. + :paramtype definition: ~azure.ai.projects.models.AgentDefinition + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword metadata: Set of 16 key-value pairs that can be attached to an object. This can be + useful for storing additional information about the object in a structured + format, and querying for objects via API or the dashboard. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. Default value is None. + :paramtype metadata: dict[str, str] + :keyword description: A human-readable description of the agent. Default value is None. + :paramtype description: str + :keyword blueprint_reference: The blueprint reference for the agent. Default value is None. + :paramtype blueprint_reference: ~azure.ai.projects.models.AgentBlueprintReference + :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentVersionDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_version( + self, agent_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AgentVersionDetails: + """Create a new agent version. + + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentVersionDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_version( + self, agent_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AgentVersionDetails: + """Create a new agent version. + + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentVersionDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_version( + self, + agent_name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + definition: _models.AgentDefinition = _Unset, + metadata: Optional[dict[str, str]] = None, + description: Optional[str] = None, + blueprint_reference: Optional[_models.AgentBlueprintReference] = None, + **kwargs: Any + ) -> _models.AgentVersionDetails: + """Create a new agent version. + + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword definition: The agent definition. This can be a workflow, hosted agent, or a simple + agent definition. Required. + :paramtype definition: ~azure.ai.projects.models.AgentDefinition + :keyword metadata: Set of 16 key-value pairs that can be attached to an object. This can be + useful for storing additional information about the object in a structured + format, and querying for objects via API or the dashboard. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. Default value is None. + :paramtype metadata: dict[str, str] + :keyword description: A human-readable description of the agent. Default value is None. + :paramtype description: str + :keyword blueprint_reference: The blueprint reference for the agent. Default value is None. + :paramtype blueprint_reference: ~azure.ai.projects.models.AgentBlueprintReference + :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentVersionDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AgentVersionDetails] = kwargs.pop("cls", None) + + if body is _Unset: + if definition is _Unset: + raise TypeError("missing required argument: definition") + body = { + "blueprint_reference": blueprint_reference, + "definition": definition, + "description": description, + "metadata": metadata, + } + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_agents_create_version_request( + agent_name=agent_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentVersionDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_version_from_manifest( + self, + agent_name: str, + *, + manifest_id: str, + parameter_values: dict[str, Any], + content_type: str = "application/json", + metadata: Optional[dict[str, str]] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> _models.AgentVersionDetails: + """Create a new agent version from a manifest. + + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :keyword manifest_id: The manifest ID to import the agent version from. Required. + :paramtype manifest_id: str + :keyword parameter_values: The inputs to the manifest that will result in a fully materialized + Agent. Required. + :paramtype parameter_values: dict[str, any] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword metadata: Set of 16 key-value pairs that can be attached to an object. This can be + useful for storing additional information about the object in a structured + format, and querying for objects via API or the dashboard. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. Default value is None. + :paramtype metadata: dict[str, str] + :keyword description: A human-readable description of the agent. Default value is None. + :paramtype description: str + :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentVersionDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_version_from_manifest( + self, agent_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AgentVersionDetails: + """Create a new agent version from a manifest. + + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentVersionDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_version_from_manifest( + self, agent_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AgentVersionDetails: + """Create a new agent version from a manifest. + + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentVersionDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_version_from_manifest( + self, + agent_name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + manifest_id: str = _Unset, + parameter_values: dict[str, Any] = _Unset, + metadata: Optional[dict[str, str]] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> _models.AgentVersionDetails: + """Create a new agent version from a manifest. + + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword manifest_id: The manifest ID to import the agent version from. Required. + :paramtype manifest_id: str + :keyword parameter_values: The inputs to the manifest that will result in a fully materialized + Agent. Required. + :paramtype parameter_values: dict[str, any] + :keyword metadata: Set of 16 key-value pairs that can be attached to an object. This can be + useful for storing additional information about the object in a structured + format, and querying for objects via API or the dashboard. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. Default value is None. + :paramtype metadata: dict[str, str] + :keyword description: A human-readable description of the agent. Default value is None. + :paramtype description: str + :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentVersionDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AgentVersionDetails] = kwargs.pop("cls", None) + + if body is _Unset: + if manifest_id is _Unset: + raise TypeError("missing required argument: manifest_id") + if parameter_values is _Unset: + raise TypeError("missing required argument: parameter_values") + body = { + "description": description, + "manifest_id": manifest_id, + "metadata": metadata, + "parameter_values": parameter_values, + } + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_agents_create_version_from_manifest_request( + agent_name=agent_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentVersionDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_version(self, agent_name: str, agent_version: str, **kwargs: Any) -> _models.AgentVersionDetails: + """Retrieves a specific version of an agent. + + :param agent_name: The name of the agent to retrieve. Required. + :type agent_name: str + :param agent_version: The version of the agent to retrieve. Required. + :type agent_version: str + :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentVersionDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AgentVersionDetails] = kwargs.pop("cls", None) + + _request = build_agents_get_version_request( + agent_name=agent_name, + agent_version=agent_version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentVersionDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete_version( + self, agent_name: str, agent_version: str, *, force: Optional[bool] = None, **kwargs: Any + ) -> _models.DeleteAgentVersionResponse: + """Deletes a specific version of an agent. For hosted agents, if the version has active sessions, + the request is rejected with HTTP 409 unless ``force`` is set to true. When force is true, all + sessions associated with this version are cascade-deleted. + + :param agent_name: The name of the agent to delete. Required. + :type agent_name: str + :param agent_version: The version of the agent to delete. Required. + :type agent_version: str + :keyword force: For Hosted Agents, if true, force-deletes the version even if it has active + sessions, cascading deletion to all associated sessions. This value is not relevant for other + Agent types. Defaults to false. Default value is None. + :paramtype force: bool + :return: DeleteAgentVersionResponse. The DeleteAgentVersionResponse is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.DeleteAgentVersionResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DeleteAgentVersionResponse] = kwargs.pop("cls", None) + + _request = build_agents_delete_version_request( + agent_name=agent_name, + agent_version=agent_version, + force=force, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DeleteAgentVersionResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_versions( + self, + agent_name: str, + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.AgentVersionDetails"]: + """Returns the list of versions of an agent. + + :param agent_name: The name of the agent to retrieve versions for. Required. + :type agent_name: str + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of AgentVersionDetails + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.AgentVersionDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AgentVersionDetails]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(_continuation_token=None): + + _request = build_agents_list_versions_request( + agent_name=agent_name, + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.AgentVersionDetails], + deserialized.get("data", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, iter(list_of_elem) + + def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class EvaluationRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`evaluation_rules` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, id: str, **kwargs: Any) -> _models.EvaluationRule: + """Get an evaluation rule. + + :param id: Unique identifier for the evaluation rule. Required. + :type id: str + :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.EvaluationRule] = kwargs.pop("cls", None) + + _request = build_evaluation_rules_get_request( + id=id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.EvaluationRule, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete(self, id: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Delete an evaluation rule. + + :param id: Unique identifier for the evaluation rule. Required. + :type id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_evaluation_rules_delete_request( + id=id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def create_or_update( + self, id: str, evaluation_rule: _models.EvaluationRule, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationRule: + """Create or update an evaluation rule. + + :param id: Unique identifier for the evaluation rule. Required. + :type id: str + :param evaluation_rule: Evaluation rule resource. Required. + :type evaluation_rule: ~azure.ai.projects.models.EvaluationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, id: str, evaluation_rule: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationRule: + """Create or update an evaluation rule. + + :param id: Unique identifier for the evaluation rule. Required. + :type id: str + :param evaluation_rule: Evaluation rule resource. Required. + :type evaluation_rule: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, id: str, evaluation_rule: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationRule: + """Create or update an evaluation rule. + + :param id: Unique identifier for the evaluation rule. Required. + :type id: str + :param evaluation_rule: Evaluation rule resource. Required. + :type evaluation_rule: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, id: str, evaluation_rule: Union[_models.EvaluationRule, JSON, IO[bytes]], **kwargs: Any + ) -> _models.EvaluationRule: + """Create or update an evaluation rule. + + :param id: Unique identifier for the evaluation rule. Required. + :type id: str + :param evaluation_rule: Evaluation rule resource. Is one of the following types: + EvaluationRule, JSON, IO[bytes] Required. + :type evaluation_rule: ~azure.ai.projects.models.EvaluationRule or JSON or IO[bytes] + :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EvaluationRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(evaluation_rule, (IOBase, bytes)): + _content = evaluation_rule + else: + _content = json.dumps(evaluation_rule, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_evaluation_rules_create_or_update_request( + id=id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.EvaluationRule, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + *, + action_type: Optional[Union[str, _models.EvaluationRuleActionType]] = None, + agent_name: Optional[str] = None, + enabled: Optional[bool] = None, + **kwargs: Any + ) -> ItemPaged["_models.EvaluationRule"]: + """List all evaluation rules. + + :keyword action_type: Filter by the type of evaluation rule. Known values are: + "continuousEvaluation" and "humanEvaluationPreview". Default value is None. + :paramtype action_type: str or ~azure.ai.projects.models.EvaluationRuleActionType + :keyword agent_name: Filter by the agent name. Default value is None. + :paramtype agent_name: str + :keyword enabled: Filter by the enabled status. Default value is None. + :paramtype enabled: bool + :return: An iterator like instance of EvaluationRule + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.EvaluationRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.EvaluationRule]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_evaluation_rules_list_request( + action_type=action_type, + agent_name=agent_name, + enabled=enabled, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.EvaluationRule], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def _get(self, name: str, **kwargs: Any) -> _models.Connection: + """Get a connection by name, without populating connection credentials. + + :param name: The friendly name of the connection, provided by the user. Required. + :type name: str + :return: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Connection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Connection] = kwargs.pop("cls", None) + + _request = build_connections_get_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["x-ms-client-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-client-request-id") + ) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Connection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def _get_with_credentials(self, name: str, **kwargs: Any) -> _models.Connection: + """Get a connection by name, with its connection credentials. + + :param name: The friendly name of the connection, provided by the user. Required. + :type name: str + :return: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Connection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Connection] = kwargs.pop("cls", None) + + _request = build_connections_get_with_credentials_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["x-ms-client-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-client-request-id") + ) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Connection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + *, + connection_type: Optional[Union[str, _models.ConnectionType]] = None, + default_connection: Optional[bool] = None, + **kwargs: Any + ) -> ItemPaged["_models.Connection"]: + """List all connections in the project, without populating connection credentials. + + :keyword connection_type: List connections of this specific type. Known values are: + "AzureOpenAI", "AzureBlob", "AzureStorageAccount", "CognitiveSearch", "CosmosDB", "ApiKey", + "AppConfig", "AppInsights", "CustomKeys", and "RemoteTool_Preview". Default value is None. + :paramtype connection_type: str or ~azure.ai.projects.models.ConnectionType + :keyword default_connection: List connections that are default connections. Default value is + None. + :paramtype default_connection: bool + :return: An iterator like instance of Connection + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Connection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_connections_list_request( + connection_type=connection_type, + default_connection=default_connection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Connection], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class DatasetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`datasets` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_versions(self, name: str, **kwargs: Any) -> ItemPaged["_models.DatasetVersion"]: + """List all versions of the given DatasetVersion. + + :param name: The name of the resource. Required. + :type name: str + :return: An iterator like instance of DatasetVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.DatasetVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DatasetVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_datasets_list_versions_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DatasetVersion], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.DatasetVersion"]: + """List the latest version of each DatasetVersion. + + :return: An iterator like instance of DatasetVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.DatasetVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DatasetVersion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_datasets_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DatasetVersion], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, name: str, version: str, **kwargs: Any) -> _models.DatasetVersion: + """Get the specific version of the DatasetVersion. The service returns 404 Not Found error if the + DatasetVersion does not exist. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to retrieve. Required. + :type version: str + :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DatasetVersion] = kwargs.pop("cls", None) + + _request = build_datasets_get_request( + name=name, + version=version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DatasetVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete(self, name: str, version: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Delete the specific version of the DatasetVersion. The service returns 204 No Content if the + DatasetVersion was deleted successfully or if the DatasetVersion does not exist. + + :param name: The name of the resource. Required. + :type name: str + :param version: The version of the DatasetVersion to delete. Required. + :type version: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_datasets_delete_request( + name=name, + version=version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def create_or_update( + self, + name: str, + version: str, + dataset_version: _models.DatasetVersion, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.DatasetVersion: + """Create a new or update an existing DatasetVersion with the given version id. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to create or update. Required. + :type version: str + :param dataset_version: The DatasetVersion to create or update. Required. + :type dataset_version: ~azure.ai.projects.models.DatasetVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + name: str, + version: str, + dataset_version: JSON, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.DatasetVersion: + """Create a new or update an existing DatasetVersion with the given version id. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to create or update. Required. + :type version: str + :param dataset_version: The DatasetVersion to create or update. Required. + :type dataset_version: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + name: str, + version: str, + dataset_version: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.DatasetVersion: + """Create a new or update an existing DatasetVersion with the given version id. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to create or update. Required. + :type version: str + :param dataset_version: The DatasetVersion to create or update. Required. + :type dataset_version: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, name: str, version: str, dataset_version: Union[_models.DatasetVersion, JSON, IO[bytes]], **kwargs: Any + ) -> _models.DatasetVersion: + """Create a new or update an existing DatasetVersion with the given version id. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to create or update. Required. + :type version: str + :param dataset_version: The DatasetVersion to create or update. Is one of the following types: + DatasetVersion, JSON, IO[bytes] Required. + :type dataset_version: ~azure.ai.projects.models.DatasetVersion or JSON or IO[bytes] + :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatasetVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/merge-patch+json" + _content = None + if isinstance(dataset_version, (IOBase, bytes)): + _content = dataset_version + else: + _content = json.dumps(dataset_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_datasets_create_or_update_request( + name=name, + version=version, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DatasetVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def pending_upload( + self, + name: str, + version: str, + pending_upload_request: _models.PendingUploadRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PendingUploadResult: + """Start a new or get an existing pending upload of a dataset for a specific version. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to operate on. Required. + :type version: str + :param pending_upload_request: The pending upload request parameters. Required. + :type pending_upload_request: ~azure.ai.projects.models.PendingUploadRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def pending_upload( + self, + name: str, + version: str, + pending_upload_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PendingUploadResult: + """Start a new or get an existing pending upload of a dataset for a specific version. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to operate on. Required. + :type version: str + :param pending_upload_request: The pending upload request parameters. Required. + :type pending_upload_request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def pending_upload( + self, + name: str, + version: str, + pending_upload_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PendingUploadResult: + """Start a new or get an existing pending upload of a dataset for a specific version. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to operate on. Required. + :type version: str + :param pending_upload_request: The pending upload request parameters. Required. + :type pending_upload_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def pending_upload( + self, + name: str, + version: str, + pending_upload_request: Union[_models.PendingUploadRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.PendingUploadResult: + """Start a new or get an existing pending upload of a dataset for a specific version. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to operate on. Required. + :type version: str + :param pending_upload_request: The pending upload request parameters. Is one of the following + types: PendingUploadRequest, JSON, IO[bytes] Required. + :type pending_upload_request: ~azure.ai.projects.models.PendingUploadRequest or JSON or + IO[bytes] + :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PendingUploadResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(pending_upload_request, (IOBase, bytes)): + _content = pending_upload_request + else: + _content = json.dumps(pending_upload_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_datasets_pending_upload_request( + name=name, + version=version, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PendingUploadResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_credentials(self, name: str, version: str, **kwargs: Any) -> _models.DatasetCredential: + """Get the SAS credential to access the storage account associated with a Dataset version. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to operate on. Required. + :type version: str + :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetCredential + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DatasetCredential] = kwargs.pop("cls", None) + + _request = build_datasets_get_credentials_request( + name=name, + version=version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DatasetCredential, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class DeploymentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`deployments` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, name: str, **kwargs: Any) -> _models.Deployment: + """Get a deployed model. + + :param name: Name of the deployment. Required. + :type name: str + :return: Deployment. The Deployment is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Deployment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) + + _request = build_deployments_get_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["x-ms-client-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-client-request-id") + ) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Deployment, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + *, + model_publisher: Optional[str] = None, + model_name: Optional[str] = None, + deployment_type: Optional[Union[str, _models.DeploymentType]] = None, + **kwargs: Any + ) -> ItemPaged["_models.Deployment"]: + """List all deployed models in the project. + + :keyword model_publisher: Model publisher to filter models by. Default value is None. + :paramtype model_publisher: str + :keyword model_name: Model name (the publisher specific name) to filter models by. Default + value is None. + :paramtype model_name: str + :keyword deployment_type: Type of deployment to filter list by. "ModelDeployment" Default value + is None. + :paramtype deployment_type: str or ~azure.ai.projects.models.DeploymentType + :return: An iterator like instance of Deployment + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Deployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployments_list_request( + model_publisher=model_publisher, + model_name=model_name, + deployment_type=deployment_type, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Deployment], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class IndexesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`indexes` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_versions(self, name: str, **kwargs: Any) -> ItemPaged["_models.Index"]: + """List all versions of the given Index. + + :param name: The name of the resource. Required. + :type name: str + :return: An iterator like instance of Index + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Index] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Index]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_indexes_list_versions_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Index], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.Index"]: + """List the latest version of each Index. + + :return: An iterator like instance of Index + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Index] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Index]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_indexes_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Index], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, name: str, version: str, **kwargs: Any) -> _models.Index: + """Get the specific version of the Index. The service returns 404 Not Found error if the Index + does not exist. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the Index to retrieve. Required. + :type version: str + :return: Index. The Index is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Index + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Index] = kwargs.pop("cls", None) + + _request = build_indexes_get_request( + name=name, + version=version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Index, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete(self, name: str, version: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Delete the specific version of the Index. The service returns 204 No Content if the Index was + deleted successfully or if the Index does not exist. + + :param name: The name of the resource. Required. + :type name: str + :param version: The version of the Index to delete. Required. + :type version: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_indexes_delete_request( + name=name, + version=version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def create_or_update( + self, + name: str, + version: str, + index: _models.Index, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.Index: + """Create a new or update an existing Index with the given version id. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the Index to create or update. Required. + :type version: str + :param index: The Index to create or update. Required. + :type index: ~azure.ai.projects.models.Index + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: Index. The Index is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Index + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, name: str, version: str, index: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any + ) -> _models.Index: + """Create a new or update an existing Index with the given version id. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the Index to create or update. Required. + :type version: str + :param index: The Index to create or update. Required. + :type index: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: Index. The Index is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Index + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + name: str, + version: str, + index: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.Index: + """Create a new or update an existing Index with the given version id. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the Index to create or update. Required. + :type version: str + :param index: The Index to create or update. Required. + :type index: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: Index. The Index is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Index + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, name: str, version: str, index: Union[_models.Index, JSON, IO[bytes]], **kwargs: Any + ) -> _models.Index: + """Create a new or update an existing Index with the given version id. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the Index to create or update. Required. + :type version: str + :param index: The Index to create or update. Is one of the following types: Index, JSON, + IO[bytes] Required. + :type index: ~azure.ai.projects.models.Index or JSON or IO[bytes] + :return: Index. The Index is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Index + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Index] = kwargs.pop("cls", None) + + content_type = content_type or "application/merge-patch+json" + _content = None + if isinstance(index, (IOBase, bytes)): + _content = index + else: + _content = json.dumps(index, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_indexes_create_or_update_request( + name=name, + version=version, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Index, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ToolboxesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`toolboxes` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def create_version( + self, + name: str, + *, + tools: List[_models.Tool], + content_type: str = "application/json", + description: Optional[str] = None, + metadata: Optional[dict[str, str]] = None, + policies: Optional[_models.ToolboxPolicies] = None, + **kwargs: Any + ) -> _models.ToolboxVersionObject: + """Create a new version of a toolbox. If the toolbox does not exist, it will be created. + + :param name: The name of the toolbox. If the toolbox does not exist, it will be created. + Required. + :type name: str + :keyword tools: The list of tools to include in this version. Required. + :paramtype tools: list[~azure.ai.projects.models.Tool] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword description: A human-readable description of the toolbox. Default value is None. + :paramtype description: str + :keyword metadata: Arbitrary key-value metadata to associate with the toolbox. Default value is + None. + :paramtype metadata: dict[str, str] + :keyword policies: Policy configuration for this toolbox version. Default value is None. + :paramtype policies: ~azure.ai.projects.models.ToolboxPolicies + :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxVersionObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_version( + self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ToolboxVersionObject: + """Create a new version of a toolbox. If the toolbox does not exist, it will be created. + + :param name: The name of the toolbox. If the toolbox does not exist, it will be created. + Required. + :type name: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxVersionObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_version( + self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ToolboxVersionObject: + """Create a new version of a toolbox. If the toolbox does not exist, it will be created. + + :param name: The name of the toolbox. If the toolbox does not exist, it will be created. + Required. + :type name: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxVersionObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_version( + self, + name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + tools: List[_models.Tool] = _Unset, + description: Optional[str] = None, + metadata: Optional[dict[str, str]] = None, + policies: Optional[_models.ToolboxPolicies] = None, + **kwargs: Any + ) -> _models.ToolboxVersionObject: + """Create a new version of a toolbox. If the toolbox does not exist, it will be created. + + :param name: The name of the toolbox. If the toolbox does not exist, it will be created. + Required. + :type name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword tools: The list of tools to include in this version. Required. + :paramtype tools: list[~azure.ai.projects.models.Tool] + :keyword description: A human-readable description of the toolbox. Default value is None. + :paramtype description: str + :keyword metadata: Arbitrary key-value metadata to associate with the toolbox. Default value is + None. + :paramtype metadata: dict[str, str] + :keyword policies: Policy configuration for this toolbox version. Default value is None. + :paramtype policies: ~azure.ai.projects.models.ToolboxPolicies + :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxVersionObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ToolboxVersionObject] = kwargs.pop("cls", None) + + if body is _Unset: + if tools is _Unset: + raise TypeError("missing required argument: tools") + body = {"description": description, "metadata": metadata, "policies": policies, "tools": tools} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_toolboxes_create_version_request( + name=name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ToolboxVersionObject, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: + """Retrieve a toolbox. + + :param name: The name of the toolbox to retrieve. Required. + :type name: str + :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ToolboxObject] = kwargs.pop("cls", None) + + _request = build_toolboxes_get_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ToolboxObject, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.ToolboxObject"]: + """List all toolboxes. + + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of ToolboxObject + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.ToolboxObject] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ToolboxObject]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(_continuation_token=None): + + _request = build_toolboxes_list_request( + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ToolboxObject], + deserialized.get("data", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, iter(list_of_elem) + + def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_versions( + self, + name: str, + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.ToolboxVersionObject"]: + """List all versions of a toolbox. + + :param name: The name of the toolbox to list versions for. Required. + :type name: str + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of ToolboxVersionObject + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.ToolboxVersionObject] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ToolboxVersionObject]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(_continuation_token=None): + + _request = build_toolboxes_list_versions_request( + name=name, + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ToolboxVersionObject], + deserialized.get("data", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, iter(list_of_elem) + + def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_version(self, name: str, version: str, **kwargs: Any) -> _models.ToolboxVersionObject: + """Retrieve a specific version of a toolbox. + + :param name: The name of the toolbox. Required. + :type name: str + :param version: The version identifier to retrieve. Required. + :type version: str + :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxVersionObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ToolboxVersionObject] = kwargs.pop("cls", None) + + _request = build_toolboxes_get_version_request( + name=name, + version=version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ToolboxVersionObject, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, name: str, *, default_version: str, content_type: str = "application/json", **kwargs: Any + ) -> _models.ToolboxObject: + """Update a toolbox to point to a specific version. + + :param name: The name of the toolbox to update. Required. + :type name: str + :keyword default_version: The version identifier that the toolbox should point to. When set, + the toolbox's default version will resolve to this version instead of the latest. Required. + :paramtype default_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ToolboxObject: + """Update a toolbox to point to a specific version. + + :param name: The name of the toolbox to update. Required. + :type name: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ToolboxObject: + """Update a toolbox to point to a specific version. + + :param name: The name of the toolbox to update. Required. + :type name: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, name: str, body: Union[JSON, IO[bytes]] = _Unset, *, default_version: str = _Unset, **kwargs: Any + ) -> _models.ToolboxObject: + """Update a toolbox to point to a specific version. + + :param name: The name of the toolbox to update. Required. + :type name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword default_version: The version identifier that the toolbox should point to. When set, + the toolbox's default version will resolve to this version instead of the latest. Required. + :paramtype default_version: str + :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ToolboxObject] = kwargs.pop("cls", None) + + if body is _Unset: + if default_version is _Unset: + raise TypeError("missing required argument: default_version") + body = {"default_version": default_version} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_toolboxes_update_request( + name=name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ToolboxObject, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Delete a toolbox and all its versions. + + :param name: The name of the toolbox to delete. Required. + :type name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_toolboxes_delete_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def delete_version( # pylint: disable=inconsistent-return-statements + self, name: str, version: str, **kwargs: Any + ) -> None: + """Delete a specific version of a toolbox. + + :param name: The name of the toolbox. Required. + :type name: str + :param version: The version identifier to delete. Required. + :type version: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_toolboxes_delete_version_request( + name=name, + version=version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class BetaAgentsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`agents` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def update_agent_from_code( + self, + agent_name: str, + content: _models.CreateAgentVersionFromCodeContent, + *, + code_zip_sha256: str, + **kwargs: Any + ) -> _models.AgentDetails: + """Updates a code-based agent by uploading new code and creating a new version. If the code and + definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing + version. The request body is multipart/form-data with a JSON metadata part and a binary code + part (part order is irrelevant). Maximum upload size is 250 MB. + + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param content: Required. + :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent + :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change + detection (dedup) and integrity verification. Required. + :paramtype code_zip_sha256: str + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_agent_from_code( + self, agent_name: str, content: JSON, *, code_zip_sha256: str, **kwargs: Any + ) -> _models.AgentDetails: + """Updates a code-based agent by uploading new code and creating a new version. If the code and + definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing + version. The request body is multipart/form-data with a JSON metadata part and a binary code + part (part order is irrelevant). Maximum upload size is 250 MB. + + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param content: Required. + :type content: JSON + :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change + detection (dedup) and integrity verification. Required. + :paramtype code_zip_sha256: str + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_agent_from_code( + self, + agent_name: str, + content: Union[_models.CreateAgentVersionFromCodeContent, JSON], + *, + code_zip_sha256: str, + **kwargs: Any + ) -> _models.AgentDetails: + """Updates a code-based agent by uploading new code and creating a new version. If the code and + definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing + version. The request body is multipart/form-data with a JSON metadata part and a binary code + part (part order is irrelevant). Maximum upload size is 250 MB. + + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param content: Is either a CreateAgentVersionFromCodeContent type or a JSON type. Required. + :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent or JSON + :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change + detection (dedup) and integrity verification. Required. + :paramtype code_zip_sha256: str + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AgentDetails] = kwargs.pop("cls", None) + + _body = content.as_dict() if isinstance(content, _Model) else content + _file_fields: list[str] = ["code"] + _data_fields: list[str] = ["metadata"] + _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) + + _request = build_beta_agents_update_agent_from_code_request( + agent_name=agent_name, + code_zip_sha256=code_zip_sha256, + api_version=self._config.api_version, + files=_files, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def patch_agent_details( + self, + agent_name: str, + *, + content_type: str = "application/merge-patch+json", + agent_endpoint: Optional[_models.AgentEndpointConfig] = None, + agent_card: Optional[_models.AgentCard] = None, + **kwargs: Any + ) -> _models.AgentDetails: + """Updates an agent endpoint. + + :param agent_name: The name of the agent to retrieve. Required. + :type agent_name: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :keyword agent_endpoint: The endpoint configuration for the agent. Default value is None. + :paramtype agent_endpoint: ~azure.ai.projects.models.AgentEndpointConfig + :keyword agent_card: Optional agent card for the agent. Default value is None. + :paramtype agent_card: ~azure.ai.projects.models.AgentCard + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def patch_agent_details( + self, agent_name: str, body: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any + ) -> _models.AgentDetails: + """Updates an agent endpoint. + + :param agent_name: The name of the agent to retrieve. Required. + :type agent_name: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def patch_agent_details( + self, agent_name: str, body: IO[bytes], *, content_type: str = "application/merge-patch+json", **kwargs: Any + ) -> _models.AgentDetails: + """Updates an agent endpoint. + + :param agent_name: The name of the agent to retrieve. Required. + :type agent_name: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def patch_agent_details( + self, + agent_name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + agent_endpoint: Optional[_models.AgentEndpointConfig] = None, + agent_card: Optional[_models.AgentCard] = None, + **kwargs: Any + ) -> _models.AgentDetails: + """Updates an agent endpoint. + + :param agent_name: The name of the agent to retrieve. Required. + :type agent_name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword agent_endpoint: The endpoint configuration for the agent. Default value is None. + :paramtype agent_endpoint: ~azure.ai.projects.models.AgentEndpointConfig + :keyword agent_card: Optional agent card for the agent. Default value is None. + :paramtype agent_card: ~azure.ai.projects.models.AgentCard + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DeleteAgentResponse] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AgentDetails] = kwargs.pop("cls", None) - _request = build_agents_delete_request( + if body is _Unset: + body = {"agent_card": agent_card, "agent_endpoint": agent_endpoint} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/merge-patch+json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_agents_patch_agent_details_request( agent_name=agent_name, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -2850,51 +7841,175 @@ def delete(self, agent_name: str, **kwargs: Any) -> _models.DeleteAgentResponse: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DeleteAgentResponse, response.json()) + deserialized = _deserialize(_models.AgentDetails, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + @overload + def create_agent_version_from_code( + self, + agent_name: str, + content: _models.CreateAgentVersionFromCodeContent, + *, + code_zip_sha256: str, + **kwargs: Any + ) -> _models.AgentVersionDetails: + """create_agent_version_from_code. + + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param content: Required. + :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent + :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change + detection (dedup) and integrity verification. Required. + :paramtype code_zip_sha256: str + :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentVersionDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_agent_version_from_code( + self, agent_name: str, content: JSON, *, code_zip_sha256: str, **kwargs: Any + ) -> _models.AgentVersionDetails: + """create_agent_version_from_code. + + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param content: Required. + :type content: JSON + :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change + detection (dedup) and integrity verification. Required. + :paramtype code_zip_sha256: str + :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentVersionDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def list( + def create_agent_version_from_code( self, + agent_name: str, + content: Union[_models.CreateAgentVersionFromCodeContent, JSON], *, - kind: Optional[Union[str, _models.AgentKind]] = None, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, + code_zip_sha256: str, **kwargs: Any - ) -> ItemPaged["_models.AgentDetails"]: - """Returns the list of all agents. + ) -> _models.AgentVersionDetails: + """create_agent_version_from_code. - :keyword kind: Filter agents by kind. If not provided, all agents are returned. Known values - are: "prompt", "hosted", and "workflow". Default value is None. - :paramtype kind: str or ~azure.ai.projects.models.AgentKind - :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the - default is 20. Default value is None. - :paramtype limit: int - :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for - ascending order and``desc`` - for descending order. Known values are: "asc" and "desc". Default value is None. - :paramtype order: str or ~azure.ai.projects.models.PageOrder - :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your - place in the list. - For instance, if you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page of the list. - Default value is None. - :paramtype before: str - :return: An iterator like instance of AgentDetails - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.AgentDetails] + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param content: Is either a CreateAgentVersionFromCodeContent type or a JSON type. Required. + :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent or JSON + :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change + detection (dedup) and integrity verification. Required. + :paramtype code_zip_sha256: str + :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.AgentDetails]] = kwargs.pop("cls", None) + cls: ClsType[_models.AgentVersionDetails] = kwargs.pop("cls", None) + + _body = content.as_dict() if isinstance(content, _Model) else content + _file_fields: list[str] = ["code"] + _data_fields: list[str] = ["metadata"] + _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) + + _request = build_beta_agents_create_agent_version_from_code_request( + agent_name=agent_name, + code_zip_sha256=code_zip_sha256, + api_version=self._config.api_version, + files=_files, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentVersionDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @distributed_trace + def download_agent_code( + self, agent_name: str, *, agent_version: Optional[str] = None, **kwargs: Any + ) -> Iterator[bytes]: + """Download the code zip for a code-based hosted agent. + Returns the previously-uploaded zip (``application/zip``). + + If ``agent_version`` is supplied, returns that version's code zip; otherwise + returns the latest version's code zip. + + The SHA-256 digest of the returned bytes matches the ``content_hash`` on the + resolved version's ``code_configuration``. + + :param agent_name: The name of the agent. Required. + :type agent_name: str + :keyword agent_version: The version of the agent whose code zip should be downloaded. + If omitted, the latest version's code zip is returned. Default value is None. + :paramtype agent_version: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2903,183 +8018,149 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(_continuation_token=None): + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_agents_list_request( - kind=kind, - limit=limit, - order=order, - after=_continuation_token, - before=before, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_beta_agents_download_agent_code_request( + agent_name=agent_name, + agent_version=agent_version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.AgentDetails], - deserialized.get("data", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("last_id") or None, iter(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(_continuation_token=None): - _request = prepare_request(_continuation_token) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, ) - response = pipeline_response.http_response + raise HttpResponseError(response=response, model=error) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["x-ms-agent-version"] = self._deserialize("str", response.headers.get("x-ms-agent-version")) + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) - return pipeline_response + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload - def create_version( + def create_session( self, agent_name: str, *, - definition: _models.AgentDefinition, + version_indicator: _models.VersionIndicator, content_type: str = "application/json", - metadata: Optional[dict[str, str]] = None, - description: Optional[str] = None, - blueprint_reference: Optional[_models.AgentBlueprintReference] = None, + agent_session_id: Optional[str] = None, **kwargs: Any - ) -> _models.AgentVersionDetails: - """Create a new agent version. - - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + ) -> _models.AgentSessionResource: + """Creates a new session for an agent endpoint. The endpoint resolves the backing agent version + from ``version_indicator`` and enforces session ownership using the provided isolation key for + session-mutating operations. - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. + :param agent_name: The name of the agent to create a session for. Required. :type agent_name: str - :keyword definition: The agent definition. This can be a workflow, hosted agent, or a simple - agent definition. Required. - :paramtype definition: ~azure.ai.projects.models.AgentDefinition + :keyword version_indicator: Determines which agent version backs the session. Required. + :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword metadata: Set of 16 key-value pairs that can be attached to an object. This can be - useful for storing additional information about the object in a structured - format, and querying for objects via API or the dashboard. - - Keys are strings with a maximum length of 64 characters. Values are strings - with a maximum length of 512 characters. Default value is None. - :paramtype metadata: dict[str, str] - :keyword description: A human-readable description of the agent. Default value is None. - :paramtype description: str - :keyword blueprint_reference: The blueprint reference for the agent. Default value is None. - :paramtype blueprint_reference: ~azure.ai.projects.models.AgentBlueprintReference - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :keyword agent_session_id: Optional caller-provided session ID. If specified, it must be unique + within the agent endpoint. Auto-generated if omitted. Default value is None. + :paramtype agent_session_id: str + :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentSessionResource :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_version( + def create_session( self, agent_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentVersionDetails: - """Create a new agent version. - - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + ) -> _models.AgentSessionResource: + """Creates a new session for an agent endpoint. The endpoint resolves the backing agent version + from ``version_indicator`` and enforces session ownership using the provided isolation key for + session-mutating operations. - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. + :param agent_name: The name of the agent to create a session for. Required. :type agent_name: str :param body: Required. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentSessionResource :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_version( + def create_session( self, agent_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentVersionDetails: - """Create a new agent version. - - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + ) -> _models.AgentSessionResource: + """Creates a new session for an agent endpoint. The endpoint resolves the backing agent version + from ``version_indicator`` and enforces session ownership using the provided isolation key for + session-mutating operations. - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. + :param agent_name: The name of the agent to create a session for. Required. :type agent_name: str :param body: Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentSessionResource :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_version( + def create_session( self, agent_name: str, body: Union[JSON, IO[bytes]] = _Unset, *, - definition: _models.AgentDefinition = _Unset, - metadata: Optional[dict[str, str]] = None, - description: Optional[str] = None, - blueprint_reference: Optional[_models.AgentBlueprintReference] = None, + version_indicator: _models.VersionIndicator = _Unset, + agent_session_id: Optional[str] = None, **kwargs: Any - ) -> _models.AgentVersionDetails: - """Create a new agent version. - - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + ) -> _models.AgentSessionResource: + """Creates a new session for an agent endpoint. The endpoint resolves the backing agent version + from ``version_indicator`` and enforces session ownership using the provided isolation key for + session-mutating operations. - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. + :param agent_name: The name of the agent to create a session for. Required. :type agent_name: str :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword definition: The agent definition. This can be a workflow, hosted agent, or a simple - agent definition. Required. - :paramtype definition: ~azure.ai.projects.models.AgentDefinition - :keyword metadata: Set of 16 key-value pairs that can be attached to an object. This can be - useful for storing additional information about the object in a structured - format, and querying for objects via API or the dashboard. - - Keys are strings with a maximum length of 64 characters. Values are strings - with a maximum length of 512 characters. Default value is None. - :paramtype metadata: dict[str, str] - :keyword description: A human-readable description of the agent. Default value is None. - :paramtype description: str - :keyword blueprint_reference: The blueprint reference for the agent. Default value is None. - :paramtype blueprint_reference: ~azure.ai.projects.models.AgentBlueprintReference - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :keyword version_indicator: Determines which agent version backs the session. Required. + :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator + :keyword agent_session_id: Optional caller-provided session ID. If specified, it must be unique + within the agent endpoint. Auto-generated if omitted. Default value is None. + :paramtype agent_session_id: str + :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentSessionResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -3094,17 +8175,12 @@ def create_version( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentVersionDetails] = kwargs.pop("cls", None) + cls: ClsType[_models.AgentSessionResource] = kwargs.pop("cls", None) if body is _Unset: - if definition is _Unset: - raise TypeError("missing required argument: definition") - body = { - "blueprint_reference": blueprint_reference, - "definition": definition, - "description": description, - "metadata": metadata, - } + if version_indicator is _Unset: + raise TypeError("missing required argument: version_indicator") + body = {"agent_session_id": agent_session_id, "version_indicator": version_indicator} body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None @@ -3113,11 +8189,79 @@ def create_version( else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_agents_create_version_request( + _request = build_beta_agents_create_session_request( + agent_name=agent_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentSessionResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_session(self, agent_name: str, session_id: str, **kwargs: Any) -> _models.AgentSessionResource: + """Retrieves a session by ID. + + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param session_id: The session identifier. Required. + :type session_id: str + :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentSessionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AgentSessionResource] = kwargs.pop("cls", None) + + _request = build_beta_agents_get_session_request( agent_name=agent_name, - content_type=content_type, + session_id=session_id, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -3150,141 +8294,204 @@ def create_version( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.AgentVersionDetails, response.json()) + deserialized = _deserialize(_models.AgentSessionResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def create_version_from_manifest( - self, - agent_name: str, - *, - manifest_id: str, - parameter_values: dict[str, Any], - content_type: str = "application/json", - metadata: Optional[dict[str, str]] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> _models.AgentVersionDetails: - """Create a new agent version from a manifest. - - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + @distributed_trace + def delete_session( # pylint: disable=inconsistent-return-statements + self, agent_name: str, session_id: str, **kwargs: Any + ) -> None: + """Deletes a session synchronously. Returns 204 No Content when the session is deleted or does not + exist. - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. + :param agent_name: The name of the agent. Required. :type agent_name: str - :keyword manifest_id: The manifest ID to import the agent version from. Required. - :paramtype manifest_id: str - :keyword parameter_values: The inputs to the manifest that will result in a fully materialized - Agent. Required. - :paramtype parameter_values: dict[str, any] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword metadata: Set of 16 key-value pairs that can be attached to an object. This can be - useful for storing additional information about the object in a structured - format, and querying for objects via API or the dashboard. - - Keys are strings with a maximum length of 64 characters. Values are strings - with a maximum length of 512 characters. Default value is None. - :paramtype metadata: dict[str, str] - :keyword description: A human-readable description of the agent. Default value is None. - :paramtype description: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :param session_id: The session identifier. Required. + :type session_id: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @overload - def create_version_from_manifest( - self, agent_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentVersionDetails: - """Create a new agent version from a manifest. + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + cls: ClsType[None] = kwargs.pop("cls", None) - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. - :type agent_name: str - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ + _request = build_beta_agents_delete_session_request( + agent_name=agent_name, + session_id=session_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - @overload - def create_version_from_manifest( - self, agent_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentVersionDetails: - """Create a new agent version from a manifest. + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + response = pipeline_response.http_response - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. - :type agent_name: str - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - def create_version_from_manifest( + def list_sessions( self, agent_name: str, - body: Union[JSON, IO[bytes]] = _Unset, *, - manifest_id: str = _Unset, - parameter_values: dict[str, Any] = _Unset, - metadata: Optional[dict[str, str]] = None, - description: Optional[str] = None, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, **kwargs: Any - ) -> _models.AgentVersionDetails: - """Create a new agent version from a manifest. + ) -> ItemPaged["_models.AgentSessionResource"]: + """Returns a list of sessions for the specified agent. + + :param agent_name: The name of the agent. Required. + :type agent_name: str + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of AgentSessionResource + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.AgentSessionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AgentSessionResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(_continuation_token=None): + + _request = build_beta_agents_list_sessions_request( + agent_name=agent_name, + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.AgentSessionResource], + deserialized.get("data", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, iter(list_of_elem) + + def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_session_log_stream( + self, agent_name: str, agent_version: str, session_id: str, **kwargs: Any + ) -> _models.SessionLogEvent: + """Streams console logs (stdout / stderr) for a specific hosted agent session + as a Server-Sent Events (SSE) stream. + + Each SSE frame contains: + + * `event`: always `"log"` + * `data`: a plain-text log line (currently JSON-formatted, but the schema is not contractual and may include additional keys or change format over time; clients should treat it as an opaque string) + + Example SSE frames: + + .. code-block:: + + event: log + data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting FoundryCBAgent server on port 8088"} + + event: log + data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application startup complete."} + + event: log + data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} + + event: log + data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since last 60 seconds"} - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + The stream remains open until the client disconnects or the server + terminates the connection. Clients should handle reconnection as needed. - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. + :param agent_name: The name of the hosted agent. Required. :type agent_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword manifest_id: The manifest ID to import the agent version from. Required. - :paramtype manifest_id: str - :keyword parameter_values: The inputs to the manifest that will result in a fully materialized - Agent. Required. - :paramtype parameter_values: dict[str, any] - :keyword metadata: Set of 16 key-value pairs that can be attached to an object. This can be - useful for storing additional information about the object in a structured - format, and querying for objects via API or the dashboard. - - Keys are strings with a maximum length of 64 characters. Values are strings - with a maximum length of 512 characters. Default value is None. - :paramtype metadata: dict[str, str] - :keyword description: A human-readable description of the agent. Default value is None. - :paramtype description: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :param agent_version: The version of the agent. Required. + :type agent_version: str + :param session_id: The session ID (maps to an ADC sandbox). Required. + :type session_id: str + :return: SessionLogEvent. The SessionLogEvent is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SessionLogEvent :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -3295,36 +8502,16 @@ def create_version_from_manifest( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentVersionDetails] = kwargs.pop("cls", None) - - if body is _Unset: - if manifest_id is _Unset: - raise TypeError("missing required argument: manifest_id") - if parameter_values is _Unset: - raise TypeError("missing required argument: parameter_values") - body = { - "description": description, - "manifest_id": manifest_id, - "metadata": metadata, - "parameter_values": parameter_values, - } - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.SessionLogEvent] = kwargs.pop("cls", None) - _request = build_agents_create_version_from_manifest_request( + _request = build_beta_agents_get_session_log_stream_request( agent_name=agent_name, - content_type=content_type, + agent_version=agent_version, + session_id=session_id, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -3334,7 +8521,7 @@ def create_version_from_manifest( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3354,26 +8541,47 @@ def create_version_from_manifest( ) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.AgentVersionDetails, response.json()) + deserialized = _deserialize(_models.SessionLogEvent, response.text()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def get_version(self, agent_name: str, agent_version: str, **kwargs: Any) -> _models.AgentVersionDetails: - """Retrieves a specific version of an agent. + def _upload_session_file( + self, + agent_name: str, + agent_session_id: str, + content: bytes, + *, + path: str, + user_isolation_key: Optional[str] = None, + **kwargs: Any + ) -> _models.SessionFileWriteResult: + """Upload a file to the session sandbox via binary stream. Maximum file size is 50 MB. Uploads + exceeding this limit return 413 Payload Too Large. - :param agent_name: The name of the agent to retrieve. Required. + :param agent_name: The name of the agent. Required. :type agent_name: str - :param agent_version: The version of the agent to retrieve. Required. - :type agent_version: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :param agent_session_id: The session ID. Required. + :type agent_session_id: str + :param content: Required. + :type content: bytes + :keyword path: The destination file path within the sandbox, relative to the session home + directory. Required. + :paramtype path: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SessionFileWriteResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -3384,15 +8592,22 @@ def get_version(self, agent_name: str, agent_version: str, **kwargs: Any) -> _mo } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.AgentVersionDetails] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + cls: ClsType[_models.SessionFileWriteResult] = kwargs.pop("cls", None) - _request = build_agents_get_version_request( + _content = content + + _request = build_beta_agents_upload_session_file_request( agent_name=agent_name, - agent_version=agent_version, + agent_session_id=agent_session_id, + path=path, + user_isolation_key=user_isolation_key, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -3409,7 +8624,7 @@ def get_version(self, agent_name: str, agent_version: str, **kwargs: Any) -> _mo response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [201]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -3425,7 +8640,7 @@ def get_version(self, agent_name: str, agent_version: str, **kwargs: Any) -> _mo if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.AgentVersionDetails, response.json()) + deserialized = _deserialize(_models.SessionFileWriteResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3433,16 +8648,29 @@ def get_version(self, agent_name: str, agent_version: str, **kwargs: Any) -> _mo return deserialized # type: ignore @distributed_trace - def delete_version(self, agent_name: str, agent_version: str, **kwargs: Any) -> _models.DeleteAgentVersionResponse: - """Deletes a specific version of an agent. + def download_session_file( + self, + agent_name: str, + agent_session_id: str, + *, + path: str, + user_isolation_key: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Download a file from the session sandbox as a binary stream. - :param agent_name: The name of the agent to delete. Required. + :param agent_name: The name of the agent. Required. :type agent_name: str - :param agent_version: The version of the agent to delete. Required. - :type agent_version: str - :return: DeleteAgentVersionResponse. The DeleteAgentVersionResponse is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.DeleteAgentVersionResponse + :param agent_session_id: The session ID. Required. + :type agent_session_id: str + :keyword path: The file path to download from the sandbox, relative to the session home + directory. Required. + :paramtype path: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -3456,11 +8684,13 @@ def delete_version(self, agent_name: str, agent_version: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DeleteAgentVersionResponse] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_agents_delete_version_request( + _request = build_beta_agents_download_session_file_request( agent_name=agent_name, - agent_version=agent_version, + agent_session_id=agent_session_id, + path=path, + user_isolation_key=user_isolation_key, api_version=self._config.api_version, headers=_headers, params=_params, @@ -3471,7 +8701,7 @@ def delete_version(self, agent_name: str, agent_version: str, **kwargs: Any) -> _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3491,136 +8721,38 @@ def delete_version(self, agent_name: str, agent_version: str, **kwargs: Any) -> ) raise HttpResponseError(response=response, model=error) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.DeleteAgentVersionResponse, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_versions( - self, - agent_name: str, - *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.AgentVersionDetails"]: - """Returns the list of versions of an agent. - - :param agent_name: The name of the agent to retrieve versions for. Required. - :type agent_name: str - :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the - default is 20. Default value is None. - :paramtype limit: int - :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for - ascending order and``desc`` - for descending order. Known values are: "asc" and "desc". Default value is None. - :paramtype order: str or ~azure.ai.projects.models.PageOrder - :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your - place in the list. - For instance, if you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page of the list. - Default value is None. - :paramtype before: str - :return: An iterator like instance of AgentVersionDetails - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.AgentVersionDetails] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.AgentVersionDetails]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(_continuation_token=None): - - _request = build_agents_list_versions_request( - agent_name=agent_name, - limit=limit, - order=order, - after=_continuation_token, - before=before, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.AgentVersionDetails], - deserialized.get("data", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("last_id") or None, iter(list_of_elem) - - def get_next(_continuation_token=None): - _request = prepare_request(_continuation_token) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class EvaluationRulesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`evaluation_rules` attribute. - """ + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace - def get(self, id: str, **kwargs: Any) -> _models.EvaluationRule: - """Get an evaluation rule. + def get_session_files( + self, + agent_name: str, + agent_session_id: str, + *, + path: str, + user_isolation_key: Optional[str] = None, + **kwargs: Any + ) -> _models.SessionDirectoryListResult: + """List files and directories at a given path in the session sandbox. Returns only the immediate + children of the specified directory (non-recursive). - :param id: Unique identifier for the evaluation rule. Required. - :type id: str - :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationRule + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param agent_session_id: The session ID. Required. + :type agent_session_id: str + :keyword path: The directory path to list, relative to the session home directory. Required. + :paramtype path: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :return: SessionDirectoryListResult. The SessionDirectoryListResult is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.SessionDirectoryListResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -3634,10 +8766,13 @@ def get(self, id: str, **kwargs: Any) -> _models.EvaluationRule: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.EvaluationRule] = kwargs.pop("cls", None) + cls: ClsType[_models.SessionDirectoryListResult] = kwargs.pop("cls", None) - _request = build_evaluation_rules_get_request( - id=id, + _request = build_beta_agents_get_session_files_request( + agent_name=agent_name, + agent_session_id=agent_session_id, + path=path, + user_isolation_key=user_isolation_key, api_version=self._config.api_version, headers=_headers, params=_params, @@ -3662,12 +8797,16 @@ def get(self, id: str, **kwargs: Any) -> _models.EvaluationRule: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluationRule, response.json()) + deserialized = _deserialize(_models.SessionDirectoryListResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3675,11 +8814,32 @@ def get(self, id: str, **kwargs: Any) -> _models.EvaluationRule: return deserialized # type: ignore @distributed_trace - def delete(self, id: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """Delete an evaluation rule. + def delete_session_file( # pylint: disable=inconsistent-return-statements + self, + agent_name: str, + agent_session_id: str, + *, + path: str, + recursive: Optional[bool] = None, + user_isolation_key: Optional[str] = None, + **kwargs: Any + ) -> None: + """Delete a file or directory from the session sandbox. If ``recursive`` is false (default) and + the target is a non-empty directory, the API returns 409 Conflict. - :param id: Unique identifier for the evaluation rule. Required. - :type id: str + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param agent_session_id: The session ID. Required. + :type agent_session_id: str + :keyword path: The file or directory path to delete, relative to the session home directory. + Required. + :paramtype path: str + :keyword recursive: Whether to recursively delete directory contents. Defaults to false. + Default value is None. + :paramtype recursive: bool + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -3697,8 +8857,12 @@ def delete(self, id: str, **kwargs: Any) -> None: # pylint: disable=inconsisten cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_evaluation_rules_delete_request( - id=id, + _request = build_beta_agents_delete_session_file_request( + agent_name=agent_name, + agent_session_id=agent_session_id, + path=path, + recursive=recursive, + user_isolation_key=user_isolation_key, api_version=self._config.api_version, headers=_headers, params=_params, @@ -3717,78 +8881,108 @@ def delete(self, id: str, **kwargs: Any) -> None: # pylint: disable=inconsisten if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if cls: return cls(pipeline_response, None, {}) # type: ignore @overload - def create_or_update( - self, id: str, evaluation_rule: _models.EvaluationRule, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationRule: - """Create or update an evaluation rule. + def create_optimization_job( + self, + job: _models.OptimizationJob, + *, + operation_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.OptimizationJob: + """Creates an agent optimization job. - :param id: Unique identifier for the evaluation rule. Required. - :type id: str - :param evaluation_rule: Evaluation rule resource. Required. - :type evaluation_rule: ~azure.ai.projects.models.EvaluationRule + Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for + idempotent retry. + + :param job: The job to create. Required. + :type job: ~azure.ai.projects.models.OptimizationJob + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationRule + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( - self, id: str, evaluation_rule: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationRule: - """Create or update an evaluation rule. + def create_optimization_job( + self, job: JSON, *, operation_id: Optional[str] = None, content_type: str = "application/json", **kwargs: Any + ) -> _models.OptimizationJob: + """Creates an agent optimization job. - :param id: Unique identifier for the evaluation rule. Required. - :type id: str - :param evaluation_rule: Evaluation rule resource. Required. - :type evaluation_rule: JSON + Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for + idempotent retry. + + :param job: The job to create. Required. + :type job: JSON + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationRule + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( - self, id: str, evaluation_rule: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationRule: - """Create or update an evaluation rule. + def create_optimization_job( + self, + job: IO[bytes], + *, + operation_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.OptimizationJob: + """Creates an agent optimization job. - :param id: Unique identifier for the evaluation rule. Required. - :type id: str - :param evaluation_rule: Evaluation rule resource. Required. - :type evaluation_rule: IO[bytes] + Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for + idempotent retry. + + :param job: The job to create. Required. + :type job: IO[bytes] + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationRule + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_or_update( - self, id: str, evaluation_rule: Union[_models.EvaluationRule, JSON, IO[bytes]], **kwargs: Any - ) -> _models.EvaluationRule: - """Create or update an evaluation rule. + def create_optimization_job( + self, job: Union[_models.OptimizationJob, JSON, IO[bytes]], *, operation_id: Optional[str] = None, **kwargs: Any + ) -> _models.OptimizationJob: + """Creates an agent optimization job. - :param id: Unique identifier for the evaluation rule. Required. - :type id: str - :param evaluation_rule: Evaluation rule resource. Is one of the following types: - EvaluationRule, JSON, IO[bytes] Required. - :type evaluation_rule: ~azure.ai.projects.models.EvaluationRule or JSON or IO[bytes] - :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationRule + Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for + idempotent retry. + + :param job: The job to create. Is one of the following types: OptimizationJob, JSON, IO[bytes] + Required. + :type job: ~azure.ai.projects.models.OptimizationJob or JSON or IO[bytes] + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -3803,17 +8997,17 @@ def create_or_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EvaluationRule] = kwargs.pop("cls", None) + cls: ClsType[_models.OptimizationJob] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(evaluation_rule, (IOBase, bytes)): - _content = evaluation_rule + if isinstance(job, (IOBase, bytes)): + _content = job else: - _content = json.dumps(evaluation_rule, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(job, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_evaluation_rules_create_or_update_request( - id=id, + _request = build_beta_agents_create_optimization_job_request( + operation_id=operation_id, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -3833,51 +9027,146 @@ def create_or_update( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [201]: if _stream: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluationRule, response.json()) + deserialized = _deserialize(_models.OptimizationJob, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def list( + def get_optimization_job(self, job_id: str, **kwargs: Any) -> _models.OptimizationJob: + """Get info about an agent optimization job. + + Get an optimization job by id. Emits ``Retry-After`` while the job is non-terminal. + + :param job_id: The ID of the job. Required. + :type job_id: str + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OptimizationJob] = kwargs.pop("cls", None) + + _request = build_beta_agents_get_optimization_job_request( + job_id=job_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.OptimizationJob, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_optimization_jobs( self, *, - action_type: Optional[Union[str, _models.EvaluationRuleActionType]] = None, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, + status: Optional[Union[str, _models.JobStatus]] = None, agent_name: Optional[str] = None, - enabled: Optional[bool] = None, **kwargs: Any - ) -> ItemPaged["_models.EvaluationRule"]: - """List all evaluation rules. + ) -> ItemPaged["_models.OptimizationJob"]: + """Returns a list of agent optimization jobs. - :keyword action_type: Filter by the type of evaluation rule. Known values are: - "continuousEvaluation" and "humanEvaluationPreview". Default value is None. - :paramtype action_type: str or ~azure.ai.projects.models.EvaluationRuleActionType - :keyword agent_name: Filter by the agent name. Default value is None. + List optimization jobs. Supports cursor pagination and optional ``status`` / ``agent_name`` + filters. + + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :keyword status: Filter to jobs in this lifecycle state. Known values are: "queued", + "in_progress", "succeeded", "failed", and "cancelled". Default value is None. + :paramtype status: str or ~azure.ai.projects.models.JobStatus + :keyword agent_name: Filter to jobs targeting this agent name. Default value is None. :paramtype agent_name: str - :keyword enabled: Filter by the enabled status. Default value is None. - :paramtype enabled: bool - :return: An iterator like instance of EvaluationRule - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.EvaluationRule] + :return: An iterator like instance of OptimizationJob + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.OptimizationJob] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.EvaluationRule]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.OptimizationJob]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3887,58 +9176,37 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_evaluation_rules_list_request( - action_type=action_type, - agent_name=agent_name, - enabled=enabled, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + def prepare_request(_continuation_token=None): + _request = build_beta_agents_list_optimization_jobs_request( + limit=limit, + order=order, + after=_continuation_token, + before=before, + status=status, + agent_name=agent_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) return _request def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.EvaluationRule], - deserialized.get("value", []), + List[_models.OptimizationJob], + deserialized.get("data", []), ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + return deserialized.get("last_id") or None, iter(list_of_elem) - def get_next(next_link=None): - _request = prepare_request(next_link) + def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access @@ -3948,38 +9216,26 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) return pipeline_response return ItemPaged(get_next, extract_data) - -class ConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`connections` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def _get(self, name: str, **kwargs: Any) -> _models.Connection: - """Get a connection by name, without populating connection credentials. + def cancel_optimization_job(self, job_id: str, **kwargs: Any) -> _models.OptimizationJob: + """Cancels an agent optimization job. - :param name: The friendly name of the connection, provided by the user. Required. - :type name: str - :return: Connection. The Connection is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Connection + Request cancellation. Idempotent on terminal states. + + :param job_id: The ID of the job to cancel. Required. + :type job_id: str + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -3993,10 +9249,10 @@ def _get(self, name: str, **kwargs: Any) -> _models.Connection: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Connection] = kwargs.pop("cls", None) + cls: ClsType[_models.OptimizationJob] = kwargs.pop("cls", None) - _request = build_connections_get_request( - name=name, + _request = build_beta_agents_cancel_optimization_job_request( + job_id=job_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4021,31 +9277,34 @@ def _get(self, name: str, **kwargs: Any) -> _models.Connection: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["x-ms-client-request-id"] = self._deserialize( - "str", response.headers.get("x-ms-client-request-id") - ) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Connection, response.json()) + deserialized = _deserialize(_models.OptimizationJob, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace - def _get_with_credentials(self, name: str, **kwargs: Any) -> _models.Connection: - """Get a connection by name, with its connection credentials. + def delete_optimization_job( # pylint: disable=inconsistent-return-statements + self, job_id: str, **kwargs: Any + ) -> None: + """Deletes an agent optimization job. - :param name: The friendly name of the connection, provided by the user. Required. - :type name: str - :return: Connection. The Connection is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Connection + Delete the job and its candidate artifacts. Cancels first if non-terminal. + + :param job_id: The ID of the job to delete. Required. + :type job_id: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4059,10 +9318,10 @@ def _get_with_credentials(self, name: str, **kwargs: Any) -> _models.Connection: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Connection] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_connections_get_with_credentials_request( - name=name, + _request = build_beta_agents_delete_optimization_job_request( + job_id=job_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4072,171 +9331,141 @@ def _get_with_credentials(self, name: str, **kwargs: Any) -> _models.Connection: } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["x-ms-client-request-id"] = self._deserialize( - "str", response.headers.get("x-ms-client-request-id") - ) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Connection, response.json()) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, - *, - connection_type: Optional[Union[str, _models.ConnectionType]] = None, - default_connection: Optional[bool] = None, - **kwargs: Any - ) -> ItemPaged["_models.Connection"]: - """List all connections in the project, without populating connection credentials. - - :keyword connection_type: List connections of this specific type. Known values are: - "AzureOpenAI", "AzureBlob", "AzureStorageAccount", "CognitiveSearch", "CosmosDB", "ApiKey", - "AppConfig", "AppInsights", "CustomKeys", and "RemoteTool_Preview". Default value is None. - :paramtype connection_type: str or ~azure.ai.projects.models.ConnectionType - :keyword default_connection: List connections that are default connections. Default value is - None. - :paramtype default_connection: bool - :return: An iterator like instance of Connection - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Connection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Connection]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_connections_list_request( - connection_type=connection_type, - default_connection=default_connection, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + return cls(pipeline_response, None, {}) # type: ignore - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + @distributed_trace + def list_optimization_candidates( + self, + job_id: str, + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + after: Optional[str] = None, + before: Optional[str] = None, + **kwargs: Any + ) -> _models.AgentsPagedResultOptimizationCandidate: + """Returns a list of candidates for an optimization job. - return _request + List candidates produced by a job. - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Connection], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + :param job_id: The optimization job id. Required. + :type job_id: str + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword after: A cursor for use in pagination. ``after`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include after=obj_foo in order to fetch the next page of the list. Default + value is None. + :paramtype after: str + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: AgentsPagedResultOptimizationCandidate. The AgentsPagedResultOptimizationCandidate is + compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentsPagedResultOptimizationCandidate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - def get_next(next_link=None): - _request = prepare_request(next_link) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + cls: ClsType[_models.AgentsPagedResultOptimizationCandidate] = kwargs.pop("cls", None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + _request = build_beta_agents_list_optimization_candidates_request( + job_id=job_id, + limit=limit, + order=order, + after=after, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return pipeline_response + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - return ItemPaged(get_next, extract_data) + response = pipeline_response.http_response + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) -class DatasetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentsPagedResultOptimizationCandidate, response.json()) - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`datasets` attribute. - """ + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return deserialized # type: ignore @distributed_trace - def list_versions(self, name: str, **kwargs: Any) -> ItemPaged["_models.DatasetVersion"]: - """List all versions of the given DatasetVersion. + def get_optimization_candidate( + self, job_id: str, candidate_id: str, **kwargs: Any + ) -> _models.OptimizationCandidate: + """Get a candidate by id. - :param name: The name of the resource. Required. - :type name: str - :return: An iterator like instance of DatasetVersion - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.DatasetVersion] + Get a single candidate manifest and aggregated evaluation summary. + + :param job_id: The optimization job id. Required. + :type job_id: str + :param candidate_id: The candidate id. Required. + :type candidate_id: str + :return: OptimizationCandidate. The OptimizationCandidate is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationCandidate :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DatasetVersion]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4245,84 +9474,71 @@ def list_versions(self, name: str, **kwargs: Any) -> ItemPaged["_models.DatasetV } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_datasets_list_versions_request( - name=name, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[_models.OptimizationCandidate] = kwargs.pop("cls", None) - return _request + _request = build_beta_agents_get_optimization_candidate_request( + job_id=job_id, + candidate_id=candidate_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.DatasetVersion], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, ) - response = pipeline_response.http_response + raise HttpResponseError(response=response, model=error) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.OptimizationCandidate, response.json()) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return ItemPaged(get_next, extract_data) + return deserialized # type: ignore @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.DatasetVersion"]: - """List the latest version of each DatasetVersion. + def get_optimization_candidate_config( + self, job_id: str, candidate_id: str, **kwargs: Any + ) -> _models.CandidateDeployConfig: + """Get candidate deploy config. - :return: An iterator like instance of DatasetVersion - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.DatasetVersion] + Get the candidate's deploy config JSON. Used to compose ``agents.create_version(...)`` from a + candidate. + + :param job_id: The optimization job id. Required. + :type job_id: str + :param candidate_id: The candidate id. Required. + :type candidate_id: str + :return: CandidateDeployConfig. The CandidateDeployConfig is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.CandidateDeployConfig :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DatasetVersion]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4331,81 +9547,68 @@ def list(self, **kwargs: Any) -> ItemPaged["_models.DatasetVersion"]: } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_datasets_list_request( - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[_models.CandidateDeployConfig] = kwargs.pop("cls", None) - return _request + _request = build_beta_agents_get_optimization_candidate_config_request( + job_id=job_id, + candidate_id=candidate_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.DatasetVersion], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, ) - response = pipeline_response.http_response + raise HttpResponseError(response=response, model=error) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CandidateDeployConfig, response.json()) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return ItemPaged(get_next, extract_data) + return deserialized # type: ignore @distributed_trace - def get(self, name: str, version: str, **kwargs: Any) -> _models.DatasetVersion: - """Get the specific version of the DatasetVersion. The service returns 404 Not Found error if the - DatasetVersion does not exist. + def get_optimization_candidate_results( + self, job_id: str, candidate_id: str, **kwargs: Any + ) -> _models.CandidateResults: + """Get candidate evaluation results. - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to retrieve. Required. - :type version: str - :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetVersion + Get full per-task evaluation results for a candidate. + + :param job_id: The optimization job id. Required. + :type job_id: str + :param candidate_id: The candidate id. Required. + :type candidate_id: str + :return: CandidateResults. The CandidateResults is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.CandidateResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4419,11 +9622,11 @@ def get(self, name: str, version: str, **kwargs: Any) -> _models.DatasetVersion: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DatasetVersion] = kwargs.pop("cls", None) + cls: ClsType[_models.CandidateResults] = kwargs.pop("cls", None) - _request = build_datasets_get_request( - name=name, - version=version, + _request = build_beta_agents_get_optimization_candidate_results_request( + job_id=job_id, + candidate_id=candidate_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4448,29 +9651,48 @@ def get(self, name: str, version: str, **kwargs: Any) -> _models.DatasetVersion: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DatasetVersion, response.json()) + deserialized = _deserialize(_models.CandidateResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + +class BetaEvaluationTaxonomiesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`evaluation_taxonomies` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace - def delete(self, name: str, version: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """Delete the specific version of the DatasetVersion. The service returns 204 No Content if the - DatasetVersion was deleted successfully or if the DatasetVersion does not exist. + def get(self, name: str, **kwargs: Any) -> _models.EvaluationTaxonomy: + """Get an evaluation run by name. :param name: The name of the resource. Required. :type name: str - :param version: The version of the DatasetVersion to delete. Required. - :type version: str - :return: None - :rtype: None + :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationTaxonomy :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4484,11 +9706,10 @@ def delete(self, name: str, version: str, **kwargs: Any) -> None: # pylint: dis _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.EvaluationTaxonomy] = kwargs.pop("cls", None) - _request = build_datasets_delete_request( + _request = build_beta_evaluation_taxonomies_get_request( name=name, - version=version, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4498,113 +9719,137 @@ def delete(self, name: str, version: str, **kwargs: Any) -> None: # pylint: dis } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.EvaluationTaxonomy, response.json()) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore - @overload - def create_or_update( - self, - name: str, - version: str, - dataset_version: _models.DatasetVersion, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> _models.DatasetVersion: - """Create a new or update an existing DatasetVersion with the given version id. + return deserialized # type: ignore - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to create or update. Required. - :type version: str - :param dataset_version: The DatasetVersion to create or update. Required. - :type dataset_version: ~azure.ai.projects.models.DatasetVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetVersion + @distributed_trace + def list( + self, *, input_name: Optional[str] = None, input_type: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.EvaluationTaxonomy"]: + """List evaluation taxonomies. + + :keyword input_name: Filter by the evaluation input name. Default value is None. + :paramtype input_name: str + :keyword input_type: Filter by taxonomy input type. Default value is None. + :paramtype input_type: str + :return: An iterator like instance of EvaluationTaxonomy + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.EvaluationTaxonomy] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - def create_or_update( - self, - name: str, - version: str, - dataset_version: JSON, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> _models.DatasetVersion: - """Create a new or update an existing DatasetVersion with the given version id. + cls: ClsType[List[_models.EvaluationTaxonomy]] = kwargs.pop("cls", None) - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to create or update. Required. - :type version: str - :param dataset_version: The DatasetVersion to create or update. Required. - :type dataset_version: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_beta_evaluation_taxonomies_list_request( + input_name=input_name, + input_type=input_type, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.EvaluationTaxonomy], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - @overload - def create_or_update( - self, - name: str, - version: str, - dataset_version: IO[bytes], - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> _models.DatasetVersion: - """Create a new or update an existing DatasetVersion with the given version id. + return pipeline_response - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to create or update. Required. - :type version: str - :param dataset_version: The DatasetVersion to create or update. Required. - :type dataset_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ + return ItemPaged(get_next, extract_data) @distributed_trace - def create_or_update( - self, name: str, version: str, dataset_version: Union[_models.DatasetVersion, JSON, IO[bytes]], **kwargs: Any - ) -> _models.DatasetVersion: - """Create a new or update an existing DatasetVersion with the given version id. + def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Delete an evaluation taxonomy by name. :param name: The name of the resource. Required. :type name: str - :param version: The specific version id of the DatasetVersion to create or update. Required. - :type version: str - :param dataset_version: The DatasetVersion to create or update. Is one of the following types: - DatasetVersion, JSON, IO[bytes] Required. - :type dataset_version: ~azure.ai.projects.models.DatasetVersion or JSON or IO[bytes] - :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetVersion + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4615,25 +9860,14 @@ def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DatasetVersion] = kwargs.pop("cls", None) - - content_type = content_type or "application/merge-patch+json" - _content = None - if isinstance(dataset_version, (IOBase, bytes)): - _content = dataset_version - else: - _content = json.dumps(dataset_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_datasets_create_or_update_request( + _request = build_beta_evaluation_taxonomies_delete_request( name=name, - version=version, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -4642,131 +9876,87 @@ def create_or_update( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.DatasetVersion, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore @overload - def pending_upload( - self, - name: str, - version: str, - pending_upload_request: _models.PendingUploadRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PendingUploadResult: - """Start a new or get an existing pending upload of a dataset for a specific version. + def create( + self, name: str, taxonomy: _models.EvaluationTaxonomy, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationTaxonomy: + """Create an evaluation taxonomy. - :param name: The name of the resource. Required. + :param name: The name of the evaluation taxonomy. Required. :type name: str - :param version: The specific version id of the DatasetVersion to operate on. Required. - :type version: str - :param pending_upload_request: The pending upload request parameters. Required. - :type pending_upload_request: ~azure.ai.projects.models.PendingUploadRequest + :param taxonomy: The evaluation taxonomy. Required. + :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResult + :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationTaxonomy :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def pending_upload( - self, - name: str, - version: str, - pending_upload_request: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PendingUploadResult: - """Start a new or get an existing pending upload of a dataset for a specific version. + def create( + self, name: str, taxonomy: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationTaxonomy: + """Create an evaluation taxonomy. - :param name: The name of the resource. Required. + :param name: The name of the evaluation taxonomy. Required. :type name: str - :param version: The specific version id of the DatasetVersion to operate on. Required. - :type version: str - :param pending_upload_request: The pending upload request parameters. Required. - :type pending_upload_request: JSON + :param taxonomy: The evaluation taxonomy. Required. + :type taxonomy: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResult + :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationTaxonomy :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def pending_upload( - self, - name: str, - version: str, - pending_upload_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PendingUploadResult: - """Start a new or get an existing pending upload of a dataset for a specific version. + def create( + self, name: str, taxonomy: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationTaxonomy: + """Create an evaluation taxonomy. - :param name: The name of the resource. Required. + :param name: The name of the evaluation taxonomy. Required. :type name: str - :param version: The specific version id of the DatasetVersion to operate on. Required. - :type version: str - :param pending_upload_request: The pending upload request parameters. Required. - :type pending_upload_request: IO[bytes] + :param taxonomy: The evaluation taxonomy. Required. + :type taxonomy: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResult + :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationTaxonomy :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def pending_upload( - self, - name: str, - version: str, - pending_upload_request: Union[_models.PendingUploadRequest, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.PendingUploadResult: - """Start a new or get an existing pending upload of a dataset for a specific version. + def create( + self, name: str, taxonomy: Union[_models.EvaluationTaxonomy, JSON, IO[bytes]], **kwargs: Any + ) -> _models.EvaluationTaxonomy: + """Create an evaluation taxonomy. - :param name: The name of the resource. Required. + :param name: The name of the evaluation taxonomy. Required. :type name: str - :param version: The specific version id of the DatasetVersion to operate on. Required. - :type version: str - :param pending_upload_request: The pending upload request parameters. Is one of the following - types: PendingUploadRequest, JSON, IO[bytes] Required. - :type pending_upload_request: ~azure.ai.projects.models.PendingUploadRequest or JSON or - IO[bytes] - :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResult + :param taxonomy: The evaluation taxonomy. Is one of the following types: EvaluationTaxonomy, + JSON, IO[bytes] Required. + :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy or JSON or IO[bytes] + :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationTaxonomy :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4781,85 +9971,20 @@ def pending_upload( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PendingUploadResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(pending_upload_request, (IOBase, bytes)): - _content = pending_upload_request - else: - _content = json.dumps(pending_upload_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_datasets_pending_upload_request( - name=name, - version=version, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.PendingUploadResult, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_credentials(self, name: str, version: str, **kwargs: Any) -> _models.DatasetCredential: - """Get the SAS credential to access the storage account associated with a Dataset version. - - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to operate on. Required. - :type version: str - :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetCredential - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + cls: ClsType[_models.EvaluationTaxonomy] = kwargs.pop("cls", None) - cls: ClsType[_models.DatasetCredential] = kwargs.pop("cls", None) + content_type = content_type or "application/json" + _content = None + if isinstance(taxonomy, (IOBase, bytes)): + _content = taxonomy + else: + _content = json.dumps(taxonomy, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_datasets_get_credentials_request( + _request = build_beta_evaluation_taxonomies_create_request( name=name, - version=version, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -4876,7 +10001,7 @@ def get_credentials(self, name: str, version: str, **kwargs: Any) -> _models.Dat response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -4888,39 +10013,80 @@ def get_credentials(self, name: str, version: str, **kwargs: Any) -> _models.Dat if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DatasetCredential, response.json()) + deserialized = _deserialize(_models.EvaluationTaxonomy, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + @overload + def update( + self, name: str, taxonomy: _models.EvaluationTaxonomy, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationTaxonomy: + """Update an evaluation taxonomy. -class DeploymentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + :param name: The name of the evaluation taxonomy. Required. + :type name: str + :param taxonomy: The evaluation taxonomy. Required. + :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :raises ~azure.core.exceptions.HttpResponseError: + """ - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`deployments` attribute. - """ + @overload + def update( + self, name: str, taxonomy: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationTaxonomy: + """Update an evaluation taxonomy. - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + :param name: The name of the evaluation taxonomy. Required. + :type name: str + :param taxonomy: The evaluation taxonomy. Required. + :type taxonomy: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, name: str, taxonomy: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationTaxonomy: + """Update an evaluation taxonomy. + + :param name: The name of the evaluation taxonomy. Required. + :type name: str + :param taxonomy: The evaluation taxonomy. Required. + :type taxonomy: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def get(self, name: str, **kwargs: Any) -> _models.Deployment: - """Get a deployed model. + def update( + self, name: str, taxonomy: Union[_models.EvaluationTaxonomy, JSON, IO[bytes]], **kwargs: Any + ) -> _models.EvaluationTaxonomy: + """Update an evaluation taxonomy. - :param name: Name of the deployment. Required. + :param name: The name of the evaluation taxonomy. Required. :type name: str - :return: Deployment. The Deployment is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Deployment + :param taxonomy: The evaluation taxonomy. Is one of the following types: EvaluationTaxonomy, + JSON, IO[bytes] Required. + :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy or JSON or IO[bytes] + :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationTaxonomy :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4931,14 +10097,24 @@ def get(self, name: str, **kwargs: Any) -> _models.Deployment: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EvaluationTaxonomy] = kwargs.pop("cls", None) - _request = build_deployments_get_request( + content_type = content_type or "application/json" + _content = None + if isinstance(taxonomy, (IOBase, bytes)): + _content = taxonomy + else: + _content = json.dumps(taxonomy, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_evaluation_taxonomies_update_request( name=name, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -4964,133 +10140,25 @@ def get(self, name: str, **kwargs: Any) -> _models.Deployment: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - response_headers = {} - response_headers["x-ms-client-request-id"] = self._deserialize( - "str", response.headers.get("x-ms-client-request-id") - ) - if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Deployment, response.json()) + deserialized = _deserialize(_models.EvaluationTaxonomy, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list( - self, - *, - model_publisher: Optional[str] = None, - model_name: Optional[str] = None, - deployment_type: Optional[Union[str, _models.DeploymentType]] = None, - **kwargs: Any - ) -> ItemPaged["_models.Deployment"]: - """List all deployed models in the project. - - :keyword model_publisher: Model publisher to filter models by. Default value is None. - :paramtype model_publisher: str - :keyword model_name: Model name (the publisher specific name) to filter models by. Default - value is None. - :paramtype model_name: str - :keyword deployment_type: Type of deployment to filter list by. "ModelDeployment" Default value - is None. - :paramtype deployment_type: str or ~azure.ai.projects.models.DeploymentType - :return: An iterator like instance of Deployment - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Deployment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_deployments_list_request( - model_publisher=model_publisher, - model_name=model_name, - deployment_type=deployment_type, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Deployment], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - -class IndexesOperations: +class BetaEvaluatorsOperations: # pylint: disable=too-many-public-methods """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`indexes` attribute. + :attr:`evaluators` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -5101,19 +10169,33 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_versions(self, name: str, **kwargs: Any) -> ItemPaged["_models.Index"]: - """List all versions of the given Index. + def list_versions( + self, + name: str, + *, + type: Optional[Union[Literal["builtin"], Literal["custom"], Literal["all"], str]] = None, + limit: Optional[int] = None, + **kwargs: Any + ) -> ItemPaged["_models.EvaluatorVersion"]: + """List all versions of the given evaluator. :param name: The name of the resource. Required. :type name: str - :return: An iterator like instance of Index - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Index] + :keyword type: Filter evaluators by type. Possible values: 'all', 'custom', 'builtin'. Is one + of the following types: Literal["builtin"], Literal["custom"], Literal["all"], str Default + value is None. + :paramtype type: str or str or str or str + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the default is 20. Default value is None. + :paramtype limit: int + :return: An iterator like instance of EvaluatorVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.EvaluatorVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Index]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.EvaluatorVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5126,8 +10208,10 @@ def list_versions(self, name: str, **kwargs: Any) -> ItemPaged["_models.Index"]: def prepare_request(next_link=None): if not next_link: - _request = build_indexes_list_versions_request( + _request = build_beta_evaluators_list_versions_request( name=name, + type=type, + limit=limit, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5150,7 +10234,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -5164,7 +10251,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.Index], + List[_models.EvaluatorVersion], deserialized.get("value", []), ) if cls: @@ -5189,17 +10276,30 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Index"]: - """List the latest version of each Index. + def list( + self, + *, + type: Optional[Union[Literal["builtin"], Literal["custom"], Literal["all"], str]] = None, + limit: Optional[int] = None, + **kwargs: Any + ) -> ItemPaged["_models.EvaluatorVersion"]: + """List the latest version of each evaluator. - :return: An iterator like instance of Index - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Index] + :keyword type: Filter evaluators by type. Possible values: 'all', 'custom', 'builtin'. Is one + of the following types: Literal["builtin"], Literal["custom"], Literal["all"], str Default + value is None. + :paramtype type: str or str or str or str + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the default is 20. Default value is None. + :paramtype limit: int + :return: An iterator like instance of EvaluatorVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.EvaluatorVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Index]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.EvaluatorVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5212,7 +10312,9 @@ def list(self, **kwargs: Any) -> ItemPaged["_models.Index"]: def prepare_request(next_link=None): if not next_link: - _request = build_indexes_list_request( + _request = build_beta_evaluators_list_request( + type=type, + limit=limit, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5235,7 +10337,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -5249,7 +10354,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.Index], + List[_models.EvaluatorVersion], deserialized.get("value", []), ) if cls: @@ -5274,81 +10379,16 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def get(self, name: str, version: str, **kwargs: Any) -> _models.Index: - """Get the specific version of the Index. The service returns 404 Not Found error if the Index - does not exist. - - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the Index to retrieve. Required. - :type version: str - :return: Index. The Index is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Index - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Index] = kwargs.pop("cls", None) - - _request = build_indexes_get_request( - name=name, - version=version, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Index, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete(self, name: str, version: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """Delete the specific version of the Index. The service returns 204 No Content if the Index was - deleted successfully or if the Index does not exist. + def get_version(self, name: str, version: str, **kwargs: Any) -> _models.EvaluatorVersion: + """Get the specific version of the EvaluatorVersion. The service returns 404 Not Found error if + the EvaluatorVersion does not exist. :param name: The name of the resource. Required. :type name: str - :param version: The version of the Index to delete. Required. + :param version: The specific version id of the EvaluatorVersion to retrieve. Required. :type version: str - :return: None - :rtype: None + :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5362,150 +10402,12 @@ def delete(self, name: str, version: str, **kwargs: Any) -> None: # pylint: dis _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_indexes_delete_request( - name=name, - version=version, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def create_or_update( - self, - name: str, - version: str, - index: _models.Index, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> _models.Index: - """Create a new or update an existing Index with the given version id. - - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the Index to create or update. Required. - :type version: str - :param index: The Index to create or update. Required. - :type index: ~azure.ai.projects.models.Index - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: Index. The Index is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Index - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, name: str, version: str, index: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.Index: - """Create a new or update an existing Index with the given version id. - - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the Index to create or update. Required. - :type version: str - :param index: The Index to create or update. Required. - :type index: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: Index. The Index is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Index - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - name: str, - version: str, - index: IO[bytes], - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> _models.Index: - """Create a new or update an existing Index with the given version id. - - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the Index to create or update. Required. - :type version: str - :param index: The Index to create or update. Required. - :type index: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: Index. The Index is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Index - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, name: str, version: str, index: Union[_models.Index, JSON, IO[bytes]], **kwargs: Any - ) -> _models.Index: - """Create a new or update an existing Index with the given version id. - - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the Index to create or update. Required. - :type version: str - :param index: The Index to create or update. Is one of the following types: Index, JSON, - IO[bytes] Required. - :type index: ~azure.ai.projects.models.Index or JSON or IO[bytes] - :return: Index. The Index is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Index - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Index] = kwargs.pop("cls", None) - - content_type = content_type or "application/merge-patch+json" - _content = None - if isinstance(index, (IOBase, bytes)): - _content = index - else: - _content = json.dumps(index, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.EvaluatorVersion] = kwargs.pop("cls", None) - _request = build_indexes_create_or_update_request( + _request = build_beta_evaluators_get_version_request( name=name, version=version, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -5522,7 +10424,7 @@ def create_or_update( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -5534,116 +10436,26 @@ def create_or_update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Index, response.json()) + deserialized = _deserialize(_models.EvaluatorVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - -class BetaAgentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`agents` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def update_agent_from_code( - self, - agent_name: str, - content: _models.CreateAgentVersionFromCodeContent, - *, - code_zip_sha256: str, - **kwargs: Any - ) -> _models.AgentDetails: - """Updates a code-based agent by uploading new code and creating a new version. If the code and - definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing - version. The request body is multipart/form-data with a JSON metadata part and a binary code - part (part order is irrelevant). Maximum upload size is 250 MB. - - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. - - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. - :type agent_name: str - :param content: Required. - :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent - :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change - detection (dedup) and integrity verification. Required. - :paramtype code_zip_sha256: str - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update_agent_from_code( - self, agent_name: str, content: JSON, *, code_zip_sha256: str, **kwargs: Any - ) -> _models.AgentDetails: - """Updates a code-based agent by uploading new code and creating a new version. If the code and - definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing - version. The request body is multipart/form-data with a JSON metadata part and a binary code - part (part order is irrelevant). Maximum upload size is 250 MB. - - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. - - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. - :type agent_name: str - :param content: Required. - :type content: JSON - :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change - detection (dedup) and integrity verification. Required. - :paramtype code_zip_sha256: str - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def update_agent_from_code( - self, - agent_name: str, - content: Union[_models.CreateAgentVersionFromCodeContent, JSON], - *, - code_zip_sha256: str, - **kwargs: Any - ) -> _models.AgentDetails: - """Updates a code-based agent by uploading new code and creating a new version. If the code and - definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing - version. The request body is multipart/form-data with a JSON metadata part and a binary code - part (part order is irrelevant). Maximum upload size is 250 MB. - - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + def delete_version( # pylint: disable=inconsistent-return-statements + self, name: str, version: str, **kwargs: Any + ) -> None: + """Delete the specific version of the EvaluatorVersion. The service returns 204 No Content if the + EvaluatorVersion was deleted successfully or if the EvaluatorVersion does not exist. - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. - :type agent_name: str - :param content: Is either a CreateAgentVersionFromCodeContent type or a JSON type. Required. - :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent or JSON - :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change - detection (dedup) and integrity verification. Required. - :paramtype code_zip_sha256: str - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails + :param name: The name of the resource. Required. + :type name: str + :param version: The version of the EvaluatorVersion to delete. Required. + :type version: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5657,18 +10469,12 @@ def update_agent_from_code( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.AgentDetails] = kwargs.pop("cls", None) - - _body = content.as_dict() if isinstance(content, _Model) else content - _file_fields: list[str] = ["code"] - _data_fields: list[str] = ["metadata"] - _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_agents_update_agent_from_code_request( - agent_name=agent_name, - code_zip_sha256=code_zip_sha256, + _request = build_beta_evaluators_delete_version_request( + name=name, + version=version, api_version=self._config.api_version, - files=_files, headers=_headers, params=_params, ) @@ -5677,121 +10483,92 @@ def update_agent_from_code( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.AgentDetails, response.json()) + raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore @overload - def patch_agent_details( + def create_version( self, - agent_name: str, + name: str, + evaluator_version: _models.EvaluatorVersion, *, - content_type: str = "application/merge-patch+json", - agent_endpoint: Optional[_models.AgentEndpointConfig] = None, - agent_card: Optional[_models.AgentCard] = None, + content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentDetails: - """Updates an agent endpoint. + ) -> _models.EvaluatorVersion: + """Create a new EvaluatorVersion with auto incremented version id. - :param agent_name: The name of the agent to retrieve. Required. - :type agent_name: str + :param name: The name of the resource. Required. + :type name: str + :param evaluator_version: Required. + :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". + Default value is "application/json". :paramtype content_type: str - :keyword agent_endpoint: The endpoint configuration for the agent. Default value is None. - :paramtype agent_endpoint: ~azure.ai.projects.models.AgentEndpointConfig - :keyword agent_card: Optional agent card for the agent. Default value is None. - :paramtype agent_card: ~azure.ai.projects.models.AgentCard - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails + :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorVersion :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def patch_agent_details( - self, agent_name: str, body: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.AgentDetails: - """Updates an agent endpoint. + def create_version( + self, name: str, evaluator_version: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluatorVersion: + """Create a new EvaluatorVersion with auto incremented version id. - :param agent_name: The name of the agent to retrieve. Required. - :type agent_name: str - :param body: Required. - :type body: JSON + :param name: The name of the resource. Required. + :type name: str + :param evaluator_version: Required. + :type evaluator_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". + Default value is "application/json". :paramtype content_type: str - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails + :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorVersion :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def patch_agent_details( - self, agent_name: str, body: IO[bytes], *, content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.AgentDetails: - """Updates an agent endpoint. + def create_version( + self, name: str, evaluator_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluatorVersion: + """Create a new EvaluatorVersion with auto incremented version id. - :param agent_name: The name of the agent to retrieve. Required. - :type agent_name: str - :param body: Required. - :type body: IO[bytes] + :param name: The name of the resource. Required. + :type name: str + :param evaluator_version: Required. + :type evaluator_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/merge-patch+json". + Default value is "application/json". :paramtype content_type: str - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails + :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorVersion :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def patch_agent_details( - self, - agent_name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - agent_endpoint: Optional[_models.AgentEndpointConfig] = None, - agent_card: Optional[_models.AgentCard] = None, - **kwargs: Any - ) -> _models.AgentDetails: - """Updates an agent endpoint. + def create_version( + self, name: str, evaluator_version: Union[_models.EvaluatorVersion, JSON, IO[bytes]], **kwargs: Any + ) -> _models.EvaluatorVersion: + """Create a new EvaluatorVersion with auto incremented version id. - :param agent_name: The name of the agent to retrieve. Required. - :type agent_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword agent_endpoint: The endpoint configuration for the agent. Default value is None. - :paramtype agent_endpoint: ~azure.ai.projects.models.AgentEndpointConfig - :keyword agent_card: Optional agent card for the agent. Default value is None. - :paramtype agent_card: ~azure.ai.projects.models.AgentCard - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails + :param name: The name of the resource. Required. + :type name: str + :param evaluator_version: Is one of the following types: EvaluatorVersion, JSON, IO[bytes] + Required. + :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion or JSON or IO[bytes] + :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5806,20 +10583,17 @@ def patch_agent_details( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentDetails] = kwargs.pop("cls", None) + cls: ClsType[_models.EvaluatorVersion] = kwargs.pop("cls", None) - if body is _Unset: - body = {"agent_card": agent_card, "agent_endpoint": agent_endpoint} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/merge-patch+json" + content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(evaluator_version, (IOBase, bytes)): + _content = evaluator_version else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(evaluator_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_agents_patch_agent_details_request( - agent_name=agent_name, + _request = build_beta_evaluators_create_version_request( + name=name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -5839,23 +10613,19 @@ def patch_agent_details( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [201]: if _stream: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.AgentDetails, response.json()) + deserialized = _deserialize(_models.EvaluatorVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5863,81 +10633,96 @@ def patch_agent_details( return deserialized # type: ignore @overload - def create_agent_version_from_code( + def update_version( self, - agent_name: str, - content: _models.CreateAgentVersionFromCodeContent, + name: str, + version: str, + evaluator_version: _models.EvaluatorVersion, *, - code_zip_sha256: str, + content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentVersionDetails: - """create_agent_version_from_code. - - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + ) -> _models.EvaluatorVersion: + """Update an existing EvaluatorVersion with the given version id. - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. - :type agent_name: str - :param content: Required. - :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent - :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change - detection (dedup) and integrity verification. Required. - :paramtype code_zip_sha256: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :param name: The name of the resource. Required. + :type name: str + :param version: The version of the EvaluatorVersion to update. Required. + :type version: str + :param evaluator_version: Evaluator resource. Required. + :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorVersion :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_agent_version_from_code( - self, agent_name: str, content: JSON, *, code_zip_sha256: str, **kwargs: Any - ) -> _models.AgentVersionDetails: - """create_agent_version_from_code. - - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + def update_version( + self, name: str, version: str, evaluator_version: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluatorVersion: + """Update an existing EvaluatorVersion with the given version id. - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. - :type agent_name: str - :param content: Required. - :type content: JSON - :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change - detection (dedup) and integrity verification. Required. - :paramtype code_zip_sha256: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :param name: The name of the resource. Required. + :type name: str + :param version: The version of the EvaluatorVersion to update. Required. + :type version: str + :param evaluator_version: Evaluator resource. Required. + :type evaluator_version: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorVersion :raises ~azure.core.exceptions.HttpResponseError: """ - @distributed_trace - def create_agent_version_from_code( + @overload + def update_version( self, - agent_name: str, - content: Union[_models.CreateAgentVersionFromCodeContent, JSON], + name: str, + version: str, + evaluator_version: IO[bytes], *, - code_zip_sha256: str, + content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentVersionDetails: - """create_agent_version_from_code. + ) -> _models.EvaluatorVersion: + """Update an existing EvaluatorVersion with the given version id. - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + :param name: The name of the resource. Required. + :type name: str + :param version: The version of the EvaluatorVersion to update. Required. + :type version: str + :param evaluator_version: Evaluator resource. Required. + :type evaluator_version: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. - :type agent_name: str - :param content: Is either a CreateAgentVersionFromCodeContent type or a JSON type. Required. - :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent or JSON - :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change - detection (dedup) and integrity verification. Required. - :paramtype code_zip_sha256: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + @distributed_trace + def update_version( + self, + name: str, + version: str, + evaluator_version: Union[_models.EvaluatorVersion, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.EvaluatorVersion: + """Update an existing EvaluatorVersion with the given version id. + + :param name: The name of the resource. Required. + :type name: str + :param version: The version of the EvaluatorVersion to update. Required. + :type version: str + :param evaluator_version: Evaluator resource. Is one of the following types: EvaluatorVersion, + JSON, IO[bytes] Required. + :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion or JSON or IO[bytes] + :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5948,21 +10733,25 @@ def create_agent_version_from_code( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.AgentVersionDetails] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EvaluatorVersion] = kwargs.pop("cls", None) - _body = content.as_dict() if isinstance(content, _Model) else content - _file_fields: list[str] = ["code"] - _data_fields: list[str] = ["metadata"] - _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) + content_type = content_type or "application/json" + _content = None + if isinstance(evaluator_version, (IOBase, bytes)): + _content = evaluator_version + else: + _content = json.dumps(evaluator_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_agents_create_agent_version_from_code_request( - agent_name=agent_name, - code_zip_sha256=code_zip_sha256, + _request = build_beta_evaluators_update_version_request( + name=name, + version=version, + content_type=content_type, api_version=self._config.api_version, - files=_files, + content=_content, headers=_headers, params=_params, ) @@ -5986,34 +10775,116 @@ def create_agent_version_from_code( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.AgentVersionDetails, response.json()) + deserialized = _deserialize(_models.EvaluatorVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + @overload + def pending_upload( + self, + name: str, + version: str, + pending_upload_request: _models.PendingUploadRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PendingUploadResult: + """Start a new or get an existing pending upload of an evaluator for a specific version. + + :param name: Required. + :type name: str + :param version: The specific version id of the EvaluatorVersion to operate on. Required. + :type version: str + :param pending_upload_request: The pending upload request parameters. Required. + :type pending_upload_request: ~azure.ai.projects.models.PendingUploadRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def pending_upload( + self, + name: str, + version: str, + pending_upload_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PendingUploadResult: + """Start a new or get an existing pending upload of an evaluator for a specific version. + + :param name: Required. + :type name: str + :param version: The specific version id of the EvaluatorVersion to operate on. Required. + :type version: str + :param pending_upload_request: The pending upload request parameters. Required. + :type pending_upload_request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def pending_upload( + self, + name: str, + version: str, + pending_upload_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PendingUploadResult: + """Start a new or get an existing pending upload of an evaluator for a specific version. + + :param name: Required. + :type name: str + :param version: The specific version id of the EvaluatorVersion to operate on. Required. + :type version: str + :param pending_upload_request: The pending upload request parameters. Required. + :type pending_upload_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def download_agent_version_code(self, agent_name: str, agent_version: str, **kwargs: Any) -> Iterator[bytes]: - """Download the code zip for a specific version of a code-based hosted agent. Returns the - previously-uploaded zip (``application/zip``). The SHA-256 digest of the returned bytes matches - the ``content_hash`` on the agent version's ``code_configuration``. + def pending_upload( + self, + name: str, + version: str, + pending_upload_request: Union[_models.PendingUploadRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.PendingUploadResult: + """Start a new or get an existing pending upload of an evaluator for a specific version. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param agent_version: The version of the agent whose code zip should be downloaded. Required. - :type agent_version: str - :return: Iterator[bytes] - :rtype: Iterator[bytes] + :param name: Required. + :type name: str + :param version: The specific version id of the EvaluatorVersion to operate on. Required. + :type version: str + :param pending_upload_request: The pending upload request parameters. Is one of the following + types: PendingUploadRequest, JSON, IO[bytes] Required. + :type pending_upload_request: ~azure.ai.projects.models.PendingUploadRequest or JSON or + IO[bytes] + :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6024,15 +10895,25 @@ def download_agent_version_code(self, agent_name: str, agent_version: str, **kwa } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PendingUploadResult] = kwargs.pop("cls", None) - _request = build_beta_agents_download_agent_version_code_request( - agent_name=agent_name, - agent_version=agent_version, + content_type = content_type or "application/json" + _content = None + if isinstance(pending_upload_request, (IOBase, bytes)): + _content = pending_upload_request + else: + _content = json.dumps(pending_upload_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_evaluators_pending_upload_request( + name=name, + version=version, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -6042,7 +10923,7 @@ def download_agent_version_code(self, agent_name: str, agent_version: str, **kwa _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6062,27 +10943,114 @@ def download_agent_version_code(self, agent_name: str, agent_version: str, **kwa ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PendingUploadResult, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + @overload + def get_credentials( + self, + name: str, + version: str, + credential_request: _models.EvaluatorCredentialRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DatasetCredential: + """Get the SAS credential to access the storage account associated with an Evaluator version. + + :param name: Required. + :type name: str + :param version: The specific version id of the EvaluatorVersion to operate on. Required. + :type version: str + :param credential_request: The credential request parameters. Required. + :type credential_request: ~azure.ai.projects.models.EvaluatorCredentialRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetCredential + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_credentials( + self, + name: str, + version: str, + credential_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DatasetCredential: + """Get the SAS credential to access the storage account associated with an Evaluator version. + + :param name: Required. + :type name: str + :param version: The specific version id of the EvaluatorVersion to operate on. Required. + :type version: str + :param credential_request: The credential request parameters. Required. + :type credential_request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetCredential + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_credentials( + self, + name: str, + version: str, + credential_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DatasetCredential: + """Get the SAS credential to access the storage account associated with an Evaluator version. + + :param name: Required. + :type name: str + :param version: The specific version id of the EvaluatorVersion to operate on. Required. + :type version: str + :param credential_request: The credential request parameters. Required. + :type credential_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetCredential + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def download_agent_code(self, agent_name: str, **kwargs: Any) -> Iterator[bytes]: - """Download the code zip for the latest version of a code-based hosted agent. Returns the - previously-uploaded zip (``application/zip``). The SHA-256 digest of the returned bytes matches - the ``content_hash`` on the latest version's ``code_configuration``. + def get_credentials( + self, + name: str, + version: str, + credential_request: Union[_models.EvaluatorCredentialRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.DatasetCredential: + """Get the SAS credential to access the storage account associated with an Evaluator version. - :param agent_name: The name of the agent whose latest-version code zip should be downloaded. - Required. - :type agent_name: str - :return: Iterator[bytes] - :rtype: Iterator[bytes] + :param name: Required. + :type name: str + :param version: The specific version id of the EvaluatorVersion to operate on. Required. + :type version: str + :param credential_request: The credential request parameters. Is one of the following types: + EvaluatorCredentialRequest, JSON, IO[bytes] Required. + :type credential_request: ~azure.ai.projects.models.EvaluatorCredentialRequest or JSON or + IO[bytes] + :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetCredential :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6093,14 +11061,25 @@ def download_agent_code(self, agent_name: str, **kwargs: Any) -> Iterator[bytes] } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatasetCredential] = kwargs.pop("cls", None) - _request = build_beta_agents_download_agent_code_request( - agent_name=agent_name, + content_type = content_type or "application/json" + _content = None + if isinstance(credential_request, (IOBase, bytes)): + _content = credential_request + else: + _content = json.dumps(credential_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_evaluators_get_credentials_request( + name=name, + version=version, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -6110,7 +11089,7 @@ def download_agent_code(self, agent_name: str, **kwargs: Any) -> Iterator[bytes] _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6130,110 +11109,113 @@ def download_agent_code(self, agent_name: str, **kwargs: Any) -> Iterator[bytes] ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DatasetCredential, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @overload - def create_session( + def create_generation_job( self, - agent_name: str, + job: _models.EvaluatorGenerationJob, *, - version_indicator: _models.VersionIndicator, + operation_id: Optional[str] = None, content_type: str = "application/json", - agent_session_id: Optional[str] = None, **kwargs: Any - ) -> _models.AgentSessionResource: - """Creates a new session for an agent endpoint. The endpoint resolves the backing agent version - from ``version_indicator`` and enforces session ownership using the provided isolation key for - session-mutating operations. + ) -> _models.EvaluatorGenerationJob: + """Creates an evaluator generation job. - :param agent_name: The name of the agent to create a session for. Required. - :type agent_name: str - :keyword version_indicator: Determines which agent version backs the session. Required. - :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator + Creates an evaluator generation job. The service generates rubric-based evaluator definitions + from the provided source materials asynchronously. + + :param job: The job to create. Required. + :type job: ~azure.ai.projects.models.EvaluatorGenerationJob + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword agent_session_id: Optional caller-provided session ID. If specified, it must be unique - within the agent endpoint. Auto-generated if omitted. Default value is None. - :paramtype agent_session_id: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource + :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_session( - self, agent_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentSessionResource: - """Creates a new session for an agent endpoint. The endpoint resolves the backing agent version - from ``version_indicator`` and enforces session ownership using the provided isolation key for - session-mutating operations. + def create_generation_job( + self, job: JSON, *, operation_id: Optional[str] = None, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluatorGenerationJob: + """Creates an evaluator generation job. - :param agent_name: The name of the agent to create a session for. Required. - :type agent_name: str - :param body: Required. - :type body: JSON + Creates an evaluator generation job. The service generates rubric-based evaluator definitions + from the provided source materials asynchronously. + + :param job: The job to create. Required. + :type job: JSON + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource + :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_session( - self, agent_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentSessionResource: - """Creates a new session for an agent endpoint. The endpoint resolves the backing agent version - from ``version_indicator`` and enforces session ownership using the provided isolation key for - session-mutating operations. + def create_generation_job( + self, + job: IO[bytes], + *, + operation_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EvaluatorGenerationJob: + """Creates an evaluator generation job. - :param agent_name: The name of the agent to create a session for. Required. - :type agent_name: str - :param body: Required. - :type body: IO[bytes] + Creates an evaluator generation job. The service generates rubric-based evaluator definitions + from the provided source materials asynchronously. + + :param job: The job to create. Required. + :type job: IO[bytes] + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource + :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_session( + def create_generation_job( self, - agent_name: str, - body: Union[JSON, IO[bytes]] = _Unset, + job: Union[_models.EvaluatorGenerationJob, JSON, IO[bytes]], *, - version_indicator: _models.VersionIndicator = _Unset, - agent_session_id: Optional[str] = None, + operation_id: Optional[str] = None, **kwargs: Any - ) -> _models.AgentSessionResource: - """Creates a new session for an agent endpoint. The endpoint resolves the backing agent version - from ``version_indicator`` and enforces session ownership using the provided isolation key for - session-mutating operations. + ) -> _models.EvaluatorGenerationJob: + """Creates an evaluator generation job. + + Creates an evaluator generation job. The service generates rubric-based evaluator definitions + from the provided source materials asynchronously. - :param agent_name: The name of the agent to create a session for. Required. - :type agent_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword version_indicator: Determines which agent version backs the session. Required. - :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator - :keyword agent_session_id: Optional caller-provided session ID. If specified, it must be unique - within the agent endpoint. Auto-generated if omitted. Default value is None. - :paramtype agent_session_id: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource + :param job: The job to create. Is one of the following types: EvaluatorGenerationJob, JSON, + IO[bytes] Required. + :type job: ~azure.ai.projects.models.EvaluatorGenerationJob or JSON or IO[bytes] + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6248,22 +11230,17 @@ def create_session( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentSessionResource] = kwargs.pop("cls", None) + cls: ClsType[_models.EvaluatorGenerationJob] = kwargs.pop("cls", None) - if body is _Unset: - if version_indicator is _Unset: - raise TypeError("missing required argument: version_indicator") - body = {"agent_session_id": agent_session_id, "version_indicator": version_indicator} - body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(job, (IOBase, bytes)): + _content = job else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(job, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_agents_create_session_request( - agent_name=agent_name, + _request = build_beta_evaluators_create_generation_job_request( + operation_id=operation_id, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -6296,26 +11273,30 @@ def create_session( ) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.AgentSessionResource, response.json()) + deserialized = _deserialize(_models.EvaluatorGenerationJob, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def get_session(self, agent_name: str, session_id: str, **kwargs: Any) -> _models.AgentSessionResource: - """Retrieves a session by ID. + def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.EvaluatorGenerationJob: + """Get info about an evaluator generation job. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param session_id: The session identifier. Required. - :type session_id: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource + Gets the details of an evaluator generation job by its ID. + + :param job_id: The ID of the job. Required. + :type job_id: str + :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6329,11 +11310,10 @@ def get_session(self, agent_name: str, session_id: str, **kwargs: Any) -> _model _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.AgentSessionResource] = kwargs.pop("cls", None) + cls: ClsType[_models.EvaluatorGenerationJob] = kwargs.pop("cls", None) - _request = build_beta_agents_get_session_request( - agent_name=agent_name, - session_id=session_id, + _request = build_beta_evaluators_get_generation_job_request( + job_id=job_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6364,10 +11344,177 @@ def get_session(self, agent_name: str, session_id: str, **kwargs: Any) -> _model ) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.AgentSessionResource, response.json()) + deserialized = _deserialize(_models.EvaluatorGenerationJob, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_generation_jobs( + self, + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, + category: Optional[Union[str, _models.EvaluatorCategory]] = None, + **kwargs: Any + ) -> ItemPaged["_models.EvaluatorGenerationJob"]: + """Returns a list of evaluator generation jobs. + + Returns a list of evaluator generation jobs. + + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :keyword category: Filter evaluator generation jobs by category. Known values are: "quality", + "safety", and "agents". Default value is None. + :paramtype category: str or ~azure.ai.projects.models.EvaluatorCategory + :return: An iterator like instance of EvaluatorGenerationJob + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.EvaluatorGenerationJob] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.EvaluatorGenerationJob]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(_continuation_token=None): + + _request = build_beta_evaluators_list_generation_jobs_request( + limit=limit, + order=order, + after=_continuation_token, + before=before, + category=category, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.EvaluatorGenerationJob], + deserialized.get("data", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, iter(list_of_elem) + + def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.EvaluatorGenerationJob: + """Cancels an evaluator generation job. + + Cancels an evaluator generation job by its ID. + + :param job_id: The ID of the job to cancel. Required. + :type job_id: str + :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.EvaluatorGenerationJob] = kwargs.pop("cls", None) + + _request = build_beta_evaluators_cancel_generation_job_request( + job_id=job_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.EvaluatorGenerationJob, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6375,16 +11522,14 @@ def get_session(self, agent_name: str, session_id: str, **kwargs: Any) -> _model return deserialized # type: ignore @distributed_trace - def delete_session( # pylint: disable=inconsistent-return-statements - self, agent_name: str, session_id: str, **kwargs: Any + def delete_generation_job( # pylint: disable=inconsistent-return-statements + self, job_id: str, **kwargs: Any ) -> None: - """Deletes a session synchronously. Returns 204 No Content when the session is deleted or does not - exist. + """Deletes an evaluator generation job by its ID. Deletes the job record only; the generated + evaluator (if any) is preserved. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param session_id: The session identifier. Required. - :type session_id: str + :param job_id: The ID of the job to delete. Required. + :type job_id: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -6402,9 +11547,8 @@ def delete_session( # pylint: disable=inconsistent-return-statements cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_agents_delete_session_request( - agent_name=agent_name, - session_id=session_id, + _request = build_beta_evaluators_delete_generation_job_request( + job_id=job_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6433,41 +11577,19 @@ def delete_session( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - def list_sessions( - self, - agent_name: str, - *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.AgentSessionResource"]: - """Returns a list of sessions for the specified agent. + def list_evaluation_suite_versions(self, name: str, **kwargs: Any) -> ItemPaged["_models.EvaluationSuiteVersion"]: + """List all versions of the given EvaluationSuiteVersion. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the - default is 20. Default value is None. - :paramtype limit: int - :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for - ascending order and``desc`` - for descending order. Known values are: "asc" and "desc". Default value is None. - :paramtype order: str or ~azure.ai.projects.models.PageOrder - :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your - place in the list. - For instance, if you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page of the list. - Default value is None. - :paramtype before: str - :return: An iterator like instance of AgentSessionResource - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.AgentSessionResource] + :param name: The name of the resource. Required. + :type name: str + :return: An iterator like instance of EvaluationSuiteVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.EvaluationSuiteVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.AgentSessionResource]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.EvaluationSuiteVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6477,36 +11599,59 @@ def list_sessions( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(_continuation_token=None): + def prepare_request(next_link=None): + if not next_link: + + _request = build_beta_evaluators_list_evaluation_suite_versions_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_beta_agents_list_sessions_request( - agent_name=agent_name, - limit=limit, - order=order, - after=_continuation_token, - before=before, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) return _request def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.AgentSessionResource], - deserialized.get("data", []), + List[_models.EvaluationSuiteVersion], + deserialized.get("value", []), ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("last_id") or None, iter(list_of_elem) + return deserialized.get("nextLink") or None, iter(list_of_elem) - def get_next(_continuation_token=None): - _request = prepare_request(_continuation_token) + def get_next(next_link=None): + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access @@ -6516,57 +11661,30 @@ def get_next(_continuation_token=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) return pipeline_response return ItemPaged(get_next, extract_data) @distributed_trace - def get_session_log_stream( - self, agent_name: str, agent_version: str, session_id: str, **kwargs: Any - ) -> _models.SessionLogEvent: - """Streams console logs (stdout / stderr) for a specific hosted agent session - as a Server-Sent Events (SSE) stream. - - Each SSE frame contains: - - * `event`: always `"log"` - * `data`: a plain-text log line (currently JSON-formatted, but the schema is not contractual and may include additional keys or change format over time; clients should treat it as an opaque string) - - Example SSE frames: - - .. code-block:: - - event: log - data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting FoundryCBAgent server on port 8088"} - - event: log - data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application startup complete."} - - event: log - data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} - - event: log - data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since last 60 seconds"} - - The stream remains open until the client disconnects or the server - terminates the connection. Clients should handle reconnection as needed. + def list_evaluation_suites( + self, *, agent_name: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.EvaluationSuiteVersion"]: + """List the latest version of each EvaluationSuiteVersion. - :param agent_name: The name of the hosted agent. Required. - :type agent_name: str - :param agent_version: The version of the agent. Required. - :type agent_version: str - :param session_id: The session ID (maps to an ADC sandbox). Required. - :type session_id: str - :return: SessionLogEvent. The SessionLogEvent is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SessionLogEvent + :keyword agent_name: Filter by associated Foundry agent name (from target). Default value is + None. + :paramtype agent_name: str + :return: An iterator like instance of EvaluationSuiteVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.EvaluationSuiteVersion] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.EvaluationSuiteVersion]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6575,76 +11693,85 @@ def get_session_log_stream( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.SessionLogEvent] = kwargs.pop("cls", None) + def prepare_request(next_link=None): + if not next_link: - _request = build_beta_agents_get_session_log_stream_request( - agent_name=agent_name, - agent_version=agent_version, - session_id=session_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_beta_evaluators_list_evaluation_suites_request( + agent_name=agent_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - response = pipeline_response.http_response + return _request - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.EvaluationSuiteVersion], + deserialized.get("value", []), ) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.SessionLogEvent, response.text()) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + def get_next(next_link=None): + _request = prepare_request(next_link) - return deserialized # type: ignore + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - @distributed_trace - def _upload_session_file( - self, agent_name: str, agent_session_id: str, content: bytes, *, path: str, **kwargs: Any - ) -> _models.SessionFileWriteResult: - """Upload a file to the session sandbox via binary stream. Maximum file size is 50 MB. Uploads - exceeding this limit return 413 Payload Too Large. + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param agent_session_id: The session ID. Required. - :type agent_session_id: str - :param content: Required. - :type content: bytes - :keyword path: The destination file path within the sandbox, relative to the session home - directory. Required. - :paramtype path: str - :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SessionFileWriteResult + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_evaluation_suite(self, name: str, version: str, **kwargs: Any) -> _models.EvaluationSuiteVersion: + """Get the specific version of the EvaluationSuiteVersion. The service returns 404 Not Found error + if the EvaluationSuiteVersion does not exist. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the EvaluationSuiteVersion to retrieve. Required. + :type version: str + :return: EvaluationSuiteVersion. The EvaluationSuiteVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6655,21 +11782,15 @@ def _upload_session_file( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) - cls: ClsType[_models.SessionFileWriteResult] = kwargs.pop("cls", None) - - _content = content + cls: ClsType[_models.EvaluationSuiteVersion] = kwargs.pop("cls", None) - _request = build_beta_agents_upload_session_file_request( - agent_name=agent_name, - agent_session_id=agent_session_id, - path=path, - content_type=content_type, + _request = build_beta_evaluators_get_evaluation_suite_request( + name=name, + version=version, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -6686,23 +11807,19 @@ def _upload_session_file( response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200]: if _stream: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SessionFileWriteResult, response.json()) + deserialized = _deserialize(_models.EvaluationSuiteVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6710,20 +11827,19 @@ def _upload_session_file( return deserialized # type: ignore @distributed_trace - def download_session_file( - self, agent_name: str, agent_session_id: str, *, path: str, **kwargs: Any - ) -> Iterator[bytes]: - """Download a file from the session sandbox as a binary stream. + def delete_evaluation_suite( # pylint: disable=inconsistent-return-statements + self, name: str, version: str, **kwargs: Any + ) -> None: + """Delete the specific version of the EvaluationSuiteVersion. The service returns 204 No Content + if the EvaluationSuiteVersion was deleted successfully or if the EvaluationSuiteVersion does + not exist. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param agent_session_id: The session ID. Required. - :type agent_session_id: str - :keyword path: The file path to download from the sandbox, relative to the session home - directory. Required. - :paramtype path: str - :return: Iterator[bytes] - :rtype: Iterator[bytes] + :param name: The name of the resource. Required. + :type name: str + :param version: The version of the EvaluationSuiteVersion to delete. Required. + :type version: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6737,12 +11853,11 @@ def download_session_file( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_agents_download_session_file_request( - agent_name=agent_name, - agent_session_id=agent_session_id, - path=path, + _request = build_beta_evaluators_delete_evaluation_suite_request( + name=name, + version=version, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6752,50 +11867,122 @@ def download_session_file( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", True) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, None, {}) # type: ignore - return deserialized # type: ignore + @overload + def create_or_update_evaluation_suite( + self, + name: str, + version: str, + evaluation_suite_version: _models.EvaluationSuiteVersion, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.EvaluationSuiteVersion: + """Create a new or update an existing EvaluationSuiteVersion with the given version id. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the EvaluationSuiteVersion to create or update. + Required. + :type version: str + :param evaluation_suite_version: The EvaluationSuiteVersion to create or update. Required. + :type evaluation_suite_version: ~azure.ai.projects.models.EvaluationSuiteVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: EvaluationSuiteVersion. The EvaluationSuiteVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_evaluation_suite( + self, + name: str, + version: str, + evaluation_suite_version: JSON, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.EvaluationSuiteVersion: + """Create a new or update an existing EvaluationSuiteVersion with the given version id. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the EvaluationSuiteVersion to create or update. + Required. + :type version: str + :param evaluation_suite_version: The EvaluationSuiteVersion to create or update. Required. + :type evaluation_suite_version: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: EvaluationSuiteVersion. The EvaluationSuiteVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_evaluation_suite( + self, + name: str, + version: str, + evaluation_suite_version: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.EvaluationSuiteVersion: + """Create a new or update an existing EvaluationSuiteVersion with the given version id. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the EvaluationSuiteVersion to create or update. + Required. + :type version: str + :param evaluation_suite_version: The EvaluationSuiteVersion to create or update. Required. + :type evaluation_suite_version: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: EvaluationSuiteVersion. The EvaluationSuiteVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def get_session_files( - self, agent_name: str, agent_session_id: str, *, path: str, **kwargs: Any - ) -> _models.SessionDirectoryListResult: - """List files and directories at a given path in the session sandbox. Returns only the immediate - children of the specified directory (non-recursive). + def create_or_update_evaluation_suite( + self, + name: str, + version: str, + evaluation_suite_version: Union[_models.EvaluationSuiteVersion, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.EvaluationSuiteVersion: + """Create a new or update an existing EvaluationSuiteVersion with the given version id. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param agent_session_id: The session ID. Required. - :type agent_session_id: str - :keyword path: The directory path to list, relative to the session home directory. Required. - :paramtype path: str - :return: SessionDirectoryListResult. The SessionDirectoryListResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.SessionDirectoryListResult + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the EvaluationSuiteVersion to create or update. + Required. + :type version: str + :param evaluation_suite_version: The EvaluationSuiteVersion to create or update. Is one of the + following types: EvaluationSuiteVersion, JSON, IO[bytes] Required. + :type evaluation_suite_version: ~azure.ai.projects.models.EvaluationSuiteVersion or JSON or + IO[bytes] + :return: EvaluationSuiteVersion. The EvaluationSuiteVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6806,16 +11993,25 @@ def get_session_files( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SessionDirectoryListResult] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EvaluationSuiteVersion] = kwargs.pop("cls", None) - _request = build_beta_agents_get_session_files_request( - agent_name=agent_name, - agent_session_id=agent_session_id, - path=path, + content_type = content_type or "application/merge-patch+json" + _content = None + if isinstance(evaluation_suite_version, (IOBase, bytes)): + _content = evaluation_suite_version + else: + _content = json.dumps(evaluation_suite_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_evaluators_create_or_update_evaluation_suite_request( + name=name, + version=version, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -6832,121 +12028,98 @@ def get_session_files( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: if _stream: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SessionDirectoryListResult, response.json()) + deserialized = _deserialize(_models.EvaluationSuiteVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def delete_session_file( # pylint: disable=inconsistent-return-statements - self, agent_name: str, agent_session_id: str, *, path: str, recursive: Optional[bool] = None, **kwargs: Any - ) -> None: - """Delete a file or directory from the session sandbox. If ``recursive`` is false (default) and - the target is a non-empty directory, the API returns 409 Conflict. + @overload + def create_evaluation_suite( + self, + name: str, + evaluation_suite_version: _models.EvaluationSuiteVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EvaluationSuiteVersion: + """Create a new EvaluationSuiteVersion with auto incremented version id. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param agent_session_id: The session ID. Required. - :type agent_session_id: str - :keyword path: The file or directory path to delete, relative to the session home directory. - Required. - :paramtype path: str - :keyword recursive: Whether to recursively delete directory contents. Defaults to false. - Default value is None. - :paramtype recursive: bool - :return: None - :rtype: None + :param name: The name of the evaluation suite. Required. + :type name: str + :param evaluation_suite_version: The evaluation suite version to create. Required. + :type evaluation_suite_version: ~azure.ai.projects.models.EvaluationSuiteVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationSuiteVersion. The EvaluationSuiteVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteVersion :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_beta_agents_delete_session_file_request( - agent_name=agent_name, - agent_session_id=agent_session_id, - path=path, - recursive=recursive, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore + @overload + def create_evaluation_suite( + self, name: str, evaluation_suite_version: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationSuiteVersion: + """Create a new EvaluationSuiteVersion with auto incremented version id. -class BetaEvaluationTaxonomiesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + :param name: The name of the evaluation suite. Required. + :type name: str + :param evaluation_suite_version: The evaluation suite version to create. Required. + :type evaluation_suite_version: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationSuiteVersion. The EvaluationSuiteVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`evaluation_taxonomies` attribute. - """ + @overload + def create_evaluation_suite( + self, name: str, evaluation_suite_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationSuiteVersion: + """Create a new EvaluationSuiteVersion with auto incremented version id. - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + :param name: The name of the evaluation suite. Required. + :type name: str + :param evaluation_suite_version: The evaluation suite version to create. Required. + :type evaluation_suite_version: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationSuiteVersion. The EvaluationSuiteVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def get(self, name: str, **kwargs: Any) -> _models.EvaluationTaxonomy: - """Get an evaluation run by name. + def create_evaluation_suite( + self, name: str, evaluation_suite_version: Union[_models.EvaluationSuiteVersion, JSON, IO[bytes]], **kwargs: Any + ) -> _models.EvaluationSuiteVersion: + """Create a new EvaluationSuiteVersion with auto incremented version id. - :param name: The name of the resource. Required. + :param name: The name of the evaluation suite. Required. :type name: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :param evaluation_suite_version: The evaluation suite version to create. Is one of the + following types: EvaluationSuiteVersion, JSON, IO[bytes] Required. + :type evaluation_suite_version: ~azure.ai.projects.models.EvaluationSuiteVersion or JSON or + IO[bytes] + :return: EvaluationSuiteVersion. The EvaluationSuiteVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6957,14 +12130,24 @@ def get(self, name: str, **kwargs: Any) -> _models.EvaluationTaxonomy: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.EvaluationTaxonomy] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EvaluationSuiteVersion] = kwargs.pop("cls", None) - _request = build_beta_evaluation_taxonomies_get_request( + content_type = content_type or "application/json" + _content = None + if isinstance(evaluation_suite_version, (IOBase, bytes)): + _content = evaluation_suite_version + else: + _content = json.dumps(evaluation_suite_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_evaluators_create_evaluation_suite_request( name=name, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -6981,129 +12164,105 @@ def get(self, name: str, **kwargs: Any) -> _models.EvaluationTaxonomy: response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [201]: if _stream: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluationTaxonomy, response.json()) + deserialized = _deserialize(_models.EvaluationSuiteVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list( - self, *, input_name: Optional[str] = None, input_type: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.EvaluationTaxonomy"]: - """List evaluation taxonomies. + @overload + def run_evaluation_suite( + self, + name: str, + body: _models.EvaluationSuiteRunRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EvaluationSuiteRunResponse: + """Run an evaluation using the suite's testing criteria and dataset. - :keyword input_name: Filter by the evaluation input name. Default value is None. - :paramtype input_name: str - :keyword input_type: Filter by taxonomy input type. Default value is None. - :paramtype input_type: str - :return: An iterator like instance of EvaluationTaxonomy - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.EvaluationTaxonomy] + :param name: The name of the evaluation suite. Required. + :type name: str + :param body: The run request parameters. Required. + :type body: ~azure.ai.projects.models.EvaluationSuiteRunRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationSuiteRunResponse. The EvaluationSuiteRunResponse is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteRunResponse :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.EvaluationTaxonomy]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_beta_evaluation_taxonomies_list_request( - input_name=input_name, - input_type=input_type, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.EvaluationTaxonomy], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + @overload + def run_evaluation_suite( + self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationSuiteRunResponse: + """Run an evaluation using the suite's testing criteria and dataset. - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + :param name: The name of the evaluation suite. Required. + :type name: str + :param body: The run request parameters. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationSuiteRunResponse. The EvaluationSuiteRunResponse is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteRunResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ - return pipeline_response + @overload + def run_evaluation_suite( + self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationSuiteRunResponse: + """Run an evaluation using the suite's testing criteria and dataset. - return ItemPaged(get_next, extract_data) + :param name: The name of the evaluation suite. Required. + :type name: str + :param body: The run request parameters. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationSuiteRunResponse. The EvaluationSuiteRunResponse is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteRunResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """Delete an evaluation taxonomy by name. + def run_evaluation_suite( + self, name: str, body: Union[_models.EvaluationSuiteRunRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.EvaluationSuiteRunResponse: + """Run an evaluation using the suite's testing criteria and dataset. - :param name: The name of the resource. Required. + :param name: The name of the evaluation suite. Required. :type name: str - :return: None - :rtype: None + :param body: The run request parameters. Is one of the following types: + EvaluationSuiteRunRequest, JSON, IO[bytes] Required. + :type body: ~azure.ai.projects.models.EvaluationSuiteRunRequest or JSON or IO[bytes] + :return: EvaluationSuiteRunResponse. The EvaluationSuiteRunResponse is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteRunResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7114,14 +12273,24 @@ def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsist } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EvaluationSuiteRunResponse] = kwargs.pop("cls", None) - _request = build_beta_evaluation_taxonomies_delete_request( + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_evaluators_run_evaluation_suite_request( name=name, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -7130,87 +12299,138 @@ def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsist } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.EvaluationSuiteRunResponse, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload - def create( - self, name: str, taxonomy: _models.EvaluationTaxonomy, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Create an evaluation taxonomy. + def create_generation_suite_job( + self, + job: _models.EvaluationSuiteGenerationJob, + *, + operation_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EvaluationSuiteGenerationJob: + """Creates an evaluation suite generation job. - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy + Create a new job (preview). Includes optional Foundry-Features header and Operation-Id for + idempotent retries. + + :param job: The job to create. Required. + :type job: ~azure.ai.projects.models.EvaluationSuiteGenerationJob + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :return: EvaluationSuiteGenerationJob. The EvaluationSuiteGenerationJob is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create( - self, name: str, taxonomy: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Create an evaluation taxonomy. + def create_generation_suite_job( + self, job: JSON, *, operation_id: Optional[str] = None, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationSuiteGenerationJob: + """Creates an evaluation suite generation job. - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: JSON + Create a new job (preview). Includes optional Foundry-Features header and Operation-Id for + idempotent retries. + + :param job: The job to create. Required. + :type job: JSON + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :return: EvaluationSuiteGenerationJob. The EvaluationSuiteGenerationJob is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ - @overload - def create( - self, name: str, taxonomy: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Create an evaluation taxonomy. + @overload + def create_generation_suite_job( + self, + job: IO[bytes], + *, + operation_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EvaluationSuiteGenerationJob: + """Creates an evaluation suite generation job. + + Create a new job (preview). Includes optional Foundry-Features header and Operation-Id for + idempotent retries. - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: IO[bytes] + :param job: The job to create. Required. + :type job: IO[bytes] + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :return: EvaluationSuiteGenerationJob. The EvaluationSuiteGenerationJob is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create( - self, name: str, taxonomy: Union[_models.EvaluationTaxonomy, JSON, IO[bytes]], **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Create an evaluation taxonomy. + def create_generation_suite_job( + self, + job: Union[_models.EvaluationSuiteGenerationJob, JSON, IO[bytes]], + *, + operation_id: Optional[str] = None, + **kwargs: Any + ) -> _models.EvaluationSuiteGenerationJob: + """Creates an evaluation suite generation job. - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Is one of the following types: EvaluationTaxonomy, + Create a new job (preview). Includes optional Foundry-Features header and Operation-Id for + idempotent retries. + + :param job: The job to create. Is one of the following types: EvaluationSuiteGenerationJob, JSON, IO[bytes] Required. - :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy or JSON or IO[bytes] - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :type job: ~azure.ai.projects.models.EvaluationSuiteGenerationJob or JSON or IO[bytes] + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :return: EvaluationSuiteGenerationJob. The EvaluationSuiteGenerationJob is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7225,17 +12445,17 @@ def create( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EvaluationTaxonomy] = kwargs.pop("cls", None) + cls: ClsType[_models.EvaluationSuiteGenerationJob] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(taxonomy, (IOBase, bytes)): - _content = taxonomy + if isinstance(job, (IOBase, bytes)): + _content = job else: - _content = json.dumps(taxonomy, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(job, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_evaluation_taxonomies_create_request( - name=name, + _request = build_beta_evaluators_create_generation_suite_job_request( + operation_id=operation_id, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -7255,92 +12475,44 @@ def create( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [201]: if _stream: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluationTaxonomy, response.json()) + deserialized = _deserialize(_models.EvaluationSuiteGenerationJob, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def update( - self, name: str, taxonomy: _models.EvaluationTaxonomy, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Update an evaluation taxonomy. - - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, name: str, taxonomy: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Update an evaluation taxonomy. - - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, name: str, taxonomy: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Update an evaluation taxonomy. - - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def update( - self, name: str, taxonomy: Union[_models.EvaluationTaxonomy, JSON, IO[bytes]], **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Update an evaluation taxonomy. + def get_generation_suite_job(self, job_id: str, **kwargs: Any) -> _models.EvaluationSuiteGenerationJob: + """Get info about an evaluation suite generation job. - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Is one of the following types: EvaluationTaxonomy, - JSON, IO[bytes] Required. - :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy or JSON or IO[bytes] - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + Get a job by ID (preview). Includes optional Foundry-Features header. + + :param job_id: The ID of the job. Required. + :type job_id: str + :return: EvaluationSuiteGenerationJob. The EvaluationSuiteGenerationJob is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7351,24 +12523,14 @@ def update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EvaluationTaxonomy] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(taxonomy, (IOBase, bytes)): - _content = taxonomy - else: - _content = json.dumps(taxonomy, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.EvaluationSuiteGenerationJob] = kwargs.pop("cls", None) - _request = build_beta_evaluation_taxonomies_update_request( - name=name, - content_type=content_type, + _request = build_beta_evaluators_get_generation_suite_job_request( + job_id=job_id, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -7392,128 +12554,98 @@ def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluationTaxonomy, response.json()) + deserialized = _deserialize(_models.EvaluationSuiteGenerationJob, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - -class BetaEvaluatorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`evaluators` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list_versions( + def list_generation_suite_jobs( self, - name: str, *, - type: Optional[Union[Literal["builtin"], Literal["custom"], Literal["all"], str]] = None, limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.EvaluatorVersion"]: - """List all versions of the given evaluator. + ) -> ItemPaged["_models.EvaluationSuiteGenerationJob"]: + """Returns a list of evaluation suite generation jobs. + + List jobs with cursor-based pagination (preview). Includes optional Foundry-Features header. - :param name: The name of the resource. Required. - :type name: str - :keyword type: Filter evaluators by type. Possible values: 'all', 'custom', 'builtin'. Is one - of the following types: Literal["builtin"], Literal["custom"], Literal["all"], str Default - value is None. - :paramtype type: str or str or str or str :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. Default value is None. + 100, and the + default is 20. Default value is None. :paramtype limit: int - :return: An iterator like instance of EvaluatorVersion - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.EvaluatorVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.EvaluatorVersion]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_beta_evaluators_list_versions_request( - name=name, - type=type, - limit=limit, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of EvaluationSuiteGenerationJob + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.EvaluationSuiteGenerationJob] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.EvaluationSuiteGenerationJob]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(_continuation_token=None): + _request = build_beta_evaluators_list_generation_suite_jobs_request( + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) return _request def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.EvaluatorVersion], - deserialized.get("value", []), + List[_models.EvaluationSuiteGenerationJob], + deserialized.get("data", []), ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + return deserialized.get("last_id") or None, iter(list_of_elem) - def get_next(next_link=None): - _request = prepare_request(next_link) + def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access @@ -7523,38 +12655,98 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) return pipeline_response return ItemPaged(get_next, extract_data) @distributed_trace - def list( - self, - *, - type: Optional[Union[Literal["builtin"], Literal["custom"], Literal["all"], str]] = None, - limit: Optional[int] = None, - **kwargs: Any - ) -> ItemPaged["_models.EvaluatorVersion"]: - """List the latest version of each evaluator. + def cancel_generation_suite_job(self, job_id: str, **kwargs: Any) -> _models.EvaluationSuiteGenerationJob: + """Cancels an evaluation suite generation job. - :keyword type: Filter evaluators by type. Possible values: 'all', 'custom', 'builtin'. Is one - of the following types: Literal["builtin"], Literal["custom"], Literal["all"], str Default - value is None. - :paramtype type: str or str or str or str - :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. Default value is None. - :paramtype limit: int - :return: An iterator like instance of EvaluatorVersion - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.EvaluatorVersion] + Cancel a running job (preview). Returns 200 with the updated job. + + :param job_id: The ID of the job to cancel. Required. + :type job_id: str + :return: EvaluationSuiteGenerationJob. The EvaluationSuiteGenerationJob is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationSuiteGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.EvaluatorVersion]] = kwargs.pop("cls", None) + cls: ClsType[_models.EvaluationSuiteGenerationJob] = kwargs.pop("cls", None) + + _request = build_beta_evaluators_cancel_generation_suite_job_request( + job_id=job_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.EvaluationSuiteGenerationJob, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete_generation_suite_job( # pylint: disable=inconsistent-return-statements + self, job_id: str, **kwargs: Any + ) -> None: + """Deletes an evaluation suite generation job. + + Delete a job (preview). Returns 204 No Content. + + :param job_id: The ID of the job to delete. Required. + :type job_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7563,86 +12755,114 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_beta_evaluators_list_request( - type=type, - limit=limit, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[None] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_beta_evaluators_delete_generation_suite_job_request( + job_id=job_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.EvaluatorVersion], - deserialized.get("value", []), + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + raise HttpResponseError(response=response, model=error) - def get_next(next_link=None): - _request = prepare_request(next_link) + if cls: + return cls(pipeline_response, None, {}) # type: ignore - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) +class BetaInsightsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`insights` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def generate( + self, insight: _models.Insight, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.Insight: + """Generate Insights. + + :param insight: Complete evaluation configuration including data source, evaluators, and result + settings. Required. + :type insight: ~azure.ai.projects.models.Insight + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Insight. The Insight is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Insight + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def generate(self, insight: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.Insight: + """Generate Insights. + + :param insight: Complete evaluation configuration including data source, evaluators, and result + settings. Required. + :type insight: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Insight. The Insight is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Insight + :raises ~azure.core.exceptions.HttpResponseError: + """ - return pipeline_response + @overload + def generate(self, insight: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> _models.Insight: + """Generate Insights. - return ItemPaged(get_next, extract_data) + :param insight: Complete evaluation configuration including data source, evaluators, and result + settings. Required. + :type insight: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Insight. The Insight is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Insight + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def get_version(self, name: str, version: str, **kwargs: Any) -> _models.EvaluatorVersion: - """Get the specific version of the EvaluatorVersion. The service returns 404 Not Found error if - the EvaluatorVersion does not exist. + def generate(self, insight: Union[_models.Insight, JSON, IO[bytes]], **kwargs: Any) -> _models.Insight: + """Generate Insights. - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the EvaluatorVersion to retrieve. Required. - :type version: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion + :param insight: Complete evaluation configuration including data source, evaluators, and result + settings. Is one of the following types: Insight, JSON, IO[bytes] Required. + :type insight: ~azure.ai.projects.models.Insight or JSON or IO[bytes] + :return: Insight. The Insight is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Insight :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7653,15 +12873,23 @@ def get_version(self, name: str, version: str, **kwargs: Any) -> _models.Evaluat } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.EvaluatorVersion] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Insight] = kwargs.pop("cls", None) - _request = build_beta_evaluators_get_version_request( - name=name, - version=version, + content_type = content_type or "application/json" + _content = None + if isinstance(insight, (IOBase, bytes)): + _content = insight + else: + _content = json.dumps(insight, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_insights_generate_request( + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -7678,19 +12906,23 @@ def get_version(self, name: str, version: str, **kwargs: Any) -> _models.Evaluat response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [201]: if _stream: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorVersion, response.json()) + deserialized = _deserialize(_models.Insight, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7698,18 +12930,16 @@ def get_version(self, name: str, version: str, **kwargs: Any) -> _models.Evaluat return deserialized # type: ignore @distributed_trace - def delete_version( # pylint: disable=inconsistent-return-statements - self, name: str, version: str, **kwargs: Any - ) -> None: - """Delete the specific version of the EvaluatorVersion. The service returns 204 No Content if the - EvaluatorVersion was deleted successfully or if the EvaluatorVersion does not exist. + def get(self, insight_id: str, *, include_coordinates: Optional[bool] = None, **kwargs: Any) -> _models.Insight: + """Get a specific insight by Id. - :param name: The name of the resource. Required. - :type name: str - :param version: The version of the EvaluatorVersion to delete. Required. - :type version: str - :return: None - :rtype: None + :param insight_id: The unique identifier for the insights report. Required. + :type insight_id: str + :keyword include_coordinates: Whether to include coordinates for visualization in the response. + Defaults to false. Default value is None. + :paramtype include_coordinates: bool + :return: Insight. The Insight is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Insight :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7723,11 +12953,11 @@ def delete_version( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.Insight] = kwargs.pop("cls", None) - _request = build_beta_evaluators_delete_version_request( - name=name, - version=version, + _request = build_beta_insights_get_request( + insight_id=insight_id, + include_coordinates=include_coordinates, api_version=self._config.api_version, headers=_headers, params=_params, @@ -7737,94 +12967,71 @@ def delete_version( # pylint: disable=inconsistent-return-statements } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Insight, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore - @overload - def create_version( + return deserialized # type: ignore + + @distributed_trace + def list( self, - name: str, - evaluator_version: _models.EvaluatorVersion, *, - content_type: str = "application/json", + type: Optional[Union[str, _models.InsightType]] = None, + eval_id: Optional[str] = None, + run_id: Optional[str] = None, + agent_name: Optional[str] = None, + include_coordinates: Optional[bool] = None, **kwargs: Any - ) -> _models.EvaluatorVersion: - """Create a new EvaluatorVersion with auto incremented version id. - - :param name: The name of the resource. Required. - :type name: str - :param evaluator_version: Required. - :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_version( - self, name: str, evaluator_version: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluatorVersion: - """Create a new EvaluatorVersion with auto incremented version id. - - :param name: The name of the resource. Required. - :type name: str - :param evaluator_version: Required. - :type evaluator_version: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_version( - self, name: str, evaluator_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluatorVersion: - """Create a new EvaluatorVersion with auto incremented version id. + ) -> ItemPaged["_models.Insight"]: + """List all insights in reverse chronological order (newest first). - :param name: The name of the resource. Required. - :type name: str - :param evaluator_version: Required. - :type evaluator_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion + :keyword type: Filter by the type of analysis. Known values are: "EvaluationRunClusterInsight", + "AgentClusterInsight", and "EvaluationComparison". Default value is None. + :paramtype type: str or ~azure.ai.projects.models.InsightType + :keyword eval_id: Filter by the evaluation ID. Default value is None. + :paramtype eval_id: str + :keyword run_id: Filter by the evaluation run ID. Default value is None. + :paramtype run_id: str + :keyword agent_name: Filter by the agent name. Default value is None. + :paramtype agent_name: str + :keyword include_coordinates: Whether to include coordinates for visualization in the response. + Defaults to false. Default value is None. + :paramtype include_coordinates: bool + :return: An iterator like instance of Insight + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Insight] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @distributed_trace - def create_version( - self, name: str, evaluator_version: Union[_models.EvaluatorVersion, JSON, IO[bytes]], **kwargs: Any - ) -> _models.EvaluatorVersion: - """Create a new EvaluatorVersion with auto incremented version id. + cls: ClsType[List[_models.Insight]] = kwargs.pop("cls", None) - :param name: The name of the resource. Required. - :type name: str - :param evaluator_version: Is one of the following types: EvaluatorVersion, JSON, IO[bytes] - Required. - :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion or JSON or IO[bytes] - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7833,150 +13040,188 @@ def create_version( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: + + _request = build_beta_insights_list_request( + type=type, + eval_id=eval_id, + run_id=run_id, + agent_name=agent_name, + include_coordinates=include_coordinates, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Insight], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EvaluatorVersion] = kwargs.pop("cls", None) + def get_next(next_link=None): + _request = prepare_request(next_link) - content_type = content_type or "application/json" - _content = None - if isinstance(evaluator_version, (IOBase, bytes)): - _content = evaluator_version - else: - _content = json.dumps(evaluator_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - _request = build_beta_evaluators_create_version_request( - name=name, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return pipeline_response - response = pipeline_response.http_response + return ItemPaged(get_next, extract_data) - if response.status_code not in [201]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.EvaluatorVersion, response.json()) +class BetaMemoryStoresOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`memory_stores` attribute. + """ - return deserialized # type: ignore + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload - def update_version( + def create( self, - name: str, - version: str, - evaluator_version: _models.EvaluatorVersion, *, + name: str, + definition: _models.MemoryStoreDefinition, content_type: str = "application/json", + description: Optional[str] = None, + metadata: Optional[dict[str, str]] = None, **kwargs: Any - ) -> _models.EvaluatorVersion: - """Update an existing EvaluatorVersion with the given version id. + ) -> _models.MemoryStoreDetails: + """Create a memory store. - :param name: The name of the resource. Required. - :type name: str - :param version: The version of the EvaluatorVersion to update. Required. - :type version: str - :param evaluator_version: Evaluator resource. Required. - :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion + :keyword name: The name of the memory store. Required. + :paramtype name: str + :keyword definition: The memory store definition. Required. + :paramtype definition: ~azure.ai.projects.models.MemoryStoreDefinition :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion + :keyword description: A human-readable description of the memory store. Default value is None. + :paramtype description: str + :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default + value is None. + :paramtype metadata: dict[str, str] + :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update_version( - self, name: str, version: str, evaluator_version: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluatorVersion: - """Update an existing EvaluatorVersion with the given version id. + def create( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryStoreDetails: + """Create a memory store. - :param name: The name of the resource. Required. - :type name: str - :param version: The version of the EvaluatorVersion to update. Required. - :type version: str - :param evaluator_version: Evaluator resource. Required. - :type evaluator_version: JSON + :param body: Required. + :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion + :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update_version( - self, - name: str, - version: str, - evaluator_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.EvaluatorVersion: - """Update an existing EvaluatorVersion with the given version id. + def create( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryStoreDetails: + """Create a memory store. - :param name: The name of the resource. Required. - :type name: str - :param version: The version of the EvaluatorVersion to update. Required. - :type version: str - :param evaluator_version: Evaluator resource. Required. - :type evaluator_version: IO[bytes] + :param body: Required. + :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion + :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def update_version( + def create( self, - name: str, - version: str, - evaluator_version: Union[_models.EvaluatorVersion, JSON, IO[bytes]], + body: Union[JSON, IO[bytes]] = _Unset, + *, + name: str = _Unset, + definition: _models.MemoryStoreDefinition = _Unset, + description: Optional[str] = None, + metadata: Optional[dict[str, str]] = None, **kwargs: Any - ) -> _models.EvaluatorVersion: - """Update an existing EvaluatorVersion with the given version id. + ) -> _models.MemoryStoreDetails: + """Create a memory store. - :param name: The name of the resource. Required. - :type name: str - :param version: The version of the EvaluatorVersion to update. Required. - :type version: str - :param evaluator_version: Evaluator resource. Is one of the following types: EvaluatorVersion, - JSON, IO[bytes] Required. - :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion or JSON or IO[bytes] - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword name: The name of the memory store. Required. + :paramtype name: str + :keyword definition: The memory store definition. Required. + :paramtype definition: ~azure.ai.projects.models.MemoryStoreDefinition + :keyword description: A human-readable description of the memory store. Default value is None. + :paramtype description: str + :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default + value is None. + :paramtype metadata: dict[str, str] + :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7991,18 +13236,23 @@ def update_version( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EvaluatorVersion] = kwargs.pop("cls", None) + cls: ClsType[_models.MemoryStoreDetails] = kwargs.pop("cls", None) + if body is _Unset: + if name is _Unset: + raise TypeError("missing required argument: name") + if definition is _Unset: + raise TypeError("missing required argument: definition") + body = {"definition": definition, "description": description, "metadata": metadata, "name": name} + body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None - if isinstance(evaluator_version, (IOBase, bytes)): - _content = evaluator_version + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(evaluator_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_evaluators_update_version_request( - name=name, - version=version, + _request = build_beta_memory_stores_create_request( content_type=content_type, api_version=self._config.api_version, content=_content, @@ -8029,12 +13279,16 @@ def update_version( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorVersion, response.json()) + deserialized = _deserialize(_models.MemoryStoreDetails, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8042,102 +13296,91 @@ def update_version( return deserialized # type: ignore @overload - def create_generation_job( + def update( self, - job: _models.EvaluatorGenerationJob, + name: str, *, - operation_id: Optional[str] = None, content_type: str = "application/json", + description: Optional[str] = None, + metadata: Optional[dict[str, str]] = None, **kwargs: Any - ) -> _models.EvaluatorGenerationJob: - """Creates an evaluator generation job. - - Creates an evaluator generation job. The service generates rubric-based evaluator definitions - from the provided source materials asynchronously. + ) -> _models.MemoryStoreDetails: + """Update a memory store. - :param job: The job to create. Required. - :type job: ~azure.ai.projects.models.EvaluatorGenerationJob - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str + :param name: The name of the memory store to update. Required. + :type name: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob + :keyword description: A human-readable description of the memory store. Default value is None. + :paramtype description: str + :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default + value is None. + :paramtype metadata: dict[str, str] + :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_generation_job( - self, job: JSON, *, operation_id: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluatorGenerationJob: - """Creates an evaluator generation job. - - Creates an evaluator generation job. The service generates rubric-based evaluator definitions - from the provided source materials asynchronously. + def update( + self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryStoreDetails: + """Update a memory store. - :param job: The job to create. Required. - :type job: JSON - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str + :param name: The name of the memory store to update. Required. + :type name: str + :param body: Required. + :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob + :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_generation_job( - self, - job: IO[bytes], - *, - operation_id: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.EvaluatorGenerationJob: - """Creates an evaluator generation job. - - Creates an evaluator generation job. The service generates rubric-based evaluator definitions - from the provided source materials asynchronously. + def update( + self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryStoreDetails: + """Update a memory store. - :param job: The job to create. Required. - :type job: IO[bytes] - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str + :param name: The name of the memory store to update. Required. + :type name: str + :param body: Required. + :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob + :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_generation_job( + def update( self, - job: Union[_models.EvaluatorGenerationJob, JSON, IO[bytes]], + name: str, + body: Union[JSON, IO[bytes]] = _Unset, *, - operation_id: Optional[str] = None, + description: Optional[str] = None, + metadata: Optional[dict[str, str]] = None, **kwargs: Any - ) -> _models.EvaluatorGenerationJob: - """Creates an evaluator generation job. - - Creates an evaluator generation job. The service generates rubric-based evaluator definitions - from the provided source materials asynchronously. + ) -> _models.MemoryStoreDetails: + """Update a memory store. - :param job: The job to create. Is one of the following types: EvaluatorGenerationJob, JSON, - IO[bytes] Required. - :type job: ~azure.ai.projects.models.EvaluatorGenerationJob or JSON or IO[bytes] - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str - :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob + :param name: The name of the memory store to update. Required. + :type name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword description: A human-readable description of the memory store. Default value is None. + :paramtype description: str + :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default + value is None. + :paramtype metadata: dict[str, str] + :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8152,17 +13395,20 @@ def create_generation_job( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EvaluatorGenerationJob] = kwargs.pop("cls", None) + cls: ClsType[_models.MemoryStoreDetails] = kwargs.pop("cls", None) + if body is _Unset: + body = {"description": description, "metadata": metadata} + body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None - if isinstance(job, (IOBase, bytes)): - _content = job + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(job, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_evaluators_create_generation_job_request( - operation_id=operation_id, + _request = build_beta_memory_stores_update_request( + name=name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -8182,7 +13428,7 @@ def create_generation_job( response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -8195,30 +13441,24 @@ def create_generation_job( ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorGenerationJob, response.json()) + deserialized = _deserialize(_models.MemoryStoreDetails, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace - def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.EvaluatorGenerationJob: - """Get info about an evaluator generation job. - - Gets the details of an evaluator generation job by its ID. + def get(self, name: str, **kwargs: Any) -> _models.MemoryStoreDetails: + """Retrieve a memory store. - :param job_id: The ID of the job. Required. - :type job_id: str - :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob + :param name: The name of the memory store to retrieve. Required. + :type name: str + :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8232,10 +13472,10 @@ def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.EvaluatorGen _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.EvaluatorGenerationJob] = kwargs.pop("cls", None) + cls: ClsType[_models.MemoryStoreDetails] = kwargs.pop("cls", None) - _request = build_beta_evaluators_get_generation_job_request( - job_id=job_id, + _request = build_beta_memory_stores_get_request( + name=name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -8266,32 +13506,26 @@ def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.EvaluatorGen ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorGenerationJob, response.json()) + deserialized = _deserialize(_models.MemoryStoreDetails, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace - def list_generation_jobs( + def list( self, *, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, - category: Optional[Union[str, _models.EvaluatorCategory]] = None, **kwargs: Any - ) -> ItemPaged["_models.EvaluatorGenerationJob"]: - """Returns a list of evaluator generation jobs. - - Returns a list of evaluator generation jobs. + ) -> ItemPaged["_models.MemoryStoreDetails"]: + """List all memory stores. :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the @@ -8307,17 +13541,14 @@ def list_generation_jobs( subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None. :paramtype before: str - :keyword category: Filter evaluator generation jobs by category. Known values are: "quality", - "safety", and "agents". Default value is None. - :paramtype category: str or ~azure.ai.projects.models.EvaluatorCategory - :return: An iterator like instance of EvaluatorGenerationJob - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.EvaluatorGenerationJob] + :return: An iterator like instance of MemoryStoreDetails + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.MemoryStoreDetails] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.EvaluatorGenerationJob]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.MemoryStoreDetails]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8329,12 +13560,11 @@ def list_generation_jobs( def prepare_request(_continuation_token=None): - _request = build_beta_evaluators_list_generation_jobs_request( + _request = build_beta_memory_stores_list_request( limit=limit, order=order, after=_continuation_token, before=before, - category=category, api_version=self._config.api_version, headers=_headers, params=_params, @@ -8348,7 +13578,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.EvaluatorGenerationJob], + List[_models.MemoryStoreDetails], deserialized.get("data", []), ) if cls: @@ -8377,15 +13607,121 @@ def get_next(_continuation_token=None): return ItemPaged(get_next, extract_data) @distributed_trace - def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.EvaluatorGenerationJob: - """Cancels an evaluator generation job. + def delete(self, name: str, **kwargs: Any) -> _models.DeleteMemoryStoreResult: + """Delete a memory store. - Cancels an evaluator generation job by its ID. + :param name: The name of the memory store to delete. Required. + :type name: str + :return: DeleteMemoryStoreResult. The DeleteMemoryStoreResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DeleteMemoryStoreResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - :param job_id: The ID of the job to cancel. Required. - :type job_id: str - :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DeleteMemoryStoreResult] = kwargs.pop("cls", None) + + _request = build_beta_memory_stores_delete_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DeleteMemoryStoreResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def _search_memories( + self, + name: str, + *, + scope: str, + content_type: str = "application/json", + items: Optional[List[dict[str, Any]]] = None, + previous_search_id: Optional[str] = None, + options: Optional[_models.MemorySearchOptions] = None, + **kwargs: Any + ) -> _models.MemoryStoreSearchResult: ... + @overload + def _search_memories( + self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryStoreSearchResult: ... + @overload + def _search_memories( + self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryStoreSearchResult: ... + + @distributed_trace + def _search_memories( + self, + name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + scope: str = _Unset, + items: Optional[List[dict[str, Any]]] = None, + previous_search_id: Optional[str] = None, + options: Optional[_models.MemorySearchOptions] = None, + **kwargs: Any + ) -> _models.MemoryStoreSearchResult: + """Search for relevant memories from a memory store based on conversation context. + + :param name: The name of the memory store to search. Required. + :type name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. + Required. + :paramtype scope: str + :keyword items: Items for which to search for relevant memories. Default value is None. + :paramtype items: list[dict[str, any]] + :keyword previous_search_id: The unique ID of the previous search request, enabling incremental + memory search from where the last operation left off. Default value is None. + :paramtype previous_search_id: str + :keyword options: Memory search options. Default value is None. + :paramtype options: ~azure.ai.projects.models.MemorySearchOptions + :return: MemoryStoreSearchResult. The MemoryStoreSearchResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreSearchResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8396,14 +13732,34 @@ def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.Evaluator } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.EvaluatorGenerationJob] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MemoryStoreSearchResult] = kwargs.pop("cls", None) - _request = build_beta_evaluators_cancel_generation_job_request( - job_id=job_id, + if body is _Unset: + if scope is _Unset: + raise TypeError("missing required argument: scope") + body = { + "items": items, + "options": options, + "previous_search_id": previous_search_id, + "scope": scope, + } + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_memory_stores_search_memories_request( + name=name, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -8436,26 +13792,24 @@ def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.Evaluator if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorGenerationJob, response.json()) + deserialized = _deserialize(_models.MemoryStoreSearchResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def delete_generation_job( # pylint: disable=inconsistent-return-statements - self, job_id: str, **kwargs: Any - ) -> None: - """Deletes an evaluator generation job by its ID. Deletes the job record only; the generated - evaluator (if any) is preserved. - - :param job_id: The ID of the job to delete. Required. - :type job_id: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _update_memories_initial( + self, + name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + scope: str = _Unset, + items: Optional[List[dict[str, Any]]] = None, + previous_update_id: Optional[str] = None, + update_delay: Optional[int] = None, + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8464,14 +13818,34 @@ def delete_generation_job( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_beta_evaluators_delete_generation_job_request( - job_id=job_id, + if body is _Unset: + if scope is _Unset: + raise TypeError("missing required argument: scope") + body = { + "items": items, + "previous_update_id": previous_update_id, + "scope": scope, + "update_delay": update_delay, + } + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_memory_stores_update_memories_request( + name=name, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -8480,14 +13854,19 @@ def delete_generation_job( # pylint: disable=inconsistent-return-statements } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -8495,83 +13874,209 @@ def delete_generation_job( # pylint: disable=inconsistent-return-statements ) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized # type: ignore -class BetaInsightsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + @overload + def _begin_update_memories( + self, + name: str, + *, + scope: str, + content_type: str = "application/json", + items: Optional[List[dict[str, Any]]] = None, + previous_update_id: Optional[str] = None, + update_delay: Optional[int] = None, + **kwargs: Any + ) -> LROPoller[_models.MemoryStoreUpdateCompletedResult]: ... + @overload + def _begin_update_memories( + self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.MemoryStoreUpdateCompletedResult]: ... + @overload + def _begin_update_memories( + self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.MemoryStoreUpdateCompletedResult]: ... - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`insights` attribute. - """ + @distributed_trace + def _begin_update_memories( + self, + name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + scope: str = _Unset, + items: Optional[List[dict[str, Any]]] = None, + previous_update_id: Optional[str] = None, + update_delay: Optional[int] = None, + **kwargs: Any + ) -> LROPoller[_models.MemoryStoreUpdateCompletedResult]: + """Update memory store with conversation memories. - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + :param name: The name of the memory store to update. Required. + :type name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. + Required. + :paramtype scope: str + :keyword items: Conversation items to be stored in memory. Default value is None. + :paramtype items: list[dict[str, any]] + :keyword previous_update_id: The unique ID of the previous update request, enabling incremental + memory updates from where the last operation left off. Default value is None. + :paramtype previous_update_id: str + :keyword update_delay: Timeout period before processing the memory update in seconds. + If a new update request is received during this period, it will cancel the current request and + reset the timeout. + Set to 0 to immediately trigger the update without delay. + Defaults to 300 (5 minutes). Default value is None. + :paramtype update_delay: int + :return: An instance of LROPoller that returns MemoryStoreUpdateCompletedResult. The + MemoryStoreUpdateCompletedResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.ai.projects.models.MemoryStoreUpdateCompletedResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MemoryStoreUpdateCompletedResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_memories_initial( + name=name, + body=body, + scope=scope, + items=items, + previous_update_id=previous_update_id, + update_delay=update_delay, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + + deserialized = _deserialize(_models.MemoryStoreUpdateCompletedResult, response.json().get("result", {})) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.MemoryStoreUpdateCompletedResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MemoryStoreUpdateCompletedResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload - def generate( - self, insight: _models.Insight, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Insight: - """Generate Insights. + def delete_scope( + self, name: str, *, scope: str, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryStoreDeleteScopeResult: + """Delete all memories associated with a specific scope from a memory store. - :param insight: Complete evaluation configuration including data source, evaluators, and result - settings. Required. - :type insight: ~azure.ai.projects.models.Insight + :param name: The name of the memory store. Required. + :type name: str + :keyword scope: The namespace that logically groups and isolates memories to delete, such as a + user ID. Required. + :paramtype scope: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Insight. The Insight is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Insight + :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def generate(self, insight: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.Insight: - """Generate Insights. + def delete_scope( + self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryStoreDeleteScopeResult: + """Delete all memories associated with a specific scope from a memory store. - :param insight: Complete evaluation configuration including data source, evaluators, and result - settings. Required. - :type insight: JSON + :param name: The name of the memory store. Required. + :type name: str + :param body: Required. + :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Insight. The Insight is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Insight + :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def generate(self, insight: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> _models.Insight: - """Generate Insights. + def delete_scope( + self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryStoreDeleteScopeResult: + """Delete all memories associated with a specific scope from a memory store. - :param insight: Complete evaluation configuration including data source, evaluators, and result - settings. Required. - :type insight: IO[bytes] + :param name: The name of the memory store. Required. + :type name: str + :param body: Required. + :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: Insight. The Insight is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Insight + :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def generate(self, insight: Union[_models.Insight, JSON, IO[bytes]], **kwargs: Any) -> _models.Insight: - """Generate Insights. + def delete_scope( + self, name: str, body: Union[JSON, IO[bytes]] = _Unset, *, scope: str = _Unset, **kwargs: Any + ) -> _models.MemoryStoreDeleteScopeResult: + """Delete all memories associated with a specific scope from a memory store. - :param insight: Complete evaluation configuration including data source, evaluators, and result - settings. Is one of the following types: Insight, JSON, IO[bytes] Required. - :type insight: ~azure.ai.projects.models.Insight or JSON or IO[bytes] - :return: Insight. The Insight is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Insight + :param name: The name of the memory store. Required. + :type name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword scope: The namespace that logically groups and isolates memories to delete, such as a + user ID. Required. + :paramtype scope: str + :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8586,16 +14091,22 @@ def generate(self, insight: Union[_models.Insight, JSON, IO[bytes]], **kwargs: A _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Insight] = kwargs.pop("cls", None) + cls: ClsType[_models.MemoryStoreDeleteScopeResult] = kwargs.pop("cls", None) + if body is _Unset: + if scope is _Unset: + raise TypeError("missing required argument: scope") + body = {"scope": scope} + body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None - if isinstance(insight, (IOBase, bytes)): - _content = insight + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(insight, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_insights_generate_request( + _request = build_beta_memory_stores_delete_scope_request( + name=name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -8615,75 +14126,6 @@ def generate(self, insight: Union[_models.Insight, JSON, IO[bytes]], **kwargs: A response = pipeline_response.http_response - if response.status_code not in [201]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Insight, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get(self, insight_id: str, *, include_coordinates: Optional[bool] = None, **kwargs: Any) -> _models.Insight: - """Get a specific insight by Id. - - :param insight_id: The unique identifier for the insights report. Required. - :type insight_id: str - :keyword include_coordinates: Whether to include coordinates for visualization in the response. - Defaults to false. Default value is None. - :paramtype include_coordinates: bool - :return: Insight. The Insight is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Insight - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Insight] = kwargs.pop("cls", None) - - _request = build_beta_insights_get_request( - insight_id=insight_id, - include_coordinates=include_coordinates, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - if response.status_code not in [200]: if _stream: try: @@ -8700,237 +14142,259 @@ def get(self, insight_id: str, *, include_coordinates: Optional[bool] = None, ** if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Insight, response.json()) + deserialized = _deserialize(_models.MemoryStoreDeleteScopeResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list( + @overload + def create_memory( self, + name: str, *, - type: Optional[Union[str, _models.InsightType]] = None, - eval_id: Optional[str] = None, - run_id: Optional[str] = None, - agent_name: Optional[str] = None, - include_coordinates: Optional[bool] = None, + scope: str, + content: str, + kind: Union[str, _models.MemoryItemKind], + content_type: str = "application/json", **kwargs: Any - ) -> ItemPaged["_models.Insight"]: - """List all insights in reverse chronological order (newest first). + ) -> _models.MemoryItem: + """Create a memory item in a memory store. - :keyword type: Filter by the type of analysis. Known values are: "EvaluationRunClusterInsight", - "AgentClusterInsight", and "EvaluationComparison". Default value is None. - :paramtype type: str or ~azure.ai.projects.models.InsightType - :keyword eval_id: Filter by the evaluation ID. Default value is None. - :paramtype eval_id: str - :keyword run_id: Filter by the evaluation run ID. Default value is None. - :paramtype run_id: str - :keyword agent_name: Filter by the agent name. Default value is None. - :paramtype agent_name: str - :keyword include_coordinates: Whether to include coordinates for visualization in the response. - Defaults to false. Default value is None. - :paramtype include_coordinates: bool - :return: An iterator like instance of Insight - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Insight] + :param name: The name of the memory store. Required. + :type name: str + :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. + Required. + :paramtype scope: str + :keyword content: The content of the memory. Required. + :paramtype content: str + :keyword kind: The kind of the memory item. Known values are: "user_profile", "chat_summary", + and "procedural". Required. + :paramtype kind: str or ~azure.ai.projects.models.MemoryItemKind + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MemoryItem. The MemoryItem is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Insight]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_beta_insights_list_request( - type=type, - eval_id=eval_id, - run_id=run_id, - agent_name=agent_name, - include_coordinates=include_coordinates, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + @overload + def create_memory( + self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryItem: + """Create a memory item in a memory store. - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + :param name: The name of the memory store. Required. + :type name: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MemoryItem. The MemoryItem is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryItem + :raises ~azure.core.exceptions.HttpResponseError: + """ - return _request + @overload + def create_memory( + self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryItem: + """Create a memory item in a memory store. - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Insight], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + :param name: The name of the memory store. Required. + :type name: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: MemoryItem. The MemoryItem is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryItem + :raises ~azure.core.exceptions.HttpResponseError: + """ - def get_next(next_link=None): - _request = prepare_request(next_link) + @distributed_trace + def create_memory( + self, + name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + scope: str = _Unset, + content: str = _Unset, + kind: Union[str, _models.MemoryItemKind] = _Unset, + **kwargs: Any + ) -> _models.MemoryItem: + """Create a memory item in a memory store. - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + :param name: The name of the memory store. Required. + :type name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. + Required. + :paramtype scope: str + :keyword content: The content of the memory. Required. + :paramtype content: str + :keyword kind: The kind of the memory item. Known values are: "user_profile", "chat_summary", + and "procedural". Required. + :paramtype kind: str or ~azure.ai.projects.models.MemoryItemKind + :return: MemoryItem. The MemoryItem is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryItem + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - return pipeline_response + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MemoryItem] = kwargs.pop("cls", None) - return ItemPaged(get_next, extract_data) + if body is _Unset: + if scope is _Unset: + raise TypeError("missing required argument: scope") + if content is _Unset: + raise TypeError("missing required argument: content") + if kind is _Unset: + raise TypeError("missing required argument: kind") + body = {"content": content, "kind": kind, "scope": scope} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _request = build_beta_memory_stores_create_memory_request( + name=name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) -class BetaMemoryStoresOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`memory_stores` attribute. - """ + response = pipeline_response.http_response - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.MemoryItem, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload - def create( - self, - *, - name: str, - definition: _models.MemoryStoreDefinition, - content_type: str = "application/json", - description: Optional[str] = None, - metadata: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> _models.MemoryStoreDetails: - """Create a memory store. + def update_memory( + self, name: str, memory_id: str, *, content: str, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryItem: + """Update a memory item in a memory store. - :keyword name: The name of the memory store. Required. - :paramtype name: str - :keyword definition: The memory store definition. Required. - :paramtype definition: ~azure.ai.projects.models.MemoryStoreDefinition + :param name: The name of the memory store. Required. + :type name: str + :param memory_id: The ID of the memory item to update. Required. + :type memory_id: str + :keyword content: The updated content of the memory. Required. + :paramtype content: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword description: A human-readable description of the memory store. Default value is None. - :paramtype description: str - :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default - value is None. - :paramtype metadata: dict[str, str] - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :return: MemoryItem. The MemoryItem is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDetails: - """Create a memory store. + def update_memory( + self, name: str, memory_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryItem: + """Update a memory item in a memory store. + :param name: The name of the memory store. Required. + :type name: str + :param memory_id: The ID of the memory item to update. Required. + :type memory_id: str :param body: Required. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :return: MemoryItem. The MemoryItem is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDetails: - """Create a memory store. + def update_memory( + self, name: str, memory_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.MemoryItem: + """Update a memory item in a memory store. + :param name: The name of the memory store. Required. + :type name: str + :param memory_id: The ID of the memory item to update. Required. + :type memory_id: str :param body: Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :return: MemoryItem. The MemoryItem is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create( - self, - body: Union[JSON, IO[bytes]] = _Unset, - *, - name: str = _Unset, - definition: _models.MemoryStoreDefinition = _Unset, - description: Optional[str] = None, - metadata: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> _models.MemoryStoreDetails: - """Create a memory store. + def update_memory( + self, name: str, memory_id: str, body: Union[JSON, IO[bytes]] = _Unset, *, content: str = _Unset, **kwargs: Any + ) -> _models.MemoryItem: + """Update a memory item in a memory store. + :param name: The name of the memory store. Required. + :type name: str + :param memory_id: The ID of the memory item to update. Required. + :type memory_id: str :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword name: The name of the memory store. Required. - :paramtype name: str - :keyword definition: The memory store definition. Required. - :paramtype definition: ~azure.ai.projects.models.MemoryStoreDefinition - :keyword description: A human-readable description of the memory store. Default value is None. - :paramtype description: str - :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default - value is None. - :paramtype metadata: dict[str, str] - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :keyword content: The updated content of the memory. Required. + :paramtype content: str + :return: MemoryItem. The MemoryItem is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8945,14 +14409,12 @@ def create( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryStoreDetails] = kwargs.pop("cls", None) + cls: ClsType[_models.MemoryItem] = kwargs.pop("cls", None) if body is _Unset: - if name is _Unset: - raise TypeError("missing required argument: name") - if definition is _Unset: - raise TypeError("missing required argument: definition") - body = {"definition": definition, "description": description, "metadata": metadata, "name": name} + if content is _Unset: + raise TypeError("missing required argument: content") + body = {"content": content} body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None @@ -8961,10 +14423,80 @@ def create( else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_memory_stores_create_request( + _request = build_beta_memory_stores_update_memory_request( + name=name, + memory_id=memory_id, content_type=content_type, api_version=self._config.api_version, - content=_content, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.MemoryItem, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models.MemoryItem: + """Retrieve a memory item from a memory store. + + :param name: The name of the memory store. Required. + :type name: str + :param memory_id: The ID of the memory item to retrieve. Required. + :type memory_id: str + :return: MemoryItem. The MemoryItem is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.MemoryItem + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.MemoryItem] = kwargs.pop("cls", None) + + _request = build_beta_memory_stores_get_memory_request( + name=name, + memory_id=memory_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) @@ -8997,99 +14529,117 @@ def create( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryStoreDetails, response.json()) + deserialized = _deserialize(_models.MemoryItem, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def update( + @distributed_trace + def list_memories( self, name: str, *, - content_type: str = "application/json", - description: Optional[str] = None, - metadata: Optional[dict[str, str]] = None, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, **kwargs: Any - ) -> _models.MemoryStoreDetails: - """Update a memory store. + ) -> ItemPaged["_models.MemoryItem"]: + """List all memory items in a memory store. - :param name: The name of the memory store to update. Required. + :param name: The name of the memory store. Required. :type name: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword description: A human-readable description of the memory store. Default value is None. - :paramtype description: str - :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default - value is None. - :paramtype metadata: dict[str, str] - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of MemoryItem + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.MemoryItem] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - def update( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDetails: - """Update a memory store. + cls: ClsType[List[_models.MemoryItem]] = kwargs.pop("cls", None) - :param name: The name of the memory store to update. Required. - :type name: str - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @overload - def update( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDetails: - """Update a memory store. + def prepare_request(_continuation_token=None): - :param name: The name of the memory store to update. Required. - :type name: str - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ + _request = build_beta_memory_stores_list_memories_request( + name=name, + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.MemoryItem], + deserialized.get("data", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, iter(list_of_elem) + + def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged(get_next, extract_data) @distributed_trace - def update( - self, - name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - description: Optional[str] = None, - metadata: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> _models.MemoryStoreDetails: - """Update a memory store. + def delete_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models.DeleteMemoryResponse: + """Delete a memory item from a memory store. - :param name: The name of the memory store to update. Required. + :param name: The name of the memory store. Required. :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword description: A human-readable description of the memory store. Default value is None. - :paramtype description: str - :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default - value is None. - :paramtype metadata: dict[str, str] - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :param memory_id: The ID of the memory item to delete. Required. + :type memory_id: str + :return: DeleteMemoryResponse. The DeleteMemoryResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DeleteMemoryResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -9100,27 +14650,15 @@ def update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryStoreDetails] = kwargs.pop("cls", None) - - if body is _Unset: - body = {"description": description, "metadata": metadata} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.DeleteMemoryResponse] = kwargs.pop("cls", None) - _request = build_beta_memory_stores_update_request( + _request = build_beta_memory_stores_delete_memory_request( name=name, - content_type=content_type, + memory_id=memory_id, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -9153,23 +14691,46 @@ def update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryStoreDetails, response.json()) + deserialized = _deserialize(_models.DeleteMemoryResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + +class BetaModelsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`models` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace - def get(self, name: str, **kwargs: Any) -> _models.MemoryStoreDetails: - """Retrieve a memory store. + def list_versions(self, name: str, **kwargs: Any) -> ItemPaged["_models.ModelVersion"]: + """List all versions of the given ModelVersion. - :param name: The name of the memory store to retrieve. Required. + :param name: The name of the resource. Required. :type name: str - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :return: An iterator like instance of ModelVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.ModelVersion] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ModelVersion]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9178,86 +14739,86 @@ def get(self, name: str, **kwargs: Any) -> _models.MemoryStoreDetails: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[_models.MemoryStoreDetails] = kwargs.pop("cls", None) + _request = build_beta_models_list_versions_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_beta_memory_stores_get_request( - name=name, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ModelVersion], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - raise HttpResponseError(response=response, model=error) + response = pipeline_response.http_response - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.MemoryStoreDetails, response.json()) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) @distributed_trace - def list( - self, - *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.MemoryStoreDetails"]: - """List all memory stores. + def list(self, **kwargs: Any) -> ItemPaged["_models.ModelVersion"]: + """List the latest version of each ModelVersion. - :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the - default is 20. Default value is None. - :paramtype limit: int - :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for - ascending order and``desc`` - for descending order. Known values are: "asc" and "desc". Default value is None. - :paramtype order: str or ~azure.ai.projects.models.PageOrder - :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your - place in the list. - For instance, if you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page of the list. - Default value is None. - :paramtype before: str - :return: An iterator like instance of MemoryStoreDetails - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.MemoryStoreDetails] + :return: An iterator like instance of ModelVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.ModelVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.MemoryStoreDetails]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ModelVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9267,35 +14828,58 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(_continuation_token=None): + def prepare_request(next_link=None): + if not next_link: + + _request = build_beta_models_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_beta_memory_stores_list_request( - limit=limit, - order=order, - after=_continuation_token, - before=before, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) return _request def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.MemoryStoreDetails], - deserialized.get("data", []), + List[_models.ModelVersion], + deserialized.get("value", []), ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("last_id") or None, iter(list_of_elem) + return deserialized.get("nextLink") or None, iter(list_of_elem) - def get_next(_continuation_token=None): - _request = prepare_request(_continuation_token) + def get_next(next_link=None): + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access @@ -9305,24 +14889,23 @@ def get_next(_continuation_token=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) return pipeline_response return ItemPaged(get_next, extract_data) @distributed_trace - def delete(self, name: str, **kwargs: Any) -> _models.DeleteMemoryStoreResult: - """Delete a memory store. + def get(self, name: str, version: str, **kwargs: Any) -> _models.ModelVersion: + """Get the specific version of the ModelVersion. The service returns 404 Not Found error if the + ModelVersion does not exist. - :param name: The name of the memory store to delete. Required. + :param name: The name of the resource. Required. :type name: str - :return: DeleteMemoryStoreResult. The DeleteMemoryStoreResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DeleteMemoryStoreResult + :param version: The specific version id of the ModelVersion to retrieve. Required. + :type version: str + :return: ModelVersion. The ModelVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ModelVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -9336,10 +14919,11 @@ def delete(self, name: str, **kwargs: Any) -> _models.DeleteMemoryStoreResult: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DeleteMemoryStoreResult] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelVersion] = kwargs.pop("cls", None) - _request = build_beta_memory_stores_delete_request( + _request = build_beta_models_get_request( name=name, + version=version, api_version=self._config.api_version, headers=_headers, params=_params, @@ -9364,73 +14948,161 @@ def delete(self, name: str, **kwargs: Any) -> _models.DeleteMemoryStoreResult: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DeleteMemoryStoreResult, response.json()) + deserialized = _deserialize(_models.ModelVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + @distributed_trace + def delete(self, name: str, version: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Delete the specific version of the ModelVersion. The service returns 200 OK if the ModelVersion + was deleted successfully or if the ModelVersion does not exist. + + :param name: The name of the resource. Required. + :type name: str + :param version: The version of the ModelVersion to delete. Required. + :type version: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_beta_models_delete_request( + name=name, + version=version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + @overload - def _search_memories( + def update( self, name: str, + version: str, + body: _models.UpdateModelVersionRequest, *, - scope: str, - content_type: str = "application/json", - items: Optional[List[dict[str, Any]]] = None, - previous_search_id: Optional[str] = None, - options: Optional[_models.MemorySearchOptions] = None, + content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.MemoryStoreSearchResult: ... - @overload - def _search_memories( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreSearchResult: ... + ) -> _models.ModelVersion: + """Update an existing ModelVersion with the given version id. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the UpdateModelVersionRequest to create or update. + Required. + :type version: str + :param body: The UpdateModelVersionRequest to create or update. Required. + :type body: ~azure.ai.projects.models.UpdateModelVersionRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: ModelVersion. The ModelVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ModelVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload - def _search_memories( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreSearchResult: ... + def update( + self, name: str, version: str, body: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any + ) -> _models.ModelVersion: + """Update an existing ModelVersion with the given version id. - @distributed_trace - def _search_memories( + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the UpdateModelVersionRequest to create or update. + Required. + :type version: str + :param body: The UpdateModelVersionRequest to create or update. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: ModelVersion. The ModelVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ModelVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + version: str, + body: IO[bytes], *, - scope: str = _Unset, - items: Optional[List[dict[str, Any]]] = None, - previous_search_id: Optional[str] = None, - options: Optional[_models.MemorySearchOptions] = None, + content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.MemoryStoreSearchResult: - """Search for relevant memories from a memory store based on conversation context. + ) -> _models.ModelVersion: + """Update an existing ModelVersion with the given version id. - :param name: The name of the memory store to search. Required. + :param name: The name of the resource. Required. :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. + :param version: The specific version id of the UpdateModelVersionRequest to create or update. Required. - :paramtype scope: str - :keyword items: Items for which to search for relevant memories. Default value is None. - :paramtype items: list[dict[str, any]] - :keyword previous_search_id: The unique ID of the previous search request, enabling incremental - memory search from where the last operation left off. Default value is None. - :paramtype previous_search_id: str - :keyword options: Memory search options. Default value is None. - :paramtype options: ~azure.ai.projects.models.MemorySearchOptions - :return: MemoryStoreSearchResult. The MemoryStoreSearchResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreSearchResult + :type version: str + :param body: The UpdateModelVersionRequest to create or update. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: ModelVersion. The ModelVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ModelVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, name: str, version: str, body: Union[_models.UpdateModelVersionRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.ModelVersion: + """Update an existing ModelVersion with the given version id. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the UpdateModelVersionRequest to create or update. + Required. + :type version: str + :param body: The UpdateModelVersionRequest to create or update. Is one of the following types: + UpdateModelVersionRequest, JSON, IO[bytes] Required. + :type body: ~azure.ai.projects.models.UpdateModelVersionRequest or JSON or IO[bytes] + :return: ModelVersion. The ModelVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ModelVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -9445,27 +15117,18 @@ def _search_memories( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryStoreSearchResult] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelVersion] = kwargs.pop("cls", None) - if body is _Unset: - if scope is _Unset: - raise TypeError("missing required argument: scope") - body = { - "items": items, - "options": options, - "previous_search_id": previous_search_id, - "scope": scope, - } - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" + content_type = content_type or "application/merge-patch+json" _content = None if isinstance(body, (IOBase, bytes)): _content = body else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_memory_stores_search_memories_request( + _request = build_beta_models_update_request( name=name, + version=version, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -9485,40 +15148,112 @@ def _search_memories( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: if _stream: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryStoreSearchResult, response.json()) + deserialized = _deserialize(_models.ModelVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _update_memories_initial( + @overload + def create_async( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + version: str, + body: _models.ModelVersion, *, - scope: str = _Unset, - items: Optional[List[dict[str, Any]]] = None, - previous_update_id: Optional[str] = None, - update_delay: Optional[int] = None, + content_type: str = "application/json", **kwargs: Any - ) -> Iterator[bytes]: + ) -> _models.CreateAsyncResponse: + """Creates a model version asynchronously with blob content validation. Returns 202 Accepted with + a Location header for polling. + + :param name: Name of the model. Required. + :type name: str + :param version: Version of the model. Required. + :type version: str + :param body: Model version to create. Required. + :type body: ~azure.ai.projects.models.ModelVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CreateAsyncResponse. The CreateAsyncResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.CreateAsyncResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_async( + self, name: str, version: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CreateAsyncResponse: + """Creates a model version asynchronously with blob content validation. Returns 202 Accepted with + a Location header for polling. + + :param name: Name of the model. Required. + :type name: str + :param version: Version of the model. Required. + :type version: str + :param body: Model version to create. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CreateAsyncResponse. The CreateAsyncResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.CreateAsyncResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_async( + self, name: str, version: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CreateAsyncResponse: + """Creates a model version asynchronously with blob content validation. Returns 202 Accepted with + a Location header for polling. + + :param name: Name of the model. Required. + :type name: str + :param version: Version of the model. Required. + :type version: str + :param body: Model version to create. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CreateAsyncResponse. The CreateAsyncResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.CreateAsyncResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_async( + self, name: str, version: str, body: Union[_models.ModelVersion, JSON, IO[bytes]], **kwargs: Any + ) -> _models.CreateAsyncResponse: + """Creates a model version asynchronously with blob content validation. Returns 202 Accepted with + a Location header for polling. + + :param name: Name of the model. Required. + :type name: str + :param version: Version of the model. Required. + :type version: str + :param body: Model version to create. Is one of the following types: ModelVersion, JSON, + IO[bytes] Required. + :type body: ~azure.ai.projects.models.ModelVersion or JSON or IO[bytes] + :return: CreateAsyncResponse. The CreateAsyncResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.CreateAsyncResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9531,18 +15266,8 @@ def _update_memories_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.CreateAsyncResponse] = kwargs.pop("cls", None) - if body is _Unset: - if scope is _Unset: - raise TypeError("missing required argument: scope") - body = { - "items": items, - "previous_update_id": previous_update_id, - "scope": scope, - "update_delay": update_delay, - } - body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None if isinstance(body, (IOBase, bytes)): @@ -9550,8 +15275,9 @@ def _update_memories_initial( else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_memory_stores_update_memories_request( + _request = build_beta_models_create_async_request( name=name, + version=version, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -9564,7 +15290,7 @@ def _update_memories_initial( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -9572,21 +15298,21 @@ def _update_memories_initial( response = pipeline_response.http_response if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) response_headers = {} - response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CreateAsyncResponse, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -9594,198 +15320,234 @@ def _update_memories_initial( return deserialized # type: ignore @overload - def _begin_update_memories( + def pending_upload( self, name: str, + version: str, + body: _models.ModelPendingUploadRequest, *, - scope: str, content_type: str = "application/json", - items: Optional[List[dict[str, Any]]] = None, - previous_update_id: Optional[str] = None, - update_delay: Optional[int] = None, **kwargs: Any - ) -> LROPoller[_models.MemoryStoreUpdateCompletedResult]: ... + ) -> _models.ModelPendingUploadResponse: + """Start or retrieve a pending upload for a model version. + + :param name: Name of the model. Required. + :type name: str + :param version: Version of the model. Required. + :type version: str + :param body: Required. + :type body: ~azure.ai.projects.models.ModelPendingUploadRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ModelPendingUploadResponse. The ModelPendingUploadResponse is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.ModelPendingUploadResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload - def _begin_update_memories( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MemoryStoreUpdateCompletedResult]: ... + def pending_upload( + self, name: str, version: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ModelPendingUploadResponse: + """Start or retrieve a pending upload for a model version. + + :param name: Name of the model. Required. + :type name: str + :param version: Version of the model. Required. + :type version: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ModelPendingUploadResponse. The ModelPendingUploadResponse is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.ModelPendingUploadResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload - def _begin_update_memories( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MemoryStoreUpdateCompletedResult]: ... + def pending_upload( + self, name: str, version: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ModelPendingUploadResponse: + """Start or retrieve a pending upload for a model version. + + :param name: Name of the model. Required. + :type name: str + :param version: Version of the model. Required. + :type version: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ModelPendingUploadResponse. The ModelPendingUploadResponse is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.ModelPendingUploadResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def _begin_update_memories( - self, - name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - scope: str = _Unset, - items: Optional[List[dict[str, Any]]] = None, - previous_update_id: Optional[str] = None, - update_delay: Optional[int] = None, - **kwargs: Any - ) -> LROPoller[_models.MemoryStoreUpdateCompletedResult]: - """Update memory store with conversation memories. + def pending_upload( + self, name: str, version: str, body: Union[_models.ModelPendingUploadRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.ModelPendingUploadResponse: + """Start or retrieve a pending upload for a model version. - :param name: The name of the memory store to update. Required. + :param name: Name of the model. Required. :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. + :param version: Version of the model. Required. + :type version: str + :param body: Is one of the following types: ModelPendingUploadRequest, JSON, IO[bytes] Required. - :paramtype scope: str - :keyword items: Conversation items to be stored in memory. Default value is None. - :paramtype items: list[dict[str, any]] - :keyword previous_update_id: The unique ID of the previous update request, enabling incremental - memory updates from where the last operation left off. Default value is None. - :paramtype previous_update_id: str - :keyword update_delay: Timeout period before processing the memory update in seconds. - If a new update request is received during this period, it will cancel the current request and - reset the timeout. - Set to 0 to immediately trigger the update without delay. - Defaults to 300 (5 minutes). Default value is None. - :paramtype update_delay: int - :return: An instance of LROPoller that returns MemoryStoreUpdateCompletedResult. The - MemoryStoreUpdateCompletedResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.ai.projects.models.MemoryStoreUpdateCompletedResult] + :type body: ~azure.ai.projects.models.ModelPendingUploadRequest or JSON or IO[bytes] + :return: ModelPendingUploadResponse. The ModelPendingUploadResponse is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.ModelPendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryStoreUpdateCompletedResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_memories_initial( - name=name, - body=body, - scope=scope, - items=items, - previous_update_id=previous_update_id, - update_delay=update_delay, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Operation-Location"] = self._deserialize( - "str", response.headers.get("Operation-Location") - ) + cls: ClsType[_models.ModelPendingUploadResponse] = kwargs.pop("cls", None) - deserialized = _deserialize(_models.MemoryStoreUpdateCompletedResult, response.json().get("result", {})) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _request = build_beta_models_pending_upload_request( + name=name, + version=version, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MemoryStoreUpdateCompletedResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MemoryStoreUpdateCompletedResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ModelPendingUploadResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @overload - def delete_scope( - self, name: str, *, scope: str, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDeleteScopeResult: - """Delete all memories associated with a specific scope from a memory store. + def get_credentials( + self, + name: str, + version: str, + body: _models.ModelCredentialRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DatasetCredential: + """Get credentials for a model version asset. - :param name: The name of the memory store. Required. + :param name: Name of the model. Required. :type name: str - :keyword scope: The namespace that logically groups and isolates memories to delete, such as a - user ID. Required. - :paramtype scope: str + :param version: Version of the model. Required. + :type version: str + :param body: Required. + :type body: ~azure.ai.projects.models.ModelCredentialRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult + :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetCredential :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def delete_scope( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDeleteScopeResult: - """Delete all memories associated with a specific scope from a memory store. + def get_credentials( + self, name: str, version: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.DatasetCredential: + """Get credentials for a model version asset. - :param name: The name of the memory store. Required. + :param name: Name of the model. Required. :type name: str + :param version: Version of the model. Required. + :type version: str :param body: Required. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult + :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetCredential :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def delete_scope( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDeleteScopeResult: - """Delete all memories associated with a specific scope from a memory store. + def get_credentials( + self, name: str, version: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.DatasetCredential: + """Get credentials for a model version asset. - :param name: The name of the memory store. Required. + :param name: Name of the model. Required. :type name: str + :param version: Version of the model. Required. + :type version: str :param body: Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult + :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetCredential :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def delete_scope( - self, name: str, body: Union[JSON, IO[bytes]] = _Unset, *, scope: str = _Unset, **kwargs: Any - ) -> _models.MemoryStoreDeleteScopeResult: - """Delete all memories associated with a specific scope from a memory store. + def get_credentials( + self, name: str, version: str, body: Union[_models.ModelCredentialRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.DatasetCredential: + """Get credentials for a model version asset. - :param name: The name of the memory store. Required. + :param name: Name of the model. Required. :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword scope: The namespace that logically groups and isolates memories to delete, such as a - user ID. Required. - :paramtype scope: str - :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult + :param version: Version of the model. Required. + :type version: str + :param body: Is one of the following types: ModelCredentialRequest, JSON, IO[bytes] Required. + :type body: ~azure.ai.projects.models.ModelCredentialRequest or JSON or IO[bytes] + :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetCredential :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -9800,13 +15562,8 @@ def delete_scope( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryStoreDeleteScopeResult] = kwargs.pop("cls", None) + cls: ClsType[_models.DatasetCredential] = kwargs.pop("cls", None) - if body is _Unset: - if scope is _Unset: - raise TypeError("missing required argument: scope") - body = {"scope": scope} - body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None if isinstance(body, (IOBase, bytes)): @@ -9814,8 +15571,9 @@ def delete_scope( else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_memory_stores_delete_scope_request( + _request = build_beta_models_get_credentials_request( name=name, + version=version, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -9842,16 +15600,12 @@ def delete_scope( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryStoreDeleteScopeResult, response.json()) + deserialized = _deserialize(_models.DatasetCredential, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10092,150 +15846,19 @@ def create(self, red_team: Union[_models.RedTeam, JSON, IO[bytes]], **kwargs: An _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RedTeam] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(red_team, (IOBase, bytes)): - _content = red_team - else: - _content = json.dumps(red_team, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_beta_red_teams_create_request( - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.RedTeam, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - -class BetaSchedulesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`schedules` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def delete(self, schedule_id: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """Delete a schedule. - - :param schedule_id: Identifier of the schedule. Required. - :type schedule_id: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_beta_schedules_delete_request( - schedule_id=schedule_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get(self, schedule_id: str, **kwargs: Any) -> _models.Schedule: - """Get a schedule by id. - - :param schedule_id: Identifier of the schedule. Required. - :type schedule_id: str - :return: Schedule. The Schedule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Schedule - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + cls: ClsType[_models.RedTeam] = kwargs.pop("cls", None) - cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) + content_type = content_type or "application/json" + _content = None + if isinstance(red_team, (IOBase, bytes)): + _content = red_team + else: + _content = json.dumps(red_team, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_schedules_get_request( - schedule_id=schedule_id, + _request = build_beta_red_teams_create_request( + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -10252,193 +15875,145 @@ def get(self, schedule_id: str, **kwargs: Any) -> _models.Schedule: response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [201]: if _stream: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Schedule, response.json()) + deserialized = _deserialize(_models.RedTeam, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list( - self, - *, - type: Optional[Union[str, _models.ScheduleTaskType]] = None, - enabled: Optional[bool] = None, - **kwargs: Any - ) -> ItemPaged["_models.Schedule"]: - """List all schedules. - - :keyword type: Filter by the type of schedule. Known values are: "Evaluation" and "Insight". - Default value is None. - :paramtype type: str or ~azure.ai.projects.models.ScheduleTaskType - :keyword enabled: Filter by the enabled status. Default value is None. - :paramtype enabled: bool - :return: An iterator like instance of Schedule - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Schedule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Schedule]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_beta_schedules_list_request( - type=type, - enabled=enabled, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Schedule], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) +class BetaRoutinesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - return pipeline_response + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`routines` attribute. + """ - return ItemPaged(get_next, extract_data) + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload def create_or_update( - self, schedule_id: str, schedule: _models.Schedule, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Schedule: - """Create or update operation template. - - :param schedule_id: Identifier of the schedule. Required. - :type schedule_id: str - :param schedule: The resource instance. Required. - :type schedule: ~azure.ai.projects.models.Schedule + self, + routine_name: str, + *, + triggers: dict[str, _models.RoutineTrigger], + action: _models.RoutineAction, + content_type: str = "application/json", + description: Optional[str] = None, + enabled: Optional[bool] = None, + **kwargs: Any + ) -> _models.Routine: + """Create or update a routine. + + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :keyword triggers: The triggers configured for the routine. In v1, exactly one trigger entry is + supported. Required. + :paramtype triggers: dict[str, ~azure.ai.projects.models.RoutineTrigger] + :keyword action: The action executed when the routine fires. Required. + :paramtype action: ~azure.ai.projects.models.RoutineAction :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Schedule. The Schedule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Schedule + :keyword description: A human-readable description of the routine. Default value is None. + :paramtype description: str + :keyword enabled: Whether the routine is enabled. Default value is None. + :paramtype enabled: bool + :return: Routine. The Routine is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Routine :raises ~azure.core.exceptions.HttpResponseError: """ @overload def create_or_update( - self, schedule_id: str, schedule: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Schedule: - """Create or update operation template. + self, routine_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.Routine: + """Create or update a routine. - :param schedule_id: Identifier of the schedule. Required. - :type schedule_id: str - :param schedule: The resource instance. Required. - :type schedule: JSON + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :param body: Required. + :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Schedule. The Schedule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Schedule + :return: Routine. The Routine is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Routine :raises ~azure.core.exceptions.HttpResponseError: """ @overload def create_or_update( - self, schedule_id: str, schedule: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Schedule: - """Create or update operation template. + self, routine_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.Routine: + """Create or update a routine. - :param schedule_id: Identifier of the schedule. Required. - :type schedule_id: str - :param schedule: The resource instance. Required. - :type schedule: IO[bytes] + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :param body: Required. + :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: Schedule. The Schedule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Schedule + :return: Routine. The Routine is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Routine :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace def create_or_update( - self, schedule_id: str, schedule: Union[_models.Schedule, JSON, IO[bytes]], **kwargs: Any - ) -> _models.Schedule: - """Create or update operation template. + self, + routine_name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + triggers: dict[str, _models.RoutineTrigger] = _Unset, + action: _models.RoutineAction = _Unset, + description: Optional[str] = None, + enabled: Optional[bool] = None, + **kwargs: Any + ) -> _models.Routine: + """Create or update a routine. - :param schedule_id: Identifier of the schedule. Required. - :type schedule_id: str - :param schedule: The resource instance. Is one of the following types: Schedule, JSON, - IO[bytes] Required. - :type schedule: ~azure.ai.projects.models.Schedule or JSON or IO[bytes] - :return: Schedule. The Schedule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Schedule + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword triggers: The triggers configured for the routine. In v1, exactly one trigger entry is + supported. Required. + :paramtype triggers: dict[str, ~azure.ai.projects.models.RoutineTrigger] + :keyword action: The action executed when the routine fires. Required. + :paramtype action: ~azure.ai.projects.models.RoutineAction + :keyword description: A human-readable description of the routine. Default value is None. + :paramtype description: str + :keyword enabled: Whether the routine is enabled. Default value is None. + :paramtype enabled: bool + :return: Routine. The Routine is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Routine :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -10453,20 +16028,92 @@ def create_or_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) + cls: ClsType[_models.Routine] = kwargs.pop("cls", None) + if body is _Unset: + if triggers is _Unset: + raise TypeError("missing required argument: triggers") + if action is _Unset: + raise TypeError("missing required argument: action") + body = {"action": action, "description": description, "enabled": enabled, "triggers": triggers} + body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None - if isinstance(schedule, (IOBase, bytes)): - _content = schedule + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(schedule, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_routines_create_or_update_request( + routine_name=routine_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Routine, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get(self, routine_name: str, **kwargs: Any) -> _models.Routine: + """Retrieve a routine. + + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :return: Routine. The Routine is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Routine + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_beta_schedules_create_or_update_request( - schedule_id=schedule_id, - content_type=content_type, + cls: ClsType[_models.Routine] = kwargs.pop("cls", None) + + _request = build_beta_routines_get_request( + routine_name=routine_name, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -10483,19 +16130,23 @@ def create_or_update( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200]: if _stream: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Schedule, response.json()) + deserialized = _deserialize(_models.Routine, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10503,15 +16154,13 @@ def create_or_update( return deserialized # type: ignore @distributed_trace - def get_run(self, schedule_id: str, run_id: str, **kwargs: Any) -> _models.ScheduleRun: - """Get a schedule run by id. + def enable(self, routine_name: str, **kwargs: Any) -> _models.Routine: + """Enable a routine. - :param schedule_id: The unique identifier of the schedule. Required. - :type schedule_id: str - :param run_id: The unique identifier of the schedule run. Required. - :type run_id: str - :return: ScheduleRun. The ScheduleRun is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ScheduleRun + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :return: Routine. The Routine is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Routine :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -10525,11 +16174,10 @@ def get_run(self, schedule_id: str, run_id: str, **kwargs: Any) -> _models.Sched _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ScheduleRun] = kwargs.pop("cls", None) + cls: ClsType[_models.Routine] = kwargs.pop("cls", None) - _request = build_beta_schedules_get_run_request( - schedule_id=schedule_id, - run_id=run_id, + _request = build_beta_routines_enable_request( + routine_name=routine_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -10563,7 +16211,7 @@ def get_run(self, schedule_id: str, run_id: str, **kwargs: Any) -> _models.Sched if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ScheduleRun, response.json()) + deserialized = _deserialize(_models.Routine, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10571,230 +16219,13 @@ def get_run(self, schedule_id: str, run_id: str, **kwargs: Any) -> _models.Sched return deserialized # type: ignore @distributed_trace - def list_runs( - self, - schedule_id: str, - *, - type: Optional[Union[str, _models.ScheduleTaskType]] = None, - enabled: Optional[bool] = None, - **kwargs: Any - ) -> ItemPaged["_models.ScheduleRun"]: - """List all schedule runs. - - :param schedule_id: Identifier of the schedule. Required. - :type schedule_id: str - :keyword type: Filter by the type of schedule. Known values are: "Evaluation" and "Insight". - Default value is None. - :paramtype type: str or ~azure.ai.projects.models.ScheduleTaskType - :keyword enabled: Filter by the enabled status. Default value is None. - :paramtype enabled: bool - :return: An iterator like instance of ScheduleRun - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.ScheduleRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.ScheduleRun]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_beta_schedules_list_runs_request( - schedule_id=schedule_id, - type=type, - enabled=enabled, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.ScheduleRun], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class BetaToolboxesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`toolboxes` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def create_version( - self, - name: str, - *, - tools: List[_models.Tool], - content_type: str = "application/json", - description: Optional[str] = None, - metadata: Optional[dict[str, str]] = None, - policies: Optional[_models.ToolboxPolicies] = None, - **kwargs: Any - ) -> _models.ToolboxVersionObject: - """Create a new version of a toolbox. If the toolbox does not exist, it will be created. - - :param name: The name of the toolbox. If the toolbox does not exist, it will be created. - Required. - :type name: str - :keyword tools: The list of tools to include in this version. Required. - :paramtype tools: list[~azure.ai.projects.models.Tool] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword description: A human-readable description of the toolbox. Default value is None. - :paramtype description: str - :keyword metadata: Arbitrary key-value metadata to associate with the toolbox. Default value is - None. - :paramtype metadata: dict[str, str] - :keyword policies: Policy configuration for this toolbox version. Default value is None. - :paramtype policies: ~azure.ai.projects.models.ToolboxPolicies - :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxVersionObject - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_version( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxVersionObject: - """Create a new version of a toolbox. If the toolbox does not exist, it will be created. - - :param name: The name of the toolbox. If the toolbox does not exist, it will be created. - Required. - :type name: str - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxVersionObject - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_version( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxVersionObject: - """Create a new version of a toolbox. If the toolbox does not exist, it will be created. - - :param name: The name of the toolbox. If the toolbox does not exist, it will be created. - Required. - :type name: str - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxVersionObject - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_version( - self, - name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - tools: List[_models.Tool] = _Unset, - description: Optional[str] = None, - metadata: Optional[dict[str, str]] = None, - policies: Optional[_models.ToolboxPolicies] = None, - **kwargs: Any - ) -> _models.ToolboxVersionObject: - """Create a new version of a toolbox. If the toolbox does not exist, it will be created. + def disable(self, routine_name: str, **kwargs: Any) -> _models.Routine: + """Disable a routine. - :param name: The name of the toolbox. If the toolbox does not exist, it will be created. - Required. - :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword tools: The list of tools to include in this version. Required. - :paramtype tools: list[~azure.ai.projects.models.Tool] - :keyword description: A human-readable description of the toolbox. Default value is None. - :paramtype description: str - :keyword metadata: Arbitrary key-value metadata to associate with the toolbox. Default value is - None. - :paramtype metadata: dict[str, str] - :keyword policies: Policy configuration for this toolbox version. Default value is None. - :paramtype policies: ~azure.ai.projects.models.ToolboxPolicies - :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxVersionObject + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :return: Routine. The Routine is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Routine :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -10805,29 +16236,14 @@ def create_version( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ToolboxVersionObject] = kwargs.pop("cls", None) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - if body is _Unset: - if tools is _Unset: - raise TypeError("missing required argument: tools") - body = {"description": description, "metadata": metadata, "policies": policies, "tools": tools} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.Routine] = kwargs.pop("cls", None) - _request = build_beta_toolboxes_create_version_request( - name=name, - content_type=content_type, + _request = build_beta_routines_disable_request( + routine_name=routine_name, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -10860,7 +16276,7 @@ def create_version( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ToolboxVersionObject, response.json()) + deserialized = _deserialize(_models.Routine, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10868,13 +16284,103 @@ def create_version( return deserialized # type: ignore @distributed_trace - def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: - """Retrieve a toolbox. + def list( + self, + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.Routine"]: + """List routines. - :param name: The name of the toolbox to retrieve. Required. - :type name: str - :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxObject + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of Routine + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Routine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Routine]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(_continuation_token=None): + + _request = build_beta_routines_list_request( + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Routine], + deserialized.get("data", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, iter(list_of_elem) + + def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def delete(self, routine_name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Delete a routine. + + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -10888,10 +16394,10 @@ def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ToolboxObject] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_toolboxes_get_request( - name=name, + _request = build_beta_routines_delete_request( + routine_name=routine_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -10901,20 +16407,14 @@ def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -10922,27 +16422,27 @@ def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: ) raise HttpResponseError(response=response, model=error) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.ToolboxObject, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - def list( + def list_runs( self, + routine_name: str, *, + filter: Optional[str] = None, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.ToolboxObject"]: - """List all toolboxes. - + ) -> ItemPaged["_models.RoutineRun"]: + """List prior runs for a routine. + + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :keyword filter: An optional MLflow search-runs filter expression applied within the routine's + experiment. Default value is None. + :paramtype filter: str :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None. @@ -10957,14 +16457,14 @@ def list( subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None. :paramtype before: str - :return: An iterator like instance of ToolboxObject - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.ToolboxObject] + :return: An iterator like instance of RoutineRun + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.RoutineRun] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ToolboxObject]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RoutineRun]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10976,7 +16476,9 @@ def list( def prepare_request(_continuation_token=None): - _request = build_beta_toolboxes_list_request( + _request = build_beta_routines_list_runs_request( + routine_name=routine_name, + filter=filter, limit=limit, order=order, after=_continuation_token, @@ -10994,7 +16496,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.ToolboxObject], + List[_models.RoutineRun], deserialized.get("data", []), ) if cls: @@ -11020,45 +16522,186 @@ def get_next(_continuation_token=None): return pipeline_response - return ItemPaged(get_next, extract_data) + return ItemPaged(get_next, extract_data) + + @overload + def dispatch_async( + self, + routine_name: str, + *, + content_type: str = "application/json", + payload: Optional[_models.RoutineDispatchPayload] = None, + **kwargs: Any + ) -> _models.DispatchRoutineResponse: + """Queue an asynchronous routine dispatch. + + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword payload: A direct action-input override sent downstream when testing a routine. + Default value is None. + :paramtype payload: ~azure.ai.projects.models.RoutineDispatchPayload + :return: DispatchRoutineResponse. The DispatchRoutineResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DispatchRoutineResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def dispatch_async( + self, routine_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.DispatchRoutineResponse: + """Queue an asynchronous routine dispatch. + + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DispatchRoutineResponse. The DispatchRoutineResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DispatchRoutineResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def dispatch_async( + self, routine_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.DispatchRoutineResponse: + """Queue an asynchronous routine dispatch. + + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DispatchRoutineResponse. The DispatchRoutineResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DispatchRoutineResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def dispatch_async( + self, + routine_name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + payload: Optional[_models.RoutineDispatchPayload] = None, + **kwargs: Any + ) -> _models.DispatchRoutineResponse: + """Queue an asynchronous routine dispatch. + + :param routine_name: The unique name of the routine. Required. + :type routine_name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword payload: A direct action-input override sent downstream when testing a routine. + Default value is None. + :paramtype payload: ~azure.ai.projects.models.RoutineDispatchPayload + :return: DispatchRoutineResponse. The DispatchRoutineResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DispatchRoutineResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DispatchRoutineResponse] = kwargs.pop("cls", None) + + if body is _Unset: + body = {"payload": payload} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_routines_dispatch_async_request( + routine_name=routine_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DispatchRoutineResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class BetaSchedulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`schedules` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_versions( - self, - name: str, - *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.ToolboxVersionObject"]: - """List all versions of a toolbox. + def delete(self, schedule_id: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Delete a schedule. - :param name: The name of the toolbox to list versions for. Required. - :type name: str - :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the - default is 20. Default value is None. - :paramtype limit: int - :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for - ascending order and``desc`` - for descending order. Known values are: "asc" and "desc". Default value is None. - :paramtype order: str or ~azure.ai.projects.models.PageOrder - :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your - place in the list. - For instance, if you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page of the list. - Default value is None. - :paramtype before: str - :return: An iterator like instance of ToolboxVersionObject - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.ToolboxVersionObject] + :param schedule_id: Identifier of the schedule. Required. + :type schedule_id: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.ToolboxVersionObject]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11067,65 +16710,44 @@ def list_versions( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(_continuation_token=None): - - _request = build_beta_toolboxes_list_versions_request( - name=name, - limit=limit, - order=order, - after=_continuation_token, - before=before, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.ToolboxVersionObject], - deserialized.get("data", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("last_id") or None, iter(list_of_elem) + cls: ClsType[None] = kwargs.pop("cls", None) - def get_next(_continuation_token=None): - _request = prepare_request(_continuation_token) + _request = build_beta_schedules_delete_request( + schedule_id=schedule_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + response = pipeline_response.http_response - return pipeline_response + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - def get_version(self, name: str, version: str, **kwargs: Any) -> _models.ToolboxVersionObject: - """Retrieve a specific version of a toolbox. + def get(self, schedule_id: str, **kwargs: Any) -> _models.Schedule: + """Get a schedule by id. - :param name: The name of the toolbox. Required. - :type name: str - :param version: The version identifier to retrieve. Required. - :type version: str - :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxVersionObject + :param schedule_id: Identifier of the schedule. Required. + :type schedule_id: str + :return: Schedule. The Schedule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Schedule :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -11139,11 +16761,10 @@ def get_version(self, name: str, version: str, **kwargs: Any) -> _models.Toolbox _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ToolboxVersionObject] = kwargs.pop("cls", None) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) - _request = build_beta_toolboxes_get_version_request( - name=name, - version=version, + _request = build_beta_schedules_get_request( + schedule_id=schedule_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -11168,92 +16789,186 @@ def get_version(self, name: str, version: str, **kwargs: Any) -> _models.Toolbox except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ToolboxVersionObject, response.json()) + deserialized = _deserialize(_models.Schedule, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + @distributed_trace + def list( + self, + *, + type: Optional[Union[str, _models.ScheduleTaskType]] = None, + enabled: Optional[bool] = None, + **kwargs: Any + ) -> ItemPaged["_models.Schedule"]: + """List all schedules. + + :keyword type: Filter by the type of schedule. Known values are: "Evaluation" and "Insight". + Default value is None. + :paramtype type: str or ~azure.ai.projects.models.ScheduleTaskType + :keyword enabled: Filter by the enabled status. Default value is None. + :paramtype enabled: bool + :return: An iterator like instance of Schedule + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Schedule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Schedule]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_beta_schedules_list_request( + type=type, + enabled=enabled, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Schedule], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + @overload - def update( - self, name: str, *, default_version: str, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxObject: - """Update a toolbox to point to a specific version. + def create_or_update( + self, schedule_id: str, schedule: _models.Schedule, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.Schedule: + """Create or update operation template. - :param name: The name of the toolbox to update. Required. - :type name: str - :keyword default_version: The version identifier that the toolbox should point to. When set, - the toolbox's default version will resolve to this version instead of the latest. Required. - :paramtype default_version: str + :param schedule_id: Identifier of the schedule. Required. + :type schedule_id: str + :param schedule: The resource instance. Required. + :type schedule: ~azure.ai.projects.models.Schedule :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxObject + :return: Schedule. The Schedule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Schedule :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxObject: - """Update a toolbox to point to a specific version. + def create_or_update( + self, schedule_id: str, schedule: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.Schedule: + """Create or update operation template. - :param name: The name of the toolbox to update. Required. - :type name: str - :param body: Required. - :type body: JSON + :param schedule_id: Identifier of the schedule. Required. + :type schedule_id: str + :param schedule: The resource instance. Required. + :type schedule: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxObject + :return: Schedule. The Schedule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Schedule :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxObject: - """Update a toolbox to point to a specific version. + def create_or_update( + self, schedule_id: str, schedule: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.Schedule: + """Create or update operation template. - :param name: The name of the toolbox to update. Required. - :type name: str - :param body: Required. - :type body: IO[bytes] + :param schedule_id: Identifier of the schedule. Required. + :type schedule_id: str + :param schedule: The resource instance. Required. + :type schedule: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxObject + :return: Schedule. The Schedule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Schedule :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def update( - self, name: str, body: Union[JSON, IO[bytes]] = _Unset, *, default_version: str = _Unset, **kwargs: Any - ) -> _models.ToolboxObject: - """Update a toolbox to point to a specific version. + def create_or_update( + self, schedule_id: str, schedule: Union[_models.Schedule, JSON, IO[bytes]], **kwargs: Any + ) -> _models.Schedule: + """Create or update operation template. - :param name: The name of the toolbox to update. Required. - :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword default_version: The version identifier that the toolbox should point to. When set, - the toolbox's default version will resolve to this version instead of the latest. Required. - :paramtype default_version: str - :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxObject + :param schedule_id: Identifier of the schedule. Required. + :type schedule_id: str + :param schedule: The resource instance. Is one of the following types: Schedule, JSON, + IO[bytes] Required. + :type schedule: ~azure.ai.projects.models.Schedule or JSON or IO[bytes] + :return: Schedule. The Schedule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Schedule :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -11268,22 +16983,17 @@ def update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ToolboxObject] = kwargs.pop("cls", None) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) - if body is _Unset: - if default_version is _Unset: - raise TypeError("missing required argument: default_version") - body = {"default_version": default_version} - body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(schedule, (IOBase, bytes)): + _content = schedule else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(schedule, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_toolboxes_update_request( - name=name, + _request = build_beta_schedules_create_or_update_request( + schedule_id=schedule_id, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -11303,23 +17013,19 @@ def update( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: if _stream: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ToolboxObject, response.json()) + deserialized = _deserialize(_models.Schedule, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11327,13 +17033,15 @@ def update( return deserialized # type: ignore @distributed_trace - def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """Delete a toolbox and all its versions. + def get_run(self, schedule_id: str, run_id: str, **kwargs: Any) -> _models.ScheduleRun: + """Get a schedule run by id. - :param name: The name of the toolbox to delete. Required. - :type name: str - :return: None - :rtype: None + :param schedule_id: The unique identifier of the schedule. Required. + :type schedule_id: str + :param run_id: The unique identifier of the schedule run. Required. + :type run_id: str + :return: ScheduleRun. The ScheduleRun is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ScheduleRun :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -11347,10 +17055,11 @@ def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsist _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.ScheduleRun] = kwargs.pop("cls", None) - _request = build_beta_toolboxes_delete_request( - name=name, + _request = build_beta_schedules_get_run_request( + schedule_id=schedule_id, + run_id=run_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -11360,14 +17069,20 @@ def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsist } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -11375,23 +17090,43 @@ def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsist ) raise HttpResponseError(response=response, model=error) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ScheduleRun, response.json()) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace - def delete_version( # pylint: disable=inconsistent-return-statements - self, name: str, version: str, **kwargs: Any - ) -> None: - """Delete a specific version of a toolbox. + def list_runs( + self, + schedule_id: str, + *, + type: Optional[Union[str, _models.ScheduleTaskType]] = None, + enabled: Optional[bool] = None, + **kwargs: Any + ) -> ItemPaged["_models.ScheduleRun"]: + """List all schedule runs. - :param name: The name of the toolbox. Required. - :type name: str - :param version: The version identifier to delete. Required. - :type version: str - :return: None - :rtype: None + :param schedule_id: Identifier of the schedule. Required. + :type schedule_id: str + :keyword type: Filter by the type of schedule. Known values are: "Evaluation" and "Insight". + Default value is None. + :paramtype type: str or ~azure.ai.projects.models.ScheduleTaskType + :keyword enabled: Filter by the enabled status. Default value is None. + :paramtype enabled: bool + :return: An iterator like instance of ScheduleRun + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.ScheduleRun] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ScheduleRun]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11400,40 +17135,75 @@ def delete_version( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[None] = kwargs.pop("cls", None) + _request = build_beta_schedules_list_runs_request( + schedule_id=schedule_id, + type=type, + enabled=enabled, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_beta_toolboxes_delete_version_request( - name=name, - version=version, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ScheduleRun], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - raise HttpResponseError(response=response, model=error) + response = pipeline_response.http_response - if cls: - return cls(pipeline_response, None, {}) # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return ItemPaged(get_next, extract_data) class BetaSkillsOperations: diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch.py index 784a8ba6b182..24d2cf912792 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch.py @@ -24,11 +24,12 @@ BetaEvaluationTaxonomiesOperations, BetaEvaluatorsOperations, BetaInsightsOperations, + BetaModelsOperations, BetaOperations as GeneratedBetaOperations, BetaRedTeamsOperations, + BetaRoutinesOperations, BetaSchedulesOperations, BetaSkillsOperations, - BetaToolboxesOperations, ) @@ -105,12 +106,14 @@ class BetaOperations(GeneratedBetaOperations): """:class:`~azure.ai.projects.operations.BetaInsightsOperations` operations""" memory_stores: BetaMemoryStoresOperations """:class:`~azure.ai.projects.operations.BetaMemoryStoresOperations` operations""" + models: BetaModelsOperations + """:class:`~azure.ai.projects.operations.BetaModelsOperations` operations""" red_teams: BetaRedTeamsOperations """:class:`~azure.ai.projects.operations.BetaRedTeamsOperations` operations""" + routines: BetaRoutinesOperations + """:class:`~azure.ai.projects.operations.BetaRoutinesOperations` operations""" schedules: BetaSchedulesOperations """:class:`~azure.ai.projects.operations.BetaSchedulesOperations` operations""" - toolboxes: BetaToolboxesOperations - """:class:`~azure.ai.projects.operations.BetaToolboxesOperations` operations""" skills: BetaSkillsOperations """:class:`~azure.ai.projects.operations.BetaSkillsOperations` operations""" datasets: BetaDatasetsOperations @@ -141,11 +144,12 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: "BetaEvaluatorsOperations", "BetaInsightsOperations", "BetaMemoryStoresOperations", + "BetaModelsOperations", "BetaOperations", "BetaRedTeamsOperations", + "BetaRoutinesOperations", "BetaSchedulesOperations", "BetaSkillsOperations", - "BetaToolboxesOperations", "ConnectionsOperations", "DatasetsOperations", "EvaluationRulesOperations", diff --git a/sdk/ai/azure-ai-projects/post-emitter-fixes.cmd b/sdk/ai/azure-ai-projects/post-emitter-fixes.cmd index 594848cfb591..c84b10bdcbce 100644 --- a/sdk/ai/azure-ai-projects/post-emitter-fixes.cmd +++ b/sdk/ai/azure-ai-projects/post-emitter-fixes.cmd @@ -25,8 +25,9 @@ powershell -Command "(Get-Content azure\ai\projects\models\_models.py) -replace REM Rename DEFAULT2024_11_15 to DEFAULT_2024_11_15 powershell -Command "(Get-Content azure\ai\projects\models\_enums.py) -replace 'DEFAULT2024_11_15', 'DEFAULT_2024_11_15' | Set-Content azure\ai\projects\models\_enums.py" -REM Rename `A2_A` to `A2A` in enum class AgentEndpointProtocol in _enums.py +REM Rename `A2_A` to `A2A` in enum class AgentEndpointProtocol in _enums.py & _models.py powershell -Command "(Get-Content azure\ai\projects\models\_enums.py) -replace 'A2_A', 'A2A' | Set-Content azure\ai\projects\models\_enums.py" +powershell -Command "(Get-Content azure\ai\projects\models\_models.py) -replace 'A2_A', 'A2A' | Set-Content azure\ai\projects\models\_models.py" REM Edit both _operations.py files to fix missing Foundry-Features HTTP request header in continued list paging calls. Add: REM headers=_headers diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview.py index 63bdc57e0ee8..ca59e5aab6ec 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview.py @@ -17,7 +17,7 @@ those inner tools. Toolboxes and tool search are preview features. CRUD goes through - 'project_client.beta.toolboxes'. + 'project_client.toolboxes'. USAGE: python sample_toolboxes_with_search_preview.py @@ -72,7 +72,7 @@ project_connection_id=os.environ["MCP_PROJECT_CONNECTION_ID"], ) - toolbox_version = project_client.beta.toolboxes.create_version( + toolbox_version = project_client.toolboxes.create_version( name=TOOLBOX_NAME, description=f"Toolbox with `{INNER_MCP_LABEL}` MCP server and tool search enabled.", tools=[inner_mcp_tool, ToolboxSearchPreviewTool()], @@ -86,7 +86,6 @@ server_label=TOOLBOX_MCP_LABEL, server_url=toolbox_mcp_url, authorization=token, - headers={"Foundry-Features": "Toolboxes=V1Preview"}, require_approval="never", ) diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview_async.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview_async.py index bfd43071c2f3..d10e025af59a 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview_async.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview_async.py @@ -17,7 +17,7 @@ those inner tools. Toolboxes and tool search are preview features. CRUD goes through - 'project_client.beta.toolboxes'. + 'project_client.toolboxes'. USAGE: python sample_toolboxes_with_search_preview_async.py @@ -73,7 +73,7 @@ async def main() -> None: project_connection_id=os.environ["MCP_PROJECT_CONNECTION_ID"], ) - toolbox_version = await project_client.beta.toolboxes.create_version( + toolbox_version = await project_client.toolboxes.create_version( name=TOOLBOX_NAME, description=f"Toolbox with `{INNER_MCP_LABEL}` MCP server and tool search enabled.", tools=[inner_mcp_tool, ToolboxSearchPreviewTool()], @@ -87,7 +87,6 @@ async def main() -> None: server_label=TOOLBOX_MCP_LABEL, server_url=toolbox_mcp_url, authorization=token, - headers={"Foundry-Features": "Toolboxes=V1Preview"}, require_approval="never", ) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code.py index afc332e7236e..77d3e8059b4e 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code.py @@ -114,7 +114,7 @@ version_zip_path = Path(tempfile.gettempdir()) / f"{agent_name}-{created.version}.zip" sha = hashlib.sha256() with open(version_zip_path, "wb") as f: - for chunk in project_client.beta.agents.download_agent_version_code( + for chunk in project_client.beta.agents.download_agent_code( agent_name=agent_name, agent_version=created.version, ): diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code_async.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code_async.py index 85b1368f48c1..c2df2e813bef 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code_async.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code_async.py @@ -119,7 +119,7 @@ async def main() -> None: # Download the zip for the version we just created, streaming to a temp file. version_zip_path = Path(tempfile.gettempdir()) / f"{agent_name}-{created.version}.zip" sha = hashlib.sha256() - version_stream = await project_client.beta.agents.download_agent_version_code( + version_stream = await project_client.beta.agents.download_agent_code( agent_name=agent_name, agent_version=created.version, ) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud.py index 60ca6d1b969a..fadb722fe983 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud.py @@ -14,7 +14,7 @@ MCP `require_approval` setting from the fetched default version. Toolboxes are currently a preview feature. In the Python SDK, you access - these operations via `project_client.beta.toolboxes`. + these operations via `project_client.toolboxes`. USAGE: python sample_toolboxes_crud.py @@ -59,7 +59,7 @@ def print_mcp_require_approval(tools: list[Tool]) -> None: toolbox_name = "toolbox_with_mcp_tool" try: - project_client.beta.toolboxes.delete(toolbox_name) + project_client.toolboxes.delete(toolbox_name) print(f"Toolbox `{toolbox_name}` deleted") except ResourceNotFoundError: pass @@ -80,52 +80,52 @@ def print_mcp_require_approval(tools: list[Tool]) -> None: ) ] - created = project_client.beta.toolboxes.create_version( + created = project_client.toolboxes.create_version( name=toolbox_name, description="Toolbox version with MCP require_approval set to 'never'.", tools=tools_with_mcp_approval_required, ) print(f"Created toolbox: {created.name} with MCP tools requiring approval 'never' in version {created.version}") - created = project_client.beta.toolboxes.create_version( + created = project_client.toolboxes.create_version( name=toolbox_name, description="Toolbox version with MCP require_approval set to 'always'.", tools=tools_with_mcp_approval_always, ) print(f"Created toolbox: {created.name} with MCP tools requiring approval 'always' in version {created.version}") - updated = project_client.beta.toolboxes.update( + updated = project_client.toolboxes.update( toolbox_name, default_version="2", ) print(f"Updated toolbox: {updated.name} default version is now {updated.default_version}") - fetched = project_client.beta.toolboxes.get(name=toolbox_name) + fetched = project_client.toolboxes.get(name=toolbox_name) print(f"Retrieved toolbox with default version: {fetched.default_version}") - fetched_version = project_client.beta.toolboxes.get_version( + fetched_version = project_client.toolboxes.get_version( name=toolbox_name, version=fetched.default_version, ) print_mcp_require_approval(fetched_version.tools) - updated = project_client.beta.toolboxes.update( + updated = project_client.toolboxes.update( toolbox_name, default_version="1", ) print(f"Updated toolbox: {updated.name} default version is now {updated.default_version}") - fetched = project_client.beta.toolboxes.get(name=toolbox_name) + fetched = project_client.toolboxes.get(name=toolbox_name) print(f"Retrieved toolbox with default version: {fetched.default_version}") - fetched_version = project_client.beta.toolboxes.get_version( + fetched_version = project_client.toolboxes.get_version( name=toolbox_name, version=fetched.default_version, ) print_mcp_require_approval(fetched_version.tools) - toolboxes = list(project_client.beta.toolboxes.list()) + toolboxes = list(project_client.toolboxes.list()) print(f"Found {len(toolboxes)} toolboxes") for item in toolboxes: print(f" - {item.name} ({item.id})") - project_client.beta.toolboxes.delete(name=toolbox_name) + project_client.toolboxes.delete(name=toolbox_name) print("Toolbox deleted") diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud_async.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud_async.py index 1721a5e6fdb0..dc8cb2049bac 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud_async.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud_async.py @@ -14,7 +14,7 @@ MCP `require_approval` setting from the fetched default version. Toolboxes are currently a preview feature. In the Python SDK, you access - these operations via `project_client.beta.toolboxes`. + these operations via `project_client.toolboxes`. USAGE: python sample_toolboxes_crud_async.py @@ -60,7 +60,7 @@ async def main() -> None: toolbox_name = "toolbox_with_mcp_tool" try: - await project_client.beta.toolboxes.delete(toolbox_name) + await project_client.toolboxes.delete(toolbox_name) print(f"Toolbox `{toolbox_name}` deleted") except ResourceNotFoundError: pass @@ -81,14 +81,14 @@ async def main() -> None: ) ] - created = await project_client.beta.toolboxes.create_version( + created = await project_client.toolboxes.create_version( name=toolbox_name, description="Toolbox version with MCP require_approval set to 'never'.", tools=tools_with_mcp_approval_never, ) print(f"Created toolbox: {created.name} with MCP tools requiring approval 'never' in version {created.version}") - created = await project_client.beta.toolboxes.create_version( + created = await project_client.toolboxes.create_version( name=toolbox_name, description="Toolbox version with MCP require_approval set to 'always'.", tools=tools_with_mcp_approval_always, @@ -97,42 +97,42 @@ async def main() -> None: f"Created toolbox: {created.name} with MCP tools requiring approval 'always' in version {created.version}" ) - updated = await project_client.beta.toolboxes.update( + updated = await project_client.toolboxes.update( name=toolbox_name, default_version="2", ) print(f"Updated toolbox: {updated.name} default version is now {updated.default_version}") - fetched = await project_client.beta.toolboxes.get(name=toolbox_name) + fetched = await project_client.toolboxes.get(name=toolbox_name) print(f"Retrieved toolbox with default version: {fetched.default_version}") - fetched_version = await project_client.beta.toolboxes.get_version( + fetched_version = await project_client.toolboxes.get_version( name=toolbox_name, version=fetched.default_version, ) print_mcp_require_approval(fetched_version.tools) - updated = await project_client.beta.toolboxes.update( + updated = await project_client.toolboxes.update( toolbox_name, default_version="1", ) print(f"Updated toolbox: {updated.name} default version is now {updated.default_version}") - fetched = await project_client.beta.toolboxes.get(name=toolbox_name) + fetched = await project_client.toolboxes.get(name=toolbox_name) print(f"Retrieved toolbox with default version: {fetched.default_version}") - fetched_version = await project_client.beta.toolboxes.get_version( + fetched_version = await project_client.toolboxes.get_version( name=toolbox_name, version=fetched.default_version, ) print_mcp_require_approval(fetched_version.tools) toolboxes = [] - async for item in project_client.beta.toolboxes.list(): + async for item in project_client.toolboxes.list(): toolboxes.append(item) print(f"Found {len(toolboxes)} toolboxes") for item in toolboxes: print(f" - {item.name} ({item.id})") - await project_client.beta.toolboxes.delete(name=toolbox_name) + await project_client.toolboxes.delete(name=toolbox_name) print("Toolbox deleted") diff --git a/sdk/ai/azure-ai-projects/tests/foundry_features_header/foundry_features_header_test_base.py b/sdk/ai/azure-ai-projects/tests/foundry_features_header/foundry_features_header_test_base.py index c0c242ee5723..3c68b2b18fce 100644 --- a/sdk/ai/azure-ai-projects/tests/foundry_features_header/foundry_features_header_test_base.py +++ b/sdk/ai/azure-ai-projects/tests/foundry_features_header/foundry_features_header_test_base.py @@ -39,9 +39,10 @@ "evaluators": "Evaluations=V1Preview", "insights": "Insights=V1Preview", "memory_stores": "MemoryStores=V1Preview", + "models": "Models=V1Preview", "red_teams": "RedTeams=V1Preview", + "routines": "Routines=V1Preview", "schedules": "Schedules=V1Preview", - "toolboxes": "Toolboxes=V1Preview", "skills": "Skills=V1Preview", "datasets": "DataGenerationJobs=V1Preview", "agents": "HostedAgents=V1Preview,AgentEndpoints=V1Preview,CodeAgents=V1Preview", diff --git a/sdk/ai/azure-ai-projects/tests/samples/llm_instructions.py b/sdk/ai/azure-ai-projects/tests/samples/llm_instructions.py index 0e0f776441cf..af98d794a98d 100644 --- a/sdk/ai/azure-ai-projects/tests/samples/llm_instructions.py +++ b/sdk/ai/azure-ai-projects/tests/samples/llm_instructions.py @@ -18,8 +18,7 @@ from typing import Final -agent_tools_instructions: Final[str] = ( - """ +agent_tools_instructions: Final[str] = """ We just ran Python code and captured print/log output in an attached log file (TXT). Validate whether sample execution/output is correct for a tool-driven assistant workflow. @@ -44,11 +43,9 @@ Always include `reason` with a concise explanation tied to the observed print output. """.strip() -) -memories_instructions: Final[str] = ( - """ +memories_instructions: Final[str] = """ We just ran Python code and captured print/log output in an attached log file (TXT). Validate whether sample execution/output is correct for a memories workflow. @@ -73,11 +70,9 @@ Always include `reason` with a concise explanation tied to the observed print output. """.strip() -) -agents_instructions: Final[str] = ( - """ +agents_instructions: Final[str] = """ We just ran Python code and captured print/log output in an attached log file (TXT). Validate whether sample execution/output is correct. @@ -108,11 +103,9 @@ Always include `reason` with a concise explanation tied to the observed print output. """.strip() -) -chat_completions_instructions: Final[str] = ( - """ +chat_completions_instructions: Final[str] = """ We just ran Python code and captured print/log output in an attached log file (TXT). Validate whether sample execution/output is correct for Chat Completions scenarios. @@ -131,11 +124,9 @@ Always include `reason` with a concise explanation tied to the observed print output. """.strip() -) -resource_management_instructions: Final[str] = ( - """ +resource_management_instructions: Final[str] = """ We just ran Python code and captured print/log output in an attached log file (TXT). Validate whether sample execution/output is correct for resource-management samples (for example connections, files, and deployments). @@ -161,11 +152,9 @@ Always include `reason` with a concise explanation tied to the observed print output. """.strip() -) -fine_tuning_instructions: Final[str] = ( - """ +fine_tuning_instructions: Final[str] = """ We just ran Python code and captured print/log output in an attached log file (TXT). Validate whether sample execution/output is correct for a fine-tuning workflow. @@ -189,11 +178,9 @@ Always include `reason` with a concise explanation tied to the observed print output. """.strip() -) -evaluations_instructions: Final[str] = ( - """ +evaluations_instructions: Final[str] = """ We just ran Python code for an evaluation sample and captured print/log output in an attached log file (TXT). Your job: determine if the sample code executed to completion WITHOUT throwing an unhandled exception. @@ -215,11 +202,9 @@ Always respond with `reason` indicating the reason for the response. """.strip() -) -hosted_agents_instructions: Final[str] = ( - """ +hosted_agents_instructions: Final[str] = """ We just ran Python code for a hosted-agent sample and captured print/log output in an attached log file (TXT). Validate whether the sample executed correctly. @@ -241,7 +226,6 @@ Always include `reason` with a concise explanation tied to the observed print output. """.strip() -) # Folder (under samples/) -> instructions. diff --git a/sdk/ai/azure-ai-projects/tsp-location.yaml b/sdk/ai/azure-ai-projects/tsp-location.yaml index f7ab1acc313e..0830e7e3acbc 100644 --- a/sdk/ai/azure-ai-projects/tsp-location.yaml +++ b/sdk/ai/azure-ai-projects/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/ai-foundry/data-plane/Foundry -commit: 8dba3c8402a82cf0c2bf8a905b0e932bec57727a +commit: e4466bef21be226c5cf8db77a37b57ddcb8acfd2 repo: Azure/azure-rest-api-specs additionalDirectories: