From a43f4c5c03501a06ceb21cee8481b0c548222b1a Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 12 May 2025 23:40:34 +0000 Subject: [PATCH] CodeGen from PR 34614 in Azure/azure-rest-api-specs Merge 54339198c8f1f77ec5effa832ac6a4e07ff926bb into e70895d3c077412514b402fb3030235dc0de5a5d --- ...AgentsPersistentClientBuilderExtensions.cs | 14 +- .../src/Generated/AISearchIndexResource.cs | 14 +- .../AzureAISearchResource.Serialization.cs | 2 +- .../src/Generated/AzureAISearchResource.cs | 6 +- ...ureAISearchToolDefinition.Serialization.cs | 126 - .../Generated/AzureAISearchToolDefinition.cs | 29 - .../AzureFunctionBinding.Serialization.cs | 150 - .../src/Generated/AzureFunctionBinding.cs | 80 - .../src/Generated/AzureFunctionBindingType.cs | 48 - ...AzureFunctionStorageQueue.Serialization.cs | 150 - .../Generated/AzureFunctionStorageQueue.cs | 82 - ...ureFunctionToolDefinition.Serialization.cs | 134 - .../Generated/AzureFunctionToolDefinition.cs | 30 - ...CustomSearchConfiguration.Serialization.cs | 205 - .../BingCustomSearchConfiguration.cs | 98 - ...omSearchConfigurationList.Serialization.cs | 152 - .../BingCustomSearchConfigurationList.cs | 85 - ...ustomSearchToolDefinition.Serialization.cs | 134 - .../BingCustomSearchToolDefinition.cs | 44 - ...undingSearchConfiguration.Serialization.cs | 196 - .../BingGroundingSearchConfiguration.cs | 91 - ...ngSearchConfigurationList.Serialization.cs | 152 - .../BingGroundingSearchConfigurationList.cs | 85 - ...ngGroundingToolDefinition.Serialization.cs | 134 - .../Generated/BingGroundingToolDefinition.cs | 44 - ...InterpreterToolDefinition.Serialization.cs | 126 - .../CodeInterpreterToolDefinition.cs | 29 - ...deInterpreterToolResource.Serialization.cs | 4 +- .../Generated/CodeInterpreterToolResource.cs | 8 +- .../ConnectedAgentDetails.Serialization.cs | 158 - .../src/Generated/ConnectedAgentDetails.cs | 89 - ...nectedAgentToolDefinition.Serialization.cs | 134 - .../Generated/ConnectedAgentToolDefinition.cs | 44 - .../CreateAgentRequest.Serialization.cs | 379 -- .../src/Generated/CreateAgentRequest.cs | 189 - .../CreateMessageRequest.Serialization.cs | 222 - .../src/Generated/CreateMessageRequest.cs | 159 - .../CreateRunRequest.Serialization.cs | 530 -- .../src/Generated/CreateRunRequest.cs | 281 - ...CreateThreadAndRunRequest.Serialization.cs | 513 -- .../Generated/CreateThreadAndRunRequest.cs | 274 - .../CreateThreadRequest.Serialization.cs | 215 - .../src/Generated/CreateThreadRequest.cs | 83 - .../src/Generated/Docs/VectorStoresClient.xml | 5261 ++++++++++++++++ .../src/Generated/File.Serialization.cs | 164 - .../src/Generated/File.cs | 184 - .../src/Generated/FileSearchRankingOptions.cs | 6 +- .../FileSearchToolDefinition.Serialization.cs | 141 - .../src/Generated/FileSearchToolDefinition.cs | 34 - ...archToolDefinitionDetails.Serialization.cs | 164 - .../FileSearchToolDefinitionDetails.cs | 77 - .../FileSearchToolResource.Serialization.cs | 4 +- .../src/Generated/FileSearchToolResource.cs | 8 +- .../src/Generated/FileState.cs | 75 - .../FunctionToolDefinition.Serialization.cs | 134 - .../src/Generated/FunctionToolDefinition.cs | 30 - .../src/Generated/ImageDetailLevel.cs | 54 - .../src/Generated/IncompleteDetailsReason.cs | 51 - .../IncompleteRunDetails.Serialization.cs | 142 - .../src/Generated/IncompleteRunDetails.cs | 72 - ...ternalAgentDeletionStatus.Serialization.cs | 158 - .../Generated/InternalAgentDeletionStatus.cs | 85 - .../InternalAgentDeletionStatusObject.cs | 48 - ...alAzureFunctionDefinition.Serialization.cs | 158 - .../InternalAzureFunctionDefinition.cs | 89 - ...nterpreterToolCallDetails.Serialization.cs | 160 - .../InternalCodeInterpreterToolCallDetails.cs | 95 - ...nternalFileDeletionStatus.Serialization.cs | 158 - .../Generated/InternalFileDeletionStatus.cs | 85 - .../InternalFileDeletionStatusObject.cs | 48 - .../InternalFileListResponse.Serialization.cs | 160 - .../src/Generated/InternalFileListResponse.cs | 81 - .../InternalFileListResponseObject.cs | 48 - ...nternalFunctionDefinition.Serialization.cs | 168 - .../Generated/InternalFunctionDefinition.cs | 115 - ...stentAgentsResponseFormat.Serialization.cs | 149 - .../InternalPersistentAgentsResponseFormat.cs | 68 - ...edFunctionToolCallDetails.Serialization.cs | 150 - ...InternalRequiredFunctionToolCallDetails.cs | 82 - ...epFunctionToolCallDetails.Serialization.cs | 150 - .../InternalRunStepFunctionToolCallDetails.cs | 82 - ...lSubmitToolOutputsDetails.Serialization.cs | 152 - .../InternalSubmitToolOutputsDetails.cs | 88 - .../MessageAttachment.Serialization.cs | 197 - .../src/Generated/MessageAttachment.cs | 121 - .../src/Generated/MessageBlockType.cs | 54 - .../MessageImageFileParam.Serialization.cs | 157 - .../src/Generated/MessageImageFileParam.cs | 79 - .../MessageImageUriParam.Serialization.cs | 157 - .../src/Generated/MessageImageUriParam.cs | 79 - .../MessageIncompleteDetails.Serialization.cs | 142 - .../src/Generated/MessageIncompleteDetails.cs | 72 - .../MessageIncompleteDetailsReason.cs | 60 - .../MessageInputContentBlock.Serialization.cs | 135 - .../src/Generated/MessageInputContentBlock.cs | 69 - ...essageInputImageFileBlock.Serialization.cs | 134 - .../Generated/MessageInputImageFileBlock.cs | 44 - ...MessageInputImageUriBlock.Serialization.cs | 134 - .../Generated/MessageInputImageUriBlock.cs | 44 - .../MessageInputTextBlock.Serialization.cs | 134 - .../src/Generated/MessageInputTextBlock.cs | 44 - .../src/Generated/MessageStatus.cs | 54 - ...osoftFabricToolDefinition.Serialization.cs | 134 - .../MicrosoftFabricToolDefinition.cs | 44 - ...enApiAnonymousAuthDetails.Serialization.cs | 126 - .../Generated/OpenApiAnonymousAuthDetails.cs | 29 - .../OpenApiAuthDetails.Serialization.cs | 135 - .../src/Generated/OpenApiAuthDetails.cs | 69 - .../src/Generated/OpenApiAuthType.cs | 59 - ...nApiConnectionAuthDetails.Serialization.cs | 134 - .../Generated/OpenApiConnectionAuthDetails.cs | 44 - ...iConnectionSecurityScheme.Serialization.cs | 142 - .../OpenApiConnectionSecurityScheme.cs | 75 - ...OpenApiFunctionDefinition.Serialization.cs | 233 - .../Generated/OpenApiFunctionDefinition.cs | 142 - ...OpenApiManagedAuthDetails.Serialization.cs | 134 - .../Generated/OpenApiManagedAuthDetails.cs | 44 - ...nApiManagedSecurityScheme.Serialization.cs | 142 - .../Generated/OpenApiManagedSecurityScheme.cs | 75 - .../OpenApiToolDefinition.Serialization.cs | 134 - .../src/Generated/OpenApiToolDefinition.cs | 44 - .../PersistentAgent.Serialization.cs | 379 -- .../src/Generated/PersistentAgent.cs | 236 - .../PersistentAgentFileInfo.Serialization.cs | 217 - .../src/Generated/PersistentAgentFileInfo.cs | 110 - .../PersistentAgentFileInfoObject.cs | 48 - .../src/Generated/PersistentAgentObject.cs | 48 - .../PersistentAgentThread.Serialization.cs | 215 - .../src/Generated/PersistentAgentThread.cs | 108 - ...gentThreadCreationOptions.Serialization.cs | 215 - .../PersistentAgentThreadCreationOptions.cs | 83 - .../Generated/PersistentAgentThreadObject.cs | 48 - .../PersistentAgentsAdministrationClient.cs | 879 --- .../src/Generated/PersistentAgentsFiles.cs | 632 -- ...sistentAgentsFunctionName.Serialization.cs | 142 - .../Generated/PersistentAgentsFunctionName.cs | 75 - .../Generated/PersistentAgentsModelFactory.cs | 516 +- ...tentAgentsNamedToolChoice.Serialization.cs | 157 - .../PersistentAgentsNamedToolChoice.cs | 76 - .../PersistentAgentsNamedToolChoiceType.cs | 72 - .../PersistentAgentsResponseFormatMode.cs | 51 - .../PersistentAgentsToolChoiceOptionMode.cs | 51 - .../PersistentThreadMessage.Serialization.cs | 376 -- .../src/Generated/PersistentThreadMessage.cs | 165 - .../PersistentThreadMessageObject.cs | 48 - .../Generated/RequiredAction.Serialization.cs | 133 - .../src/Generated/RequiredAction.cs | 69 - .../RequiredFunctionToolCall.Serialization.cs | 140 - .../src/Generated/RequiredFunctionToolCall.cs | 43 - .../RequiredToolCall.Serialization.cs | 119 - .../src/Generated/RequiredToolCall.cs | 47 - .../src/Generated/ResponseFormat.cs | 51 - .../ResponseFormatJsonSchema.Serialization.cs | 168 - .../src/Generated/ResponseFormatJsonSchema.cs | 115 - ...ponseFormatJsonSchemaType.Serialization.cs | 150 - .../Generated/ResponseFormatJsonSchemaType.cs | 80 - .../ResponseFormatJsonSchemaTypeType.cs | 48 - .../src/Generated/RunAdditionalFieldList.cs | 48 - .../RunCompletionUsage.Serialization.cs | 158 - .../src/Generated/RunCompletionUsage.cs | 84 - .../src/Generated/RunError.Serialization.cs | 150 - .../src/Generated/RunError.cs | 82 - .../src/Generated/RunStatus.cs | 69 - .../src/Generated/RunStep.Serialization.cs | 357 -- .../src/Generated/RunStep.cs | 176 - ...StepAzureAISearchToolCall.Serialization.cs | 151 - .../Generated/RunStepAzureAISearchToolCall.cs | 50 - ...pBingCustomSearchToolCall.Serialization.cs | 151 - .../RunStepBingCustomSearchToolCall.cs | 50 - ...StepBingGroundingToolCall.Serialization.cs | 151 - .../Generated/RunStepBingGroundingToolCall.cs | 50 - ...odeInterpreterImageOutput.Serialization.cs | 134 - .../RunStepCodeInterpreterImageOutput.cs | 44 - ...InterpreterImageReference.Serialization.cs | 142 - .../RunStepCodeInterpreterImageReference.cs | 75 - ...pCodeInterpreterLogOutput.Serialization.cs | 134 - .../RunStepCodeInterpreterLogOutput.cs | 44 - ...epCodeInterpreterToolCall.Serialization.cs | 140 - .../RunStepCodeInterpreterToolCall.cs | 47 - ...InterpreterToolCallOutput.Serialization.cs | 134 - .../RunStepCodeInterpreterToolCallOutput.cs | 69 - .../RunStepCompletionUsage.Serialization.cs | 158 - .../src/Generated/RunStepCompletionUsage.cs | 84 - .../Generated/RunStepDetails.Serialization.cs | 134 - .../src/Generated/RunStepDetails.cs | 69 - .../Generated/RunStepError.Serialization.cs | 150 - .../src/Generated/RunStepError.cs | 81 - .../src/Generated/RunStepErrorCode.cs | 51 - ...RunStepFileSearchToolCall.Serialization.cs | 140 - .../Generated/RunStepFileSearchToolCall.cs | 50 - .../RunStepFunctionToolCall.Serialization.cs | 140 - .../src/Generated/RunStepFunctionToolCall.cs | 47 - ...tepMessageCreationDetails.Serialization.cs | 134 - .../RunStepMessageCreationDetails.cs | 44 - ...pMessageCreationReference.Serialization.cs | 142 - .../RunStepMessageCreationReference.cs | 75 - ...epMicrosoftFabricToolCall.Serialization.cs | 151 - .../RunStepMicrosoftFabricToolCall.cs | 50 - .../src/Generated/RunStepObject.cs | 48 - .../RunStepOpenAPIToolCall.Serialization.cs | 151 - .../src/Generated/RunStepOpenAPIToolCall.cs | 50 - ...RunStepSharepointToolCall.Serialization.cs | 151 - .../Generated/RunStepSharepointToolCall.cs | 50 - .../src/Generated/RunStepStatus.cs | 60 - .../RunStepToolCall.Serialization.cs | 143 - .../src/Generated/RunStepToolCall.cs | 83 - .../RunStepToolCallDetails.Serialization.cs | 144 - .../src/Generated/RunStepToolCallDetails.cs | 57 - .../src/Generated/RunStepType.cs | 51 - .../SharepointToolDefinition.Serialization.cs | 134 - .../src/Generated/SharepointToolDefinition.cs | 44 - .../SubmitToolOutputsAction.Serialization.cs | 134 - .../src/Generated/SubmitToolOutputsAction.cs | 41 - ...itToolOutputsToRunRequest.Serialization.cs | 175 - .../SubmitToolOutputsToRunRequest.cs | 80 - .../ThreadDeletionStatus.Serialization.cs | 158 - .../src/Generated/ThreadDeletionStatus.cs | 85 - .../Generated/ThreadDeletionStatusObject.cs | 48 - .../ThreadMessageOptions.Serialization.cs | 222 - .../src/Generated/ThreadMessageOptions.cs | 162 - .../src/Generated/ThreadMessages.cs | 537 -- .../src/Generated/ThreadRun.Serialization.cs | 625 -- .../src/Generated/ThreadRun.cs | 341 -- .../src/Generated/ThreadRunObject.cs | 48 - .../src/Generated/ThreadRunSteps.cs | 270 - .../src/Generated/ThreadRuns.cs | 793 --- .../src/Generated/Threads.cs | 608 -- .../Generated/ToolConnection.Serialization.cs | 142 - .../src/Generated/ToolConnection.cs | 75 - .../ToolConnectionList.Serialization.cs | 159 - .../src/Generated/ToolConnectionList.cs | 72 - .../Generated/ToolDefinition.Serialization.cs | 143 - .../src/Generated/ToolDefinition.cs | 69 - .../src/Generated/ToolOutput.Serialization.cs | 156 - .../src/Generated/ToolOutput.cs | 69 - .../src/Generated/ToolResources.cs | 8 +- .../src/Generated/Truncation.Serialization.cs | 165 - .../src/Generated/Truncation.cs | 91 - .../src/Generated/TruncationStrategy.cs | 51 - ...nMessageInputContentBlock.Serialization.cs | 126 - .../UnknownMessageInputContentBlock.cs | 28 - ...UnknownOpenApiAuthDetails.Serialization.cs | 126 - .../Generated/UnknownOpenApiAuthDetails.cs | 28 - .../UnknownRequiredAction.Serialization.cs | 126 - .../src/Generated/UnknownRequiredAction.cs | 28 - .../UnknownRequiredToolCall.Serialization.cs | 132 - .../src/Generated/UnknownRequiredToolCall.cs | 29 - ...InterpreterToolCallOutput.Serialization.cs | 126 - ...ownRunStepCodeInterpreterToolCallOutput.cs | 28 - .../UnknownRunStepDetails.Serialization.cs | 126 - .../src/Generated/UnknownRunStepDetails.cs | 28 - .../UnknownRunStepToolCall.Serialization.cs | 132 - .../src/Generated/UnknownRunStepToolCall.cs | 29 - .../UnknownToolDefinition.Serialization.cs | 126 - .../src/Generated/UnknownToolDefinition.cs | 28 - .../UpdateAgentRequest.Serialization.cs | 374 -- .../src/Generated/UpdateAgentRequest.cs | 179 - ...preterToolResourceOptions.Serialization.cs | 159 - ...pdateCodeInterpreterToolResourceOptions.cs | 66 - ...SearchToolResourceOptions.Serialization.cs | 159 - .../UpdateFileSearchToolResourceOptions.cs | 66 - .../UpdateMessageRequest.Serialization.cs | 167 - .../src/Generated/UpdateMessageRequest.cs | 66 - .../UpdateRunRequest.Serialization.cs | 167 - .../src/Generated/UpdateRunRequest.cs | 66 - .../UpdateThreadRequest.Serialization.cs | 190 - .../src/Generated/UpdateThreadRequest.cs | 78 - ...pdateToolResourcesOptions.Serialization.cs | 179 - .../Generated/UpdateToolResourcesOptions.cs | 83 - .../UploadFileRequest.Serialization.cs | 179 - .../src/Generated/UploadFileRequest.cs | 85 - .../Generated/VectorStoreConfigurations.cs | 6 +- .../src/Generated/VectorStoreDataSource.cs | 4 +- .../src/Generated/VectorStoreFileBatches.cs | 508 -- .../src/Generated/VectorStoreFiles.cs | 505 -- .../src/Generated/VectorStores.cs | 614 -- .../src/Generated/VectorStoresClient.cs | 1837 ++++++ ...ptions.cs => VectorStoresClientOptions.cs} | 8 +- .../Samples/Samples_VectorStoresClient.cs | 5395 +++++++++++++++++ .../tsp-location.yaml | 2 +- 280 files changed, 12703 insertions(+), 35627 deletions(-) delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchToolDefinition.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchToolDefinition.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionBinding.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionBinding.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionBindingType.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionStorageQueue.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionStorageQueue.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionToolDefinition.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionToolDefinition.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchConfiguration.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchConfiguration.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchConfigurationList.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchConfigurationList.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchToolDefinition.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchToolDefinition.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingSearchConfiguration.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingSearchConfiguration.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingSearchConfigurationList.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingSearchConfigurationList.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingToolDefinition.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingToolDefinition.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CodeInterpreterToolDefinition.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CodeInterpreterToolDefinition.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ConnectedAgentDetails.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ConnectedAgentDetails.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ConnectedAgentToolDefinition.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ConnectedAgentToolDefinition.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateAgentRequest.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateAgentRequest.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateMessageRequest.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateMessageRequest.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateRunRequest.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateRunRequest.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateThreadAndRunRequest.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateThreadAndRunRequest.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateThreadRequest.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateThreadRequest.cs create mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/Docs/VectorStoresClient.xml delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/File.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/File.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolDefinition.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolDefinition.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolDefinitionDetails.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolDefinitionDetails.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileState.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FunctionToolDefinition.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FunctionToolDefinition.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ImageDetailLevel.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/IncompleteDetailsReason.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/IncompleteRunDetails.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/IncompleteRunDetails.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalAgentDeletionStatus.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalAgentDeletionStatus.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalAgentDeletionStatusObject.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalAzureFunctionDefinition.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalAzureFunctionDefinition.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalCodeInterpreterToolCallDetails.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalCodeInterpreterToolCallDetails.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileDeletionStatus.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileDeletionStatus.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileDeletionStatusObject.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileListResponse.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileListResponse.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileListResponseObject.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFunctionDefinition.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFunctionDefinition.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalPersistentAgentsResponseFormat.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalPersistentAgentsResponseFormat.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalRequiredFunctionToolCallDetails.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalRequiredFunctionToolCallDetails.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalRunStepFunctionToolCallDetails.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalRunStepFunctionToolCallDetails.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalSubmitToolOutputsDetails.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalSubmitToolOutputsDetails.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageAttachment.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageAttachment.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageBlockType.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageImageFileParam.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageImageFileParam.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageImageUriParam.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageImageUriParam.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageIncompleteDetails.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageIncompleteDetails.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageIncompleteDetailsReason.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputContentBlock.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputContentBlock.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputImageFileBlock.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputImageFileBlock.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputImageUriBlock.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputImageUriBlock.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputTextBlock.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputTextBlock.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageStatus.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MicrosoftFabricToolDefinition.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MicrosoftFabricToolDefinition.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiAnonymousAuthDetails.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiAnonymousAuthDetails.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiAuthDetails.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiAuthDetails.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiAuthType.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiConnectionAuthDetails.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiConnectionAuthDetails.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiConnectionSecurityScheme.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiConnectionSecurityScheme.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiFunctionDefinition.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiFunctionDefinition.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiManagedAuthDetails.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiManagedAuthDetails.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiManagedSecurityScheme.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiManagedSecurityScheme.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiToolDefinition.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiToolDefinition.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgent.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgent.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentFileInfo.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentFileInfo.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentFileInfoObject.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentObject.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentThread.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentThread.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentThreadCreationOptions.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentThreadCreationOptions.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentThreadObject.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsAdministrationClient.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsFiles.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsFunctionName.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsFunctionName.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsNamedToolChoice.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsNamedToolChoice.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsNamedToolChoiceType.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsResponseFormatMode.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsToolChoiceOptionMode.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentThreadMessage.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentThreadMessage.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentThreadMessageObject.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredAction.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredAction.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredFunctionToolCall.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredFunctionToolCall.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredToolCall.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredToolCall.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormat.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormatJsonSchema.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormatJsonSchema.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormatJsonSchemaType.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormatJsonSchemaType.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormatJsonSchemaTypeType.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunAdditionalFieldList.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunCompletionUsage.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunCompletionUsage.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunError.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunError.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStatus.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStep.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStep.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepAzureAISearchToolCall.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepAzureAISearchToolCall.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepBingCustomSearchToolCall.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepBingCustomSearchToolCall.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepBingGroundingToolCall.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepBingGroundingToolCall.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterImageOutput.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterImageOutput.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterImageReference.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterImageReference.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterLogOutput.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterLogOutput.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterToolCall.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterToolCall.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterToolCallOutput.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterToolCallOutput.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCompletionUsage.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCompletionUsage.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepDetails.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepDetails.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepError.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepError.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepErrorCode.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepFileSearchToolCall.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepFileSearchToolCall.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepFunctionToolCall.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepFunctionToolCall.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMessageCreationDetails.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMessageCreationDetails.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMessageCreationReference.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMessageCreationReference.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMicrosoftFabricToolCall.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMicrosoftFabricToolCall.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepObject.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepOpenAPIToolCall.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepOpenAPIToolCall.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepSharepointToolCall.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepSharepointToolCall.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepStatus.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepToolCall.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepToolCall.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepToolCallDetails.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepToolCallDetails.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepType.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SharepointToolDefinition.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SharepointToolDefinition.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SubmitToolOutputsAction.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SubmitToolOutputsAction.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SubmitToolOutputsToRunRequest.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SubmitToolOutputsToRunRequest.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadDeletionStatus.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadDeletionStatus.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadDeletionStatusObject.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadMessageOptions.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadMessageOptions.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadMessages.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRun.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRun.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRunObject.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRunSteps.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRuns.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/Threads.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolConnection.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolConnection.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolConnectionList.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolConnectionList.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolDefinition.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolDefinition.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolOutput.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolOutput.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/Truncation.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/Truncation.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/TruncationStrategy.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownMessageInputContentBlock.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownMessageInputContentBlock.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownOpenApiAuthDetails.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownOpenApiAuthDetails.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRequiredAction.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRequiredAction.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRequiredToolCall.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRequiredToolCall.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepCodeInterpreterToolCallOutput.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepCodeInterpreterToolCallOutput.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepDetails.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepDetails.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepToolCall.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepToolCall.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownToolDefinition.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownToolDefinition.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateAgentRequest.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateAgentRequest.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateCodeInterpreterToolResourceOptions.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateCodeInterpreterToolResourceOptions.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateFileSearchToolResourceOptions.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateFileSearchToolResourceOptions.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateMessageRequest.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateMessageRequest.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateRunRequest.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateRunRequest.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateThreadRequest.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateThreadRequest.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateToolResourcesOptions.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateToolResourcesOptions.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UploadFileRequest.Serialization.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UploadFileRequest.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoreFileBatches.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoreFiles.cs delete mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStores.cs create mode 100644 sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoresClient.cs rename sdk/ai/Azure.AI.Agents.Persistent/src/Generated/{PersistentAgentsAdministrationClientOptions.cs => VectorStoresClientOptions.cs} (70%) create mode 100644 sdk/ai/Azure.AI.Agents.Persistent/tests/Generated/Samples/Samples_VectorStoresClient.cs diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AIAgentsPersistentClientBuilderExtensions.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AIAgentsPersistentClientBuilderExtensions.cs index d407d1ed5ffe..10b50d4b28de 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AIAgentsPersistentClientBuilderExtensions.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AIAgentsPersistentClientBuilderExtensions.cs @@ -11,25 +11,25 @@ namespace Microsoft.Extensions.Azure { - /// Extension methods to add to client builder. + /// Extension methods to add to client builder. public static partial class AIAgentsPersistentClientBuilderExtensions { - /// Registers a instance. + /// Registers a instance. /// The builder to register with. /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. - public static IAzureClientBuilder AddPersistentAgentsAdministrationClient(this TBuilder builder, Uri endpoint) + public static IAzureClientBuilder AddVectorStoresClient(this TBuilder builder, Uri endpoint) where TBuilder : IAzureClientFactoryBuilderWithCredential { - return builder.RegisterClientFactory((options, cred) => new PersistentAgentsAdministrationClient(endpoint, cred, options)); + return builder.RegisterClientFactory((options, cred) => new VectorStoresClient(endpoint, cred, options)); } - /// Registers a instance. + /// Registers a instance. /// The builder to register with. /// The configuration values. - public static IAzureClientBuilder AddPersistentAgentsAdministrationClient(this TBuilder builder, TConfiguration configuration) + public static IAzureClientBuilder AddVectorStoresClient(this TBuilder builder, TConfiguration configuration) where TBuilder : IAzureClientFactoryBuilderWithConfiguration { - return builder.RegisterClientFactory(configuration); + return builder.RegisterClientFactory(configuration); } } } diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AISearchIndexResource.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AISearchIndexResource.cs index 4d504c2142ac..99d86f874224 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AISearchIndexResource.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AISearchIndexResource.cs @@ -49,7 +49,7 @@ public partial class AISearchIndexResource /// An index connection id in an IndexResource attached to this agent. /// The name of an index in an IndexResource attached to this agent. /// or is null. - public AISearchIndexResource(string indexConnectionId, string indexName) + internal AISearchIndexResource(string indexConnectionId, string indexName) { Argument.AssertNotNull(indexConnectionId, nameof(indexConnectionId)); Argument.AssertNotNull(indexName, nameof(indexName)); @@ -83,16 +83,16 @@ internal AISearchIndexResource() } /// An index connection id in an IndexResource attached to this agent. - public string IndexConnectionId { get; set; } + public string IndexConnectionId { get; } /// The name of an index in an IndexResource attached to this agent. - public string IndexName { get; set; } + public string IndexName { get; } /// Type of query in an AIIndexResource attached to this agent. - public AzureAISearchQueryType? QueryType { get; set; } + public AzureAISearchQueryType? QueryType { get; } /// Number of documents to retrieve from search and present to the model. - public int? TopK { get; set; } + public int? TopK { get; } /// filter string for search resource. - public string Filter { get; set; } + public string Filter { get; } /// Index asset id for search resource. - public string IndexAssetId { get; set; } + public string IndexAssetId { get; } } } diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchResource.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchResource.Serialization.cs index ee236005887d..7e40fcea7c7f 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchResource.Serialization.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchResource.Serialization.cs @@ -81,7 +81,7 @@ internal static AzureAISearchResource DeserializeAzureAISearchResource(JsonEleme { return null; } - IList indexes = default; + IReadOnlyList indexes = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchResource.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchResource.cs index 1c8d009cbb4e..97bc66544490 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchResource.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchResource.cs @@ -46,7 +46,7 @@ public partial class AzureAISearchResource private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public AzureAISearchResource() + internal AzureAISearchResource() { IndexList = new ChangeTrackingList(); } @@ -57,7 +57,7 @@ public AzureAISearchResource() /// resource attached to the agent. /// /// Keeps track of any properties unknown to the library. - internal AzureAISearchResource(IList indexList, IDictionary serializedAdditionalRawData) + internal AzureAISearchResource(IReadOnlyList indexList, IDictionary serializedAdditionalRawData) { IndexList = indexList; _serializedAdditionalRawData = serializedAdditionalRawData; @@ -67,6 +67,6 @@ internal AzureAISearchResource(IList indexList, IDictiona /// The indices attached to this agent. There can be a maximum of 1 index /// resource attached to the agent. /// - public IList IndexList { get; } + public IReadOnlyList IndexList { get; } } } diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchToolDefinition.Serialization.cs deleted file mode 100644 index 5da7c6661f83..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchToolDefinition.Serialization.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class AzureAISearchToolDefinition : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(AzureAISearchToolDefinition)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - AzureAISearchToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(AzureAISearchToolDefinition)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAzureAISearchToolDefinition(document.RootElement, options); - } - - internal static AzureAISearchToolDefinition DeserializeAzureAISearchToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AzureAISearchToolDefinition(type, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(AzureAISearchToolDefinition)} does not support writing '{options.Format}' format."); - } - } - - AzureAISearchToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAzureAISearchToolDefinition(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AzureAISearchToolDefinition)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new AzureAISearchToolDefinition FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAzureAISearchToolDefinition(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchToolDefinition.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchToolDefinition.cs deleted file mode 100644 index 4e3f44492aad..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureAISearchToolDefinition.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The input definition information for an Azure AI search tool as used to configure an agent. - public partial class AzureAISearchToolDefinition : ToolDefinition - { - /// Initializes a new instance of . - public AzureAISearchToolDefinition() - { - Type = "azure_ai_search"; - } - - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - internal AzureAISearchToolDefinition(string type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionBinding.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionBinding.Serialization.cs deleted file mode 100644 index 621a736875a1..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionBinding.Serialization.cs +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class AzureFunctionBinding : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(AzureFunctionBinding)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type.ToString()); - writer.WritePropertyName("storage_queue"u8); - writer.WriteObjectValue(StorageQueue, options); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - AzureFunctionBinding IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(AzureFunctionBinding)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAzureFunctionBinding(document.RootElement, options); - } - - internal static AzureFunctionBinding DeserializeAzureFunctionBinding(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AzureFunctionBindingType type = default; - AzureFunctionStorageQueue storageQueue = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) - { - type = new AzureFunctionBindingType(property.Value.GetString()); - continue; - } - if (property.NameEquals("storage_queue"u8)) - { - storageQueue = AzureFunctionStorageQueue.DeserializeAzureFunctionStorageQueue(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AzureFunctionBinding(type, storageQueue, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(AzureFunctionBinding)} does not support writing '{options.Format}' format."); - } - } - - AzureFunctionBinding IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAzureFunctionBinding(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AzureFunctionBinding)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static AzureFunctionBinding FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAzureFunctionBinding(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionBinding.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionBinding.cs deleted file mode 100644 index 7cc1a5a7cfd4..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionBinding.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The structure for keeping storage queue name and URI. - public partial class AzureFunctionBinding - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// Storage queue. - /// is null. - public AzureFunctionBinding(AzureFunctionStorageQueue storageQueue) - { - Argument.AssertNotNull(storageQueue, nameof(storageQueue)); - - StorageQueue = storageQueue; - } - - /// Initializes a new instance of . - /// The type of binding, which is always 'storage_queue'. - /// Storage queue. - /// Keeps track of any properties unknown to the library. - internal AzureFunctionBinding(AzureFunctionBindingType type, AzureFunctionStorageQueue storageQueue, IDictionary serializedAdditionalRawData) - { - Type = type; - StorageQueue = storageQueue; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AzureFunctionBinding() - { - } - - /// The type of binding, which is always 'storage_queue'. - public AzureFunctionBindingType Type { get; } = AzureFunctionBindingType.StorageQueue; - - /// Storage queue. - public AzureFunctionStorageQueue StorageQueue { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionBindingType.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionBindingType.cs deleted file mode 100644 index 7c123058e5aa..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionBindingType.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// The AzureFunctionBinding_type. - public readonly partial struct AzureFunctionBindingType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AzureFunctionBindingType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string StorageQueueValue = "storage_queue"; - - /// storage_queue. - public static AzureFunctionBindingType StorageQueue { get; } = new AzureFunctionBindingType(StorageQueueValue); - /// Determines if two values are the same. - public static bool operator ==(AzureFunctionBindingType left, AzureFunctionBindingType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AzureFunctionBindingType left, AzureFunctionBindingType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AzureFunctionBindingType(string value) => new AzureFunctionBindingType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AzureFunctionBindingType other && Equals(other); - /// - public bool Equals(AzureFunctionBindingType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionStorageQueue.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionStorageQueue.Serialization.cs deleted file mode 100644 index 95fba2e50899..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionStorageQueue.Serialization.cs +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class AzureFunctionStorageQueue : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(AzureFunctionStorageQueue)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("queue_service_endpoint"u8); - writer.WriteStringValue(StorageServiceEndpoint); - writer.WritePropertyName("queue_name"u8); - writer.WriteStringValue(QueueName); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - AzureFunctionStorageQueue IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(AzureFunctionStorageQueue)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAzureFunctionStorageQueue(document.RootElement, options); - } - - internal static AzureFunctionStorageQueue DeserializeAzureFunctionStorageQueue(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string queueServiceEndpoint = default; - string queueName = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("queue_service_endpoint"u8)) - { - queueServiceEndpoint = property.Value.GetString(); - continue; - } - if (property.NameEquals("queue_name"u8)) - { - queueName = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AzureFunctionStorageQueue(queueServiceEndpoint, queueName, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(AzureFunctionStorageQueue)} does not support writing '{options.Format}' format."); - } - } - - AzureFunctionStorageQueue IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAzureFunctionStorageQueue(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AzureFunctionStorageQueue)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static AzureFunctionStorageQueue FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAzureFunctionStorageQueue(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionStorageQueue.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionStorageQueue.cs deleted file mode 100644 index 6e0515c5d320..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionStorageQueue.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The structure for keeping storage queue name and URI. - public partial class AzureFunctionStorageQueue - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// URI to the Azure Storage Queue service allowing you to manipulate a queue. - /// The name of an Azure function storage queue. - /// or is null. - public AzureFunctionStorageQueue(string storageServiceEndpoint, string queueName) - { - Argument.AssertNotNull(storageServiceEndpoint, nameof(storageServiceEndpoint)); - Argument.AssertNotNull(queueName, nameof(queueName)); - - StorageServiceEndpoint = storageServiceEndpoint; - QueueName = queueName; - } - - /// Initializes a new instance of . - /// URI to the Azure Storage Queue service allowing you to manipulate a queue. - /// The name of an Azure function storage queue. - /// Keeps track of any properties unknown to the library. - internal AzureFunctionStorageQueue(string storageServiceEndpoint, string queueName, IDictionary serializedAdditionalRawData) - { - StorageServiceEndpoint = storageServiceEndpoint; - QueueName = queueName; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AzureFunctionStorageQueue() - { - } - - /// URI to the Azure Storage Queue service allowing you to manipulate a queue. - public string StorageServiceEndpoint { get; set; } - /// The name of an Azure function storage queue. - public string QueueName { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionToolDefinition.Serialization.cs deleted file mode 100644 index 4cb63e5da159..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionToolDefinition.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class AzureFunctionToolDefinition : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(AzureFunctionToolDefinition)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("azure_function"u8); - writer.WriteObjectValue(InternalAzureFunction, options); - } - - AzureFunctionToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(AzureFunctionToolDefinition)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAzureFunctionToolDefinition(document.RootElement, options); - } - - internal static AzureFunctionToolDefinition DeserializeAzureFunctionToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - InternalAzureFunctionDefinition azureFunction = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("azure_function"u8)) - { - azureFunction = InternalAzureFunctionDefinition.DeserializeInternalAzureFunctionDefinition(property.Value, options); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AzureFunctionToolDefinition(type, serializedAdditionalRawData, azureFunction); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(AzureFunctionToolDefinition)} does not support writing '{options.Format}' format."); - } - } - - AzureFunctionToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAzureFunctionToolDefinition(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AzureFunctionToolDefinition)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new AzureFunctionToolDefinition FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAzureFunctionToolDefinition(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionToolDefinition.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionToolDefinition.cs deleted file mode 100644 index 3fa567120be9..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AzureFunctionToolDefinition.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The input definition information for a azure function tool as used to configure an agent. - public partial class AzureFunctionToolDefinition : ToolDefinition - { - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - /// The definition of the concrete function that the function tool should call. - internal AzureFunctionToolDefinition(string type, IDictionary serializedAdditionalRawData, InternalAzureFunctionDefinition internalAzureFunction) : base(type, serializedAdditionalRawData) - { - InternalAzureFunction = internalAzureFunction; - } - - /// Initializes a new instance of for deserialization. - internal AzureFunctionToolDefinition() - { - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchConfiguration.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchConfiguration.Serialization.cs deleted file mode 100644 index ac57ac91f74f..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchConfiguration.Serialization.cs +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class BingCustomSearchConfiguration : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(BingCustomSearchConfiguration)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("connection_id"u8); - writer.WriteStringValue(ConnectionId); - writer.WritePropertyName("instance_name"u8); - writer.WriteStringValue(InstanceName); - if (Optional.IsDefined(Market)) - { - writer.WritePropertyName("market"u8); - writer.WriteStringValue(Market); - } - if (Optional.IsDefined(SetLang)) - { - writer.WritePropertyName("set_lang"u8); - writer.WriteStringValue(SetLang); - } - if (Optional.IsDefined(Count)) - { - writer.WritePropertyName("count"u8); - writer.WriteNumberValue(Count.Value); - } - if (Optional.IsDefined(Freshness)) - { - writer.WritePropertyName("freshness"u8); - writer.WriteStringValue(Freshness); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - BingCustomSearchConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(BingCustomSearchConfiguration)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeBingCustomSearchConfiguration(document.RootElement, options); - } - - internal static BingCustomSearchConfiguration DeserializeBingCustomSearchConfiguration(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string connectionId = default; - string instanceName = default; - string market = default; - string setLang = default; - long? count = default; - string freshness = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("connection_id"u8)) - { - connectionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("instance_name"u8)) - { - instanceName = property.Value.GetString(); - continue; - } - if (property.NameEquals("market"u8)) - { - market = property.Value.GetString(); - continue; - } - if (property.NameEquals("set_lang"u8)) - { - setLang = property.Value.GetString(); - continue; - } - if (property.NameEquals("count"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - count = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("freshness"u8)) - { - freshness = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new BingCustomSearchConfiguration( - connectionId, - instanceName, - market, - setLang, - count, - freshness, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(BingCustomSearchConfiguration)} does not support writing '{options.Format}' format."); - } - } - - BingCustomSearchConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeBingCustomSearchConfiguration(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(BingCustomSearchConfiguration)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static BingCustomSearchConfiguration FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeBingCustomSearchConfiguration(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchConfiguration.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchConfiguration.cs deleted file mode 100644 index a157244c40fb..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchConfiguration.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// A bing custom search configuration. - public partial class BingCustomSearchConfiguration - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// Connection id for grounding with bing search. - /// Name of the custom configuration instance given to config. - /// or is null. - public BingCustomSearchConfiguration(string connectionId, string instanceName) - { - Argument.AssertNotNull(connectionId, nameof(connectionId)); - Argument.AssertNotNull(instanceName, nameof(instanceName)); - - ConnectionId = connectionId; - InstanceName = instanceName; - } - - /// Initializes a new instance of . - /// Connection id for grounding with bing search. - /// Name of the custom configuration instance given to config. - /// The market where the results come from. - /// The language to use for user interface strings when calling Bing API. - /// The number of search results to return in the bing api response. - /// Filter search results by a specific time range. Accepted values: https://learn.microsoft.com/bing/search-apis/bing-web-search/reference/query-parameters. - /// Keeps track of any properties unknown to the library. - internal BingCustomSearchConfiguration(string connectionId, string instanceName, string market, string setLang, long? count, string freshness, IDictionary serializedAdditionalRawData) - { - ConnectionId = connectionId; - InstanceName = instanceName; - Market = market; - SetLang = setLang; - Count = count; - Freshness = freshness; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal BingCustomSearchConfiguration() - { - } - - /// Connection id for grounding with bing search. - public string ConnectionId { get; set; } - /// Name of the custom configuration instance given to config. - public string InstanceName { get; set; } - /// The market where the results come from. - public string Market { get; set; } - /// The language to use for user interface strings when calling Bing API. - public string SetLang { get; set; } - /// The number of search results to return in the bing api response. - public long? Count { get; set; } - /// Filter search results by a specific time range. Accepted values: https://learn.microsoft.com/bing/search-apis/bing-web-search/reference/query-parameters. - public string Freshness { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchConfigurationList.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchConfigurationList.Serialization.cs deleted file mode 100644 index 1f16b0532430..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchConfigurationList.Serialization.cs +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class BingCustomSearchConfigurationList : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(BingCustomSearchConfigurationList)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("search_configurations"u8); - writer.WriteStartArray(); - foreach (var item in SearchConfigurations) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - BingCustomSearchConfigurationList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(BingCustomSearchConfigurationList)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeBingCustomSearchConfigurationList(document.RootElement, options); - } - - internal static BingCustomSearchConfigurationList DeserializeBingCustomSearchConfigurationList(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList searchConfigurations = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("search_configurations"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(BingCustomSearchConfiguration.DeserializeBingCustomSearchConfiguration(item, options)); - } - searchConfigurations = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new BingCustomSearchConfigurationList(searchConfigurations, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(BingCustomSearchConfigurationList)} does not support writing '{options.Format}' format."); - } - } - - BingCustomSearchConfigurationList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeBingCustomSearchConfigurationList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(BingCustomSearchConfigurationList)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static BingCustomSearchConfigurationList FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeBingCustomSearchConfigurationList(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchConfigurationList.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchConfigurationList.cs deleted file mode 100644 index ba154aacae2b..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchConfigurationList.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.AI.Agents.Persistent -{ - /// A list of search configurations currently used by the `bing_custom_search` tool. - public partial class BingCustomSearchConfigurationList - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// - /// The connections attached to this tool. There can be a maximum of 1 connection - /// resource attached to the tool. - /// - /// is null. - public BingCustomSearchConfigurationList(IEnumerable searchConfigurations) - { - Argument.AssertNotNull(searchConfigurations, nameof(searchConfigurations)); - - SearchConfigurations = searchConfigurations.ToList(); - } - - /// Initializes a new instance of . - /// - /// The connections attached to this tool. There can be a maximum of 1 connection - /// resource attached to the tool. - /// - /// Keeps track of any properties unknown to the library. - internal BingCustomSearchConfigurationList(IList searchConfigurations, IDictionary serializedAdditionalRawData) - { - SearchConfigurations = searchConfigurations; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal BingCustomSearchConfigurationList() - { - } - - /// - /// The connections attached to this tool. There can be a maximum of 1 connection - /// resource attached to the tool. - /// - public IList SearchConfigurations { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchToolDefinition.Serialization.cs deleted file mode 100644 index 020abce9e0ea..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchToolDefinition.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class BingCustomSearchToolDefinition : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(BingCustomSearchToolDefinition)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("bing_custom_search"u8); - writer.WriteObjectValue(BingCustomSearch, options); - } - - BingCustomSearchToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(BingCustomSearchToolDefinition)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeBingCustomSearchToolDefinition(document.RootElement, options); - } - - internal static BingCustomSearchToolDefinition DeserializeBingCustomSearchToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - BingCustomSearchConfigurationList bingCustomSearch = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("bing_custom_search"u8)) - { - bingCustomSearch = BingCustomSearchConfigurationList.DeserializeBingCustomSearchConfigurationList(property.Value, options); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new BingCustomSearchToolDefinition(type, serializedAdditionalRawData, bingCustomSearch); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(BingCustomSearchToolDefinition)} does not support writing '{options.Format}' format."); - } - } - - BingCustomSearchToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeBingCustomSearchToolDefinition(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(BingCustomSearchToolDefinition)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new BingCustomSearchToolDefinition FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeBingCustomSearchToolDefinition(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchToolDefinition.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchToolDefinition.cs deleted file mode 100644 index 3018f822f2a4..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingCustomSearchToolDefinition.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The input definition information for a Bing custom search tool as used to configure an agent. - public partial class BingCustomSearchToolDefinition : ToolDefinition - { - /// Initializes a new instance of . - /// The list of search configurations used by the bing custom search tool. - /// is null. - public BingCustomSearchToolDefinition(BingCustomSearchConfigurationList bingCustomSearch) - { - Argument.AssertNotNull(bingCustomSearch, nameof(bingCustomSearch)); - - Type = "bing_custom_search"; - BingCustomSearch = bingCustomSearch; - } - - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - /// The list of search configurations used by the bing custom search tool. - internal BingCustomSearchToolDefinition(string type, IDictionary serializedAdditionalRawData, BingCustomSearchConfigurationList bingCustomSearch) : base(type, serializedAdditionalRawData) - { - BingCustomSearch = bingCustomSearch; - } - - /// Initializes a new instance of for deserialization. - internal BingCustomSearchToolDefinition() - { - } - - /// The list of search configurations used by the bing custom search tool. - public BingCustomSearchConfigurationList BingCustomSearch { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingSearchConfiguration.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingSearchConfiguration.Serialization.cs deleted file mode 100644 index 5e7f8302e757..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingSearchConfiguration.Serialization.cs +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class BingGroundingSearchConfiguration : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(BingGroundingSearchConfiguration)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("connection_id"u8); - writer.WriteStringValue(ConnectionId); - if (Optional.IsDefined(Market)) - { - writer.WritePropertyName("market"u8); - writer.WriteStringValue(Market); - } - if (Optional.IsDefined(SetLang)) - { - writer.WritePropertyName("set_lang"u8); - writer.WriteStringValue(SetLang); - } - if (Optional.IsDefined(Count)) - { - writer.WritePropertyName("count"u8); - writer.WriteNumberValue(Count.Value); - } - if (Optional.IsDefined(Freshness)) - { - writer.WritePropertyName("freshness"u8); - writer.WriteStringValue(Freshness); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - BingGroundingSearchConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(BingGroundingSearchConfiguration)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeBingGroundingSearchConfiguration(document.RootElement, options); - } - - internal static BingGroundingSearchConfiguration DeserializeBingGroundingSearchConfiguration(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string connectionId = default; - string market = default; - string setLang = default; - long? count = default; - string freshness = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("connection_id"u8)) - { - connectionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("market"u8)) - { - market = property.Value.GetString(); - continue; - } - if (property.NameEquals("set_lang"u8)) - { - setLang = property.Value.GetString(); - continue; - } - if (property.NameEquals("count"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - count = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("freshness"u8)) - { - freshness = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new BingGroundingSearchConfiguration( - connectionId, - market, - setLang, - count, - freshness, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(BingGroundingSearchConfiguration)} does not support writing '{options.Format}' format."); - } - } - - BingGroundingSearchConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeBingGroundingSearchConfiguration(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(BingGroundingSearchConfiguration)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static BingGroundingSearchConfiguration FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeBingGroundingSearchConfiguration(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingSearchConfiguration.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingSearchConfiguration.cs deleted file mode 100644 index 49aa44f4f225..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingSearchConfiguration.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Search configuration for Bing Grounding. - public partial class BingGroundingSearchConfiguration - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// Connection id for grounding with bing search. - /// is null. - public BingGroundingSearchConfiguration(string connectionId) - { - Argument.AssertNotNull(connectionId, nameof(connectionId)); - - ConnectionId = connectionId; - } - - /// Initializes a new instance of . - /// Connection id for grounding with bing search. - /// The market where the results come from. - /// The language to use for user interface strings when calling Bing API. - /// The number of search results to return in the bing api response. - /// Filter search results by a specific time range. Accepted values: https://learn.microsoft.com/bing/search-apis/bing-web-search/reference/query-parameters. - /// Keeps track of any properties unknown to the library. - internal BingGroundingSearchConfiguration(string connectionId, string market, string setLang, long? count, string freshness, IDictionary serializedAdditionalRawData) - { - ConnectionId = connectionId; - Market = market; - SetLang = setLang; - Count = count; - Freshness = freshness; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal BingGroundingSearchConfiguration() - { - } - - /// Connection id for grounding with bing search. - public string ConnectionId { get; set; } - /// The market where the results come from. - public string Market { get; set; } - /// The language to use for user interface strings when calling Bing API. - public string SetLang { get; set; } - /// The number of search results to return in the bing api response. - public long? Count { get; set; } - /// Filter search results by a specific time range. Accepted values: https://learn.microsoft.com/bing/search-apis/bing-web-search/reference/query-parameters. - public string Freshness { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingSearchConfigurationList.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingSearchConfigurationList.Serialization.cs deleted file mode 100644 index d583341aa27b..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingSearchConfigurationList.Serialization.cs +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class BingGroundingSearchConfigurationList : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(BingGroundingSearchConfigurationList)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("search_configurations"u8); - writer.WriteStartArray(); - foreach (var item in SearchConfigurations) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - BingGroundingSearchConfigurationList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(BingGroundingSearchConfigurationList)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeBingGroundingSearchConfigurationList(document.RootElement, options); - } - - internal static BingGroundingSearchConfigurationList DeserializeBingGroundingSearchConfigurationList(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList searchConfigurations = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("search_configurations"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(BingGroundingSearchConfiguration.DeserializeBingGroundingSearchConfiguration(item, options)); - } - searchConfigurations = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new BingGroundingSearchConfigurationList(searchConfigurations, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(BingGroundingSearchConfigurationList)} does not support writing '{options.Format}' format."); - } - } - - BingGroundingSearchConfigurationList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeBingGroundingSearchConfigurationList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(BingGroundingSearchConfigurationList)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static BingGroundingSearchConfigurationList FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeBingGroundingSearchConfigurationList(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingSearchConfigurationList.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingSearchConfigurationList.cs deleted file mode 100644 index 5b34ea34ef69..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingSearchConfigurationList.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.AI.Agents.Persistent -{ - /// A list of search configurations currently used by the `bing_grounding` tool. - public partial class BingGroundingSearchConfigurationList - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// - /// The search configurations attached to this tool. There can be a maximum of 1 - /// search configuration resource attached to the tool. - /// - /// is null. - public BingGroundingSearchConfigurationList(IEnumerable searchConfigurations) - { - Argument.AssertNotNull(searchConfigurations, nameof(searchConfigurations)); - - SearchConfigurations = searchConfigurations.ToList(); - } - - /// Initializes a new instance of . - /// - /// The search configurations attached to this tool. There can be a maximum of 1 - /// search configuration resource attached to the tool. - /// - /// Keeps track of any properties unknown to the library. - internal BingGroundingSearchConfigurationList(IList searchConfigurations, IDictionary serializedAdditionalRawData) - { - SearchConfigurations = searchConfigurations; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal BingGroundingSearchConfigurationList() - { - } - - /// - /// The search configurations attached to this tool. There can be a maximum of 1 - /// search configuration resource attached to the tool. - /// - public IList SearchConfigurations { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingToolDefinition.Serialization.cs deleted file mode 100644 index a20b3dbdda1c..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingToolDefinition.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class BingGroundingToolDefinition : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(BingGroundingToolDefinition)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("bing_grounding"u8); - writer.WriteObjectValue(BingGrounding, options); - } - - BingGroundingToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(BingGroundingToolDefinition)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeBingGroundingToolDefinition(document.RootElement, options); - } - - internal static BingGroundingToolDefinition DeserializeBingGroundingToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - BingGroundingSearchConfigurationList bingGrounding = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("bing_grounding"u8)) - { - bingGrounding = BingGroundingSearchConfigurationList.DeserializeBingGroundingSearchConfigurationList(property.Value, options); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new BingGroundingToolDefinition(type, serializedAdditionalRawData, bingGrounding); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(BingGroundingToolDefinition)} does not support writing '{options.Format}' format."); - } - } - - BingGroundingToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeBingGroundingToolDefinition(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(BingGroundingToolDefinition)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new BingGroundingToolDefinition FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeBingGroundingToolDefinition(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingToolDefinition.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingToolDefinition.cs deleted file mode 100644 index d08e6c8b98a9..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/BingGroundingToolDefinition.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The input definition information for a bing grounding search tool as used to configure an agent. - public partial class BingGroundingToolDefinition : ToolDefinition - { - /// Initializes a new instance of . - /// The list of search configurations used by the bing grounding tool. - /// is null. - public BingGroundingToolDefinition(BingGroundingSearchConfigurationList bingGrounding) - { - Argument.AssertNotNull(bingGrounding, nameof(bingGrounding)); - - Type = "bing_grounding"; - BingGrounding = bingGrounding; - } - - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - /// The list of search configurations used by the bing grounding tool. - internal BingGroundingToolDefinition(string type, IDictionary serializedAdditionalRawData, BingGroundingSearchConfigurationList bingGrounding) : base(type, serializedAdditionalRawData) - { - BingGrounding = bingGrounding; - } - - /// Initializes a new instance of for deserialization. - internal BingGroundingToolDefinition() - { - } - - /// The list of search configurations used by the bing grounding tool. - public BingGroundingSearchConfigurationList BingGrounding { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CodeInterpreterToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CodeInterpreterToolDefinition.Serialization.cs deleted file mode 100644 index a0b41f11b338..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CodeInterpreterToolDefinition.Serialization.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class CodeInterpreterToolDefinition : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CodeInterpreterToolDefinition)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - CodeInterpreterToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CodeInterpreterToolDefinition)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCodeInterpreterToolDefinition(document.RootElement, options); - } - - internal static CodeInterpreterToolDefinition DeserializeCodeInterpreterToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new CodeInterpreterToolDefinition(type, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(CodeInterpreterToolDefinition)} does not support writing '{options.Format}' format."); - } - } - - CodeInterpreterToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCodeInterpreterToolDefinition(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(CodeInterpreterToolDefinition)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new CodeInterpreterToolDefinition FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCodeInterpreterToolDefinition(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CodeInterpreterToolDefinition.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CodeInterpreterToolDefinition.cs deleted file mode 100644 index 1bb115a36f9c..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CodeInterpreterToolDefinition.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The input definition information for a code interpreter tool as used to configure an agent. - public partial class CodeInterpreterToolDefinition : ToolDefinition - { - /// Initializes a new instance of . - public CodeInterpreterToolDefinition() - { - Type = "code_interpreter"; - } - - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - internal CodeInterpreterToolDefinition(string type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CodeInterpreterToolResource.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CodeInterpreterToolResource.Serialization.cs index 6d18f38700f7..fb927eb6359f 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CodeInterpreterToolResource.Serialization.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CodeInterpreterToolResource.Serialization.cs @@ -91,8 +91,8 @@ internal static CodeInterpreterToolResource DeserializeCodeInterpreterToolResour { return null; } - IList fileIds = default; - IList dataSources = default; + IReadOnlyList fileIds = default; + IReadOnlyList dataSources = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CodeInterpreterToolResource.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CodeInterpreterToolResource.cs index faaba7dc05ec..25ac28ca0d8a 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CodeInterpreterToolResource.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CodeInterpreterToolResource.cs @@ -46,7 +46,7 @@ public partial class CodeInterpreterToolResource private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public CodeInterpreterToolResource() + internal CodeInterpreterToolResource() { FileIds = new ChangeTrackingList(); DataSources = new ChangeTrackingList(); @@ -59,7 +59,7 @@ public CodeInterpreterToolResource() /// /// The data sources to be used. This option is mutually exclusive with the `fileIds` property. /// Keeps track of any properties unknown to the library. - internal CodeInterpreterToolResource(IList fileIds, IList dataSources, IDictionary serializedAdditionalRawData) + internal CodeInterpreterToolResource(IReadOnlyList fileIds, IReadOnlyList dataSources, IDictionary serializedAdditionalRawData) { FileIds = fileIds; DataSources = dataSources; @@ -70,8 +70,8 @@ internal CodeInterpreterToolResource(IList fileIds, IList - public IList FileIds { get; } + public IReadOnlyList FileIds { get; } /// The data sources to be used. This option is mutually exclusive with the `fileIds` property. - public IList DataSources { get; } + public IReadOnlyList DataSources { get; } } } diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ConnectedAgentDetails.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ConnectedAgentDetails.Serialization.cs deleted file mode 100644 index 1af0ca5a9c4f..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ConnectedAgentDetails.Serialization.cs +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class ConnectedAgentDetails : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ConnectedAgentDetails)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ConnectedAgentDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ConnectedAgentDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeConnectedAgentDetails(document.RootElement, options); - } - - internal static ConnectedAgentDetails DeserializeConnectedAgentDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string name = default; - string description = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("description"u8)) - { - description = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ConnectedAgentDetails(id, name, description, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(ConnectedAgentDetails)} does not support writing '{options.Format}' format."); - } - } - - ConnectedAgentDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeConnectedAgentDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ConnectedAgentDetails)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ConnectedAgentDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeConnectedAgentDetails(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ConnectedAgentDetails.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ConnectedAgentDetails.cs deleted file mode 100644 index 857c3be16de9..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ConnectedAgentDetails.cs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Information for connecting one agent to another as a tool. - public partial class ConnectedAgentDetails - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The identifier of the child agent. - /// The name of the agent to be called. - /// A description of what the agent does, used by the model to choose when and how to call the agent. - /// , or is null. - public ConnectedAgentDetails(string id, string name, string description) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(name, nameof(name)); - Argument.AssertNotNull(description, nameof(description)); - - Id = id; - Name = name; - Description = description; - } - - /// Initializes a new instance of . - /// The identifier of the child agent. - /// The name of the agent to be called. - /// A description of what the agent does, used by the model to choose when and how to call the agent. - /// Keeps track of any properties unknown to the library. - internal ConnectedAgentDetails(string id, string name, string description, IDictionary serializedAdditionalRawData) - { - Id = id; - Name = name; - Description = description; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ConnectedAgentDetails() - { - } - - /// The identifier of the child agent. - public string Id { get; set; } - /// The name of the agent to be called. - public string Name { get; set; } - /// A description of what the agent does, used by the model to choose when and how to call the agent. - public string Description { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ConnectedAgentToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ConnectedAgentToolDefinition.Serialization.cs deleted file mode 100644 index ca0a52eadb99..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ConnectedAgentToolDefinition.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class ConnectedAgentToolDefinition : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ConnectedAgentToolDefinition)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("connected_agent"u8); - writer.WriteObjectValue(ConnectedAgent, options); - } - - ConnectedAgentToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ConnectedAgentToolDefinition)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeConnectedAgentToolDefinition(document.RootElement, options); - } - - internal static ConnectedAgentToolDefinition DeserializeConnectedAgentToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ConnectedAgentDetails connectedAgent = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("connected_agent"u8)) - { - connectedAgent = ConnectedAgentDetails.DeserializeConnectedAgentDetails(property.Value, options); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ConnectedAgentToolDefinition(type, serializedAdditionalRawData, connectedAgent); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(ConnectedAgentToolDefinition)} does not support writing '{options.Format}' format."); - } - } - - ConnectedAgentToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeConnectedAgentToolDefinition(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ConnectedAgentToolDefinition)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new ConnectedAgentToolDefinition FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeConnectedAgentToolDefinition(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ConnectedAgentToolDefinition.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ConnectedAgentToolDefinition.cs deleted file mode 100644 index b92b9106ffd7..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ConnectedAgentToolDefinition.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The input definition information for a connected agent tool which defines a domain specific sub-agent. - public partial class ConnectedAgentToolDefinition : ToolDefinition - { - /// Initializes a new instance of . - /// The sub-agent to connect. - /// is null. - public ConnectedAgentToolDefinition(ConnectedAgentDetails connectedAgent) - { - Argument.AssertNotNull(connectedAgent, nameof(connectedAgent)); - - Type = "connected_agent"; - ConnectedAgent = connectedAgent; - } - - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - /// The sub-agent to connect. - internal ConnectedAgentToolDefinition(string type, IDictionary serializedAdditionalRawData, ConnectedAgentDetails connectedAgent) : base(type, serializedAdditionalRawData) - { - ConnectedAgent = connectedAgent; - } - - /// Initializes a new instance of for deserialization. - internal ConnectedAgentToolDefinition() - { - } - - /// The sub-agent to connect. - public ConnectedAgentDetails ConnectedAgent { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateAgentRequest.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateAgentRequest.Serialization.cs deleted file mode 100644 index 5f0b9768f7e1..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateAgentRequest.Serialization.cs +++ /dev/null @@ -1,379 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class CreateAgentRequest : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CreateAgentRequest)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("model"u8); - writer.WriteStringValue(Model); - if (Optional.IsDefined(Name)) - { - if (Name != null) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - else - { - writer.WriteNull("name"); - } - } - if (Optional.IsDefined(Description)) - { - if (Description != null) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - else - { - writer.WriteNull("description"); - } - } - if (Optional.IsDefined(Instructions)) - { - if (Instructions != null) - { - writer.WritePropertyName("instructions"u8); - writer.WriteStringValue(Instructions); - } - else - { - writer.WriteNull("instructions"); - } - } - if (Optional.IsCollectionDefined(Tools)) - { - writer.WritePropertyName("tools"u8); - writer.WriteStartArray(); - foreach (var item in Tools) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(ToolResources)) - { - if (ToolResources != null) - { - writer.WritePropertyName("tool_resources"u8); - writer.WriteObjectValue(ToolResources, options); - } - else - { - writer.WriteNull("tool_resources"); - } - } - if (Optional.IsDefined(Temperature)) - { - if (Temperature != null) - { - writer.WritePropertyName("temperature"u8); - writer.WriteNumberValue(Temperature.Value); - } - else - { - writer.WriteNull("temperature"); - } - } - if (Optional.IsDefined(TopP)) - { - if (TopP != null) - { - writer.WritePropertyName("top_p"u8); - writer.WriteNumberValue(TopP.Value); - } - else - { - writer.WriteNull("top_p"); - } - } - if (Optional.IsDefined(ResponseFormat)) - { - if (ResponseFormat != null) - { - writer.WritePropertyName("response_format"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(ResponseFormat); -#else - using (JsonDocument document = JsonDocument.Parse(ResponseFormat, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - else - { - writer.WriteNull("response_format"); - } - } - if (Optional.IsCollectionDefined(Metadata)) - { - if (Metadata != null) - { - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("metadata"); - } - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - CreateAgentRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CreateAgentRequest)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCreateAgentRequest(document.RootElement, options); - } - - internal static CreateAgentRequest DeserializeCreateAgentRequest(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string model = default; - string name = default; - string description = default; - string instructions = default; - IReadOnlyList tools = default; - ToolResources toolResources = default; - float? temperature = default; - float? topP = default; - BinaryData responseFormat = default; - IReadOnlyDictionary metadata = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("model"u8)) - { - model = property.Value.GetString(); - continue; - } - if (property.NameEquals("name"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - name = null; - continue; - } - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("description"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - description = null; - continue; - } - description = property.Value.GetString(); - continue; - } - if (property.NameEquals("instructions"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - instructions = null; - continue; - } - instructions = property.Value.GetString(); - continue; - } - if (property.NameEquals("tools"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ToolDefinition.DeserializeToolDefinition(item, options)); - } - tools = array; - continue; - } - if (property.NameEquals("tool_resources"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - toolResources = null; - continue; - } - toolResources = ToolResources.DeserializeToolResources(property.Value, options); - continue; - } - if (property.NameEquals("temperature"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - temperature = null; - continue; - } - temperature = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("top_p"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - topP = null; - continue; - } - topP = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("response_format"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - responseFormat = null; - continue; - } - responseFormat = BinaryData.FromString(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("metadata"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new CreateAgentRequest( - model, - name, - description, - instructions, - tools ?? new ChangeTrackingList(), - toolResources, - temperature, - topP, - responseFormat, - metadata ?? new ChangeTrackingDictionary(), - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(CreateAgentRequest)} does not support writing '{options.Format}' format."); - } - } - - CreateAgentRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateAgentRequest(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(CreateAgentRequest)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static CreateAgentRequest FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateAgentRequest(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateAgentRequest.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateAgentRequest.cs deleted file mode 100644 index 02993f45cecc..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateAgentRequest.cs +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The CreateAgentRequest. - internal partial class CreateAgentRequest - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The ID of the model to use. - /// is null. - internal CreateAgentRequest(string model) - { - Argument.AssertNotNull(model, nameof(model)); - - Model = model; - Tools = new ChangeTrackingList(); - Metadata = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of . - /// The ID of the model to use. - /// The name of the new agent. - /// The description of the new agent. - /// The system instructions for the new agent to use. - /// - /// The collection of tools to enable for the new agent. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , , and . - /// - /// - /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` - /// tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. - /// - /// - /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, - /// while lower values like 0.2 will make it more focused and deterministic. - /// - /// - /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. - /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. - /// - /// We generally recommend altering this or temperature but not both. - /// - /// The response format of the tool calls used by this agent. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// Keeps track of any properties unknown to the library. - internal CreateAgentRequest(string model, string name, string description, string instructions, IReadOnlyList tools, ToolResources toolResources, float? temperature, float? topP, BinaryData responseFormat, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) - { - Model = model; - Name = name; - Description = description; - Instructions = instructions; - Tools = tools; - ToolResources = toolResources; - Temperature = temperature; - TopP = topP; - ResponseFormat = responseFormat; - Metadata = metadata; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal CreateAgentRequest() - { - } - - /// The ID of the model to use. - public string Model { get; } - /// The name of the new agent. - public string Name { get; } - /// The description of the new agent. - public string Description { get; } - /// The system instructions for the new agent to use. - public string Instructions { get; } - /// - /// The collection of tools to enable for the new agent. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , , and . - /// - public IReadOnlyList Tools { get; } - /// - /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` - /// tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. - /// - public ToolResources ToolResources { get; } - /// - /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, - /// while lower values like 0.2 will make it more focused and deterministic. - /// - public float? Temperature { get; } - /// - /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. - /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. - /// - /// We generally recommend altering this or temperature but not both. - /// - public float? TopP { get; } - /// - /// The response format of the tool calls used by this agent. - /// - /// To assign an object to this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// - /// Supported types: - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - public BinaryData ResponseFormat { get; } - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - public IReadOnlyDictionary Metadata { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateMessageRequest.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateMessageRequest.Serialization.cs deleted file mode 100644 index ddcd52d15722..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateMessageRequest.Serialization.cs +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class CreateMessageRequest : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CreateMessageRequest)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("role"u8); - writer.WriteStringValue(Role.ToString()); - writer.WritePropertyName("content"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(Content); -#else - using (JsonDocument document = JsonDocument.Parse(Content, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - if (Optional.IsCollectionDefined(Attachments)) - { - if (Attachments != null) - { - writer.WritePropertyName("attachments"u8); - writer.WriteStartArray(); - foreach (var item in Attachments) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - else - { - writer.WriteNull("attachments"); - } - } - if (Optional.IsCollectionDefined(Metadata)) - { - if (Metadata != null) - { - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("metadata"); - } - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - CreateMessageRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CreateMessageRequest)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCreateMessageRequest(document.RootElement, options); - } - - internal static CreateMessageRequest DeserializeCreateMessageRequest(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MessageRole role = default; - BinaryData content = default; - IReadOnlyList attachments = default; - IReadOnlyDictionary metadata = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("role"u8)) - { - role = new MessageRole(property.Value.GetString()); - continue; - } - if (property.NameEquals("content"u8)) - { - content = BinaryData.FromString(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("attachments"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(MessageAttachment.DeserializeMessageAttachment(item, options)); - } - attachments = array; - continue; - } - if (property.NameEquals("metadata"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new CreateMessageRequest(role, content, attachments ?? new ChangeTrackingList(), metadata ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(CreateMessageRequest)} does not support writing '{options.Format}' format."); - } - } - - CreateMessageRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateMessageRequest(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(CreateMessageRequest)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static CreateMessageRequest FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateMessageRequest(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateMessageRequest.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateMessageRequest.cs deleted file mode 100644 index dcb3895bb858..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateMessageRequest.cs +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The CreateMessageRequest. - internal partial class CreateMessageRequest - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// - /// The role of the entity that is creating the message. Allowed values include: - /// `user`, which indicates the message is sent by an actual user (and should be - /// used in most cases to represent user-generated messages), and `assistant`, - /// which indicates the message is generated by the agent (use this value to insert - /// messages from the agent into the conversation). - /// - /// - /// The content of the initial message. This may be a basic string (if you only - /// need text) or an array of typed content blocks (for example, text, image_file, - /// image_url, and so on). - /// - /// is null. - internal CreateMessageRequest(MessageRole role, BinaryData content) - { - Argument.AssertNotNull(content, nameof(content)); - - Role = role; - Content = content; - Attachments = new ChangeTrackingList(); - Metadata = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of . - /// - /// The role of the entity that is creating the message. Allowed values include: - /// `user`, which indicates the message is sent by an actual user (and should be - /// used in most cases to represent user-generated messages), and `assistant`, - /// which indicates the message is generated by the agent (use this value to insert - /// messages from the agent into the conversation). - /// - /// - /// The content of the initial message. This may be a basic string (if you only - /// need text) or an array of typed content blocks (for example, text, image_file, - /// image_url, and so on). - /// - /// A list of files attached to the message, and the tools they should be added to. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// Keeps track of any properties unknown to the library. - internal CreateMessageRequest(MessageRole role, BinaryData content, IReadOnlyList attachments, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) - { - Role = role; - Content = content; - Attachments = attachments; - Metadata = metadata; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal CreateMessageRequest() - { - } - - /// - /// The role of the entity that is creating the message. Allowed values include: - /// `user`, which indicates the message is sent by an actual user (and should be - /// used in most cases to represent user-generated messages), and `assistant`, - /// which indicates the message is generated by the agent (use this value to insert - /// messages from the agent into the conversation). - /// - public MessageRole Role { get; } - /// - /// The content of the initial message. This may be a basic string (if you only - /// need text) or an array of typed content blocks (for example, text, image_file, - /// image_url, and so on). - /// - /// To assign an object to this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// - /// Supported types: - /// - /// - /// - /// - /// - /// where T is of type - /// - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - public BinaryData Content { get; } - /// A list of files attached to the message, and the tools they should be added to. - public IReadOnlyList Attachments { get; } - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - public IReadOnlyDictionary Metadata { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateRunRequest.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateRunRequest.Serialization.cs deleted file mode 100644 index f0983c132abf..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateRunRequest.Serialization.cs +++ /dev/null @@ -1,530 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class CreateRunRequest : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CreateRunRequest)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("assistant_id"u8); - writer.WriteStringValue(AssistantId); - if (Optional.IsDefined(OverrideModelName)) - { - if (OverrideModelName != null) - { - writer.WritePropertyName("model"u8); - writer.WriteStringValue(OverrideModelName); - } - else - { - writer.WriteNull("model"); - } - } - if (Optional.IsDefined(OverrideInstructions)) - { - if (OverrideInstructions != null) - { - writer.WritePropertyName("instructions"u8); - writer.WriteStringValue(OverrideInstructions); - } - else - { - writer.WriteNull("instructions"); - } - } - if (Optional.IsDefined(AdditionalInstructions)) - { - if (AdditionalInstructions != null) - { - writer.WritePropertyName("additional_instructions"u8); - writer.WriteStringValue(AdditionalInstructions); - } - else - { - writer.WriteNull("additional_instructions"); - } - } - if (Optional.IsCollectionDefined(AdditionalMessages)) - { - if (AdditionalMessages != null) - { - writer.WritePropertyName("additional_messages"u8); - writer.WriteStartArray(); - foreach (var item in AdditionalMessages) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - else - { - writer.WriteNull("additional_messages"); - } - } - if (Optional.IsCollectionDefined(OverrideTools)) - { - if (OverrideTools != null) - { - writer.WritePropertyName("tools"u8); - writer.WriteStartArray(); - foreach (var item in OverrideTools) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - else - { - writer.WriteNull("tools"); - } - } - if (Optional.IsDefined(Stream)) - { - writer.WritePropertyName("stream"u8); - writer.WriteBooleanValue(Stream.Value); - } - if (Optional.IsDefined(Temperature)) - { - if (Temperature != null) - { - writer.WritePropertyName("temperature"u8); - writer.WriteNumberValue(Temperature.Value); - } - else - { - writer.WriteNull("temperature"); - } - } - if (Optional.IsDefined(TopP)) - { - if (TopP != null) - { - writer.WritePropertyName("top_p"u8); - writer.WriteNumberValue(TopP.Value); - } - else - { - writer.WriteNull("top_p"); - } - } - if (Optional.IsDefined(MaxPromptTokens)) - { - if (MaxPromptTokens != null) - { - writer.WritePropertyName("max_prompt_tokens"u8); - writer.WriteNumberValue(MaxPromptTokens.Value); - } - else - { - writer.WriteNull("max_prompt_tokens"); - } - } - if (Optional.IsDefined(MaxCompletionTokens)) - { - if (MaxCompletionTokens != null) - { - writer.WritePropertyName("max_completion_tokens"u8); - writer.WriteNumberValue(MaxCompletionTokens.Value); - } - else - { - writer.WriteNull("max_completion_tokens"); - } - } - if (Optional.IsDefined(TruncationStrategy)) - { - if (TruncationStrategy != null) - { - writer.WritePropertyName("truncation_strategy"u8); - writer.WriteObjectValue(TruncationStrategy, options); - } - else - { - writer.WriteNull("truncation_strategy"); - } - } - if (Optional.IsDefined(ToolChoice)) - { - if (ToolChoice != null) - { - writer.WritePropertyName("tool_choice"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(ToolChoice); -#else - using (JsonDocument document = JsonDocument.Parse(ToolChoice, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - else - { - writer.WriteNull("tool_choice"); - } - } - if (Optional.IsDefined(ResponseFormat)) - { - if (ResponseFormat != null) - { - writer.WritePropertyName("response_format"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(ResponseFormat); -#else - using (JsonDocument document = JsonDocument.Parse(ResponseFormat, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - else - { - writer.WriteNull("response_format"); - } - } - if (Optional.IsDefined(ParallelToolCalls)) - { - writer.WritePropertyName("parallel_tool_calls"u8); - writer.WriteBooleanValue(ParallelToolCalls.Value); - } - if (Optional.IsCollectionDefined(Metadata)) - { - if (Metadata != null) - { - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("metadata"); - } - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - CreateRunRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CreateRunRequest)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCreateRunRequest(document.RootElement, options); - } - - internal static CreateRunRequest DeserializeCreateRunRequest(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string assistantId = default; - string model = default; - string instructions = default; - string additionalInstructions = default; - IReadOnlyList additionalMessages = default; - IReadOnlyList tools = default; - bool? stream = default; - float? temperature = default; - float? topP = default; - int? maxPromptTokens = default; - int? maxCompletionTokens = default; - Truncation truncationStrategy = default; - BinaryData toolChoice = default; - BinaryData responseFormat = default; - bool? parallelToolCalls = default; - IReadOnlyDictionary metadata = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("assistant_id"u8)) - { - assistantId = property.Value.GetString(); - continue; - } - if (property.NameEquals("model"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - model = null; - continue; - } - model = property.Value.GetString(); - continue; - } - if (property.NameEquals("instructions"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - instructions = null; - continue; - } - instructions = property.Value.GetString(); - continue; - } - if (property.NameEquals("additional_instructions"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - additionalInstructions = null; - continue; - } - additionalInstructions = property.Value.GetString(); - continue; - } - if (property.NameEquals("additional_messages"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ThreadMessageOptions.DeserializeThreadMessageOptions(item, options)); - } - additionalMessages = array; - continue; - } - if (property.NameEquals("tools"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ToolDefinition.DeserializeToolDefinition(item, options)); - } - tools = array; - continue; - } - if (property.NameEquals("stream"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - stream = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("temperature"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - temperature = null; - continue; - } - temperature = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("top_p"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - topP = null; - continue; - } - topP = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("max_prompt_tokens"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - maxPromptTokens = null; - continue; - } - maxPromptTokens = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("max_completion_tokens"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - maxCompletionTokens = null; - continue; - } - maxCompletionTokens = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("truncation_strategy"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - truncationStrategy = null; - continue; - } - truncationStrategy = Truncation.DeserializeTruncation(property.Value, options); - continue; - } - if (property.NameEquals("tool_choice"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - toolChoice = null; - continue; - } - toolChoice = BinaryData.FromString(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("response_format"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - responseFormat = null; - continue; - } - responseFormat = BinaryData.FromString(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("parallel_tool_calls"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - parallelToolCalls = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("metadata"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new CreateRunRequest( - assistantId, - model, - instructions, - additionalInstructions, - additionalMessages ?? new ChangeTrackingList(), - tools ?? new ChangeTrackingList(), - stream, - temperature, - topP, - maxPromptTokens, - maxCompletionTokens, - truncationStrategy, - toolChoice, - responseFormat, - parallelToolCalls, - metadata ?? new ChangeTrackingDictionary(), - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(CreateRunRequest)} does not support writing '{options.Format}' format."); - } - } - - CreateRunRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateRunRequest(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(CreateRunRequest)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static CreateRunRequest FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateRunRequest(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateRunRequest.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateRunRequest.cs deleted file mode 100644 index d6413572c7a9..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateRunRequest.cs +++ /dev/null @@ -1,281 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The CreateRunRequest. - internal partial class CreateRunRequest - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The ID of the agent that should run the thread. - /// is null. - internal CreateRunRequest(string assistantId) - { - Argument.AssertNotNull(assistantId, nameof(assistantId)); - - AssistantId = assistantId; - AdditionalMessages = new ChangeTrackingList(); - OverrideTools = new ChangeTrackingList(); - Metadata = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of . - /// The ID of the agent that should run the thread. - /// The overridden model name that the agent should use to run the thread. - /// The overridden system instructions that the agent should use to run the thread. - /// - /// Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior - /// on a per-run basis without overriding other instructions. - /// - /// Adds additional messages to the thread before creating the run. - /// - /// The overridden list of enabled tools that the agent should use to run the thread. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , , and . - /// - /// - /// If `true`, returns a stream of events that happen during the Run as server-sent events, - /// terminating when the Run enters a terminal state with a `data: [DONE]` message. - /// - /// - /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output - /// more random, while lower values like 0.2 will make it more focused and deterministic. - /// - /// - /// An alternative to sampling with temperature, called nucleus sampling, where the model - /// considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens - /// comprising the top 10% probability mass are considered. - /// - /// We generally recommend altering this or temperature but not both. - /// - /// - /// The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only - /// the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, - /// the run will end with status `incomplete`. See `incomplete_details` for more info. - /// - /// - /// The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort - /// to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of - /// completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. - /// - /// The strategy to use for dropping messages as the context windows moves forward. - /// Controls whether or not and which tool is called by the model. - /// Specifies the format that the model must output. - /// If `true` functions will run in parallel during tool use. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// Keeps track of any properties unknown to the library. - internal CreateRunRequest(string assistantId, string overrideModelName, string overrideInstructions, string additionalInstructions, IReadOnlyList additionalMessages, IReadOnlyList overrideTools, bool? stream, float? temperature, float? topP, int? maxPromptTokens, int? maxCompletionTokens, Truncation truncationStrategy, BinaryData toolChoice, BinaryData responseFormat, bool? parallelToolCalls, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) - { - AssistantId = assistantId; - OverrideModelName = overrideModelName; - OverrideInstructions = overrideInstructions; - AdditionalInstructions = additionalInstructions; - AdditionalMessages = additionalMessages; - OverrideTools = overrideTools; - Stream = stream; - Temperature = temperature; - TopP = topP; - MaxPromptTokens = maxPromptTokens; - MaxCompletionTokens = maxCompletionTokens; - TruncationStrategy = truncationStrategy; - ToolChoice = toolChoice; - ResponseFormat = responseFormat; - ParallelToolCalls = parallelToolCalls; - Metadata = metadata; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal CreateRunRequest() - { - } - - /// The ID of the agent that should run the thread. - public string AssistantId { get; } - /// The overridden model name that the agent should use to run the thread. - public string OverrideModelName { get; } - /// The overridden system instructions that the agent should use to run the thread. - public string OverrideInstructions { get; } - /// - /// Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior - /// on a per-run basis without overriding other instructions. - /// - public string AdditionalInstructions { get; } - /// Adds additional messages to the thread before creating the run. - public IReadOnlyList AdditionalMessages { get; } - /// - /// The overridden list of enabled tools that the agent should use to run the thread. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , , and . - /// - public IReadOnlyList OverrideTools { get; } - /// - /// If `true`, returns a stream of events that happen during the Run as server-sent events, - /// terminating when the Run enters a terminal state with a `data: [DONE]` message. - /// - public bool? Stream { get; } - /// - /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output - /// more random, while lower values like 0.2 will make it more focused and deterministic. - /// - public float? Temperature { get; } - /// - /// An alternative to sampling with temperature, called nucleus sampling, where the model - /// considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens - /// comprising the top 10% probability mass are considered. - /// - /// We generally recommend altering this or temperature but not both. - /// - public float? TopP { get; } - /// - /// The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only - /// the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, - /// the run will end with status `incomplete`. See `incomplete_details` for more info. - /// - public int? MaxPromptTokens { get; } - /// - /// The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort - /// to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of - /// completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. - /// - public int? MaxCompletionTokens { get; } - /// The strategy to use for dropping messages as the context windows moves forward. - public Truncation TruncationStrategy { get; } - /// - /// Controls whether or not and which tool is called by the model. - /// - /// To assign an object to this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// - /// Supported types: - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - public BinaryData ToolChoice { get; } - /// - /// Specifies the format that the model must output. - /// - /// To assign an object to this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// - /// Supported types: - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - public BinaryData ResponseFormat { get; } - /// If `true` functions will run in parallel during tool use. - public bool? ParallelToolCalls { get; } - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - public IReadOnlyDictionary Metadata { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateThreadAndRunRequest.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateThreadAndRunRequest.Serialization.cs deleted file mode 100644 index f08fc03e6b36..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateThreadAndRunRequest.Serialization.cs +++ /dev/null @@ -1,513 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class CreateThreadAndRunRequest : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CreateThreadAndRunRequest)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("assistant_id"u8); - writer.WriteStringValue(AssistantId); - if (Optional.IsDefined(Thread)) - { - writer.WritePropertyName("thread"u8); - writer.WriteObjectValue(Thread, options); - } - if (Optional.IsDefined(OverrideModelName)) - { - if (OverrideModelName != null) - { - writer.WritePropertyName("model"u8); - writer.WriteStringValue(OverrideModelName); - } - else - { - writer.WriteNull("model"); - } - } - if (Optional.IsDefined(OverrideInstructions)) - { - if (OverrideInstructions != null) - { - writer.WritePropertyName("instructions"u8); - writer.WriteStringValue(OverrideInstructions); - } - else - { - writer.WriteNull("instructions"); - } - } - if (Optional.IsCollectionDefined(OverrideTools)) - { - if (OverrideTools != null) - { - writer.WritePropertyName("tools"u8); - writer.WriteStartArray(); - foreach (var item in OverrideTools) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - else - { - writer.WriteNull("tools"); - } - } - if (Optional.IsDefined(ToolResources)) - { - if (ToolResources != null) - { - writer.WritePropertyName("tool_resources"u8); - writer.WriteObjectValue(ToolResources, options); - } - else - { - writer.WriteNull("tool_resources"); - } - } - if (Optional.IsDefined(Stream)) - { - writer.WritePropertyName("stream"u8); - writer.WriteBooleanValue(Stream.Value); - } - if (Optional.IsDefined(Temperature)) - { - if (Temperature != null) - { - writer.WritePropertyName("temperature"u8); - writer.WriteNumberValue(Temperature.Value); - } - else - { - writer.WriteNull("temperature"); - } - } - if (Optional.IsDefined(TopP)) - { - if (TopP != null) - { - writer.WritePropertyName("top_p"u8); - writer.WriteNumberValue(TopP.Value); - } - else - { - writer.WriteNull("top_p"); - } - } - if (Optional.IsDefined(MaxPromptTokens)) - { - if (MaxPromptTokens != null) - { - writer.WritePropertyName("max_prompt_tokens"u8); - writer.WriteNumberValue(MaxPromptTokens.Value); - } - else - { - writer.WriteNull("max_prompt_tokens"); - } - } - if (Optional.IsDefined(MaxCompletionTokens)) - { - if (MaxCompletionTokens != null) - { - writer.WritePropertyName("max_completion_tokens"u8); - writer.WriteNumberValue(MaxCompletionTokens.Value); - } - else - { - writer.WriteNull("max_completion_tokens"); - } - } - if (Optional.IsDefined(TruncationStrategy)) - { - if (TruncationStrategy != null) - { - writer.WritePropertyName("truncation_strategy"u8); - writer.WriteObjectValue(TruncationStrategy, options); - } - else - { - writer.WriteNull("truncation_strategy"); - } - } - if (Optional.IsDefined(ToolChoice)) - { - if (ToolChoice != null) - { - writer.WritePropertyName("tool_choice"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(ToolChoice); -#else - using (JsonDocument document = JsonDocument.Parse(ToolChoice, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - else - { - writer.WriteNull("tool_choice"); - } - } - if (Optional.IsDefined(ResponseFormat)) - { - if (ResponseFormat != null) - { - writer.WritePropertyName("response_format"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(ResponseFormat); -#else - using (JsonDocument document = JsonDocument.Parse(ResponseFormat, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - else - { - writer.WriteNull("response_format"); - } - } - if (Optional.IsDefined(ParallelToolCalls)) - { - writer.WritePropertyName("parallel_tool_calls"u8); - writer.WriteBooleanValue(ParallelToolCalls.Value); - } - if (Optional.IsCollectionDefined(Metadata)) - { - if (Metadata != null) - { - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("metadata"); - } - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - CreateThreadAndRunRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CreateThreadAndRunRequest)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCreateThreadAndRunRequest(document.RootElement, options); - } - - internal static CreateThreadAndRunRequest DeserializeCreateThreadAndRunRequest(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string assistantId = default; - PersistentAgentThreadCreationOptions thread = default; - string model = default; - string instructions = default; - IReadOnlyList tools = default; - UpdateToolResourcesOptions toolResources = default; - bool? stream = default; - float? temperature = default; - float? topP = default; - int? maxPromptTokens = default; - int? maxCompletionTokens = default; - Truncation truncationStrategy = default; - BinaryData toolChoice = default; - BinaryData responseFormat = default; - bool? parallelToolCalls = default; - IReadOnlyDictionary metadata = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("assistant_id"u8)) - { - assistantId = property.Value.GetString(); - continue; - } - if (property.NameEquals("thread"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - thread = PersistentAgentThreadCreationOptions.DeserializePersistentAgentThreadCreationOptions(property.Value, options); - continue; - } - if (property.NameEquals("model"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - model = null; - continue; - } - model = property.Value.GetString(); - continue; - } - if (property.NameEquals("instructions"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - instructions = null; - continue; - } - instructions = property.Value.GetString(); - continue; - } - if (property.NameEquals("tools"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ToolDefinition.DeserializeToolDefinition(item, options)); - } - tools = array; - continue; - } - if (property.NameEquals("tool_resources"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - toolResources = null; - continue; - } - toolResources = UpdateToolResourcesOptions.DeserializeUpdateToolResourcesOptions(property.Value, options); - continue; - } - if (property.NameEquals("stream"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - stream = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("temperature"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - temperature = null; - continue; - } - temperature = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("top_p"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - topP = null; - continue; - } - topP = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("max_prompt_tokens"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - maxPromptTokens = null; - continue; - } - maxPromptTokens = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("max_completion_tokens"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - maxCompletionTokens = null; - continue; - } - maxCompletionTokens = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("truncation_strategy"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - truncationStrategy = null; - continue; - } - truncationStrategy = Truncation.DeserializeTruncation(property.Value, options); - continue; - } - if (property.NameEquals("tool_choice"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - toolChoice = null; - continue; - } - toolChoice = BinaryData.FromString(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("response_format"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - responseFormat = null; - continue; - } - responseFormat = BinaryData.FromString(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("parallel_tool_calls"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - parallelToolCalls = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("metadata"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new CreateThreadAndRunRequest( - assistantId, - thread, - model, - instructions, - tools ?? new ChangeTrackingList(), - toolResources, - stream, - temperature, - topP, - maxPromptTokens, - maxCompletionTokens, - truncationStrategy, - toolChoice, - responseFormat, - parallelToolCalls, - metadata ?? new ChangeTrackingDictionary(), - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(CreateThreadAndRunRequest)} does not support writing '{options.Format}' format."); - } - } - - CreateThreadAndRunRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateThreadAndRunRequest(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(CreateThreadAndRunRequest)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static CreateThreadAndRunRequest FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateThreadAndRunRequest(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateThreadAndRunRequest.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateThreadAndRunRequest.cs deleted file mode 100644 index 49848d9fc53c..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateThreadAndRunRequest.cs +++ /dev/null @@ -1,274 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The CreateThreadAndRunRequest. - internal partial class CreateThreadAndRunRequest - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The ID of the agent for which the thread should be created. - /// is null. - internal CreateThreadAndRunRequest(string assistantId) - { - Argument.AssertNotNull(assistantId, nameof(assistantId)); - - AssistantId = assistantId; - OverrideTools = new ChangeTrackingList(); - Metadata = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of . - /// The ID of the agent for which the thread should be created. - /// The details used to create the new thread. If no thread is provided, an empty one will be created. - /// The overridden model that the agent should use to run the thread. - /// The overridden system instructions the agent should use to run the thread. - /// - /// The overridden list of enabled tools the agent should use to run the thread. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , , and . - /// - /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. - /// - /// If `true`, returns a stream of events that happen during the Run as server-sent events, - /// terminating when the Run enters a terminal state with a `data: [DONE]` message. - /// - /// - /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output - /// more random, while lower values like 0.2 will make it more focused and deterministic. - /// - /// - /// An alternative to sampling with temperature, called nucleus sampling, where the model - /// considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens - /// comprising the top 10% probability mass are considered. - /// - /// We generally recommend altering this or temperature but not both. - /// - /// - /// The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only - /// the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, - /// the run will end with status `incomplete`. See `incomplete_details` for more info. - /// - /// - /// The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only - /// the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens - /// specified, the run will end with status `incomplete`. See `incomplete_details` for more info. - /// - /// The strategy to use for dropping messages as the context windows moves forward. - /// Controls whether or not and which tool is called by the model. - /// Specifies the format that the model must output. - /// If `true` functions will run in parallel during tool use. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// Keeps track of any properties unknown to the library. - internal CreateThreadAndRunRequest(string assistantId, PersistentAgentThreadCreationOptions thread, string overrideModelName, string overrideInstructions, IReadOnlyList overrideTools, UpdateToolResourcesOptions toolResources, bool? stream, float? temperature, float? topP, int? maxPromptTokens, int? maxCompletionTokens, Truncation truncationStrategy, BinaryData toolChoice, BinaryData responseFormat, bool? parallelToolCalls, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) - { - AssistantId = assistantId; - Thread = thread; - OverrideModelName = overrideModelName; - OverrideInstructions = overrideInstructions; - OverrideTools = overrideTools; - ToolResources = toolResources; - Stream = stream; - Temperature = temperature; - TopP = topP; - MaxPromptTokens = maxPromptTokens; - MaxCompletionTokens = maxCompletionTokens; - TruncationStrategy = truncationStrategy; - ToolChoice = toolChoice; - ResponseFormat = responseFormat; - ParallelToolCalls = parallelToolCalls; - Metadata = metadata; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal CreateThreadAndRunRequest() - { - } - - /// The ID of the agent for which the thread should be created. - public string AssistantId { get; } - /// The details used to create the new thread. If no thread is provided, an empty one will be created. - public PersistentAgentThreadCreationOptions Thread { get; } - /// The overridden model that the agent should use to run the thread. - public string OverrideModelName { get; } - /// The overridden system instructions the agent should use to run the thread. - public string OverrideInstructions { get; } - /// - /// The overridden list of enabled tools the agent should use to run the thread. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , , and . - /// - public IReadOnlyList OverrideTools { get; } - /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. - public UpdateToolResourcesOptions ToolResources { get; } - /// - /// If `true`, returns a stream of events that happen during the Run as server-sent events, - /// terminating when the Run enters a terminal state with a `data: [DONE]` message. - /// - public bool? Stream { get; } - /// - /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output - /// more random, while lower values like 0.2 will make it more focused and deterministic. - /// - public float? Temperature { get; } - /// - /// An alternative to sampling with temperature, called nucleus sampling, where the model - /// considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens - /// comprising the top 10% probability mass are considered. - /// - /// We generally recommend altering this or temperature but not both. - /// - public float? TopP { get; } - /// - /// The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only - /// the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, - /// the run will end with status `incomplete`. See `incomplete_details` for more info. - /// - public int? MaxPromptTokens { get; } - /// - /// The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only - /// the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens - /// specified, the run will end with status `incomplete`. See `incomplete_details` for more info. - /// - public int? MaxCompletionTokens { get; } - /// The strategy to use for dropping messages as the context windows moves forward. - public Truncation TruncationStrategy { get; } - /// - /// Controls whether or not and which tool is called by the model. - /// - /// To assign an object to this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// - /// Supported types: - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - public BinaryData ToolChoice { get; } - /// - /// Specifies the format that the model must output. - /// - /// To assign an object to this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// - /// Supported types: - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - public BinaryData ResponseFormat { get; } - /// If `true` functions will run in parallel during tool use. - public bool? ParallelToolCalls { get; } - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - public IReadOnlyDictionary Metadata { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateThreadRequest.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateThreadRequest.Serialization.cs deleted file mode 100644 index 8463bf524d45..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateThreadRequest.Serialization.cs +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class CreateThreadRequest : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CreateThreadRequest)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(Messages)) - { - writer.WritePropertyName("messages"u8); - writer.WriteStartArray(); - foreach (var item in Messages) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(ToolResources)) - { - if (ToolResources != null) - { - writer.WritePropertyName("tool_resources"u8); - writer.WriteObjectValue(ToolResources, options); - } - else - { - writer.WriteNull("tool_resources"); - } - } - if (Optional.IsCollectionDefined(Metadata)) - { - if (Metadata != null) - { - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("metadata"); - } - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - CreateThreadRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CreateThreadRequest)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCreateThreadRequest(document.RootElement, options); - } - - internal static CreateThreadRequest DeserializeCreateThreadRequest(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList messages = default; - ToolResources toolResources = default; - IReadOnlyDictionary metadata = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("messages"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ThreadMessageOptions.DeserializeThreadMessageOptions(item, options)); - } - messages = array; - continue; - } - if (property.NameEquals("tool_resources"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - toolResources = null; - continue; - } - toolResources = ToolResources.DeserializeToolResources(property.Value, options); - continue; - } - if (property.NameEquals("metadata"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new CreateThreadRequest(messages ?? new ChangeTrackingList(), toolResources, metadata ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(CreateThreadRequest)} does not support writing '{options.Format}' format."); - } - } - - CreateThreadRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateThreadRequest(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(CreateThreadRequest)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static CreateThreadRequest FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateThreadRequest(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateThreadRequest.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateThreadRequest.cs deleted file mode 100644 index f5e4e17d5c03..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateThreadRequest.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The CreateThreadRequest. - internal partial class CreateThreadRequest - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal CreateThreadRequest() - { - Messages = new ChangeTrackingList(); - Metadata = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of . - /// The initial messages to associate with the new thread. - /// - /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the - /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires - /// a list of vector store IDs. - /// - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// Keeps track of any properties unknown to the library. - internal CreateThreadRequest(IReadOnlyList messages, ToolResources toolResources, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) - { - Messages = messages; - ToolResources = toolResources; - Metadata = metadata; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The initial messages to associate with the new thread. - public IReadOnlyList Messages { get; } - /// - /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the - /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires - /// a list of vector store IDs. - /// - public ToolResources ToolResources { get; } - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - public IReadOnlyDictionary Metadata { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/Docs/VectorStoresClient.xml b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/Docs/VectorStoresClient.xml new file mode 100644 index 000000000000..4ccc346e373b --- /dev/null +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/Docs/VectorStoresClient.xml @@ -0,0 +1,5261 @@ + + + + + +This sample shows how to call CreateVectorStoreAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.CreateVectorStoreAsync(); +]]> +This sample shows how to call CreateVectorStoreAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.CreateVectorStoreAsync(); +]]> + + + +This sample shows how to call CreateVectorStore. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.CreateVectorStore(); +]]> +This sample shows how to call CreateVectorStore. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.CreateVectorStore(); +]]> + + + +This sample shows how to call CreateVectorStoreAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + file_ids = new object[] + { + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt" + }, + name = "u", + configuration = new + { + data_sources = new object[] + { + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + } + }, + }, + expires_after = new + { + anchor = "last_active_at", + days = 73, + }, + metadata = new + { + key9029 = "ghicfhykvpyj", + }, +}); +Response response = await client.CreateVectorStoreAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call CreateVectorStoreAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.CreateVectorStoreAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call CreateVectorStore and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + file_ids = new object[] + { + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt", + "hileejdmsljnblywbqgrycpbeczbt" + }, + name = "u", + configuration = new + { + data_sources = new object[] + { + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + } + }, + }, + expires_after = new + { + anchor = "last_active_at", + days = 73, + }, + metadata = new + { + key9029 = "ghicfhykvpyj", + }, +}); +Response response = client.CreateVectorStore(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call CreateVectorStore and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.CreateVectorStore(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call GetVectorStoreAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.GetVectorStoreAsync("vjsfufonwjwzvygdq"); +]]> +This sample shows how to call GetVectorStoreAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.GetVectorStoreAsync("jhrejmwmyblsdagsx"); +]]> + + + +This sample shows how to call GetVectorStore. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.GetVectorStore("vjsfufonwjwzvygdq"); +]]> +This sample shows how to call GetVectorStore. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.GetVectorStore("jhrejmwmyblsdagsx"); +]]> + + + +This sample shows how to call GetVectorStoreAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.GetVectorStoreAsync("vjsfufonwjwzvygdq", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call GetVectorStoreAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.GetVectorStoreAsync("jhrejmwmyblsdagsx", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call GetVectorStore and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.GetVectorStore("vjsfufonwjwzvygdq", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call GetVectorStore and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.GetVectorStore("jhrejmwmyblsdagsx", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call ModifyVectorStoreAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.ModifyVectorStoreAsync("pqhrqxzleymrjogjppdtlmxlsfculn"); +]]> +This sample shows how to call ModifyVectorStoreAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.ModifyVectorStoreAsync("jlamdmhxwayxxeiexcyulxcocw"); +]]> + + + +This sample shows how to call ModifyVectorStore. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.ModifyVectorStore("pqhrqxzleymrjogjppdtlmxlsfculn"); +]]> +This sample shows how to call ModifyVectorStore. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.ModifyVectorStore("jlamdmhxwayxxeiexcyulxcocw"); +]]> + + + +This sample shows how to call ModifyVectorStoreAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + name = "jcrzfsgxsgelufbkjidfvnu", + expires_after = new + { + anchor = "last_active_at", + days = 73, + }, + metadata = new + { + key9792 = "cxmmdtwupsjnjixdoaravhbkrqqqm", + }, +}); +Response response = await client.ModifyVectorStoreAsync("pqhrqxzleymrjogjppdtlmxlsfculn", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call ModifyVectorStoreAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.ModifyVectorStoreAsync("jlamdmhxwayxxeiexcyulxcocw", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call ModifyVectorStore and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + name = "jcrzfsgxsgelufbkjidfvnu", + expires_after = new + { + anchor = "last_active_at", + days = 73, + }, + metadata = new + { + key9792 = "cxmmdtwupsjnjixdoaravhbkrqqqm", + }, +}); +Response response = client.ModifyVectorStore("pqhrqxzleymrjogjppdtlmxlsfculn", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> +This sample shows how to call ModifyVectorStore and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.ModifyVectorStore("jlamdmhxwayxxeiexcyulxcocw", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_active_at").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call CreateVectorStoreFileAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.CreateVectorStoreFileAsync("kox"); +]]> + + + +This sample shows how to call CreateVectorStoreFile. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.CreateVectorStoreFile("kox"); +]]> + + + +This sample shows how to call CreateVectorStoreFileAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + file_id = "emdzaopxo", + data_source = new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, +}); +Response response = await client.CreateVectorStoreFileAsync("kox", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +]]> + + + +This sample shows how to call CreateVectorStoreFile and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + file_id = "emdzaopxo", + data_source = new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, +}); +Response response = client.CreateVectorStoreFile("kox", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +]]> + + + +This sample shows how to call GetVectorStoreFileAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.GetVectorStoreFileAsync("qusinxkarhcskvxntuym", "bds"); +]]> +This sample shows how to call GetVectorStoreFileAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.GetVectorStoreFileAsync("sar", "fakyvuniwxszpqxxcovnohhacypzp"); +]]> + + + +This sample shows how to call GetVectorStoreFile. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.GetVectorStoreFile("qusinxkarhcskvxntuym", "bds"); +]]> +This sample shows how to call GetVectorStoreFile. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.GetVectorStoreFile("sar", "fakyvuniwxszpqxxcovnohhacypzp"); +]]> + + + +This sample shows how to call GetVectorStoreFileAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.GetVectorStoreFileAsync("qusinxkarhcskvxntuym", "bds", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +]]> +This sample shows how to call GetVectorStoreFileAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.GetVectorStoreFileAsync("sar", "fakyvuniwxszpqxxcovnohhacypzp", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +]]> + + + +This sample shows how to call GetVectorStoreFile and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.GetVectorStoreFile("qusinxkarhcskvxntuym", "bds", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +]]> +This sample shows how to call GetVectorStoreFile and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.GetVectorStoreFile("sar", "fakyvuniwxszpqxxcovnohhacypzp", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("usage_bytes").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +]]> + + + +This sample shows how to call CreateVectorStoreFileBatchAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.CreateVectorStoreFileBatchAsync("bvcjtemrnqtycjuaerlxllednm"); +]]> +This sample shows how to call CreateVectorStoreFileBatchAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.CreateVectorStoreFileBatchAsync("eyxdrn"); +]]> + + + +This sample shows how to call CreateVectorStoreFileBatch. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.CreateVectorStoreFileBatch("bvcjtemrnqtycjuaerlxllednm"); +]]> +This sample shows how to call CreateVectorStoreFileBatch. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.CreateVectorStoreFileBatch("eyxdrn"); +]]> + + + +This sample shows how to call CreateVectorStoreFileBatchAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + file_ids = new object[] + { + "sseovtmhsfpghlqyzulhnhhhasall", + "sseovtmhsfpghlqyzulhnhhhasall", + "sseovtmhsfpghlqyzulhnhhhasall", + "sseovtmhsfpghlqyzulhnhhhasall", + "sseovtmhsfpghlqyzulhnhhhasall", + "sseovtmhsfpghlqyzulhnhhhasall", + "sseovtmhsfpghlqyzulhnhhhasall", + "sseovtmhsfpghlqyzulhnhhhasall" + }, + data_sources = new object[] + { + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + } + }, +}); +Response response = await client.CreateVectorStoreFileBatchAsync("bvcjtemrnqtycjuaerlxllednm", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> +This sample shows how to call CreateVectorStoreFileBatchAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.CreateVectorStoreFileBatchAsync("eyxdrn", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> + + + +This sample shows how to call CreateVectorStoreFileBatch and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + file_ids = new object[] + { + "sseovtmhsfpghlqyzulhnhhhasall", + "sseovtmhsfpghlqyzulhnhhhasall", + "sseovtmhsfpghlqyzulhnhhhasall", + "sseovtmhsfpghlqyzulhnhhhasall", + "sseovtmhsfpghlqyzulhnhhhasall", + "sseovtmhsfpghlqyzulhnhhhasall", + "sseovtmhsfpghlqyzulhnhhhasall", + "sseovtmhsfpghlqyzulhnhhhasall" + }, + data_sources = new object[] + { + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + } + }, +}); +Response response = client.CreateVectorStoreFileBatch("bvcjtemrnqtycjuaerlxllednm", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> +This sample shows how to call CreateVectorStoreFileBatch and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.CreateVectorStoreFileBatch("eyxdrn", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> + + + +This sample shows how to call GetVectorStoreFileBatchAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.GetVectorStoreFileBatchAsync("juytv", "kdcqszoqvfaipuhvijnwxmegovmeuv"); +]]> +This sample shows how to call GetVectorStoreFileBatchAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.GetVectorStoreFileBatchAsync("pmzxfueg", "kz"); +]]> + + + +This sample shows how to call GetVectorStoreFileBatch. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.GetVectorStoreFileBatch("juytv", "kdcqszoqvfaipuhvijnwxmegovmeuv"); +]]> +This sample shows how to call GetVectorStoreFileBatch. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.GetVectorStoreFileBatch("pmzxfueg", "kz"); +]]> + + + +This sample shows how to call GetVectorStoreFileBatchAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.GetVectorStoreFileBatchAsync("juytv", "kdcqszoqvfaipuhvijnwxmegovmeuv", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> +This sample shows how to call GetVectorStoreFileBatchAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.GetVectorStoreFileBatchAsync("pmzxfueg", "kz", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> + + + +This sample shows how to call GetVectorStoreFileBatch and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.GetVectorStoreFileBatch("juytv", "kdcqszoqvfaipuhvijnwxmegovmeuv", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> +This sample shows how to call GetVectorStoreFileBatch and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.GetVectorStoreFileBatch("pmzxfueg", "kz", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> + + + +This sample shows how to call CancelVectorStoreFileBatchAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.CancelVectorStoreFileBatchAsync("lqtvimqtqecqy", "kpjojtaxsspjvzyxmfgwxusqde"); +]]> +This sample shows how to call CancelVectorStoreFileBatchAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.CancelVectorStoreFileBatchAsync("qsniwwejf", "fldyjeftzzkqinhz"); +]]> + + + +This sample shows how to call CancelVectorStoreFileBatch. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.CancelVectorStoreFileBatch("lqtvimqtqecqy", "kpjojtaxsspjvzyxmfgwxusqde"); +]]> +This sample shows how to call CancelVectorStoreFileBatch. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.CancelVectorStoreFileBatch("qsniwwejf", "fldyjeftzzkqinhz"); +]]> + + + +This sample shows how to call CancelVectorStoreFileBatchAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.CancelVectorStoreFileBatchAsync("lqtvimqtqecqy", "kpjojtaxsspjvzyxmfgwxusqde", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> +This sample shows how to call CancelVectorStoreFileBatchAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = await client.CancelVectorStoreFileBatchAsync("qsniwwejf", "fldyjeftzzkqinhz", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> + + + +This sample shows how to call CancelVectorStoreFileBatch and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.CancelVectorStoreFileBatch("lqtvimqtqecqy", "kpjojtaxsspjvzyxmfgwxusqde", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> +This sample shows how to call CancelVectorStoreFileBatch and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +Response response = client.CancelVectorStoreFileBatch("qsniwwejf", "fldyjeftzzkqinhz", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("object").ToString()); +Console.WriteLine(result.GetProperty("created_at").ToString()); +Console.WriteLine(result.GetProperty("vector_store_id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); +Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); +]]> + + + +This sample shows how to call GetVectorStoresAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +await foreach (PersistentAgentsVectorStore item in client.GetVectorStoresAsync()) +{ +} +]]> +This sample shows how to call GetVectorStoresAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +await foreach (PersistentAgentsVectorStore item in client.GetVectorStoresAsync()) +{ +} +]]> + + + +This sample shows how to call GetVectorStores. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +foreach (PersistentAgentsVectorStore item in client.GetVectorStores()) +{ +} +]]> +This sample shows how to call GetVectorStores. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +foreach (PersistentAgentsVectorStore item in client.GetVectorStores()) +{ +} +]]> + + + +This sample shows how to call GetVectorStoresAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +await foreach (BinaryData item in client.GetVectorStoresAsync(20, "asc", "cfgbzxzpyyflnolbxpkbsz", "forspimiuzzd", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +} +]]> +This sample shows how to call GetVectorStoresAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +await foreach (BinaryData item in client.GetVectorStoresAsync(null, null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +} +]]> + + + +This sample shows how to call GetVectorStores and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +foreach (BinaryData item in client.GetVectorStores(20, "asc", "cfgbzxzpyyflnolbxpkbsz", "forspimiuzzd", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +} +]]> +This sample shows how to call GetVectorStores and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +foreach (BinaryData item in client.GetVectorStores(null, null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +} +]]> + + + +This sample shows how to call GetVectorStoreFilesAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +await foreach (VectorStoreFile item in client.GetVectorStoreFilesAsync("nuppye")) +{ +} +]]> +This sample shows how to call GetVectorStoreFilesAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +await foreach (VectorStoreFile item in client.GetVectorStoreFilesAsync("rijuypqar")) +{ +} +]]> + + + +This sample shows how to call GetVectorStoreFiles. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +foreach (VectorStoreFile item in client.GetVectorStoreFiles("nuppye")) +{ +} +]]> +This sample shows how to call GetVectorStoreFiles. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +foreach (VectorStoreFile item in client.GetVectorStoreFiles("rijuypqar")) +{ +} +]]> + + + +This sample shows how to call GetVectorStoreFilesAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +await foreach (BinaryData item in client.GetVectorStoreFilesAsync("nuppye", "in_progress", 8, "asc", "cayfrop", "rdxomcqockbejgfxd", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +} +]]> +This sample shows how to call GetVectorStoreFilesAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +await foreach (BinaryData item in client.GetVectorStoreFilesAsync("rijuypqar", null, null, null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +} +]]> + + + +This sample shows how to call GetVectorStoreFiles and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +foreach (BinaryData item in client.GetVectorStoreFiles("nuppye", "in_progress", 8, "asc", "cayfrop", "rdxomcqockbejgfxd", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +} +]]> +This sample shows how to call GetVectorStoreFiles and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +foreach (BinaryData item in client.GetVectorStoreFiles("rijuypqar", null, null, null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +} +]]> + + + +This sample shows how to call GetVectorStoreFileBatchFilesAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +await foreach (VectorStoreFile item in client.GetVectorStoreFileBatchFilesAsync("b", "itweqinnhpanpqxkxwqfi")) +{ +} +]]> +This sample shows how to call GetVectorStoreFileBatchFilesAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +await foreach (VectorStoreFile item in client.GetVectorStoreFileBatchFilesAsync("gipykvmemjcss", "awzuqhqpzl")) +{ +} +]]> + + + +This sample shows how to call GetVectorStoreFileBatchFiles. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +foreach (VectorStoreFile item in client.GetVectorStoreFileBatchFiles("b", "itweqinnhpanpqxkxwqfi")) +{ +} +]]> +This sample shows how to call GetVectorStoreFileBatchFiles. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +foreach (VectorStoreFile item in client.GetVectorStoreFileBatchFiles("gipykvmemjcss", "awzuqhqpzl")) +{ +} +]]> + + + +This sample shows how to call GetVectorStoreFileBatchFilesAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +await foreach (BinaryData item in client.GetVectorStoreFileBatchFilesAsync("b", "itweqinnhpanpqxkxwqfi", "in_progress", 22, "asc", "uotopjkuhxuxypqooudmdt", "lunnzgjqyjlrlvsldrkhrjvaqfovp", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +} +]]> +This sample shows how to call GetVectorStoreFileBatchFilesAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +await foreach (BinaryData item in client.GetVectorStoreFileBatchFilesAsync("gipykvmemjcss", "awzuqhqpzl", null, null, null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +} +]]> + + + +This sample shows how to call GetVectorStoreFileBatchFiles and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +foreach (BinaryData item in client.GetVectorStoreFileBatchFiles("b", "itweqinnhpanpqxkxwqfi", "in_progress", 22, "asc", "uotopjkuhxuxypqooudmdt", "lunnzgjqyjlrlvsldrkhrjvaqfovp", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +} +]]> +This sample shows how to call GetVectorStoreFileBatchFiles and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +VectorStoresClient client = new VectorStoresClient(endpoint, credential); + +foreach (BinaryData item in client.GetVectorStoreFileBatchFiles("gipykvmemjcss", "awzuqhqpzl", null, null, null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); +} +]]> + + + \ No newline at end of file diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/File.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/File.Serialization.cs deleted file mode 100644 index 3e84b77f907b..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/File.Serialization.cs +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class File : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(File)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ContentType)) - { - writer.WritePropertyName("contentType"u8); - writer.WriteStringValue(ContentType); - } - if (Optional.IsDefined(Filename)) - { - writer.WritePropertyName("filename"u8); - writer.WriteStringValue(Filename); - } - writer.WritePropertyName("contents"u8); - writer.WriteBase64StringValue(Contents.ToArray(), "D"); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - File IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(File)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeFile(document.RootElement, options); - } - - internal static File DeserializeFile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string contentType = default; - string filename = default; - BinaryData contents = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("contentType"u8)) - { - contentType = property.Value.GetString(); - continue; - } - if (property.NameEquals("filename"u8)) - { - filename = property.Value.GetString(); - continue; - } - if (property.NameEquals("contents"u8)) - { - contents = BinaryData.FromBytes(property.Value.GetBytesFromBase64("D")); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new File(contentType, filename, contents, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(File)} does not support writing '{options.Format}' format."); - } - } - - File IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeFile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(File)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static File FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeFile(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/File.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/File.cs deleted file mode 100644 index fe6fa90e5f73..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/File.cs +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// A file in an HTTP request, response, or multipart payload. - /// - /// Files have a special meaning that the HTTP library understands. When the body of an HTTP request, response, - /// or multipart payload is _effectively_ an instance of `TypeSpec.Http.File` or any type that extends it, the - /// operation is treated as a file upload or download. - /// - /// When using file bodies, the fields of the file model are defined to come from particular locations by default: - /// - /// - `contentType`: The `Content-Type` header of the request, response, or multipart payload (CANNOT be overridden or changed). - /// - `contents`: The body of the request, response, or multipart payload (CANNOT be overridden or changed). - /// - `filename`: The `filename` parameter value of the `Content-Disposition` header of the response or multipart payload - /// (MAY be overridden or changed). - /// - /// A File may be used as a normal structured JSON object in a request or response, if the request specifies an explicit - /// `Content-Type` header. In this case, the entire File model is serialized as if it were any other model. In a JSON payload, - /// it will have a structure like: - /// - /// ``` - /// { - /// "contentType": <string?>, - /// "filename": <string?>, - /// "contents": <string, base64> - /// } - /// ``` - /// - /// The `contentType` _within_ the file defines what media types the data inside the file can be, but if the specification - /// defines a `Content-Type` for the payload as HTTP metadata, that `Content-Type` metadata defines _how the file is - /// serialized_. See the examples below for more information. - /// - /// NOTE: The `filename` and `contentType` fields are optional. Furthermore, the default location of `filename` - /// (`Content-Disposition: <disposition>; filename=<filename>`) is only valid in HTTP responses and multipart payloads. If - /// you wish to send the `filename` in a request, you must use HTTP metadata decorators to describe the location of the - /// `filename` field. You can combine the metadata decorators with `@visibility` to control when the `filename` location - /// is overridden, as shown in the examples below. - /// - internal partial class File - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// - /// The contents of the file. - /// - /// In file bodies, this value comes from the body of the request, response, or multipart payload. In JSON bodies, - /// this value is serialized as a field in the response. - /// - /// is null. - public File(BinaryData contents) - { - Argument.AssertNotNull(contents, nameof(contents)); - - Contents = contents; - } - - /// Initializes a new instance of . - /// - /// The allowed media (MIME) types of the file contents. - /// - /// In file bodies, this value comes from the `Content-Type` header of the request or response. In JSON bodies, - /// this value is serialized as a field in the response. - /// - /// NOTE: this is not _necessarily_ the same as the `Content-Type` header of the request or response, but - /// it will be for file bodies. It may be different if the file is serialized as a JSON object. It always refers to the - /// _contents_ of the file, and not necessarily the way the file itself is transmitted or serialized. - /// - /// - /// The name of the file, if any. - /// - /// In file bodies, this value comes from the `filename` parameter of the `Content-Disposition` header of the response - /// or multipart payload. In JSON bodies, this value is serialized as a field in the response. - /// - /// NOTE: By default, `filename` cannot be sent in request payloads and can only be sent in responses and multipart - /// payloads, as the `Content-Disposition` header is not valid in requests. If you want to send the `filename` in a request, - /// you must extend the `File` model and override the `filename` property with a different location defined by HTTP metadata - /// decorators. - /// - /// - /// The contents of the file. - /// - /// In file bodies, this value comes from the body of the request, response, or multipart payload. In JSON bodies, - /// this value is serialized as a field in the response. - /// - /// Keeps track of any properties unknown to the library. - internal File(string contentType, string filename, BinaryData contents, IDictionary serializedAdditionalRawData) - { - ContentType = contentType; - Filename = filename; - Contents = contents; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal File() - { - } - - /// - /// The allowed media (MIME) types of the file contents. - /// - /// In file bodies, this value comes from the `Content-Type` header of the request or response. In JSON bodies, - /// this value is serialized as a field in the response. - /// - /// NOTE: this is not _necessarily_ the same as the `Content-Type` header of the request or response, but - /// it will be for file bodies. It may be different if the file is serialized as a JSON object. It always refers to the - /// _contents_ of the file, and not necessarily the way the file itself is transmitted or serialized. - /// - public string ContentType { get; set; } - /// - /// The name of the file, if any. - /// - /// In file bodies, this value comes from the `filename` parameter of the `Content-Disposition` header of the response - /// or multipart payload. In JSON bodies, this value is serialized as a field in the response. - /// - /// NOTE: By default, `filename` cannot be sent in request payloads and can only be sent in responses and multipart - /// payloads, as the `Content-Disposition` header is not valid in requests. If you want to send the `filename` in a request, - /// you must extend the `File` model and override the `filename` property with a different location defined by HTTP metadata - /// decorators. - /// - public string Filename { get; set; } - /// - /// The contents of the file. - /// - /// In file bodies, this value comes from the body of the request, response, or multipart payload. In JSON bodies, - /// this value is serialized as a field in the response. - /// - /// To assign a byte[] to this property use . - /// The byte[] will be serialized to a Base64 encoded string. - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromBytes(new byte[] { 1, 2, 3 }) - /// Creates a payload of "AQID". - /// - /// - /// - /// - public BinaryData Contents { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchRankingOptions.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchRankingOptions.cs index bdbe61ce8504..a79689fbca5b 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchRankingOptions.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchRankingOptions.cs @@ -49,7 +49,7 @@ public partial class FileSearchRankingOptions /// File search ranker. /// Ranker search threshold. /// is null. - public FileSearchRankingOptions(string ranker, float scoreThreshold) + internal FileSearchRankingOptions(string ranker, float scoreThreshold) { Argument.AssertNotNull(ranker, nameof(ranker)); @@ -74,8 +74,8 @@ internal FileSearchRankingOptions() } /// File search ranker. - public string Ranker { get; set; } + public string Ranker { get; } /// Ranker search threshold. - public float ScoreThreshold { get; set; } + public float ScoreThreshold { get; } } } diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolDefinition.Serialization.cs deleted file mode 100644 index 74b3fabe4351..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolDefinition.Serialization.cs +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class FileSearchToolDefinition : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(FileSearchToolDefinition)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(FileSearch)) - { - writer.WritePropertyName("file_search"u8); - writer.WriteObjectValue(FileSearch, options); - } - } - - FileSearchToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(FileSearchToolDefinition)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeFileSearchToolDefinition(document.RootElement, options); - } - - internal static FileSearchToolDefinition DeserializeFileSearchToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - FileSearchToolDefinitionDetails fileSearch = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("file_search"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - fileSearch = FileSearchToolDefinitionDetails.DeserializeFileSearchToolDefinitionDetails(property.Value, options); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new FileSearchToolDefinition(type, serializedAdditionalRawData, fileSearch); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(FileSearchToolDefinition)} does not support writing '{options.Format}' format."); - } - } - - FileSearchToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeFileSearchToolDefinition(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(FileSearchToolDefinition)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new FileSearchToolDefinition FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeFileSearchToolDefinition(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolDefinition.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolDefinition.cs deleted file mode 100644 index 4ca68ca24e62..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolDefinition.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The input definition information for a file search tool as used to configure an agent. - public partial class FileSearchToolDefinition : ToolDefinition - { - /// Initializes a new instance of . - public FileSearchToolDefinition() - { - Type = "file_search"; - } - - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - /// Options overrides for the file search tool. - internal FileSearchToolDefinition(string type, IDictionary serializedAdditionalRawData, FileSearchToolDefinitionDetails fileSearch) : base(type, serializedAdditionalRawData) - { - FileSearch = fileSearch; - } - - /// Options overrides for the file search tool. - public FileSearchToolDefinitionDetails FileSearch { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolDefinitionDetails.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolDefinitionDetails.Serialization.cs deleted file mode 100644 index 3805e5b8dfe9..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolDefinitionDetails.Serialization.cs +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class FileSearchToolDefinitionDetails : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(FileSearchToolDefinitionDetails)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(MaxNumResults)) - { - writer.WritePropertyName("max_num_results"u8); - writer.WriteNumberValue(MaxNumResults.Value); - } - if (Optional.IsDefined(RankingOptions)) - { - writer.WritePropertyName("ranking_options"u8); - writer.WriteObjectValue(RankingOptions, options); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - FileSearchToolDefinitionDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(FileSearchToolDefinitionDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeFileSearchToolDefinitionDetails(document.RootElement, options); - } - - internal static FileSearchToolDefinitionDetails DeserializeFileSearchToolDefinitionDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int? maxNumResults = default; - FileSearchRankingOptions rankingOptions = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("max_num_results"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - maxNumResults = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("ranking_options"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rankingOptions = FileSearchRankingOptions.DeserializeFileSearchRankingOptions(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new FileSearchToolDefinitionDetails(maxNumResults, rankingOptions, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(FileSearchToolDefinitionDetails)} does not support writing '{options.Format}' format."); - } - } - - FileSearchToolDefinitionDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeFileSearchToolDefinitionDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(FileSearchToolDefinitionDetails)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static FileSearchToolDefinitionDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeFileSearchToolDefinitionDetails(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolDefinitionDetails.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolDefinitionDetails.cs deleted file mode 100644 index 3e7a8d3e7c3d..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolDefinitionDetails.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Options overrides for the file search tool. - public partial class FileSearchToolDefinitionDetails - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public FileSearchToolDefinitionDetails() - { - } - - /// Initializes a new instance of . - /// - /// The maximum number of results the file search tool should output. The default is 20 for gpt-4* models and 5 for gpt-3.5-turbo. This number should be between 1 and 50 inclusive. - /// - /// Note that the file search tool may output fewer than `max_num_results` results. See the file search tool documentation for more information. - /// - /// Ranking options for file search. - /// Keeps track of any properties unknown to the library. - internal FileSearchToolDefinitionDetails(int? maxNumResults, FileSearchRankingOptions rankingOptions, IDictionary serializedAdditionalRawData) - { - MaxNumResults = maxNumResults; - RankingOptions = rankingOptions; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// - /// The maximum number of results the file search tool should output. The default is 20 for gpt-4* models and 5 for gpt-3.5-turbo. This number should be between 1 and 50 inclusive. - /// - /// Note that the file search tool may output fewer than `max_num_results` results. See the file search tool documentation for more information. - /// - public int? MaxNumResults { get; set; } - /// Ranking options for file search. - public FileSearchRankingOptions RankingOptions { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolResource.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolResource.Serialization.cs index 3dd0074f0d8b..70cf8ac9f14a 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolResource.Serialization.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolResource.Serialization.cs @@ -91,8 +91,8 @@ internal static FileSearchToolResource DeserializeFileSearchToolResource(JsonEle { return null; } - IList vectorStoreIds = default; - IList vectorStores = default; + IReadOnlyList vectorStoreIds = default; + IReadOnlyList vectorStores = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolResource.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolResource.cs index 765e4400325d..85e1f0d50a0a 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolResource.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileSearchToolResource.cs @@ -46,7 +46,7 @@ public partial class FileSearchToolResource private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public FileSearchToolResource() + internal FileSearchToolResource() { VectorStoreIds = new ChangeTrackingList(); VectorStores = new ChangeTrackingList(); @@ -63,7 +63,7 @@ public FileSearchToolResource() /// The only element of this list contains the list of azure asset IDs used by the search tool. /// /// Keeps track of any properties unknown to the library. - internal FileSearchToolResource(IList vectorStoreIds, IList vectorStores, IDictionary serializedAdditionalRawData) + internal FileSearchToolResource(IReadOnlyList vectorStoreIds, IReadOnlyList vectorStores, IDictionary serializedAdditionalRawData) { VectorStoreIds = vectorStoreIds; VectorStores = vectorStores; @@ -74,12 +74,12 @@ internal FileSearchToolResource(IList vectorStoreIds, IList - public IList VectorStoreIds { get; } + public IReadOnlyList VectorStoreIds { get; } /// /// The list of vector store configuration objects from Azure. /// This list is limited to one element. /// The only element of this list contains the list of azure asset IDs used by the search tool. /// - public IList VectorStores { get; } + public IReadOnlyList VectorStores { get; } } } diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileState.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileState.cs deleted file mode 100644 index cf909a8597d4..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FileState.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// The state of the file. - public readonly partial struct FileState : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public FileState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string UploadedValue = "uploaded"; - private const string PendingValue = "pending"; - private const string RunningValue = "running"; - private const string ProcessedValue = "processed"; - private const string ErrorValue = "error"; - private const string DeletingValue = "deleting"; - private const string DeletedValue = "deleted"; - - /// - /// The file has been uploaded but it's not yet processed. This state is not returned by Azure OpenAI and exposed only for - /// compatibility. It can be categorized as an inactive state. - /// - public static FileState Uploaded { get; } = new FileState(UploadedValue); - /// The operation was created and is not queued to be processed in the future. It can be categorized as an inactive state. - public static FileState Pending { get; } = new FileState(PendingValue); - /// The operation has started to be processed. It can be categorized as an active state. - public static FileState Running { get; } = new FileState(RunningValue); - /// The operation has successfully processed and is ready for consumption. It can be categorized as a terminal state. - public static FileState Processed { get; } = new FileState(ProcessedValue); - /// The operation has completed processing with a failure and cannot be further consumed. It can be categorized as a terminal state. - public static FileState Error { get; } = new FileState(ErrorValue); - /// - /// The entity is in the process to be deleted. This state is not returned by Azure OpenAI and exposed only for compatibility. - /// It can be categorized as an active state. - /// - public static FileState Deleting { get; } = new FileState(DeletingValue); - /// - /// The entity has been deleted but may still be referenced by other entities predating the deletion. It can be categorized as a - /// terminal state. - /// - public static FileState Deleted { get; } = new FileState(DeletedValue); - /// Determines if two values are the same. - public static bool operator ==(FileState left, FileState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(FileState left, FileState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator FileState(string value) => new FileState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is FileState other && Equals(other); - /// - public bool Equals(FileState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FunctionToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FunctionToolDefinition.Serialization.cs deleted file mode 100644 index b2875c563562..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FunctionToolDefinition.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class FunctionToolDefinition : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(FunctionToolDefinition)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("function"u8); - writer.WriteObjectValue(InternalFunction, options); - } - - FunctionToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(FunctionToolDefinition)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeFunctionToolDefinition(document.RootElement, options); - } - - internal static FunctionToolDefinition DeserializeFunctionToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - InternalFunctionDefinition function = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("function"u8)) - { - function = InternalFunctionDefinition.DeserializeInternalFunctionDefinition(property.Value, options); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new FunctionToolDefinition(type, serializedAdditionalRawData, function); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(FunctionToolDefinition)} does not support writing '{options.Format}' format."); - } - } - - FunctionToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeFunctionToolDefinition(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(FunctionToolDefinition)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new FunctionToolDefinition FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeFunctionToolDefinition(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FunctionToolDefinition.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FunctionToolDefinition.cs deleted file mode 100644 index 9b57e5511e98..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/FunctionToolDefinition.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The input definition information for a function tool as used to configure an agent. - public partial class FunctionToolDefinition : ToolDefinition - { - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - /// The definition of the concrete function that the function tool should call. - internal FunctionToolDefinition(string type, IDictionary serializedAdditionalRawData, InternalFunctionDefinition internalFunction) : base(type, serializedAdditionalRawData) - { - InternalFunction = internalFunction; - } - - /// Initializes a new instance of for deserialization. - internal FunctionToolDefinition() - { - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ImageDetailLevel.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ImageDetailLevel.cs deleted file mode 100644 index 5e913a717116..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ImageDetailLevel.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// Specifies an image's detail level. Can be 'auto', 'low', 'high', or an unknown future value. - public readonly partial struct ImageDetailLevel : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ImageDetailLevel(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AutoValue = "auto"; - private const string LowValue = "low"; - private const string HighValue = "high"; - - /// Automatically select an appropriate detail level. - public static ImageDetailLevel Auto { get; } = new ImageDetailLevel(AutoValue); - /// Use a lower detail level to reduce bandwidth or cost. - public static ImageDetailLevel Low { get; } = new ImageDetailLevel(LowValue); - /// Use a higher detail level—potentially more resource-intensive. - public static ImageDetailLevel High { get; } = new ImageDetailLevel(HighValue); - /// Determines if two values are the same. - public static bool operator ==(ImageDetailLevel left, ImageDetailLevel right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ImageDetailLevel left, ImageDetailLevel right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ImageDetailLevel(string value) => new ImageDetailLevel(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ImageDetailLevel other && Equals(other); - /// - public bool Equals(ImageDetailLevel other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/IncompleteDetailsReason.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/IncompleteDetailsReason.cs deleted file mode 100644 index a4109a3d1206..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/IncompleteDetailsReason.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run. - public readonly partial struct IncompleteDetailsReason : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public IncompleteDetailsReason(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string MaxCompletionTokensValue = "max_completion_tokens"; - private const string MaxPromptTokensValue = "max_prompt_tokens"; - - /// Maximum completion tokens exceeded. - public static IncompleteDetailsReason MaxCompletionTokens { get; } = new IncompleteDetailsReason(MaxCompletionTokensValue); - /// Maximum prompt tokens exceeded. - public static IncompleteDetailsReason MaxPromptTokens { get; } = new IncompleteDetailsReason(MaxPromptTokensValue); - /// Determines if two values are the same. - public static bool operator ==(IncompleteDetailsReason left, IncompleteDetailsReason right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(IncompleteDetailsReason left, IncompleteDetailsReason right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator IncompleteDetailsReason(string value) => new IncompleteDetailsReason(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is IncompleteDetailsReason other && Equals(other); - /// - public bool Equals(IncompleteDetailsReason other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/IncompleteRunDetails.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/IncompleteRunDetails.Serialization.cs deleted file mode 100644 index 724c8d824270..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/IncompleteRunDetails.Serialization.cs +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class IncompleteRunDetails : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(IncompleteRunDetails)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("reason"u8); - writer.WriteStringValue(Reason.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - IncompleteRunDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(IncompleteRunDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeIncompleteRunDetails(document.RootElement, options); - } - - internal static IncompleteRunDetails DeserializeIncompleteRunDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IncompleteDetailsReason reason = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("reason"u8)) - { - reason = new IncompleteDetailsReason(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new IncompleteRunDetails(reason, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(IncompleteRunDetails)} does not support writing '{options.Format}' format."); - } - } - - IncompleteRunDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeIncompleteRunDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(IncompleteRunDetails)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static IncompleteRunDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeIncompleteRunDetails(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/IncompleteRunDetails.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/IncompleteRunDetails.cs deleted file mode 100644 index 7e0d64c85478..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/IncompleteRunDetails.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Details on why the run is incomplete. Will be `null` if the run is not incomplete. - public partial class IncompleteRunDetails - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The reason why the run is incomplete. This indicates which specific token limit was reached during the run. - internal IncompleteRunDetails(IncompleteDetailsReason reason) - { - Reason = reason; - } - - /// Initializes a new instance of . - /// The reason why the run is incomplete. This indicates which specific token limit was reached during the run. - /// Keeps track of any properties unknown to the library. - internal IncompleteRunDetails(IncompleteDetailsReason reason, IDictionary serializedAdditionalRawData) - { - Reason = reason; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal IncompleteRunDetails() - { - } - - /// The reason why the run is incomplete. This indicates which specific token limit was reached during the run. - public IncompleteDetailsReason Reason { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalAgentDeletionStatus.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalAgentDeletionStatus.Serialization.cs deleted file mode 100644 index 65c803fcb4ae..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalAgentDeletionStatus.Serialization.cs +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class InternalAgentDeletionStatus : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InternalAgentDeletionStatus)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("deleted"u8); - writer.WriteBooleanValue(Deleted); - writer.WritePropertyName("object"u8); - writer.WriteStringValue(Object.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - InternalAgentDeletionStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InternalAgentDeletionStatus)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeInternalAgentDeletionStatus(document.RootElement, options); - } - - internal static InternalAgentDeletionStatus DeserializeInternalAgentDeletionStatus(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - bool deleted = default; - InternalAgentDeletionStatusObject @object = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("deleted"u8)) - { - deleted = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("object"u8)) - { - @object = new InternalAgentDeletionStatusObject(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new InternalAgentDeletionStatus(id, deleted, @object, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(InternalAgentDeletionStatus)} does not support writing '{options.Format}' format."); - } - } - - InternalAgentDeletionStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeInternalAgentDeletionStatus(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(InternalAgentDeletionStatus)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static InternalAgentDeletionStatus FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeInternalAgentDeletionStatus(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalAgentDeletionStatus.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalAgentDeletionStatus.cs deleted file mode 100644 index dac0cabe7a0a..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalAgentDeletionStatus.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The status of an agent deletion operation. - internal partial class InternalAgentDeletionStatus - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The ID of the resource specified for deletion. - /// A value indicating whether deletion was successful. - /// is null. - internal InternalAgentDeletionStatus(string id, bool deleted) - { - Argument.AssertNotNull(id, nameof(id)); - - Id = id; - Deleted = deleted; - } - - /// Initializes a new instance of . - /// The ID of the resource specified for deletion. - /// A value indicating whether deletion was successful. - /// The object type, which is always 'assistant.deleted'. - /// Keeps track of any properties unknown to the library. - internal InternalAgentDeletionStatus(string id, bool deleted, InternalAgentDeletionStatusObject @object, IDictionary serializedAdditionalRawData) - { - Id = id; - Deleted = deleted; - Object = @object; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal InternalAgentDeletionStatus() - { - } - - /// The ID of the resource specified for deletion. - public string Id { get; } - /// A value indicating whether deletion was successful. - public bool Deleted { get; } - /// The object type, which is always 'assistant.deleted'. - public InternalAgentDeletionStatusObject Object { get; } = InternalAgentDeletionStatusObject.AssistantDeleted; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalAgentDeletionStatusObject.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalAgentDeletionStatusObject.cs deleted file mode 100644 index cb57f938c5b4..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalAgentDeletionStatusObject.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// The InternalAgentDeletionStatus_object. - internal readonly partial struct InternalAgentDeletionStatusObject : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public InternalAgentDeletionStatusObject(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AssistantDeletedValue = "assistant.deleted"; - - /// assistant.deleted. - public static InternalAgentDeletionStatusObject AssistantDeleted { get; } = new InternalAgentDeletionStatusObject(AssistantDeletedValue); - /// Determines if two values are the same. - public static bool operator ==(InternalAgentDeletionStatusObject left, InternalAgentDeletionStatusObject right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(InternalAgentDeletionStatusObject left, InternalAgentDeletionStatusObject right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator InternalAgentDeletionStatusObject(string value) => new InternalAgentDeletionStatusObject(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is InternalAgentDeletionStatusObject other && Equals(other); - /// - public bool Equals(InternalAgentDeletionStatusObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalAzureFunctionDefinition.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalAzureFunctionDefinition.Serialization.cs deleted file mode 100644 index 89599a6437d1..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalAzureFunctionDefinition.Serialization.cs +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class InternalAzureFunctionDefinition : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InternalAzureFunctionDefinition)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("function"u8); - writer.WriteObjectValue(Function, options); - writer.WritePropertyName("input_binding"u8); - writer.WriteObjectValue(InputBinding, options); - writer.WritePropertyName("output_binding"u8); - writer.WriteObjectValue(OutputBinding, options); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - InternalAzureFunctionDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InternalAzureFunctionDefinition)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeInternalAzureFunctionDefinition(document.RootElement, options); - } - - internal static InternalAzureFunctionDefinition DeserializeInternalAzureFunctionDefinition(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - InternalFunctionDefinition function = default; - AzureFunctionBinding inputBinding = default; - AzureFunctionBinding outputBinding = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("function"u8)) - { - function = InternalFunctionDefinition.DeserializeInternalFunctionDefinition(property.Value, options); - continue; - } - if (property.NameEquals("input_binding"u8)) - { - inputBinding = AzureFunctionBinding.DeserializeAzureFunctionBinding(property.Value, options); - continue; - } - if (property.NameEquals("output_binding"u8)) - { - outputBinding = AzureFunctionBinding.DeserializeAzureFunctionBinding(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new InternalAzureFunctionDefinition(function, inputBinding, outputBinding, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(InternalAzureFunctionDefinition)} does not support writing '{options.Format}' format."); - } - } - - InternalAzureFunctionDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeInternalAzureFunctionDefinition(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(InternalAzureFunctionDefinition)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static InternalAzureFunctionDefinition FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeInternalAzureFunctionDefinition(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalAzureFunctionDefinition.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalAzureFunctionDefinition.cs deleted file mode 100644 index 47dfae031c6b..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalAzureFunctionDefinition.cs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The definition of Azure function. - internal partial class InternalAzureFunctionDefinition - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The definition of azure function and its parameters. - /// Input storage queue. The queue storage trigger runs a function as messages are added to it. - /// Output storage queue. The function writes output to this queue when the input items are processed. - /// , or is null. - public InternalAzureFunctionDefinition(InternalFunctionDefinition function, AzureFunctionBinding inputBinding, AzureFunctionBinding outputBinding) - { - Argument.AssertNotNull(function, nameof(function)); - Argument.AssertNotNull(inputBinding, nameof(inputBinding)); - Argument.AssertNotNull(outputBinding, nameof(outputBinding)); - - Function = function; - InputBinding = inputBinding; - OutputBinding = outputBinding; - } - - /// Initializes a new instance of . - /// The definition of azure function and its parameters. - /// Input storage queue. The queue storage trigger runs a function as messages are added to it. - /// Output storage queue. The function writes output to this queue when the input items are processed. - /// Keeps track of any properties unknown to the library. - internal InternalAzureFunctionDefinition(InternalFunctionDefinition function, AzureFunctionBinding inputBinding, AzureFunctionBinding outputBinding, IDictionary serializedAdditionalRawData) - { - Function = function; - InputBinding = inputBinding; - OutputBinding = outputBinding; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal InternalAzureFunctionDefinition() - { - } - - /// The definition of azure function and its parameters. - public InternalFunctionDefinition Function { get; set; } - /// Input storage queue. The queue storage trigger runs a function as messages are added to it. - public AzureFunctionBinding InputBinding { get; set; } - /// Output storage queue. The function writes output to this queue when the input items are processed. - public AzureFunctionBinding OutputBinding { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalCodeInterpreterToolCallDetails.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalCodeInterpreterToolCallDetails.Serialization.cs deleted file mode 100644 index 6b28720d5796..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalCodeInterpreterToolCallDetails.Serialization.cs +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class InternalCodeInterpreterToolCallDetails : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InternalCodeInterpreterToolCallDetails)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("input"u8); - writer.WriteStringValue(Input); - writer.WritePropertyName("outputs"u8); - writer.WriteStartArray(); - foreach (var item in Outputs) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - InternalCodeInterpreterToolCallDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InternalCodeInterpreterToolCallDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeInternalCodeInterpreterToolCallDetails(document.RootElement, options); - } - - internal static InternalCodeInterpreterToolCallDetails DeserializeInternalCodeInterpreterToolCallDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string input = default; - IReadOnlyList outputs = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("input"u8)) - { - input = property.Value.GetString(); - continue; - } - if (property.NameEquals("outputs"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(RunStepCodeInterpreterToolCallOutput.DeserializeRunStepCodeInterpreterToolCallOutput(item, options)); - } - outputs = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new InternalCodeInterpreterToolCallDetails(input, outputs, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(InternalCodeInterpreterToolCallDetails)} does not support writing '{options.Format}' format."); - } - } - - InternalCodeInterpreterToolCallDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeInternalCodeInterpreterToolCallDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(InternalCodeInterpreterToolCallDetails)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static InternalCodeInterpreterToolCallDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeInternalCodeInterpreterToolCallDetails(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalCodeInterpreterToolCallDetails.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalCodeInterpreterToolCallDetails.cs deleted file mode 100644 index 37a5c23934a9..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalCodeInterpreterToolCallDetails.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.AI.Agents.Persistent -{ - /// The detailed information about a code interpreter invocation by the model. - internal partial class InternalCodeInterpreterToolCallDetails - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The input provided by the model to the code interpreter tool. - /// - /// The outputs produced by the code interpreter tool back to the model in response to the tool call. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - /// or is null. - internal InternalCodeInterpreterToolCallDetails(string input, IEnumerable outputs) - { - Argument.AssertNotNull(input, nameof(input)); - Argument.AssertNotNull(outputs, nameof(outputs)); - - Input = input; - Outputs = outputs.ToList(); - } - - /// Initializes a new instance of . - /// The input provided by the model to the code interpreter tool. - /// - /// The outputs produced by the code interpreter tool back to the model in response to the tool call. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - /// Keeps track of any properties unknown to the library. - internal InternalCodeInterpreterToolCallDetails(string input, IReadOnlyList outputs, IDictionary serializedAdditionalRawData) - { - Input = input; - Outputs = outputs; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal InternalCodeInterpreterToolCallDetails() - { - } - - /// The input provided by the model to the code interpreter tool. - public string Input { get; } - /// - /// The outputs produced by the code interpreter tool back to the model in response to the tool call. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - public IReadOnlyList Outputs { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileDeletionStatus.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileDeletionStatus.Serialization.cs deleted file mode 100644 index a3c46d3572e1..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileDeletionStatus.Serialization.cs +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class InternalFileDeletionStatus : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InternalFileDeletionStatus)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("deleted"u8); - writer.WriteBooleanValue(Deleted); - writer.WritePropertyName("object"u8); - writer.WriteStringValue(Object.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - InternalFileDeletionStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InternalFileDeletionStatus)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeInternalFileDeletionStatus(document.RootElement, options); - } - - internal static InternalFileDeletionStatus DeserializeInternalFileDeletionStatus(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - bool deleted = default; - InternalFileDeletionStatusObject @object = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("deleted"u8)) - { - deleted = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("object"u8)) - { - @object = new InternalFileDeletionStatusObject(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new InternalFileDeletionStatus(id, deleted, @object, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(InternalFileDeletionStatus)} does not support writing '{options.Format}' format."); - } - } - - InternalFileDeletionStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeInternalFileDeletionStatus(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(InternalFileDeletionStatus)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static InternalFileDeletionStatus FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeInternalFileDeletionStatus(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileDeletionStatus.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileDeletionStatus.cs deleted file mode 100644 index e879b20d7ad8..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileDeletionStatus.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// A status response from a file deletion operation. - internal partial class InternalFileDeletionStatus - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The ID of the resource specified for deletion. - /// A value indicating whether deletion was successful. - /// is null. - internal InternalFileDeletionStatus(string id, bool deleted) - { - Argument.AssertNotNull(id, nameof(id)); - - Id = id; - Deleted = deleted; - } - - /// Initializes a new instance of . - /// The ID of the resource specified for deletion. - /// A value indicating whether deletion was successful. - /// The object type, which is always 'file'. - /// Keeps track of any properties unknown to the library. - internal InternalFileDeletionStatus(string id, bool deleted, InternalFileDeletionStatusObject @object, IDictionary serializedAdditionalRawData) - { - Id = id; - Deleted = deleted; - Object = @object; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal InternalFileDeletionStatus() - { - } - - /// The ID of the resource specified for deletion. - public string Id { get; } - /// A value indicating whether deletion was successful. - public bool Deleted { get; } - /// The object type, which is always 'file'. - public InternalFileDeletionStatusObject Object { get; } = InternalFileDeletionStatusObject.File; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileDeletionStatusObject.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileDeletionStatusObject.cs deleted file mode 100644 index 3c33bde644c5..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileDeletionStatusObject.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// The InternalFileDeletionStatus_object. - internal readonly partial struct InternalFileDeletionStatusObject : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public InternalFileDeletionStatusObject(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string FileValue = "file"; - - /// file. - public static InternalFileDeletionStatusObject File { get; } = new InternalFileDeletionStatusObject(FileValue); - /// Determines if two values are the same. - public static bool operator ==(InternalFileDeletionStatusObject left, InternalFileDeletionStatusObject right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(InternalFileDeletionStatusObject left, InternalFileDeletionStatusObject right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator InternalFileDeletionStatusObject(string value) => new InternalFileDeletionStatusObject(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is InternalFileDeletionStatusObject other && Equals(other); - /// - public bool Equals(InternalFileDeletionStatusObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileListResponse.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileListResponse.Serialization.cs deleted file mode 100644 index 56359b7141ed..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileListResponse.Serialization.cs +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class InternalFileListResponse : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InternalFileListResponse)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("object"u8); - writer.WriteStringValue(Object.ToString()); - writer.WritePropertyName("data"u8); - writer.WriteStartArray(); - foreach (var item in Data) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - InternalFileListResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InternalFileListResponse)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeInternalFileListResponse(document.RootElement, options); - } - - internal static InternalFileListResponse DeserializeInternalFileListResponse(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - InternalFileListResponseObject @object = default; - IReadOnlyList data = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("object"u8)) - { - @object = new InternalFileListResponseObject(property.Value.GetString()); - continue; - } - if (property.NameEquals("data"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(PersistentAgentFileInfo.DeserializePersistentAgentFileInfo(item, options)); - } - data = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new InternalFileListResponse(@object, data, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(InternalFileListResponse)} does not support writing '{options.Format}' format."); - } - } - - InternalFileListResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeInternalFileListResponse(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(InternalFileListResponse)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static InternalFileListResponse FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeInternalFileListResponse(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileListResponse.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileListResponse.cs deleted file mode 100644 index 3585f4a77ac0..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileListResponse.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.AI.Agents.Persistent -{ - /// The response data from a file list operation. - internal partial class InternalFileListResponse - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The files returned for the request. - /// is null. - internal InternalFileListResponse(IEnumerable data) - { - Argument.AssertNotNull(data, nameof(data)); - - Data = data.ToList(); - } - - /// Initializes a new instance of . - /// The object type, which is always 'list'. - /// The files returned for the request. - /// Keeps track of any properties unknown to the library. - internal InternalFileListResponse(InternalFileListResponseObject @object, IReadOnlyList data, IDictionary serializedAdditionalRawData) - { - Object = @object; - Data = data; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal InternalFileListResponse() - { - } - - /// The object type, which is always 'list'. - public InternalFileListResponseObject Object { get; } = InternalFileListResponseObject.List; - - /// The files returned for the request. - public IReadOnlyList Data { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileListResponseObject.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileListResponseObject.cs deleted file mode 100644 index e1273f795938..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFileListResponseObject.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// The InternalFileListResponse_object. - internal readonly partial struct InternalFileListResponseObject : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public InternalFileListResponseObject(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ListValue = "list"; - - /// list. - public static InternalFileListResponseObject List { get; } = new InternalFileListResponseObject(ListValue); - /// Determines if two values are the same. - public static bool operator ==(InternalFileListResponseObject left, InternalFileListResponseObject right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(InternalFileListResponseObject left, InternalFileListResponseObject right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator InternalFileListResponseObject(string value) => new InternalFileListResponseObject(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is InternalFileListResponseObject other && Equals(other); - /// - public bool Equals(InternalFileListResponseObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFunctionDefinition.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFunctionDefinition.Serialization.cs deleted file mode 100644 index 980322408fb7..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFunctionDefinition.Serialization.cs +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class InternalFunctionDefinition : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InternalFunctionDefinition)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - writer.WritePropertyName("parameters"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(Parameters); -#else - using (JsonDocument document = JsonDocument.Parse(Parameters, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - InternalFunctionDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InternalFunctionDefinition)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeInternalFunctionDefinition(document.RootElement, options); - } - - internal static InternalFunctionDefinition DeserializeInternalFunctionDefinition(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = default; - string description = default; - BinaryData parameters = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("description"u8)) - { - description = property.Value.GetString(); - continue; - } - if (property.NameEquals("parameters"u8)) - { - parameters = BinaryData.FromString(property.Value.GetRawText()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new InternalFunctionDefinition(name, description, parameters, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(InternalFunctionDefinition)} does not support writing '{options.Format}' format."); - } - } - - InternalFunctionDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeInternalFunctionDefinition(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(InternalFunctionDefinition)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static InternalFunctionDefinition FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeInternalFunctionDefinition(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFunctionDefinition.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFunctionDefinition.cs deleted file mode 100644 index d1e082e988ad..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalFunctionDefinition.cs +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The input definition information for a function. - internal partial class InternalFunctionDefinition - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The name of the function to be called. - /// The parameters the functions accepts, described as a JSON Schema object. - /// or is null. - public InternalFunctionDefinition(string name, BinaryData parameters) - { - Argument.AssertNotNull(name, nameof(name)); - Argument.AssertNotNull(parameters, nameof(parameters)); - - Name = name; - Parameters = parameters; - } - - /// Initializes a new instance of . - /// The name of the function to be called. - /// A description of what the function does, used by the model to choose when and how to call the function. - /// The parameters the functions accepts, described as a JSON Schema object. - /// Keeps track of any properties unknown to the library. - internal InternalFunctionDefinition(string name, string description, BinaryData parameters, IDictionary serializedAdditionalRawData) - { - Name = name; - Description = description; - Parameters = parameters; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal InternalFunctionDefinition() - { - } - - /// The name of the function to be called. - public string Name { get; set; } - /// A description of what the function does, used by the model to choose when and how to call the function. - public string Description { get; set; } - /// - /// The parameters the functions accepts, described as a JSON Schema object. - /// - /// To assign an object to this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - public BinaryData Parameters { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalPersistentAgentsResponseFormat.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalPersistentAgentsResponseFormat.Serialization.cs deleted file mode 100644 index 5080938904e6..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalPersistentAgentsResponseFormat.Serialization.cs +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class InternalPersistentAgentsResponseFormat : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InternalPersistentAgentsResponseFormat)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Type)) - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type.Value.ToString()); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - InternalPersistentAgentsResponseFormat IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InternalPersistentAgentsResponseFormat)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeInternalPersistentAgentsResponseFormat(document.RootElement, options); - } - - internal static InternalPersistentAgentsResponseFormat DeserializeInternalPersistentAgentsResponseFormat(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResponseFormat? type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - type = new ResponseFormat(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new InternalPersistentAgentsResponseFormat(type, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(InternalPersistentAgentsResponseFormat)} does not support writing '{options.Format}' format."); - } - } - - InternalPersistentAgentsResponseFormat IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeInternalPersistentAgentsResponseFormat(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(InternalPersistentAgentsResponseFormat)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static InternalPersistentAgentsResponseFormat FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeInternalPersistentAgentsResponseFormat(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalPersistentAgentsResponseFormat.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalPersistentAgentsResponseFormat.cs deleted file mode 100644 index ae42c5945c51..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalPersistentAgentsResponseFormat.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// An object describing the expected output of the model. If `json_object` only `function` type `tools` are allowed to be passed to the Run. - /// If `text` the model can return text or any value needed. - /// - internal partial class InternalPersistentAgentsResponseFormat - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public InternalPersistentAgentsResponseFormat() - { - } - - /// Initializes a new instance of . - /// Must be one of `text` or `json_object`. - /// Keeps track of any properties unknown to the library. - internal InternalPersistentAgentsResponseFormat(ResponseFormat? type, IDictionary serializedAdditionalRawData) - { - Type = type; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Must be one of `text` or `json_object`. - public ResponseFormat? Type { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalRequiredFunctionToolCallDetails.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalRequiredFunctionToolCallDetails.Serialization.cs deleted file mode 100644 index 0a4ef02fd4be..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalRequiredFunctionToolCallDetails.Serialization.cs +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class InternalRequiredFunctionToolCallDetails : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InternalRequiredFunctionToolCallDetails)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - writer.WritePropertyName("arguments"u8); - writer.WriteStringValue(Arguments); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - InternalRequiredFunctionToolCallDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InternalRequiredFunctionToolCallDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeInternalRequiredFunctionToolCallDetails(document.RootElement, options); - } - - internal static InternalRequiredFunctionToolCallDetails DeserializeInternalRequiredFunctionToolCallDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = default; - string arguments = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("arguments"u8)) - { - arguments = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new InternalRequiredFunctionToolCallDetails(name, arguments, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(InternalRequiredFunctionToolCallDetails)} does not support writing '{options.Format}' format."); - } - } - - InternalRequiredFunctionToolCallDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeInternalRequiredFunctionToolCallDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(InternalRequiredFunctionToolCallDetails)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static InternalRequiredFunctionToolCallDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeInternalRequiredFunctionToolCallDetails(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalRequiredFunctionToolCallDetails.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalRequiredFunctionToolCallDetails.cs deleted file mode 100644 index a2d8faa98f35..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalRequiredFunctionToolCallDetails.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The detailed information for a function invocation, as provided by a required action invoking a function tool, that includes the name of and arguments to the function. - internal partial class InternalRequiredFunctionToolCallDetails - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The name of the function. - /// The arguments to use when invoking the named function, as provided by the model. Arguments are presented as a JSON document that should be validated and parsed for evaluation. - /// or is null. - internal InternalRequiredFunctionToolCallDetails(string name, string arguments) - { - Argument.AssertNotNull(name, nameof(name)); - Argument.AssertNotNull(arguments, nameof(arguments)); - - Name = name; - Arguments = arguments; - } - - /// Initializes a new instance of . - /// The name of the function. - /// The arguments to use when invoking the named function, as provided by the model. Arguments are presented as a JSON document that should be validated and parsed for evaluation. - /// Keeps track of any properties unknown to the library. - internal InternalRequiredFunctionToolCallDetails(string name, string arguments, IDictionary serializedAdditionalRawData) - { - Name = name; - Arguments = arguments; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal InternalRequiredFunctionToolCallDetails() - { - } - - /// The name of the function. - public string Name { get; } - /// The arguments to use when invoking the named function, as provided by the model. Arguments are presented as a JSON document that should be validated and parsed for evaluation. - public string Arguments { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalRunStepFunctionToolCallDetails.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalRunStepFunctionToolCallDetails.Serialization.cs deleted file mode 100644 index b2e1e41ed872..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalRunStepFunctionToolCallDetails.Serialization.cs +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class InternalRunStepFunctionToolCallDetails : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InternalRunStepFunctionToolCallDetails)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - writer.WritePropertyName("arguments"u8); - writer.WriteStringValue(Arguments); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - InternalRunStepFunctionToolCallDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InternalRunStepFunctionToolCallDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeInternalRunStepFunctionToolCallDetails(document.RootElement, options); - } - - internal static InternalRunStepFunctionToolCallDetails DeserializeInternalRunStepFunctionToolCallDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = default; - string arguments = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("arguments"u8)) - { - arguments = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new InternalRunStepFunctionToolCallDetails(name, arguments, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(InternalRunStepFunctionToolCallDetails)} does not support writing '{options.Format}' format."); - } - } - - InternalRunStepFunctionToolCallDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeInternalRunStepFunctionToolCallDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(InternalRunStepFunctionToolCallDetails)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static InternalRunStepFunctionToolCallDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeInternalRunStepFunctionToolCallDetails(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalRunStepFunctionToolCallDetails.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalRunStepFunctionToolCallDetails.cs deleted file mode 100644 index a7a661c84064..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalRunStepFunctionToolCallDetails.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The detailed information about the function called by the model. - internal partial class InternalRunStepFunctionToolCallDetails - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The name of the function. - /// The arguments that the model requires are provided to the named function. - /// or is null. - internal InternalRunStepFunctionToolCallDetails(string name, string arguments) - { - Argument.AssertNotNull(name, nameof(name)); - Argument.AssertNotNull(arguments, nameof(arguments)); - - Name = name; - Arguments = arguments; - } - - /// Initializes a new instance of . - /// The name of the function. - /// The arguments that the model requires are provided to the named function. - /// Keeps track of any properties unknown to the library. - internal InternalRunStepFunctionToolCallDetails(string name, string arguments, IDictionary serializedAdditionalRawData) - { - Name = name; - Arguments = arguments; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal InternalRunStepFunctionToolCallDetails() - { - } - - /// The name of the function. - public string Name { get; } - /// The arguments that the model requires are provided to the named function. - public string Arguments { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalSubmitToolOutputsDetails.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalSubmitToolOutputsDetails.Serialization.cs deleted file mode 100644 index 2d4c2da43713..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalSubmitToolOutputsDetails.Serialization.cs +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class InternalSubmitToolOutputsDetails : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InternalSubmitToolOutputsDetails)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("tool_calls"u8); - writer.WriteStartArray(); - foreach (var item in ToolCalls) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - InternalSubmitToolOutputsDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InternalSubmitToolOutputsDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeInternalSubmitToolOutputsDetails(document.RootElement, options); - } - - internal static InternalSubmitToolOutputsDetails DeserializeInternalSubmitToolOutputsDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList toolCalls = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tool_calls"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(RequiredToolCall.DeserializeRequiredToolCall(item, options)); - } - toolCalls = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new InternalSubmitToolOutputsDetails(toolCalls, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(InternalSubmitToolOutputsDetails)} does not support writing '{options.Format}' format."); - } - } - - InternalSubmitToolOutputsDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeInternalSubmitToolOutputsDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(InternalSubmitToolOutputsDetails)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static InternalSubmitToolOutputsDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeInternalSubmitToolOutputsDetails(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalSubmitToolOutputsDetails.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalSubmitToolOutputsDetails.cs deleted file mode 100644 index 48c469214931..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/InternalSubmitToolOutputsDetails.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.AI.Agents.Persistent -{ - /// The details describing tools that should be called to submit tool outputs. - internal partial class InternalSubmitToolOutputsDetails - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// - /// The list of tool calls that must be resolved for the agent thread run to continue. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include . - /// - /// is null. - internal InternalSubmitToolOutputsDetails(IEnumerable toolCalls) - { - Argument.AssertNotNull(toolCalls, nameof(toolCalls)); - - ToolCalls = toolCalls.ToList(); - } - - /// Initializes a new instance of . - /// - /// The list of tool calls that must be resolved for the agent thread run to continue. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include . - /// - /// Keeps track of any properties unknown to the library. - internal InternalSubmitToolOutputsDetails(IReadOnlyList toolCalls, IDictionary serializedAdditionalRawData) - { - ToolCalls = toolCalls; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal InternalSubmitToolOutputsDetails() - { - } - - /// - /// The list of tool calls that must be resolved for the agent thread run to continue. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include . - /// - public IReadOnlyList ToolCalls { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageAttachment.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageAttachment.Serialization.cs deleted file mode 100644 index 146086d19636..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageAttachment.Serialization.cs +++ /dev/null @@ -1,197 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class MessageAttachment : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageAttachment)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(FileId)) - { - writer.WritePropertyName("file_id"u8); - writer.WriteStringValue(FileId); - } - if (Optional.IsDefined(DataSource)) - { - writer.WritePropertyName("data_source"u8); - writer.WriteObjectValue(DataSource, options); - } - writer.WritePropertyName("tools"u8); - writer.WriteStartArray(); - foreach (var item in Tools) - { - if (item == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item); -#else - using (JsonDocument document = JsonDocument.Parse(item, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndArray(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - MessageAttachment IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageAttachment)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageAttachment(document.RootElement, options); - } - - internal static MessageAttachment DeserializeMessageAttachment(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string fileId = default; - VectorStoreDataSource dataSource = default; - IList tools = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("file_id"u8)) - { - fileId = property.Value.GetString(); - continue; - } - if (property.NameEquals("data_source"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - dataSource = VectorStoreDataSource.DeserializeVectorStoreDataSource(property.Value, options); - continue; - } - if (property.NameEquals("tools"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - if (item.ValueKind == JsonValueKind.Null) - { - array.Add(null); - } - else - { - array.Add(BinaryData.FromString(item.GetRawText())); - } - } - tools = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MessageAttachment(fileId, dataSource, tools, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(MessageAttachment)} does not support writing '{options.Format}' format."); - } - } - - MessageAttachment IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMessageAttachment(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageAttachment)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static MessageAttachment FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMessageAttachment(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageAttachment.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageAttachment.cs deleted file mode 100644 index ec4296155e12..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageAttachment.cs +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.AI.Agents.Persistent -{ - /// This describes to which tools a file has been attached. - public partial class MessageAttachment - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The tools to add to this file. - /// is null. - public MessageAttachment(IEnumerable tools) - { - Argument.AssertNotNull(tools, nameof(tools)); - - Tools = tools.ToList(); - } - - /// Initializes a new instance of . - /// The ID of the file to attach to the message. - /// Azure asset ID. - /// The tools to add to this file. - /// Keeps track of any properties unknown to the library. - internal MessageAttachment(string fileId, VectorStoreDataSource dataSource, IList tools, IDictionary serializedAdditionalRawData) - { - FileId = fileId; - DataSource = dataSource; - Tools = tools; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MessageAttachment() - { - } - - /// The ID of the file to attach to the message. - public string FileId { get; set; } - /// Azure asset ID. - public VectorStoreDataSource DataSource { get; set; } - /// - /// The tools to add to this file. - /// - /// To assign an object to the element of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// - /// Supported types: - /// - /// - /// - /// - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - public IList Tools { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageBlockType.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageBlockType.cs deleted file mode 100644 index 2a5c2f5b5c6b..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageBlockType.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// Specifies the kind of content block within a message. Could be text, an image file, an external image URL, or an unknown future type. - internal readonly partial struct MessageBlockType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public MessageBlockType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string TextValue = "text"; - private const string ImageFileValue = "image_file"; - private const string ImageUrlValue = "image_url"; - - /// Indicates a block containing text content. - public static MessageBlockType Text { get; } = new MessageBlockType(TextValue); - /// Indicates a block referencing an internally uploaded image file. - public static MessageBlockType ImageFile { get; } = new MessageBlockType(ImageFileValue); - /// Indicates a block referencing an external image URL. - public static MessageBlockType ImageUrl { get; } = new MessageBlockType(ImageUrlValue); - /// Determines if two values are the same. - public static bool operator ==(MessageBlockType left, MessageBlockType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(MessageBlockType left, MessageBlockType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator MessageBlockType(string value) => new MessageBlockType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is MessageBlockType other && Equals(other); - /// - public bool Equals(MessageBlockType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageImageFileParam.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageImageFileParam.Serialization.cs deleted file mode 100644 index 3c04266d4f9e..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageImageFileParam.Serialization.cs +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class MessageImageFileParam : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageImageFileParam)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("file_id"u8); - writer.WriteStringValue(FileId); - if (Optional.IsDefined(Detail)) - { - writer.WritePropertyName("detail"u8); - writer.WriteStringValue(Detail.Value.ToString()); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - MessageImageFileParam IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageImageFileParam)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageImageFileParam(document.RootElement, options); - } - - internal static MessageImageFileParam DeserializeMessageImageFileParam(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string fileId = default; - ImageDetailLevel? detail = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("file_id"u8)) - { - fileId = property.Value.GetString(); - continue; - } - if (property.NameEquals("detail"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - detail = new ImageDetailLevel(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MessageImageFileParam(fileId, detail, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(MessageImageFileParam)} does not support writing '{options.Format}' format."); - } - } - - MessageImageFileParam IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMessageImageFileParam(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageImageFileParam)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static MessageImageFileParam FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMessageImageFileParam(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageImageFileParam.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageImageFileParam.cs deleted file mode 100644 index 11eec8730a99..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageImageFileParam.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Defines how an internally uploaded image file is referenced when creating an image-file block. - public partial class MessageImageFileParam - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The ID of the previously uploaded image file. - /// is null. - public MessageImageFileParam(string fileId) - { - Argument.AssertNotNull(fileId, nameof(fileId)); - - FileId = fileId; - } - - /// Initializes a new instance of . - /// The ID of the previously uploaded image file. - /// Optional detail level for the image (auto, low, or high). - /// Keeps track of any properties unknown to the library. - internal MessageImageFileParam(string fileId, ImageDetailLevel? detail, IDictionary serializedAdditionalRawData) - { - FileId = fileId; - Detail = detail; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MessageImageFileParam() - { - } - - /// The ID of the previously uploaded image file. - public string FileId { get; } - /// Optional detail level for the image (auto, low, or high). - public ImageDetailLevel? Detail { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageImageUriParam.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageImageUriParam.Serialization.cs deleted file mode 100644 index f4cc1b8e5c0e..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageImageUriParam.Serialization.cs +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class MessageImageUriParam : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageImageUriParam)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("url"u8); - writer.WriteStringValue(Uri); - if (Optional.IsDefined(Detail)) - { - writer.WritePropertyName("detail"u8); - writer.WriteStringValue(Detail.Value.ToString()); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - MessageImageUriParam IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageImageUriParam)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageImageUriParam(document.RootElement, options); - } - - internal static MessageImageUriParam DeserializeMessageImageUriParam(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string url = default; - ImageDetailLevel? detail = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("url"u8)) - { - url = property.Value.GetString(); - continue; - } - if (property.NameEquals("detail"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - detail = new ImageDetailLevel(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MessageImageUriParam(url, detail, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(MessageImageUriParam)} does not support writing '{options.Format}' format."); - } - } - - MessageImageUriParam IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMessageImageUriParam(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageImageUriParam)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static MessageImageUriParam FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMessageImageUriParam(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageImageUriParam.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageImageUriParam.cs deleted file mode 100644 index f556ffcd2335..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageImageUriParam.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Defines how an external image URL is referenced when creating an image-URL block. - public partial class MessageImageUriParam - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The publicly accessible URL of the external image. - /// is null. - public MessageImageUriParam(string uri) - { - Argument.AssertNotNull(uri, nameof(uri)); - - Uri = uri; - } - - /// Initializes a new instance of . - /// The publicly accessible URL of the external image. - /// Optional detail level for the image (auto, low, or high). Defaults to 'auto' if not specified. - /// Keeps track of any properties unknown to the library. - internal MessageImageUriParam(string uri, ImageDetailLevel? detail, IDictionary serializedAdditionalRawData) - { - Uri = uri; - Detail = detail; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MessageImageUriParam() - { - } - - /// The publicly accessible URL of the external image. - public string Uri { get; } - /// Optional detail level for the image (auto, low, or high). Defaults to 'auto' if not specified. - public ImageDetailLevel? Detail { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageIncompleteDetails.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageIncompleteDetails.Serialization.cs deleted file mode 100644 index 0ad6c80cb510..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageIncompleteDetails.Serialization.cs +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class MessageIncompleteDetails : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageIncompleteDetails)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("reason"u8); - writer.WriteStringValue(Reason.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - MessageIncompleteDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageIncompleteDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageIncompleteDetails(document.RootElement, options); - } - - internal static MessageIncompleteDetails DeserializeMessageIncompleteDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MessageIncompleteDetailsReason reason = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("reason"u8)) - { - reason = new MessageIncompleteDetailsReason(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MessageIncompleteDetails(reason, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(MessageIncompleteDetails)} does not support writing '{options.Format}' format."); - } - } - - MessageIncompleteDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMessageIncompleteDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageIncompleteDetails)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static MessageIncompleteDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMessageIncompleteDetails(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageIncompleteDetails.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageIncompleteDetails.cs deleted file mode 100644 index d4a2d1ae4a84..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageIncompleteDetails.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Information providing additional detail about a message entering an incomplete status. - public partial class MessageIncompleteDetails - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The provided reason describing why the message was marked as incomplete. - internal MessageIncompleteDetails(MessageIncompleteDetailsReason reason) - { - Reason = reason; - } - - /// Initializes a new instance of . - /// The provided reason describing why the message was marked as incomplete. - /// Keeps track of any properties unknown to the library. - internal MessageIncompleteDetails(MessageIncompleteDetailsReason reason, IDictionary serializedAdditionalRawData) - { - Reason = reason; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MessageIncompleteDetails() - { - } - - /// The provided reason describing why the message was marked as incomplete. - public MessageIncompleteDetailsReason Reason { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageIncompleteDetailsReason.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageIncompleteDetailsReason.cs deleted file mode 100644 index 4d301fa769e6..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageIncompleteDetailsReason.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// A set of reasons describing why a message is marked as incomplete. - public readonly partial struct MessageIncompleteDetailsReason : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public MessageIncompleteDetailsReason(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ContentFilterValue = "content_filter"; - private const string MaxTokensValue = "max_tokens"; - private const string RunCancelledValue = "run_cancelled"; - private const string RunFailedValue = "run_failed"; - private const string RunExpiredValue = "run_expired"; - - /// The run generating the message was terminated due to content filter flagging. - public static MessageIncompleteDetailsReason ContentFilter { get; } = new MessageIncompleteDetailsReason(ContentFilterValue); - /// The run generating the message exhausted available tokens before completion. - public static MessageIncompleteDetailsReason MaxTokens { get; } = new MessageIncompleteDetailsReason(MaxTokensValue); - /// The run generating the message was cancelled before completion. - public static MessageIncompleteDetailsReason RunCancelled { get; } = new MessageIncompleteDetailsReason(RunCancelledValue); - /// The run generating the message failed. - public static MessageIncompleteDetailsReason RunFailed { get; } = new MessageIncompleteDetailsReason(RunFailedValue); - /// The run generating the message expired. - public static MessageIncompleteDetailsReason RunExpired { get; } = new MessageIncompleteDetailsReason(RunExpiredValue); - /// Determines if two values are the same. - public static bool operator ==(MessageIncompleteDetailsReason left, MessageIncompleteDetailsReason right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(MessageIncompleteDetailsReason left, MessageIncompleteDetailsReason right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator MessageIncompleteDetailsReason(string value) => new MessageIncompleteDetailsReason(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is MessageIncompleteDetailsReason other && Equals(other); - /// - public bool Equals(MessageIncompleteDetailsReason other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputContentBlock.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputContentBlock.Serialization.cs deleted file mode 100644 index 712951e310b1..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputContentBlock.Serialization.cs +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - [PersistableModelProxy(typeof(UnknownMessageInputContentBlock))] - public partial class MessageInputContentBlock : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageInputContentBlock)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - MessageInputContentBlock IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageInputContentBlock)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageInputContentBlock(document.RootElement, options); - } - - internal static MessageInputContentBlock DeserializeMessageInputContentBlock(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - if (element.TryGetProperty("type", out JsonElement discriminator)) - { - switch (discriminator.GetString()) - { - case "image_file": return MessageInputImageFileBlock.DeserializeMessageInputImageFileBlock(element, options); - case "image_url": return MessageInputImageUriBlock.DeserializeMessageInputImageUriBlock(element, options); - case "text": return MessageInputTextBlock.DeserializeMessageInputTextBlock(element, options); - } - } - return UnknownMessageInputContentBlock.DeserializeUnknownMessageInputContentBlock(element, options); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(MessageInputContentBlock)} does not support writing '{options.Format}' format."); - } - } - - MessageInputContentBlock IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMessageInputContentBlock(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageInputContentBlock)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static MessageInputContentBlock FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMessageInputContentBlock(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputContentBlock.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputContentBlock.cs deleted file mode 100644 index 16351489e8e1..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputContentBlock.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// Defines a single content block when creating a message. The 'type' field determines whether it is text, an image file, or an external image URL, etc. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . - /// - public abstract partial class MessageInputContentBlock - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private protected IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - protected MessageInputContentBlock() - { - } - - /// Initializes a new instance of . - /// Specifies which kind of content block this is (text, image_file, image_url, etc.). - /// Keeps track of any properties unknown to the library. - internal MessageInputContentBlock(MessageBlockType type, IDictionary serializedAdditionalRawData) - { - Type = type; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Specifies which kind of content block this is (text, image_file, image_url, etc.). - internal MessageBlockType Type { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputImageFileBlock.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputImageFileBlock.Serialization.cs deleted file mode 100644 index 24325d6fea16..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputImageFileBlock.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class MessageInputImageFileBlock : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageInputImageFileBlock)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("image_file"u8); - writer.WriteObjectValue(ImageFile, options); - } - - MessageInputImageFileBlock IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageInputImageFileBlock)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageInputImageFileBlock(document.RootElement, options); - } - - internal static MessageInputImageFileBlock DeserializeMessageInputImageFileBlock(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MessageImageFileParam imageFile = default; - MessageBlockType type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("image_file"u8)) - { - imageFile = MessageImageFileParam.DeserializeMessageImageFileParam(property.Value, options); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new MessageBlockType(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MessageInputImageFileBlock(type, serializedAdditionalRawData, imageFile); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(MessageInputImageFileBlock)} does not support writing '{options.Format}' format."); - } - } - - MessageInputImageFileBlock IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMessageInputImageFileBlock(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageInputImageFileBlock)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new MessageInputImageFileBlock FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMessageInputImageFileBlock(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputImageFileBlock.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputImageFileBlock.cs deleted file mode 100644 index 991fe837af4f..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputImageFileBlock.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// An image-file block in a new message, referencing an internally uploaded image by file ID. - public partial class MessageInputImageFileBlock : MessageInputContentBlock - { - /// Initializes a new instance of . - /// Information about the referenced image file, including file ID and optional detail level. - /// is null. - public MessageInputImageFileBlock(MessageImageFileParam imageFile) - { - Argument.AssertNotNull(imageFile, nameof(imageFile)); - - Type = MessageBlockType.ImageFile; - ImageFile = imageFile; - } - - /// Initializes a new instance of . - /// Specifies which kind of content block this is (text, image_file, image_url, etc.). - /// Keeps track of any properties unknown to the library. - /// Information about the referenced image file, including file ID and optional detail level. - internal MessageInputImageFileBlock(MessageBlockType type, IDictionary serializedAdditionalRawData, MessageImageFileParam imageFile) : base(type, serializedAdditionalRawData) - { - ImageFile = imageFile; - } - - /// Initializes a new instance of for deserialization. - internal MessageInputImageFileBlock() - { - } - - /// Information about the referenced image file, including file ID and optional detail level. - public MessageImageFileParam ImageFile { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputImageUriBlock.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputImageUriBlock.Serialization.cs deleted file mode 100644 index f86084121000..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputImageUriBlock.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class MessageInputImageUriBlock : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageInputImageUriBlock)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("image_url"u8); - writer.WriteObjectValue(ImageUrl, options); - } - - MessageInputImageUriBlock IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageInputImageUriBlock)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageInputImageUriBlock(document.RootElement, options); - } - - internal static MessageInputImageUriBlock DeserializeMessageInputImageUriBlock(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MessageImageUriParam imageUrl = default; - MessageBlockType type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("image_url"u8)) - { - imageUrl = MessageImageUriParam.DeserializeMessageImageUriParam(property.Value, options); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new MessageBlockType(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MessageInputImageUriBlock(type, serializedAdditionalRawData, imageUrl); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(MessageInputImageUriBlock)} does not support writing '{options.Format}' format."); - } - } - - MessageInputImageUriBlock IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMessageInputImageUriBlock(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageInputImageUriBlock)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new MessageInputImageUriBlock FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMessageInputImageUriBlock(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputImageUriBlock.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputImageUriBlock.cs deleted file mode 100644 index dd9b2bd8ca59..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputImageUriBlock.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// An image-URL block in a new message, referencing an external image by URL. - public partial class MessageInputImageUriBlock : MessageInputContentBlock - { - /// Initializes a new instance of . - /// Information about the external image URL, including the URL and optional detail level. - /// is null. - public MessageInputImageUriBlock(MessageImageUriParam imageUrl) - { - Argument.AssertNotNull(imageUrl, nameof(imageUrl)); - - Type = MessageBlockType.ImageUrl; - ImageUrl = imageUrl; - } - - /// Initializes a new instance of . - /// Specifies which kind of content block this is (text, image_file, image_url, etc.). - /// Keeps track of any properties unknown to the library. - /// Information about the external image URL, including the URL and optional detail level. - internal MessageInputImageUriBlock(MessageBlockType type, IDictionary serializedAdditionalRawData, MessageImageUriParam imageUrl) : base(type, serializedAdditionalRawData) - { - ImageUrl = imageUrl; - } - - /// Initializes a new instance of for deserialization. - internal MessageInputImageUriBlock() - { - } - - /// Information about the external image URL, including the URL and optional detail level. - public MessageImageUriParam ImageUrl { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputTextBlock.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputTextBlock.Serialization.cs deleted file mode 100644 index 817e8e42163c..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputTextBlock.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class MessageInputTextBlock : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageInputTextBlock)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("text"u8); - writer.WriteStringValue(Text); - } - - MessageInputTextBlock IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageInputTextBlock)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageInputTextBlock(document.RootElement, options); - } - - internal static MessageInputTextBlock DeserializeMessageInputTextBlock(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string text = default; - MessageBlockType type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("text"u8)) - { - text = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new MessageBlockType(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MessageInputTextBlock(type, serializedAdditionalRawData, text); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(MessageInputTextBlock)} does not support writing '{options.Format}' format."); - } - } - - MessageInputTextBlock IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMessageInputTextBlock(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageInputTextBlock)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new MessageInputTextBlock FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMessageInputTextBlock(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputTextBlock.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputTextBlock.cs deleted file mode 100644 index 9dbb9ae09500..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageInputTextBlock.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// A text block in a new message, containing plain text content. - public partial class MessageInputTextBlock : MessageInputContentBlock - { - /// Initializes a new instance of . - /// The plain text content for this block. - /// is null. - public MessageInputTextBlock(string text) - { - Argument.AssertNotNull(text, nameof(text)); - - Type = MessageBlockType.Text; - Text = text; - } - - /// Initializes a new instance of . - /// Specifies which kind of content block this is (text, image_file, image_url, etc.). - /// Keeps track of any properties unknown to the library. - /// The plain text content for this block. - internal MessageInputTextBlock(MessageBlockType type, IDictionary serializedAdditionalRawData, string text) : base(type, serializedAdditionalRawData) - { - Text = text; - } - - /// Initializes a new instance of for deserialization. - internal MessageInputTextBlock() - { - } - - /// The plain text content for this block. - public string Text { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageStatus.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageStatus.cs deleted file mode 100644 index c40ff576c9fc..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MessageStatus.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// The possible execution status values for a thread message. - public readonly partial struct MessageStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public MessageStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string InProgressValue = "in_progress"; - private const string IncompleteValue = "incomplete"; - private const string CompletedValue = "completed"; - - /// A run is currently creating this message. - public static MessageStatus InProgress { get; } = new MessageStatus(InProgressValue); - /// This message is incomplete. See incomplete_details for more information. - public static MessageStatus Incomplete { get; } = new MessageStatus(IncompleteValue); - /// This message was successfully completed by a run. - public static MessageStatus Completed { get; } = new MessageStatus(CompletedValue); - /// Determines if two values are the same. - public static bool operator ==(MessageStatus left, MessageStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(MessageStatus left, MessageStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator MessageStatus(string value) => new MessageStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is MessageStatus other && Equals(other); - /// - public bool Equals(MessageStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MicrosoftFabricToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MicrosoftFabricToolDefinition.Serialization.cs deleted file mode 100644 index a10840a450ee..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MicrosoftFabricToolDefinition.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class MicrosoftFabricToolDefinition : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MicrosoftFabricToolDefinition)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("fabric_dataagent"u8); - writer.WriteObjectValue(FabricDataagent, options); - } - - MicrosoftFabricToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MicrosoftFabricToolDefinition)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMicrosoftFabricToolDefinition(document.RootElement, options); - } - - internal static MicrosoftFabricToolDefinition DeserializeMicrosoftFabricToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ToolConnectionList fabricDataagent = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("fabric_dataagent"u8)) - { - fabricDataagent = ToolConnectionList.DeserializeToolConnectionList(property.Value, options); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MicrosoftFabricToolDefinition(type, serializedAdditionalRawData, fabricDataagent); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(MicrosoftFabricToolDefinition)} does not support writing '{options.Format}' format."); - } - } - - MicrosoftFabricToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMicrosoftFabricToolDefinition(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MicrosoftFabricToolDefinition)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new MicrosoftFabricToolDefinition FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMicrosoftFabricToolDefinition(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MicrosoftFabricToolDefinition.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MicrosoftFabricToolDefinition.cs deleted file mode 100644 index 2cddbbe72198..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/MicrosoftFabricToolDefinition.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The input definition information for a Microsoft Fabric tool as used to configure an agent. - public partial class MicrosoftFabricToolDefinition : ToolDefinition - { - /// Initializes a new instance of . - /// The list of connections used by the Microsoft Fabric tool. - /// is null. - public MicrosoftFabricToolDefinition(ToolConnectionList fabricDataagent) - { - Argument.AssertNotNull(fabricDataagent, nameof(fabricDataagent)); - - Type = "fabric_dataagent"; - FabricDataagent = fabricDataagent; - } - - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - /// The list of connections used by the Microsoft Fabric tool. - internal MicrosoftFabricToolDefinition(string type, IDictionary serializedAdditionalRawData, ToolConnectionList fabricDataagent) : base(type, serializedAdditionalRawData) - { - FabricDataagent = fabricDataagent; - } - - /// Initializes a new instance of for deserialization. - internal MicrosoftFabricToolDefinition() - { - } - - /// The list of connections used by the Microsoft Fabric tool. - public ToolConnectionList FabricDataagent { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiAnonymousAuthDetails.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiAnonymousAuthDetails.Serialization.cs deleted file mode 100644 index e4a9604c03a1..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiAnonymousAuthDetails.Serialization.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class OpenApiAnonymousAuthDetails : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OpenApiAnonymousAuthDetails)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - OpenApiAnonymousAuthDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OpenApiAnonymousAuthDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeOpenApiAnonymousAuthDetails(document.RootElement, options); - } - - internal static OpenApiAnonymousAuthDetails DeserializeOpenApiAnonymousAuthDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - OpenApiAuthType type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) - { - type = new OpenApiAuthType(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new OpenApiAnonymousAuthDetails(type, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(OpenApiAnonymousAuthDetails)} does not support writing '{options.Format}' format."); - } - } - - OpenApiAnonymousAuthDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOpenApiAnonymousAuthDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(OpenApiAnonymousAuthDetails)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new OpenApiAnonymousAuthDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOpenApiAnonymousAuthDetails(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiAnonymousAuthDetails.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiAnonymousAuthDetails.cs deleted file mode 100644 index 638b261e9f72..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiAnonymousAuthDetails.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Security details for OpenApi anonymous authentication. - public partial class OpenApiAnonymousAuthDetails : OpenApiAuthDetails - { - /// Initializes a new instance of . - public OpenApiAnonymousAuthDetails() - { - Type = OpenApiAuthType.Anonymous; - } - - /// Initializes a new instance of . - /// The type of authentication, must be anonymous/connection/managed_identity. - /// Keeps track of any properties unknown to the library. - internal OpenApiAnonymousAuthDetails(OpenApiAuthType type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiAuthDetails.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiAuthDetails.Serialization.cs deleted file mode 100644 index 55f43d72de9b..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiAuthDetails.Serialization.cs +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - [PersistableModelProxy(typeof(UnknownOpenApiAuthDetails))] - public partial class OpenApiAuthDetails : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - OpenApiAuthDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeOpenApiAuthDetails(document.RootElement, options); - } - - internal static OpenApiAuthDetails DeserializeOpenApiAuthDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - if (element.TryGetProperty("type", out JsonElement discriminator)) - { - switch (discriminator.GetString()) - { - case "anonymous": return OpenApiAnonymousAuthDetails.DeserializeOpenApiAnonymousAuthDetails(element, options); - case "connection": return OpenApiConnectionAuthDetails.DeserializeOpenApiConnectionAuthDetails(element, options); - case "managed_identity": return OpenApiManagedAuthDetails.DeserializeOpenApiManagedAuthDetails(element, options); - } - } - return UnknownOpenApiAuthDetails.DeserializeUnknownOpenApiAuthDetails(element, options); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support writing '{options.Format}' format."); - } - } - - OpenApiAuthDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOpenApiAuthDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static OpenApiAuthDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOpenApiAuthDetails(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiAuthDetails.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiAuthDetails.cs deleted file mode 100644 index f48a94372544..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiAuthDetails.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// authentication details for OpenApiFunctionDefinition - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . - /// - public abstract partial class OpenApiAuthDetails - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private protected IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - protected OpenApiAuthDetails() - { - } - - /// Initializes a new instance of . - /// The type of authentication, must be anonymous/connection/managed_identity. - /// Keeps track of any properties unknown to the library. - internal OpenApiAuthDetails(OpenApiAuthType type, IDictionary serializedAdditionalRawData) - { - Type = type; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The type of authentication, must be anonymous/connection/managed_identity. - internal OpenApiAuthType Type { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiAuthType.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiAuthType.cs deleted file mode 100644 index 67f04bd32fc2..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiAuthType.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// Authentication type for OpenApi endpoint. Allowed types are: - /// - Anonymous (no authentication required) - /// - Connection (requires connection_id to endpoint, as setup in AI Foundry) - /// - Managed_Identity (requires audience for identity based auth) - /// - internal readonly partial struct OpenApiAuthType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public OpenApiAuthType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AnonymousValue = "anonymous"; - private const string ConnectionValue = "connection"; - private const string ManagedIdentityValue = "managed_identity"; - - /// anonymous. - public static OpenApiAuthType Anonymous { get; } = new OpenApiAuthType(AnonymousValue); - /// connection. - public static OpenApiAuthType Connection { get; } = new OpenApiAuthType(ConnectionValue); - /// managed_identity. - public static OpenApiAuthType ManagedIdentity { get; } = new OpenApiAuthType(ManagedIdentityValue); - /// Determines if two values are the same. - public static bool operator ==(OpenApiAuthType left, OpenApiAuthType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(OpenApiAuthType left, OpenApiAuthType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator OpenApiAuthType(string value) => new OpenApiAuthType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is OpenApiAuthType other && Equals(other); - /// - public bool Equals(OpenApiAuthType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiConnectionAuthDetails.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiConnectionAuthDetails.Serialization.cs deleted file mode 100644 index 5c3267d0f29e..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiConnectionAuthDetails.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class OpenApiConnectionAuthDetails : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OpenApiConnectionAuthDetails)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("security_scheme"u8); - writer.WriteObjectValue(SecurityScheme, options); - } - - OpenApiConnectionAuthDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OpenApiConnectionAuthDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeOpenApiConnectionAuthDetails(document.RootElement, options); - } - - internal static OpenApiConnectionAuthDetails DeserializeOpenApiConnectionAuthDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - OpenApiConnectionSecurityScheme securityScheme = default; - OpenApiAuthType type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("security_scheme"u8)) - { - securityScheme = OpenApiConnectionSecurityScheme.DeserializeOpenApiConnectionSecurityScheme(property.Value, options); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new OpenApiAuthType(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new OpenApiConnectionAuthDetails(type, serializedAdditionalRawData, securityScheme); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(OpenApiConnectionAuthDetails)} does not support writing '{options.Format}' format."); - } - } - - OpenApiConnectionAuthDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOpenApiConnectionAuthDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(OpenApiConnectionAuthDetails)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new OpenApiConnectionAuthDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOpenApiConnectionAuthDetails(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiConnectionAuthDetails.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiConnectionAuthDetails.cs deleted file mode 100644 index 4b0f515d32e1..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiConnectionAuthDetails.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Security details for OpenApi connection authentication. - public partial class OpenApiConnectionAuthDetails : OpenApiAuthDetails - { - /// Initializes a new instance of . - /// Connection auth security details. - /// is null. - public OpenApiConnectionAuthDetails(OpenApiConnectionSecurityScheme securityScheme) - { - Argument.AssertNotNull(securityScheme, nameof(securityScheme)); - - Type = OpenApiAuthType.Connection; - SecurityScheme = securityScheme; - } - - /// Initializes a new instance of . - /// The type of authentication, must be anonymous/connection/managed_identity. - /// Keeps track of any properties unknown to the library. - /// Connection auth security details. - internal OpenApiConnectionAuthDetails(OpenApiAuthType type, IDictionary serializedAdditionalRawData, OpenApiConnectionSecurityScheme securityScheme) : base(type, serializedAdditionalRawData) - { - SecurityScheme = securityScheme; - } - - /// Initializes a new instance of for deserialization. - internal OpenApiConnectionAuthDetails() - { - } - - /// Connection auth security details. - public OpenApiConnectionSecurityScheme SecurityScheme { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiConnectionSecurityScheme.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiConnectionSecurityScheme.Serialization.cs deleted file mode 100644 index bd37594ae604..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiConnectionSecurityScheme.Serialization.cs +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class OpenApiConnectionSecurityScheme : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OpenApiConnectionSecurityScheme)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("connection_id"u8); - writer.WriteStringValue(ConnectionId); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - OpenApiConnectionSecurityScheme IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OpenApiConnectionSecurityScheme)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeOpenApiConnectionSecurityScheme(document.RootElement, options); - } - - internal static OpenApiConnectionSecurityScheme DeserializeOpenApiConnectionSecurityScheme(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string connectionId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("connection_id"u8)) - { - connectionId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new OpenApiConnectionSecurityScheme(connectionId, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(OpenApiConnectionSecurityScheme)} does not support writing '{options.Format}' format."); - } - } - - OpenApiConnectionSecurityScheme IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOpenApiConnectionSecurityScheme(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(OpenApiConnectionSecurityScheme)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static OpenApiConnectionSecurityScheme FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOpenApiConnectionSecurityScheme(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiConnectionSecurityScheme.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiConnectionSecurityScheme.cs deleted file mode 100644 index 37b97bf8d332..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiConnectionSecurityScheme.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Security scheme for OpenApi managed_identity authentication. - public partial class OpenApiConnectionSecurityScheme - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// Connection id for Connection auth type. - /// is null. - public OpenApiConnectionSecurityScheme(string connectionId) - { - Argument.AssertNotNull(connectionId, nameof(connectionId)); - - ConnectionId = connectionId; - } - - /// Initializes a new instance of . - /// Connection id for Connection auth type. - /// Keeps track of any properties unknown to the library. - internal OpenApiConnectionSecurityScheme(string connectionId, IDictionary serializedAdditionalRawData) - { - ConnectionId = connectionId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal OpenApiConnectionSecurityScheme() - { - } - - /// Connection id for Connection auth type. - public string ConnectionId { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiFunctionDefinition.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiFunctionDefinition.Serialization.cs deleted file mode 100644 index 2f6d24b94894..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiFunctionDefinition.Serialization.cs +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class OpenApiFunctionDefinition : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OpenApiFunctionDefinition)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - writer.WritePropertyName("spec"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(Spec); -#else - using (JsonDocument document = JsonDocument.Parse(Spec, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - writer.WritePropertyName("auth"u8); - writer.WriteObjectValue(Auth, options); - if (Optional.IsCollectionDefined(DefaultParams)) - { - writer.WritePropertyName("default_params"u8); - writer.WriteStartArray(); - foreach (var item in DefaultParams) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsCollectionDefined(Functions)) - { - writer.WritePropertyName("functions"u8); - writer.WriteStartArray(); - foreach (var item in Functions) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - OpenApiFunctionDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OpenApiFunctionDefinition)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeOpenApiFunctionDefinition(document.RootElement, options); - } - - internal static OpenApiFunctionDefinition DeserializeOpenApiFunctionDefinition(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = default; - string description = default; - BinaryData spec = default; - OpenApiAuthDetails auth = default; - IList defaultParams = default; - IList functions = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("description"u8)) - { - description = property.Value.GetString(); - continue; - } - if (property.NameEquals("spec"u8)) - { - spec = BinaryData.FromString(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("auth"u8)) - { - auth = OpenApiAuthDetails.DeserializeOpenApiAuthDetails(property.Value, options); - continue; - } - if (property.NameEquals("default_params"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - defaultParams = array; - continue; - } - if (property.NameEquals("functions"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(InternalFunctionDefinition.DeserializeInternalFunctionDefinition(item, options)); - } - functions = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new OpenApiFunctionDefinition( - name, - description, - spec, - auth, - defaultParams ?? new ChangeTrackingList(), - functions ?? new ChangeTrackingList(), - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(OpenApiFunctionDefinition)} does not support writing '{options.Format}' format."); - } - } - - OpenApiFunctionDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOpenApiFunctionDefinition(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(OpenApiFunctionDefinition)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static OpenApiFunctionDefinition FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOpenApiFunctionDefinition(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiFunctionDefinition.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiFunctionDefinition.cs deleted file mode 100644 index c5decc8b7489..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiFunctionDefinition.cs +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The input definition information for an openapi function. - public partial class OpenApiFunctionDefinition - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The name of the function to be called. - /// The openapi function shape, described as a JSON Schema object. - /// - /// Open API authentication details - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . - /// - /// , or is null. - public OpenApiFunctionDefinition(string name, BinaryData spec, OpenApiAuthDetails auth) - { - Argument.AssertNotNull(name, nameof(name)); - Argument.AssertNotNull(spec, nameof(spec)); - Argument.AssertNotNull(auth, nameof(auth)); - - Name = name; - Spec = spec; - Auth = auth; - DefaultParams = new ChangeTrackingList(); - Functions = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The name of the function to be called. - /// A description of what the function does, used by the model to choose when and how to call the function. - /// The openapi function shape, described as a JSON Schema object. - /// - /// Open API authentication details - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . - /// - /// List of OpenAPI spec parameters that will use user-provided defaults. - /// List of function definitions used by OpenApi tool. - /// Keeps track of any properties unknown to the library. - internal OpenApiFunctionDefinition(string name, string description, BinaryData spec, OpenApiAuthDetails auth, IList defaultParams, IList functions, IDictionary serializedAdditionalRawData) - { - Name = name; - Description = description; - Spec = spec; - Auth = auth; - DefaultParams = defaultParams; - Functions = functions; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal OpenApiFunctionDefinition() - { - } - - /// The name of the function to be called. - public string Name { get; set; } - /// A description of what the function does, used by the model to choose when and how to call the function. - public string Description { get; set; } - /// - /// The openapi function shape, described as a JSON Schema object. - /// - /// To assign an object to this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - public BinaryData Spec { get; set; } - /// - /// Open API authentication details - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . - /// - public OpenApiAuthDetails Auth { get; set; } - /// List of OpenAPI spec parameters that will use user-provided defaults. - public IList DefaultParams { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiManagedAuthDetails.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiManagedAuthDetails.Serialization.cs deleted file mode 100644 index ba129af2338f..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiManagedAuthDetails.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class OpenApiManagedAuthDetails : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OpenApiManagedAuthDetails)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("security_scheme"u8); - writer.WriteObjectValue(SecurityScheme, options); - } - - OpenApiManagedAuthDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OpenApiManagedAuthDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeOpenApiManagedAuthDetails(document.RootElement, options); - } - - internal static OpenApiManagedAuthDetails DeserializeOpenApiManagedAuthDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - OpenApiManagedSecurityScheme securityScheme = default; - OpenApiAuthType type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("security_scheme"u8)) - { - securityScheme = OpenApiManagedSecurityScheme.DeserializeOpenApiManagedSecurityScheme(property.Value, options); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new OpenApiAuthType(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new OpenApiManagedAuthDetails(type, serializedAdditionalRawData, securityScheme); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(OpenApiManagedAuthDetails)} does not support writing '{options.Format}' format."); - } - } - - OpenApiManagedAuthDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOpenApiManagedAuthDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(OpenApiManagedAuthDetails)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new OpenApiManagedAuthDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOpenApiManagedAuthDetails(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiManagedAuthDetails.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiManagedAuthDetails.cs deleted file mode 100644 index b21c71b2e6d9..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiManagedAuthDetails.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Security details for OpenApi managed_identity authentication. - public partial class OpenApiManagedAuthDetails : OpenApiAuthDetails - { - /// Initializes a new instance of . - /// Connection auth security details. - /// is null. - public OpenApiManagedAuthDetails(OpenApiManagedSecurityScheme securityScheme) - { - Argument.AssertNotNull(securityScheme, nameof(securityScheme)); - - Type = OpenApiAuthType.ManagedIdentity; - SecurityScheme = securityScheme; - } - - /// Initializes a new instance of . - /// The type of authentication, must be anonymous/connection/managed_identity. - /// Keeps track of any properties unknown to the library. - /// Connection auth security details. - internal OpenApiManagedAuthDetails(OpenApiAuthType type, IDictionary serializedAdditionalRawData, OpenApiManagedSecurityScheme securityScheme) : base(type, serializedAdditionalRawData) - { - SecurityScheme = securityScheme; - } - - /// Initializes a new instance of for deserialization. - internal OpenApiManagedAuthDetails() - { - } - - /// Connection auth security details. - public OpenApiManagedSecurityScheme SecurityScheme { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiManagedSecurityScheme.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiManagedSecurityScheme.Serialization.cs deleted file mode 100644 index 60b6d6226441..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiManagedSecurityScheme.Serialization.cs +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class OpenApiManagedSecurityScheme : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OpenApiManagedSecurityScheme)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("audience"u8); - writer.WriteStringValue(Audience); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - OpenApiManagedSecurityScheme IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OpenApiManagedSecurityScheme)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeOpenApiManagedSecurityScheme(document.RootElement, options); - } - - internal static OpenApiManagedSecurityScheme DeserializeOpenApiManagedSecurityScheme(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string audience = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("audience"u8)) - { - audience = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new OpenApiManagedSecurityScheme(audience, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(OpenApiManagedSecurityScheme)} does not support writing '{options.Format}' format."); - } - } - - OpenApiManagedSecurityScheme IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOpenApiManagedSecurityScheme(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(OpenApiManagedSecurityScheme)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static OpenApiManagedSecurityScheme FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOpenApiManagedSecurityScheme(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiManagedSecurityScheme.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiManagedSecurityScheme.cs deleted file mode 100644 index dad65db653bb..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiManagedSecurityScheme.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Security scheme for OpenApi managed_identity authentication. - public partial class OpenApiManagedSecurityScheme - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// Authentication scope for managed_identity auth type. - /// is null. - public OpenApiManagedSecurityScheme(string audience) - { - Argument.AssertNotNull(audience, nameof(audience)); - - Audience = audience; - } - - /// Initializes a new instance of . - /// Authentication scope for managed_identity auth type. - /// Keeps track of any properties unknown to the library. - internal OpenApiManagedSecurityScheme(string audience, IDictionary serializedAdditionalRawData) - { - Audience = audience; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal OpenApiManagedSecurityScheme() - { - } - - /// Authentication scope for managed_identity auth type. - public string Audience { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiToolDefinition.Serialization.cs deleted file mode 100644 index fe5eb4f1f290..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiToolDefinition.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class OpenApiToolDefinition : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OpenApiToolDefinition)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("openapi"u8); - writer.WriteObjectValue(Openapi, options); - } - - OpenApiToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OpenApiToolDefinition)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeOpenApiToolDefinition(document.RootElement, options); - } - - internal static OpenApiToolDefinition DeserializeOpenApiToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - OpenApiFunctionDefinition openapi = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("openapi"u8)) - { - openapi = OpenApiFunctionDefinition.DeserializeOpenApiFunctionDefinition(property.Value, options); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new OpenApiToolDefinition(type, serializedAdditionalRawData, openapi); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(OpenApiToolDefinition)} does not support writing '{options.Format}' format."); - } - } - - OpenApiToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOpenApiToolDefinition(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(OpenApiToolDefinition)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new OpenApiToolDefinition FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOpenApiToolDefinition(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiToolDefinition.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiToolDefinition.cs deleted file mode 100644 index ad7371687ccc..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/OpenApiToolDefinition.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The input definition information for an OpenAPI tool as used to configure an agent. - public partial class OpenApiToolDefinition : ToolDefinition - { - /// Initializes a new instance of . - /// The openapi function definition. - /// is null. - public OpenApiToolDefinition(OpenApiFunctionDefinition openapi) - { - Argument.AssertNotNull(openapi, nameof(openapi)); - - Type = "openapi"; - Openapi = openapi; - } - - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - /// The openapi function definition. - internal OpenApiToolDefinition(string type, IDictionary serializedAdditionalRawData, OpenApiFunctionDefinition openapi) : base(type, serializedAdditionalRawData) - { - Openapi = openapi; - } - - /// Initializes a new instance of for deserialization. - internal OpenApiToolDefinition() - { - } - - /// The openapi function definition. - public OpenApiFunctionDefinition Openapi { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgent.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgent.Serialization.cs deleted file mode 100644 index 6e966835a660..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgent.Serialization.cs +++ /dev/null @@ -1,379 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class PersistentAgent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(PersistentAgent)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("object"u8); - writer.WriteStringValue(Object); - writer.WritePropertyName("created_at"u8); - writer.WriteNumberValue(CreatedAt, "U"); - if (Name != null) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - else - { - writer.WriteNull("name"); - } - if (Description != null) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - else - { - writer.WriteNull("description"); - } - writer.WritePropertyName("model"u8); - writer.WriteStringValue(Model); - if (Instructions != null) - { - writer.WritePropertyName("instructions"u8); - writer.WriteStringValue(Instructions); - } - else - { - writer.WriteNull("instructions"); - } - writer.WritePropertyName("tools"u8); - writer.WriteStartArray(); - foreach (var item in Tools) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - if (ToolResources != null) - { - writer.WritePropertyName("tool_resources"u8); - writer.WriteObjectValue(ToolResources, options); - } - else - { - writer.WriteNull("tool_resources"); - } - if (Temperature != null) - { - writer.WritePropertyName("temperature"u8); - writer.WriteNumberValue(Temperature.Value); - } - else - { - writer.WriteNull("temperature"); - } - if (TopP != null) - { - writer.WritePropertyName("top_p"u8); - writer.WriteNumberValue(TopP.Value); - } - else - { - writer.WriteNull("top_p"); - } - if (Optional.IsDefined(ResponseFormat)) - { - if (ResponseFormat != null) - { - writer.WritePropertyName("response_format"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(ResponseFormat); -#else - using (JsonDocument document = JsonDocument.Parse(ResponseFormat, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - else - { - writer.WriteNull("response_format"); - } - } - if (Metadata != null && Optional.IsCollectionDefined(Metadata)) - { - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("metadata"); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - PersistentAgent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(PersistentAgent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializePersistentAgent(document.RootElement, options); - } - - internal static PersistentAgent DeserializePersistentAgent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string @object = default; - DateTimeOffset createdAt = default; - string name = default; - string description = default; - string model = default; - string instructions = default; - IReadOnlyList tools = default; - ToolResources toolResources = default; - float? temperature = default; - float? topP = default; - BinaryData responseFormat = default; - IReadOnlyDictionary metadata = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("object"u8)) - { - @object = property.Value.GetString(); - continue; - } - if (property.NameEquals("created_at"u8)) - { - createdAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); - continue; - } - if (property.NameEquals("name"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - name = null; - continue; - } - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("description"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - description = null; - continue; - } - description = property.Value.GetString(); - continue; - } - if (property.NameEquals("model"u8)) - { - model = property.Value.GetString(); - continue; - } - if (property.NameEquals("instructions"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - instructions = null; - continue; - } - instructions = property.Value.GetString(); - continue; - } - if (property.NameEquals("tools"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ToolDefinition.DeserializeToolDefinition(item, options)); - } - tools = array; - continue; - } - if (property.NameEquals("tool_resources"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - toolResources = null; - continue; - } - toolResources = ToolResources.DeserializeToolResources(property.Value, options); - continue; - } - if (property.NameEquals("temperature"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - temperature = null; - continue; - } - temperature = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("top_p"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - topP = null; - continue; - } - topP = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("response_format"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - responseFormat = null; - continue; - } - responseFormat = BinaryData.FromString(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("metadata"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - metadata = new ChangeTrackingDictionary(); - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new PersistentAgent( - id, - @object, - createdAt, - name, - description, - model, - instructions, - tools, - toolResources, - temperature, - topP, - responseFormat, - metadata, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(PersistentAgent)} does not support writing '{options.Format}' format."); - } - } - - PersistentAgent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializePersistentAgent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(PersistentAgent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static PersistentAgent FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializePersistentAgent(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgent.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgent.cs deleted file mode 100644 index 027c8084d20e..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgent.cs +++ /dev/null @@ -1,236 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.AI.Agents.Persistent -{ - /// Represents an agent that can call the model and use tools. - public partial class PersistentAgent - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The identifier, which can be referenced in API endpoints. - /// The Unix timestamp, in seconds, representing when this object was created. - /// The name of the agent. - /// The description of the agent. - /// The ID of the model to use. - /// The system instructions for the agent to use. - /// - /// The collection of tools enabled for the agent. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , , and . - /// - /// - /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` - /// tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. - /// - /// - /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, - /// while lower values like 0.2 will make it more focused and deterministic. - /// - /// - /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. - /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. - /// - /// We generally recommend altering this or temperature but not both. - /// - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// , or is null. - internal PersistentAgent(string id, DateTimeOffset createdAt, string name, string description, string model, string instructions, IEnumerable tools, ToolResources toolResources, float? temperature, float? topP, IReadOnlyDictionary metadata) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(model, nameof(model)); - Argument.AssertNotNull(tools, nameof(tools)); - - Id = id; - CreatedAt = createdAt; - Name = name; - Description = description; - Model = model; - Instructions = instructions; - Tools = tools.ToList(); - ToolResources = toolResources; - Temperature = temperature; - TopP = topP; - Metadata = metadata; - } - - /// Initializes a new instance of . - /// The identifier, which can be referenced in API endpoints. - /// The object type, which is always assistant. - /// The Unix timestamp, in seconds, representing when this object was created. - /// The name of the agent. - /// The description of the agent. - /// The ID of the model to use. - /// The system instructions for the agent to use. - /// - /// The collection of tools enabled for the agent. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , , and . - /// - /// - /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` - /// tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. - /// - /// - /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, - /// while lower values like 0.2 will make it more focused and deterministic. - /// - /// - /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. - /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. - /// - /// We generally recommend altering this or temperature but not both. - /// - /// The response format of the tool calls used by this agent. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// Keeps track of any properties unknown to the library. - internal PersistentAgent(string id, string @object, DateTimeOffset createdAt, string name, string description, string model, string instructions, IReadOnlyList tools, ToolResources toolResources, float? temperature, float? topP, BinaryData responseFormat, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) - { - Id = id; - Object = @object; - CreatedAt = createdAt; - Name = name; - Description = description; - Model = model; - Instructions = instructions; - Tools = tools; - ToolResources = toolResources; - Temperature = temperature; - TopP = topP; - ResponseFormat = responseFormat; - Metadata = metadata; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal PersistentAgent() - { - } - - /// The identifier, which can be referenced in API endpoints. - public string Id { get; } - - /// The Unix timestamp, in seconds, representing when this object was created. - public DateTimeOffset CreatedAt { get; } - /// The name of the agent. - public string Name { get; } - /// The description of the agent. - public string Description { get; } - /// The ID of the model to use. - public string Model { get; } - /// The system instructions for the agent to use. - public string Instructions { get; } - /// - /// The collection of tools enabled for the agent. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , , and . - /// - public IReadOnlyList Tools { get; } - /// - /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` - /// tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. - /// - public ToolResources ToolResources { get; } - /// - /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, - /// while lower values like 0.2 will make it more focused and deterministic. - /// - public float? Temperature { get; } - /// - /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. - /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. - /// - /// We generally recommend altering this or temperature but not both. - /// - public float? TopP { get; } - /// - /// The response format of the tool calls used by this agent. - /// - /// To assign an object to this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// - /// Supported types: - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - public BinaryData ResponseFormat { get; } - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - public IReadOnlyDictionary Metadata { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentFileInfo.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentFileInfo.Serialization.cs deleted file mode 100644 index 7485220a8bf0..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentFileInfo.Serialization.cs +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class PersistentAgentFileInfo : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(PersistentAgentFileInfo)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("object"u8); - writer.WriteStringValue(Object); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("bytes"u8); - writer.WriteNumberValue(Size); - writer.WritePropertyName("filename"u8); - writer.WriteStringValue(Filename); - writer.WritePropertyName("created_at"u8); - writer.WriteNumberValue(CreatedAt, "U"); - writer.WritePropertyName("purpose"u8); - writer.WriteStringValue(Purpose.ToString()); - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.Value.ToString()); - } - if (Optional.IsDefined(StatusDetails)) - { - writer.WritePropertyName("status_details"u8); - writer.WriteStringValue(StatusDetails); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - PersistentAgentFileInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(PersistentAgentFileInfo)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializePersistentAgentFileInfo(document.RootElement, options); - } - - internal static PersistentAgentFileInfo DeserializePersistentAgentFileInfo(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string @object = default; - string id = default; - int bytes = default; - string filename = default; - DateTimeOffset createdAt = default; - PersistentAgentFilePurpose purpose = default; - FileState? status = default; - string statusDetails = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("object"u8)) - { - @object = property.Value.GetString(); - continue; - } - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("bytes"u8)) - { - DeserializeNullableSize(property, ref bytes); - continue; - } - if (property.NameEquals("filename"u8)) - { - filename = property.Value.GetString(); - continue; - } - if (property.NameEquals("created_at"u8)) - { - createdAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); - continue; - } - if (property.NameEquals("purpose"u8)) - { - purpose = new PersistentAgentFilePurpose(property.Value.GetString()); - continue; - } - if (property.NameEquals("status"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - status = new FileState(property.Value.GetString()); - continue; - } - if (property.NameEquals("status_details"u8)) - { - statusDetails = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new PersistentAgentFileInfo( - @object, - id, - bytes, - filename, - createdAt, - purpose, - status, - statusDetails, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(PersistentAgentFileInfo)} does not support writing '{options.Format}' format."); - } - } - - PersistentAgentFileInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializePersistentAgentFileInfo(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(PersistentAgentFileInfo)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static PersistentAgentFileInfo FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializePersistentAgentFileInfo(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentFileInfo.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentFileInfo.cs deleted file mode 100644 index 778bb97bc033..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentFileInfo.cs +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Represents an agent that can call the model and use tools. - public partial class PersistentAgentFileInfo - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The identifier, which can be referenced in API endpoints. - /// The size of the file, in bytes. - /// The name of the file. - /// The Unix timestamp, in seconds, representing when this object was created. - /// The intended purpose of a file. - /// or is null. - internal PersistentAgentFileInfo(string id, int size, string filename, DateTimeOffset createdAt, PersistentAgentFilePurpose purpose) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(filename, nameof(filename)); - - Id = id; - Size = size; - Filename = filename; - CreatedAt = createdAt; - Purpose = purpose; - } - - /// Initializes a new instance of . - /// The object type, which is always 'file'. - /// The identifier, which can be referenced in API endpoints. - /// The size of the file, in bytes. - /// The name of the file. - /// The Unix timestamp, in seconds, representing when this object was created. - /// The intended purpose of a file. - /// The state of the file. This field is available in Azure OpenAI only. - /// The error message with details in case processing of this file failed. This field is available in Azure OpenAI only. - /// Keeps track of any properties unknown to the library. - internal PersistentAgentFileInfo(string @object, string id, int size, string filename, DateTimeOffset createdAt, PersistentAgentFilePurpose purpose, FileState? status, string statusDetails, IDictionary serializedAdditionalRawData) - { - Object = @object; - Id = id; - Size = size; - Filename = filename; - CreatedAt = createdAt; - Purpose = purpose; - Status = status; - StatusDetails = statusDetails; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal PersistentAgentFileInfo() - { - } - - /// The identifier, which can be referenced in API endpoints. - public string Id { get; } - /// The size of the file, in bytes. - public int Size { get; } - /// The name of the file. - public string Filename { get; } - /// The Unix timestamp, in seconds, representing when this object was created. - public DateTimeOffset CreatedAt { get; } - /// The intended purpose of a file. - public PersistentAgentFilePurpose Purpose { get; } - /// The state of the file. This field is available in Azure OpenAI only. - public FileState? Status { get; } - /// The error message with details in case processing of this file failed. This field is available in Azure OpenAI only. - public string StatusDetails { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentFileInfoObject.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentFileInfoObject.cs deleted file mode 100644 index 941e277b0bb0..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentFileInfoObject.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// The PersistentAgentFileInfo_object. - internal readonly partial struct PersistentAgentFileInfoObject : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public PersistentAgentFileInfoObject(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string FileValue = "file"; - - /// file. - public static PersistentAgentFileInfoObject File { get; } = new PersistentAgentFileInfoObject(FileValue); - /// Determines if two values are the same. - public static bool operator ==(PersistentAgentFileInfoObject left, PersistentAgentFileInfoObject right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(PersistentAgentFileInfoObject left, PersistentAgentFileInfoObject right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator PersistentAgentFileInfoObject(string value) => new PersistentAgentFileInfoObject(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is PersistentAgentFileInfoObject other && Equals(other); - /// - public bool Equals(PersistentAgentFileInfoObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentObject.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentObject.cs deleted file mode 100644 index 71d0f2adb5cc..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentObject.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// The PersistentAgent_object. - internal readonly partial struct PersistentAgentObject : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public PersistentAgentObject(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AssistantValue = "assistant"; - - /// assistant. - public static PersistentAgentObject Assistant { get; } = new PersistentAgentObject(AssistantValue); - /// Determines if two values are the same. - public static bool operator ==(PersistentAgentObject left, PersistentAgentObject right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(PersistentAgentObject left, PersistentAgentObject right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator PersistentAgentObject(string value) => new PersistentAgentObject(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is PersistentAgentObject other && Equals(other); - /// - public bool Equals(PersistentAgentObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentThread.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentThread.Serialization.cs deleted file mode 100644 index 7d73a3a9a3cc..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentThread.Serialization.cs +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class PersistentAgentThread : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(PersistentAgentThread)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("object"u8); - writer.WriteStringValue(Object); - writer.WritePropertyName("created_at"u8); - writer.WriteNumberValue(CreatedAt, "U"); - if (ToolResources != null) - { - writer.WritePropertyName("tool_resources"u8); - writer.WriteObjectValue(ToolResources, options); - } - else - { - writer.WriteNull("tool_resources"); - } - if (Metadata != null && Optional.IsCollectionDefined(Metadata)) - { - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("metadata"); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - PersistentAgentThread IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(PersistentAgentThread)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializePersistentAgentThread(document.RootElement, options); - } - - internal static PersistentAgentThread DeserializePersistentAgentThread(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string @object = default; - DateTimeOffset createdAt = default; - ToolResources toolResources = default; - IReadOnlyDictionary metadata = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("object"u8)) - { - @object = property.Value.GetString(); - continue; - } - if (property.NameEquals("created_at"u8)) - { - createdAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); - continue; - } - if (property.NameEquals("tool_resources"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - toolResources = null; - continue; - } - toolResources = ToolResources.DeserializeToolResources(property.Value, options); - continue; - } - if (property.NameEquals("metadata"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - metadata = new ChangeTrackingDictionary(); - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new PersistentAgentThread( - id, - @object, - createdAt, - toolResources, - metadata, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(PersistentAgentThread)} does not support writing '{options.Format}' format."); - } - } - - PersistentAgentThread IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializePersistentAgentThread(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(PersistentAgentThread)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static PersistentAgentThread FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializePersistentAgentThread(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentThread.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentThread.cs deleted file mode 100644 index fa38d4d3d090..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentThread.cs +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Information about a single thread associated with an agent. - public partial class PersistentAgentThread - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The identifier, which can be referenced in API endpoints. - /// The Unix timestamp, in seconds, representing when this object was created. - /// - /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the type - /// of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list - /// of vector store IDs. - /// - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// is null. - internal PersistentAgentThread(string id, DateTimeOffset createdAt, ToolResources toolResources, IReadOnlyDictionary metadata) - { - Argument.AssertNotNull(id, nameof(id)); - - Id = id; - CreatedAt = createdAt; - ToolResources = toolResources; - Metadata = metadata; - } - - /// Initializes a new instance of . - /// The identifier, which can be referenced in API endpoints. - /// The object type, which is always 'thread'. - /// The Unix timestamp, in seconds, representing when this object was created. - /// - /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the type - /// of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list - /// of vector store IDs. - /// - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// Keeps track of any properties unknown to the library. - internal PersistentAgentThread(string id, string @object, DateTimeOffset createdAt, ToolResources toolResources, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) - { - Id = id; - Object = @object; - CreatedAt = createdAt; - ToolResources = toolResources; - Metadata = metadata; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal PersistentAgentThread() - { - } - - /// The identifier, which can be referenced in API endpoints. - public string Id { get; } - - /// The Unix timestamp, in seconds, representing when this object was created. - public DateTimeOffset CreatedAt { get; } - /// - /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the type - /// of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list - /// of vector store IDs. - /// - public ToolResources ToolResources { get; } - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - public IReadOnlyDictionary Metadata { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentThreadCreationOptions.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentThreadCreationOptions.Serialization.cs deleted file mode 100644 index b47682674b59..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentThreadCreationOptions.Serialization.cs +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class PersistentAgentThreadCreationOptions : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(PersistentAgentThreadCreationOptions)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(Messages)) - { - writer.WritePropertyName("messages"u8); - writer.WriteStartArray(); - foreach (var item in Messages) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(ToolResources)) - { - if (ToolResources != null) - { - writer.WritePropertyName("tool_resources"u8); - writer.WriteObjectValue(ToolResources, options); - } - else - { - writer.WriteNull("tool_resources"); - } - } - if (Optional.IsCollectionDefined(Metadata)) - { - if (Metadata != null) - { - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("metadata"); - } - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - PersistentAgentThreadCreationOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(PersistentAgentThreadCreationOptions)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializePersistentAgentThreadCreationOptions(document.RootElement, options); - } - - internal static PersistentAgentThreadCreationOptions DeserializePersistentAgentThreadCreationOptions(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList messages = default; - ToolResources toolResources = default; - IDictionary metadata = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("messages"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ThreadMessageOptions.DeserializeThreadMessageOptions(item, options)); - } - messages = array; - continue; - } - if (property.NameEquals("tool_resources"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - toolResources = null; - continue; - } - toolResources = ToolResources.DeserializeToolResources(property.Value, options); - continue; - } - if (property.NameEquals("metadata"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new PersistentAgentThreadCreationOptions(messages ?? new ChangeTrackingList(), toolResources, metadata ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(PersistentAgentThreadCreationOptions)} does not support writing '{options.Format}' format."); - } - } - - PersistentAgentThreadCreationOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializePersistentAgentThreadCreationOptions(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(PersistentAgentThreadCreationOptions)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static PersistentAgentThreadCreationOptions FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializePersistentAgentThreadCreationOptions(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentThreadCreationOptions.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentThreadCreationOptions.cs deleted file mode 100644 index ec8eecc3be8d..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentThreadCreationOptions.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The details used to create a new agent thread. - public partial class PersistentAgentThreadCreationOptions - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public PersistentAgentThreadCreationOptions() - { - Messages = new ChangeTrackingList(); - Metadata = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of . - /// The initial messages to associate with the new thread. - /// - /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the - /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires - /// a list of vector store IDs. - /// - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// Keeps track of any properties unknown to the library. - internal PersistentAgentThreadCreationOptions(IList messages, ToolResources toolResources, IDictionary metadata, IDictionary serializedAdditionalRawData) - { - Messages = messages; - ToolResources = toolResources; - Metadata = metadata; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The initial messages to associate with the new thread. - public IList Messages { get; } - /// - /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the - /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires - /// a list of vector store IDs. - /// - public ToolResources ToolResources { get; set; } - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - public IDictionary Metadata { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentThreadObject.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentThreadObject.cs deleted file mode 100644 index 54924ccf049c..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentThreadObject.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// The PersistentAgentThread_object. - internal readonly partial struct PersistentAgentThreadObject : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public PersistentAgentThreadObject(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ThreadValue = "thread"; - - /// thread. - public static PersistentAgentThreadObject Thread { get; } = new PersistentAgentThreadObject(ThreadValue); - /// Determines if two values are the same. - public static bool operator ==(PersistentAgentThreadObject left, PersistentAgentThreadObject right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(PersistentAgentThreadObject left, PersistentAgentThreadObject right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator PersistentAgentThreadObject(string value) => new PersistentAgentThreadObject(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is PersistentAgentThreadObject other && Equals(other); - /// - public bool Equals(PersistentAgentThreadObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsAdministrationClient.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsAdministrationClient.cs deleted file mode 100644 index 88510f528c09..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsAdministrationClient.cs +++ /dev/null @@ -1,879 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.AI.Agents.Persistent -{ - // Data plane generated client. - /// The PersistentAgentsAdministration service client. - public partial class PersistentAgentsAdministrationClient - { - private static readonly string[] AuthorizationScopes = new string[] { "https://ai.azure.com/.default" }; - private readonly TokenCredential _tokenCredential; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline => _pipeline; - - /// Initializes a new instance of PersistentAgentsAdministrationClient for mocking. - protected PersistentAgentsAdministrationClient() - { - } - - /// Initializes a new instance of PersistentAgentsAdministrationClient. - /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. - /// A credential used to authenticate to an Azure Service. - /// or is null. - public PersistentAgentsAdministrationClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new PersistentAgentsAdministrationClientOptions()) - { - } - - /// Initializes a new instance of PersistentAgentsAdministrationClient. - /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. - /// A credential used to authenticate to an Azure Service. - /// The options for configuring the client. - /// or is null. - public PersistentAgentsAdministrationClient(Uri endpoint, TokenCredential credential, PersistentAgentsAdministrationClientOptions options) - { - Argument.AssertNotNull(endpoint, nameof(endpoint)); - Argument.AssertNotNull(credential, nameof(credential)); - options ??= new PersistentAgentsAdministrationClientOptions(); - - ClientDiagnostics = new ClientDiagnostics(options, true); - _tokenCredential = credential; - _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); - _endpoint = endpoint; - _apiVersion = options.Version; - } - - /// Creates a new agent. - /// The ID of the model to use. - /// The name of the new agent. - /// The description of the new agent. - /// The system instructions for the new agent to use. - /// The collection of tools to enable for the new agent. - /// - /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` - /// tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. - /// - /// - /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, - /// while lower values like 0.2 will make it more focused and deterministic. - /// - /// - /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. - /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. - /// - /// We generally recommend altering this or temperature but not both. - /// - /// The response format of the tool calls used by this agent. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// The cancellation token to use. - /// is null. - public virtual async Task> CreateAgentAsync(string model, string name = null, string description = null, string instructions = null, IEnumerable tools = null, ToolResources toolResources = null, float? temperature = null, float? topP = null, BinaryData responseFormat = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(model, nameof(model)); - - CreateAgentRequest createAgentRequest = new CreateAgentRequest( - model, - name, - description, - instructions, - tools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), - toolResources, - temperature, - topP, - responseFormat, - metadata ?? new ChangeTrackingDictionary(), - null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await CreateAgentAsync(createAgentRequest.ToRequestContent(), context).ConfigureAwait(false); - return Response.FromValue(PersistentAgent.FromResponse(response), response); - } - - /// Creates a new agent. - /// The ID of the model to use. - /// The name of the new agent. - /// The description of the new agent. - /// The system instructions for the new agent to use. - /// The collection of tools to enable for the new agent. - /// - /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` - /// tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. - /// - /// - /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, - /// while lower values like 0.2 will make it more focused and deterministic. - /// - /// - /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. - /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. - /// - /// We generally recommend altering this or temperature but not both. - /// - /// The response format of the tool calls used by this agent. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// The cancellation token to use. - /// is null. - public virtual Response CreateAgent(string model, string name = null, string description = null, string instructions = null, IEnumerable tools = null, ToolResources toolResources = null, float? temperature = null, float? topP = null, BinaryData responseFormat = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(model, nameof(model)); - - CreateAgentRequest createAgentRequest = new CreateAgentRequest( - model, - name, - description, - instructions, - tools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), - toolResources, - temperature, - topP, - responseFormat, - metadata ?? new ChangeTrackingDictionary(), - null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = CreateAgent(createAgentRequest.ToRequestContent(), context); - return Response.FromValue(PersistentAgent.FromResponse(response), response); - } - - /// - /// [Protocol Method] Creates a new agent. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task CreateAgentAsync(RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PersistentAgentsAdministrationClient.CreateAgent"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateAgentRequest(content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Creates a new agent. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response CreateAgent(RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PersistentAgentsAdministrationClient.CreateAgent"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateAgentRequest(content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Retrieves an existing agent. - /// Identifier of the agent. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual async Task> GetAgentAsync(string assistantId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetAgentAsync(assistantId, context).ConfigureAwait(false); - return Response.FromValue(PersistentAgent.FromResponse(response), response); - } - - /// Retrieves an existing agent. - /// Identifier of the agent. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual Response GetAgent(string assistantId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetAgent(assistantId, context); - return Response.FromValue(PersistentAgent.FromResponse(response), response); - } - - /// Modifies an existing agent. - /// The ID of the agent to modify. - /// The ID of the model to use. - /// The modified name for the agent to use. - /// The modified description for the agent to use. - /// The modified system instructions for the new agent to use. - /// The modified collection of tools to enable for the agent. - /// - /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, - /// the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. - /// - /// - /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, - /// while lower values like 0.2 will make it more focused and deterministic. - /// - /// - /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. - /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. - /// - /// We generally recommend altering this or temperature but not both. - /// - /// The response format of the tool calls used by this agent. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual async Task> UpdateAgentAsync(string assistantId, string model = null, string name = null, string description = null, string instructions = null, IEnumerable tools = null, ToolResources toolResources = null, float? temperature = null, float? topP = null, BinaryData responseFormat = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); - - UpdateAgentRequest updateAgentRequest = new UpdateAgentRequest( - model, - name, - description, - instructions, - tools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), - toolResources, - temperature, - topP, - responseFormat, - metadata ?? new ChangeTrackingDictionary(), - null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await UpdateAgentAsync(assistantId, updateAgentRequest.ToRequestContent(), context).ConfigureAwait(false); - return Response.FromValue(PersistentAgent.FromResponse(response), response); - } - - /// Modifies an existing agent. - /// The ID of the agent to modify. - /// The ID of the model to use. - /// The modified name for the agent to use. - /// The modified description for the agent to use. - /// The modified system instructions for the new agent to use. - /// The modified collection of tools to enable for the agent. - /// - /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, - /// the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. - /// - /// - /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, - /// while lower values like 0.2 will make it more focused and deterministic. - /// - /// - /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. - /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. - /// - /// We generally recommend altering this or temperature but not both. - /// - /// The response format of the tool calls used by this agent. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual Response UpdateAgent(string assistantId, string model = null, string name = null, string description = null, string instructions = null, IEnumerable tools = null, ToolResources toolResources = null, float? temperature = null, float? topP = null, BinaryData responseFormat = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); - - UpdateAgentRequest updateAgentRequest = new UpdateAgentRequest( - model, - name, - description, - instructions, - tools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), - toolResources, - temperature, - topP, - responseFormat, - metadata ?? new ChangeTrackingDictionary(), - null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = UpdateAgent(assistantId, updateAgentRequest.ToRequestContent(), context); - return Response.FromValue(PersistentAgent.FromResponse(response), response); - } - - /// - /// [Protocol Method] Modifies an existing agent. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The ID of the agent to modify. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task UpdateAgentAsync(string assistantId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PersistentAgentsAdministrationClient.UpdateAgent"); - scope.Start(); - try - { - using HttpMessage message = CreateUpdateAgentRequest(assistantId, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Modifies an existing agent. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The ID of the agent to modify. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response UpdateAgent(string assistantId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PersistentAgentsAdministrationClient.UpdateAgent"); - scope.Start(); - try - { - using HttpMessage message = CreateUpdateAgentRequest(assistantId, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Deletes an agent. - /// Identifier of the agent. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - internal virtual async Task> InternalDeleteAgentAsync(string assistantId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await InternalDeleteAgentAsync(assistantId, context).ConfigureAwait(false); - return Response.FromValue(InternalAgentDeletionStatus.FromResponse(response), response); - } - - /// Deletes an agent. - /// Identifier of the agent. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - internal virtual Response InternalDeleteAgent(string assistantId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = InternalDeleteAgent(assistantId, context); - return Response.FromValue(InternalAgentDeletionStatus.FromResponse(response), response); - } - - /// - /// [Protocol Method] Deletes an agent. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the agent. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual async Task InternalDeleteAgentAsync(string assistantId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); - - using var scope = ClientDiagnostics.CreateScope("PersistentAgentsAdministrationClient.InternalDeleteAgent"); - scope.Start(); - try - { - using HttpMessage message = CreateInternalDeleteAgentRequest(assistantId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Deletes an agent. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the agent. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual Response InternalDeleteAgent(string assistantId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId)); - - using var scope = ClientDiagnostics.CreateScope("PersistentAgentsAdministrationClient.InternalDeleteAgent"); - scope.Start(); - try - { - using HttpMessage message = CreateInternalDeleteAgentRequest(assistantId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Creates a new agent thread and immediately starts a run using that new thread. - /// The ID of the agent for which the thread should be created. - /// The details used to create the new thread. If no thread is provided, an empty one will be created. - /// The overridden model that the agent should use to run the thread. - /// The overridden system instructions the agent should use to run the thread. - /// The overridden list of enabled tools the agent should use to run the thread. - /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. - /// - /// If `true`, returns a stream of events that happen during the Run as server-sent events, - /// terminating when the Run enters a terminal state with a `data: [DONE]` message. - /// - /// - /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output - /// more random, while lower values like 0.2 will make it more focused and deterministic. - /// - /// - /// An alternative to sampling with temperature, called nucleus sampling, where the model - /// considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens - /// comprising the top 10% probability mass are considered. - /// - /// We generally recommend altering this or temperature but not both. - /// - /// - /// The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only - /// the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, - /// the run will end with status `incomplete`. See `incomplete_details` for more info. - /// - /// - /// The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only - /// the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens - /// specified, the run will end with status `incomplete`. See `incomplete_details` for more info. - /// - /// The strategy to use for dropping messages as the context windows moves forward. - /// Controls whether or not and which tool is called by the model. - /// Specifies the format that the model must output. - /// If `true` functions will run in parallel during tool use. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// The cancellation token to use. - /// is null. - internal virtual async Task> CreateThreadAndRunAsync(string assistantId, PersistentAgentThreadCreationOptions thread = null, string overrideModelName = null, string overrideInstructions = null, IEnumerable overrideTools = null, UpdateToolResourcesOptions toolResources = null, bool? stream = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, Truncation truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, bool? parallelToolCalls = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(assistantId, nameof(assistantId)); - - CreateThreadAndRunRequest createThreadAndRunRequest = new CreateThreadAndRunRequest( - assistantId, - thread, - overrideModelName, - overrideInstructions, - overrideTools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), - toolResources, - stream, - temperature, - topP, - maxPromptTokens, - maxCompletionTokens, - truncationStrategy, - toolChoice, - responseFormat, - parallelToolCalls, - metadata ?? new ChangeTrackingDictionary(), - null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await CreateThreadAndRunAsync(createThreadAndRunRequest.ToRequestContent(), context).ConfigureAwait(false); - return Response.FromValue(ThreadRun.FromResponse(response), response); - } - - /// Creates a new agent thread and immediately starts a run using that new thread. - /// The ID of the agent for which the thread should be created. - /// The details used to create the new thread. If no thread is provided, an empty one will be created. - /// The overridden model that the agent should use to run the thread. - /// The overridden system instructions the agent should use to run the thread. - /// The overridden list of enabled tools the agent should use to run the thread. - /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. - /// - /// If `true`, returns a stream of events that happen during the Run as server-sent events, - /// terminating when the Run enters a terminal state with a `data: [DONE]` message. - /// - /// - /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output - /// more random, while lower values like 0.2 will make it more focused and deterministic. - /// - /// - /// An alternative to sampling with temperature, called nucleus sampling, where the model - /// considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens - /// comprising the top 10% probability mass are considered. - /// - /// We generally recommend altering this or temperature but not both. - /// - /// - /// The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only - /// the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, - /// the run will end with status `incomplete`. See `incomplete_details` for more info. - /// - /// - /// The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only - /// the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens - /// specified, the run will end with status `incomplete`. See `incomplete_details` for more info. - /// - /// The strategy to use for dropping messages as the context windows moves forward. - /// Controls whether or not and which tool is called by the model. - /// Specifies the format that the model must output. - /// If `true` functions will run in parallel during tool use. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// The cancellation token to use. - /// is null. - internal virtual Response CreateThreadAndRun(string assistantId, PersistentAgentThreadCreationOptions thread = null, string overrideModelName = null, string overrideInstructions = null, IEnumerable overrideTools = null, UpdateToolResourcesOptions toolResources = null, bool? stream = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, Truncation truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, bool? parallelToolCalls = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(assistantId, nameof(assistantId)); - - CreateThreadAndRunRequest createThreadAndRunRequest = new CreateThreadAndRunRequest( - assistantId, - thread, - overrideModelName, - overrideInstructions, - overrideTools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), - toolResources, - stream, - temperature, - topP, - maxPromptTokens, - maxCompletionTokens, - truncationStrategy, - toolChoice, - responseFormat, - parallelToolCalls, - metadata ?? new ChangeTrackingDictionary(), - null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = CreateThreadAndRun(createThreadAndRunRequest.ToRequestContent(), context); - return Response.FromValue(ThreadRun.FromResponse(response), response); - } - - /// - /// [Protocol Method] Creates a new agent thread and immediately starts a run using that new thread. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual async Task CreateThreadAndRunAsync(RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PersistentAgentsAdministrationClient.CreateThreadAndRun"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateThreadAndRunRequest(content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Creates a new agent thread and immediately starts a run using that new thread. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual Response CreateThreadAndRun(RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PersistentAgentsAdministrationClient.CreateThreadAndRun"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateThreadAndRunRequest(content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - private Threads _cachedThreads; - private ThreadMessages _cachedThreadMessages; - private ThreadRuns _cachedThreadRuns; - private ThreadRunSteps _cachedThreadRunSteps; - private PersistentAgentsFiles _cachedPersistentAgentsFiles; - private VectorStores _cachedVectorStores; - private VectorStoreFiles _cachedVectorStoreFiles; - private VectorStoreFileBatches _cachedVectorStoreFileBatches; - - internal HttpMessage CreateCreateAgentRequest(RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/assistants", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateGetAgentsRequest(int? limit, string order, string after, string before, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/assistants", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (limit != null) - { - uri.AppendQuery("limit", limit.Value, true); - } - if (order != null) - { - uri.AppendQuery("order", order, true); - } - if (after != null) - { - uri.AppendQuery("after", after, true); - } - if (before != null) - { - uri.AppendQuery("before", before, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetAgentRequest(string assistantId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/assistants/", false); - uri.AppendPath(assistantId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateUpdateAgentRequest(string assistantId, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/assistants/", false); - uri.AppendPath(assistantId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateInternalDeleteAgentRequest(string assistantId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/assistants/", false); - uri.AppendPath(assistantId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateCreateThreadAndRunRequest(RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/threads/runs", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - private static RequestContext DefaultRequestContext = new RequestContext(); - internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) - { - if (!cancellationToken.CanBeCanceled) - { - return DefaultRequestContext; - } - - return new RequestContext() { CancellationToken = cancellationToken }; - } - - private static ResponseClassifier _responseClassifier200; - private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsFiles.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsFiles.cs deleted file mode 100644 index 533bfd42c4eb..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsFiles.cs +++ /dev/null @@ -1,632 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.AI.Agents.Persistent -{ - // Data plane generated sub-client. - /// A collection of file‐related operations under `/files`. - public partial class PersistentAgentsFiles - { - private static readonly string[] AuthorizationScopes = new string[] { "https://ai.azure.com/.default" }; - private readonly TokenCredential _tokenCredential; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// The ClientDiagnostics is used to provide tracing support for the client library. - internal ClientDiagnostics ClientDiagnostics { get; } - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline => _pipeline; - - /// Initializes a new instance of PersistentAgentsFiles for mocking. - protected PersistentAgentsFiles() - { - } - - /// Initializes a new instance of PersistentAgentsFiles. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The token credential to copy. - /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. - /// The API version to use for this operation. - internal PersistentAgentsFiles(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string apiVersion) - { - ClientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - _tokenCredential = tokenCredential; - _endpoint = endpoint; - _apiVersion = apiVersion; - } - - /// Gets a list of previously uploaded files. - /// The purpose of the file. - /// The cancellation token to use. - internal virtual async Task> InternalListFilesAsync(PersistentAgentFilePurpose? purpose = null, CancellationToken cancellationToken = default) - { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await InternalListFilesAsync(purpose?.ToString(), context).ConfigureAwait(false); - return Response.FromValue(InternalFileListResponse.FromResponse(response), response); - } - - /// Gets a list of previously uploaded files. - /// The purpose of the file. - /// The cancellation token to use. - internal virtual Response InternalListFiles(PersistentAgentFilePurpose? purpose = null, CancellationToken cancellationToken = default) - { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = InternalListFiles(purpose?.ToString(), context); - return Response.FromValue(InternalFileListResponse.FromResponse(response), response); - } - - /// - /// [Protocol Method] Gets a list of previously uploaded files. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The purpose of the file. Allowed values: "fine-tune" | "fine-tune-results" | "assistants" | "assistants_output" | "batch" | "batch_output" | "vision". - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual async Task InternalListFilesAsync(string purpose, RequestContext context) - { - using var scope = ClientDiagnostics.CreateScope("PersistentAgentsFiles.InternalListFiles"); - scope.Start(); - try - { - using HttpMessage message = CreateInternalListFilesRequest(purpose, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets a list of previously uploaded files. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The purpose of the file. Allowed values: "fine-tune" | "fine-tune-results" | "assistants" | "assistants_output" | "batch" | "batch_output" | "vision". - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual Response InternalListFiles(string purpose, RequestContext context) - { - using var scope = ClientDiagnostics.CreateScope("PersistentAgentsFiles.InternalListFiles"); - scope.Start(); - try - { - using HttpMessage message = CreateInternalListFilesRequest(purpose, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Uploads a file for use by other operations. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The name of the file to upload. Allowed values: "multipart/form-data". - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task UploadFileAsync(RequestContent content, string contentType, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PersistentAgentsFiles.UploadFile"); - scope.Start(); - try - { - using HttpMessage message = CreateUploadFileRequest(content, contentType, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Uploads a file for use by other operations. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The name of the file to upload. Allowed values: "multipart/form-data". - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response UploadFile(RequestContent content, string contentType, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PersistentAgentsFiles.UploadFile"); - scope.Start(); - try - { - using HttpMessage message = CreateUploadFileRequest(content, contentType, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Delete a previously uploaded file. - /// The ID of the file to delete. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - internal virtual async Task> InternalDeleteFileAsync(string fileId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await InternalDeleteFileAsync(fileId, context).ConfigureAwait(false); - return Response.FromValue(InternalFileDeletionStatus.FromResponse(response), response); - } - - /// Delete a previously uploaded file. - /// The ID of the file to delete. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - internal virtual Response InternalDeleteFile(string fileId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = InternalDeleteFile(fileId, context); - return Response.FromValue(InternalFileDeletionStatus.FromResponse(response), response); - } - - /// - /// [Protocol Method] Delete a previously uploaded file. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The ID of the file to delete. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual async Task InternalDeleteFileAsync(string fileId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); - - using var scope = ClientDiagnostics.CreateScope("PersistentAgentsFiles.InternalDeleteFile"); - scope.Start(); - try - { - using HttpMessage message = CreateInternalDeleteFileRequest(fileId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Delete a previously uploaded file. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The ID of the file to delete. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual Response InternalDeleteFile(string fileId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); - - using var scope = ClientDiagnostics.CreateScope("PersistentAgentsFiles.InternalDeleteFile"); - scope.Start(); - try - { - using HttpMessage message = CreateInternalDeleteFileRequest(fileId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Returns information about a specific file. Does not retrieve file content. - /// The ID of the file to retrieve. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual async Task> GetFileAsync(string fileId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetFileAsync(fileId, context).ConfigureAwait(false); - return Response.FromValue(PersistentAgentFileInfo.FromResponse(response), response); - } - - /// Returns information about a specific file. Does not retrieve file content. - /// The ID of the file to retrieve. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual Response GetFile(string fileId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetFile(fileId, context); - return Response.FromValue(PersistentAgentFileInfo.FromResponse(response), response); - } - - /// - /// [Protocol Method] Returns information about a specific file. Does not retrieve file content. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The ID of the file to retrieve. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task GetFileAsync(string fileId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); - - using var scope = ClientDiagnostics.CreateScope("PersistentAgentsFiles.GetFile"); - scope.Start(); - try - { - using HttpMessage message = CreateGetFileRequest(fileId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Returns information about a specific file. Does not retrieve file content. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The ID of the file to retrieve. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response GetFile(string fileId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); - - using var scope = ClientDiagnostics.CreateScope("PersistentAgentsFiles.GetFile"); - scope.Start(); - try - { - using HttpMessage message = CreateGetFileRequest(fileId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Retrieves the raw content of a specific file. - /// The ID of the file to retrieve. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual async Task> GetFileContentAsync(string fileId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetFileContentAsync(fileId, context).ConfigureAwait(false); - return Response.FromValue(response.Content, response); - } - - /// Retrieves the raw content of a specific file. - /// The ID of the file to retrieve. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual Response GetFileContent(string fileId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetFileContent(fileId, context); - return Response.FromValue(response.Content, response); - } - - /// - /// [Protocol Method] Retrieves the raw content of a specific file. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The ID of the file to retrieve. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task GetFileContentAsync(string fileId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); - - using var scope = ClientDiagnostics.CreateScope("PersistentAgentsFiles.GetFileContent"); - scope.Start(); - try - { - using HttpMessage message = CreateGetFileContentRequest(fileId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Retrieves the raw content of a specific file. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The ID of the file to retrieve. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response GetFileContent(string fileId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); - - using var scope = ClientDiagnostics.CreateScope("PersistentAgentsFiles.GetFileContent"); - scope.Start(); - try - { - using HttpMessage message = CreateGetFileContentRequest(fileId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - internal HttpMessage CreateInternalListFilesRequest(string purpose, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/files", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (purpose != null) - { - uri.AppendQuery("purpose", purpose, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateUploadFileRequest(RequestContent content, string contentType, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/files", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", contentType); - request.Content = content; - return message; - } - - internal HttpMessage CreateInternalDeleteFileRequest(string fileId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/files/", false); - uri.AppendPath(fileId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetFileRequest(string fileId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/files/", false); - uri.AppendPath(fileId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetFileContentRequest(string fileId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/files/", false); - uri.AppendPath(fileId, true); - uri.AppendPath("/content", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/octet-stream"); - return message; - } - - private static RequestContext DefaultRequestContext = new RequestContext(); - internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) - { - if (!cancellationToken.CanBeCanceled) - { - return DefaultRequestContext; - } - - return new RequestContext() { CancellationToken = cancellationToken }; - } - - private static ResponseClassifier _responseClassifier200; - private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsFunctionName.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsFunctionName.Serialization.cs deleted file mode 100644 index 4028b14d4a75..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsFunctionName.Serialization.cs +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class PersistentAgentsFunctionName : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(PersistentAgentsFunctionName)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - PersistentAgentsFunctionName IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(PersistentAgentsFunctionName)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializePersistentAgentsFunctionName(document.RootElement, options); - } - - internal static PersistentAgentsFunctionName DeserializePersistentAgentsFunctionName(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new PersistentAgentsFunctionName(name, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(PersistentAgentsFunctionName)} does not support writing '{options.Format}' format."); - } - } - - PersistentAgentsFunctionName IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializePersistentAgentsFunctionName(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(PersistentAgentsFunctionName)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static PersistentAgentsFunctionName FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializePersistentAgentsFunctionName(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsFunctionName.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsFunctionName.cs deleted file mode 100644 index 1fbfcafaea32..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsFunctionName.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The function name that will be used, if using the `function` tool. - public partial class PersistentAgentsFunctionName - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The name of the function to call. - /// is null. - public PersistentAgentsFunctionName(string name) - { - Argument.AssertNotNull(name, nameof(name)); - - Name = name; - } - - /// Initializes a new instance of . - /// The name of the function to call. - /// Keeps track of any properties unknown to the library. - internal PersistentAgentsFunctionName(string name, IDictionary serializedAdditionalRawData) - { - Name = name; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal PersistentAgentsFunctionName() - { - } - - /// The name of the function to call. - public string Name { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsModelFactory.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsModelFactory.cs index 23056c4354aa..4815935b5870 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsModelFactory.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsModelFactory.cs @@ -14,359 +14,6 @@ namespace Azure.AI.Agents.Persistent /// Model factory for models. public static partial class PersistentAgentsModelFactory { - /// Initializes a new instance of . - /// The type of binding, which is always 'storage_queue'. - /// Storage queue. - /// A new instance for mocking. - public static AzureFunctionBinding AzureFunctionBinding(AzureFunctionBindingType type = default, AzureFunctionStorageQueue storageQueue = null) - { - return new AzureFunctionBinding(type, storageQueue, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Type. - /// The JSON schema, describing response format. - /// A new instance for mocking. - public static ResponseFormatJsonSchemaType ResponseFormatJsonSchemaType(ResponseFormatJsonSchemaTypeType type = default, ResponseFormatJsonSchema jsonSchema = null) - { - return new ResponseFormatJsonSchemaType(type, jsonSchema, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// - /// The role of the entity that is creating the message. Allowed values include: - /// `user`, which indicates the message is sent by an actual user (and should be - /// used in most cases to represent user-generated messages), and `assistant`, - /// which indicates the message is generated by the agent (use this value to insert - /// messages from the agent into the conversation). - /// - /// - /// The content of the initial message. This may be a basic string (if you only - /// need text) or an array of typed content blocks (for example, text, image_file, - /// image_url, and so on). - /// - /// A list of files attached to the message, and the tools they should be added to. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// A new instance for mocking. - public static ThreadMessageOptions ThreadMessageOptions(MessageRole role = default, BinaryData content = null, IEnumerable attachments = null, IDictionary metadata = null) - { - attachments ??= new List(); - metadata ??= new Dictionary(); - - return new ThreadMessageOptions(role, content, attachments?.ToList(), metadata, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The plain text content for this block. - /// A new instance for mocking. - public static MessageInputTextBlock MessageInputTextBlock(string text = null) - { - return new MessageInputTextBlock(MessageBlockType.Text, serializedAdditionalRawData: null, text); - } - - /// Initializes a new instance of . - /// Information about the referenced image file, including file ID and optional detail level. - /// A new instance for mocking. - public static MessageInputImageFileBlock MessageInputImageFileBlock(MessageImageFileParam imageFile = null) - { - return new MessageInputImageFileBlock(MessageBlockType.ImageFile, serializedAdditionalRawData: null, imageFile); - } - - /// Initializes a new instance of . - /// The ID of the previously uploaded image file. - /// Optional detail level for the image (auto, low, or high). - /// A new instance for mocking. - public static MessageImageFileParam MessageImageFileParam(string fileId = null, ImageDetailLevel? detail = null) - { - return new MessageImageFileParam(fileId, detail, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Information about the external image URL, including the URL and optional detail level. - /// A new instance for mocking. - public static MessageInputImageUriBlock MessageInputImageUriBlock(MessageImageUriParam imageUrl = null) - { - return new MessageInputImageUriBlock(MessageBlockType.ImageUrl, serializedAdditionalRawData: null, imageUrl); - } - - /// Initializes a new instance of . - /// The publicly accessible URL of the external image. - /// Optional detail level for the image (auto, low, or high). Defaults to 'auto' if not specified. - /// A new instance for mocking. - public static MessageImageUriParam MessageImageUriParam(string uri = null, ImageDetailLevel? detail = null) - { - return new MessageImageUriParam(uri, detail, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The object type. - /// The ID of the tool call. This ID must be referenced when submitting tool outputs. - /// A new instance for mocking. - public static RequiredToolCall RequiredToolCall(string type = null, string id = null) - { - return new UnknownRequiredToolCall(type, serializedAdditionalRawData: null, id); - } - - /// Initializes a new instance of . - /// The status for the error. - /// The human-readable text associated with the error. - /// A new instance for mocking. - public static RunError RunError(string code = null, string message = null) - { - return new RunError(code, message, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The reason why the run is incomplete. This indicates which specific token limit was reached during the run. - /// A new instance for mocking. - public static IncompleteRunDetails IncompleteRunDetails(IncompleteDetailsReason reason = default) - { - return new IncompleteRunDetails(reason, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Number of completion tokens used over the course of the run. - /// Number of prompt tokens used over the course of the run. - /// Total number of tokens used (prompt + completion). - /// A new instance for mocking. - public static RunCompletionUsage RunCompletionUsage(long completionTokens = default, long promptTokens = default, long totalTokens = default) - { - return new RunCompletionUsage(completionTokens, promptTokens, totalTokens, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The provided reason describing why the message was marked as incomplete. - /// A new instance for mocking. - public static MessageIncompleteDetails MessageIncompleteDetails(MessageIncompleteDetailsReason reason = default) - { - return new MessageIncompleteDetails(reason, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The object type. - /// The textual content associated with this text annotation item. - /// A new instance for mocking. - public static MessageTextAnnotation MessageTextAnnotation(string type = null, string text = null) - { - return new UnknownMessageTextAnnotation(type, text, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The textual content associated with this text annotation item. - /// The details of the URL citation. - /// The first text index associated with this text annotation. - /// The last text index associated with this text annotation. - /// A new instance for mocking. - public static MessageTextUriCitationAnnotation MessageTextUriCitationAnnotation(string text = null, MessageTextUriCitationDetails uriCitation = null, int? startIndex = null, int? endIndex = null) - { - return new MessageTextUriCitationAnnotation( - "url_citation", - text, - serializedAdditionalRawData: null, - uriCitation, - startIndex, - endIndex); - } - - /// Initializes a new instance of . - /// The URL associated with this citation. - /// The title of the URL. - /// A new instance for mocking. - public static MessageTextUriCitationDetails MessageTextUriCitationDetails(string uri = null, string title = null) - { - return new MessageTextUriCitationDetails(uri, title, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Information about the message creation associated with this run step. - /// A new instance for mocking. - public static RunStepMessageCreationDetails RunStepMessageCreationDetails(RunStepMessageCreationReference messageCreation = null) - { - return new RunStepMessageCreationDetails(RunStepType.MessageCreation, serializedAdditionalRawData: null, messageCreation); - } - - /// Initializes a new instance of . - /// The ID of the message created by this run step. - /// A new instance for mocking. - public static RunStepMessageCreationReference RunStepMessageCreationReference(string messageId = null) - { - return new RunStepMessageCreationReference(messageId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// - /// A list of tool call details for this run step. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , and . - /// - /// A new instance for mocking. - public static RunStepToolCallDetails RunStepToolCallDetails(IEnumerable toolCalls = null) - { - toolCalls ??= new List(); - - return new RunStepToolCallDetails(RunStepType.ToolCalls, serializedAdditionalRawData: null, toolCalls?.ToList()); - } - - /// Initializes a new instance of . - /// The object type. - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// A new instance for mocking. - public static RunStepToolCall RunStepToolCall(string type = null, string id = null) - { - return new UnknownRunStepToolCall(type, id, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The serialized log output emitted by the code interpreter. - /// A new instance for mocking. - public static RunStepCodeInterpreterLogOutput RunStepCodeInterpreterLogOutput(string logs = null) - { - return new RunStepCodeInterpreterLogOutput("logs", serializedAdditionalRawData: null, logs); - } - - /// Initializes a new instance of . - /// Referential information for the image associated with this output. - /// A new instance for mocking. - public static RunStepCodeInterpreterImageOutput RunStepCodeInterpreterImageOutput(RunStepCodeInterpreterImageReference image = null) - { - return new RunStepCodeInterpreterImageOutput("image", serializedAdditionalRawData: null, image); - } - - /// Initializes a new instance of . - /// The ID of the file associated with this image. - /// A new instance for mocking. - public static RunStepCodeInterpreterImageReference RunStepCodeInterpreterImageReference(string fileId = null) - { - return new RunStepCodeInterpreterImageReference(fileId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// For now, this is always going to be an empty object. - /// A new instance for mocking. - public static RunStepFileSearchToolCall RunStepFileSearchToolCall(string id = null, RunStepFileSearchToolCallResults fileSearch = null) - { - return new RunStepFileSearchToolCall("file_search", id, serializedAdditionalRawData: null, fileSearch); - } - - /// Initializes a new instance of . - /// Ranking options for file search. - /// The array of a file search results. - /// A new instance for mocking. - public static RunStepFileSearchToolCallResults RunStepFileSearchToolCallResults(FileSearchRankingOptions rankingOptions = null, IEnumerable results = null) - { - results ??= new List(); - - return new RunStepFileSearchToolCallResults(rankingOptions, results?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The ID of the file that result was found in. - /// The name of the file that result was found in. - /// The score of the result. All values must be a floating point number between 0 and 1. - /// The content of the result that was found. The content is only included if requested via the include query parameter. - /// A new instance for mocking. - public static RunStepFileSearchToolCallResult RunStepFileSearchToolCallResult(string fileId = null, string fileName = null, float score = default, IEnumerable content = null) - { - content ??= new List(); - - return new RunStepFileSearchToolCallResult(fileId, fileName, score, content?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The type of the content. - /// The text content of the file. - /// A new instance for mocking. - public static FileSearchToolCallContent FileSearchToolCallContent(FileSearchToolCallContentType type = default, string text = null) - { - return new FileSearchToolCallContent(type, text, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Reserved for future use. - /// A new instance for mocking. - public static RunStepBingGroundingToolCall RunStepBingGroundingToolCall(string id = null, IReadOnlyDictionary bingGrounding = null) - { - bingGrounding ??= new Dictionary(); - - return new RunStepBingGroundingToolCall("bing_grounding", id, serializedAdditionalRawData: null, bingGrounding); - } - - /// Initializes a new instance of . - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Reserved for future use. - /// A new instance for mocking. - public static RunStepAzureAISearchToolCall RunStepAzureAISearchToolCall(string id = null, IReadOnlyDictionary azureAISearch = null) - { - azureAISearch ??= new Dictionary(); - - return new RunStepAzureAISearchToolCall("azure_ai_search", id, serializedAdditionalRawData: null, azureAISearch); - } - - /// Initializes a new instance of . - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Reserved for future use. - /// A new instance for mocking. - public static RunStepSharepointToolCall RunStepSharepointToolCall(string id = null, IReadOnlyDictionary sharePoint = null) - { - sharePoint ??= new Dictionary(); - - return new RunStepSharepointToolCall("sharepoint_grounding", id, serializedAdditionalRawData: null, sharePoint); - } - - /// Initializes a new instance of . - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Reserved for future use. - /// A new instance for mocking. - public static RunStepMicrosoftFabricToolCall RunStepMicrosoftFabricToolCall(string id = null, IReadOnlyDictionary microsoftFabric = null) - { - microsoftFabric ??= new Dictionary(); - - return new RunStepMicrosoftFabricToolCall("fabric_dataagent", id, serializedAdditionalRawData: null, microsoftFabric); - } - - /// Initializes a new instance of . - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Reserved for future use. - /// A new instance for mocking. - public static RunStepBingCustomSearchToolCall RunStepBingCustomSearchToolCall(string id = null, IReadOnlyDictionary bingCustomSearch = null) - { - bingCustomSearch ??= new Dictionary(); - - return new RunStepBingCustomSearchToolCall("bing_custom_search", id, serializedAdditionalRawData: null, bingCustomSearch); - } - - /// Initializes a new instance of . - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Reserved for future use. - /// A new instance for mocking. - public static RunStepOpenAPIToolCall RunStepOpenAPIToolCall(string id = null, IReadOnlyDictionary openAPI = null) - { - openAPI ??= new Dictionary(); - - return new RunStepOpenAPIToolCall("openapi", id, serializedAdditionalRawData: null, openAPI); - } - - /// Initializes a new instance of . - /// The error code for this error. - /// The human-readable text associated with this error. - /// A new instance for mocking. - public static RunStepError RunStepError(RunStepErrorCode code = default, string message = null) - { - return new RunStepError(code, message, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Number of completion tokens used over the course of the run step. - /// Number of prompt tokens used over the course of the run step. - /// Total number of tokens used (prompt + completion). - /// A new instance for mocking. - public static RunStepCompletionUsage RunStepCompletionUsage(long completionTokens = default, long promptTokens = default, long totalTokens = default) - { - return new RunStepCompletionUsage(completionTokens, promptTokens, totalTokens, serializedAdditionalRawData: null); - } - /// Initializes a new instance of . /// The identifier, which can be referenced in API endpoints. /// The object type, which is always `vector_store`. @@ -493,6 +140,169 @@ public static VectorStoreFileBatch VectorStoreFileBatch(string id = null, Vector serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// File search ranker. + /// Ranker search threshold. + /// A new instance for mocking. + public static FileSearchRankingOptions FileSearchRankingOptions(string ranker = null, float scoreThreshold = default) + { + return new FileSearchRankingOptions(ranker, scoreThreshold, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Resources to be used by the `code_interpreter` tool consisting of file IDs. + /// Resources to be used by the `file_search` tool consisting of vector store IDs. + /// Resources to be used by the `azure_ai_search` tool consisting of index IDs and names. + /// A new instance for mocking. + public static ToolResources ToolResources(CodeInterpreterToolResource codeInterpreter = null, FileSearchToolResource fileSearch = null, AzureAISearchResource azureAISearch = null) + { + return new ToolResources(codeInterpreter, fileSearch, azureAISearch, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// + /// A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files + /// associated with the tool. + /// + /// The data sources to be used. This option is mutually exclusive with the `fileIds` property. + /// A new instance for mocking. + public static CodeInterpreterToolResource CodeInterpreterToolResource(IEnumerable fileIds = null, IEnumerable dataSources = null) + { + fileIds ??= new List(); + dataSources ??= new List(); + + return new CodeInterpreterToolResource(fileIds?.ToList(), dataSources?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// + /// The ID of the vector store attached to this agent. There can be a maximum of 1 vector + /// store attached to the agent. + /// + /// + /// The list of vector store configuration objects from Azure. + /// This list is limited to one element. + /// The only element of this list contains the list of azure asset IDs used by the search tool. + /// + /// A new instance for mocking. + public static FileSearchToolResource FileSearchToolResource(IEnumerable vectorStoreIds = null, IEnumerable vectorStores = null) + { + vectorStoreIds ??= new List(); + vectorStores ??= new List(); + + return new FileSearchToolResource(vectorStoreIds?.ToList(), vectorStores?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Name. + /// Configurations. + /// A new instance for mocking. + public static VectorStoreConfigurations VectorStoreConfigurations(string storeName = null, VectorStoreConfiguration storeConfiguration = null) + { + return new VectorStoreConfigurations(storeName, storeConfiguration, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// + /// The indices attached to this agent. There can be a maximum of 1 index + /// resource attached to the agent. + /// + /// A new instance for mocking. + public static AzureAISearchResource AzureAISearchResource(IEnumerable indexList = null) + { + indexList ??= new List(); + + return new AzureAISearchResource(indexList?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// An index connection id in an IndexResource attached to this agent. + /// The name of an index in an IndexResource attached to this agent. + /// Type of query in an AIIndexResource attached to this agent. + /// Number of documents to retrieve from search and present to the model. + /// filter string for search resource. + /// Index asset id for search resource. + /// A new instance for mocking. + public static AISearchIndexResource AISearchIndexResource(string indexConnectionId = null, string indexName = null, AzureAISearchQueryType? queryType = null, int? topK = null, string filter = null, string indexAssetId = null) + { + return new AISearchIndexResource( + indexConnectionId, + indexName, + queryType, + topK, + filter, + indexAssetId, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Ranking options for file search. + /// The array of a file search results. + /// A new instance for mocking. + public static RunStepFileSearchToolCallResults RunStepFileSearchToolCallResults(FileSearchRankingOptions rankingOptions = null, IEnumerable results = null) + { + results ??= new List(); + + return new RunStepFileSearchToolCallResults(rankingOptions, results?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The ID of the file that result was found in. + /// The name of the file that result was found in. + /// The score of the result. All values must be a floating point number between 0 and 1. + /// The content of the result that was found. The content is only included if requested via the include query parameter. + /// A new instance for mocking. + public static RunStepFileSearchToolCallResult RunStepFileSearchToolCallResult(string fileId = null, string fileName = null, float score = default, IEnumerable content = null) + { + content ??= new List(); + + return new RunStepFileSearchToolCallResult(fileId, fileName, score, content?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The type of the content. + /// The text content of the file. + /// A new instance for mocking. + public static FileSearchToolCallContent FileSearchToolCallContent(FileSearchToolCallContentType type = default, string text = null) + { + return new FileSearchToolCallContent(type, text, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The object type. + /// The textual content associated with this text annotation item. + /// A new instance for mocking. + public static MessageTextAnnotation MessageTextAnnotation(string type = null, string text = null) + { + return new UnknownMessageTextAnnotation(type, text, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The textual content associated with this text annotation item. + /// The details of the URL citation. + /// The first text index associated with this text annotation. + /// The last text index associated with this text annotation. + /// A new instance for mocking. + public static MessageTextUriCitationAnnotation MessageTextUriCitationAnnotation(string text = null, MessageTextUriCitationDetails uriCitation = null, int? startIndex = null, int? endIndex = null) + { + return new MessageTextUriCitationAnnotation( + "url_citation", + text, + serializedAdditionalRawData: null, + uriCitation, + startIndex, + endIndex); + } + + /// Initializes a new instance of . + /// The URL associated with this citation. + /// The title of the URL. + /// A new instance for mocking. + public static MessageTextUriCitationDetails MessageTextUriCitationDetails(string uri = null, string title = null) + { + return new MessageTextUriCitationDetails(uri, title, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The identifier of the message, which can be referenced in API endpoints. /// The object type, which is always `thread.message.delta`. diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsNamedToolChoice.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsNamedToolChoice.Serialization.cs deleted file mode 100644 index 9c5b419356ee..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsNamedToolChoice.Serialization.cs +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class PersistentAgentsNamedToolChoice : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(PersistentAgentsNamedToolChoice)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type.ToString()); - if (Optional.IsDefined(Function)) - { - writer.WritePropertyName("function"u8); - writer.WriteObjectValue(Function, options); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - PersistentAgentsNamedToolChoice IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(PersistentAgentsNamedToolChoice)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializePersistentAgentsNamedToolChoice(document.RootElement, options); - } - - internal static PersistentAgentsNamedToolChoice DeserializePersistentAgentsNamedToolChoice(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - PersistentAgentsNamedToolChoiceType type = default; - PersistentAgentsFunctionName function = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) - { - type = new PersistentAgentsNamedToolChoiceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("function"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - function = PersistentAgentsFunctionName.DeserializePersistentAgentsFunctionName(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new PersistentAgentsNamedToolChoice(type, function, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(PersistentAgentsNamedToolChoice)} does not support writing '{options.Format}' format."); - } - } - - PersistentAgentsNamedToolChoice IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializePersistentAgentsNamedToolChoice(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(PersistentAgentsNamedToolChoice)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static PersistentAgentsNamedToolChoice FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializePersistentAgentsNamedToolChoice(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsNamedToolChoice.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsNamedToolChoice.cs deleted file mode 100644 index 9b2e58d38d38..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsNamedToolChoice.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Specifies a tool the model should use. Use to force the model to call a specific tool. - public partial class PersistentAgentsNamedToolChoice - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// the type of tool. If type is `function`, the function name must be set. - public PersistentAgentsNamedToolChoice(PersistentAgentsNamedToolChoiceType type) - { - Type = type; - } - - /// Initializes a new instance of . - /// the type of tool. If type is `function`, the function name must be set. - /// The name of the function to call. - /// Keeps track of any properties unknown to the library. - internal PersistentAgentsNamedToolChoice(PersistentAgentsNamedToolChoiceType type, PersistentAgentsFunctionName function, IDictionary serializedAdditionalRawData) - { - Type = type; - Function = function; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal PersistentAgentsNamedToolChoice() - { - } - - /// the type of tool. If type is `function`, the function name must be set. - public PersistentAgentsNamedToolChoiceType Type { get; set; } - /// The name of the function to call. - public PersistentAgentsFunctionName Function { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsNamedToolChoiceType.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsNamedToolChoiceType.cs deleted file mode 100644 index 5abd0fa864fd..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsNamedToolChoiceType.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// Available tool types for agents named tools. - public readonly partial struct PersistentAgentsNamedToolChoiceType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public PersistentAgentsNamedToolChoiceType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string FunctionValue = "function"; - private const string CodeInterpreterValue = "code_interpreter"; - private const string FileSearchValue = "file_search"; - private const string BingGroundingValue = "bing_grounding"; - private const string MicrosoftFabricValue = "fabric_dataagent"; - private const string SharepointValue = "sharepoint_grounding"; - private const string AzureAISearchValue = "azure_ai_search"; - private const string BingCustomSearchValue = "bing_custom_search"; - private const string ConnectedAgentValue = "connected_agent"; - - /// Tool type `function`. - public static PersistentAgentsNamedToolChoiceType Function { get; } = new PersistentAgentsNamedToolChoiceType(FunctionValue); - /// Tool type `code_interpreter`. - public static PersistentAgentsNamedToolChoiceType CodeInterpreter { get; } = new PersistentAgentsNamedToolChoiceType(CodeInterpreterValue); - /// Tool type `file_search`. - public static PersistentAgentsNamedToolChoiceType FileSearch { get; } = new PersistentAgentsNamedToolChoiceType(FileSearchValue); - /// Tool type `bing_grounding`. - public static PersistentAgentsNamedToolChoiceType BingGrounding { get; } = new PersistentAgentsNamedToolChoiceType(BingGroundingValue); - /// Tool type `fabric_dataagent`. - public static PersistentAgentsNamedToolChoiceType MicrosoftFabric { get; } = new PersistentAgentsNamedToolChoiceType(MicrosoftFabricValue); - /// Tool type `sharepoint_grounding`. - public static PersistentAgentsNamedToolChoiceType Sharepoint { get; } = new PersistentAgentsNamedToolChoiceType(SharepointValue); - /// Tool type `azure_ai_search`. - public static PersistentAgentsNamedToolChoiceType AzureAISearch { get; } = new PersistentAgentsNamedToolChoiceType(AzureAISearchValue); - /// Tool type `bing_custom_search`. - public static PersistentAgentsNamedToolChoiceType BingCustomSearch { get; } = new PersistentAgentsNamedToolChoiceType(BingCustomSearchValue); - /// Tool type `connected_agent`. - public static PersistentAgentsNamedToolChoiceType ConnectedAgent { get; } = new PersistentAgentsNamedToolChoiceType(ConnectedAgentValue); - /// Determines if two values are the same. - public static bool operator ==(PersistentAgentsNamedToolChoiceType left, PersistentAgentsNamedToolChoiceType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(PersistentAgentsNamedToolChoiceType left, PersistentAgentsNamedToolChoiceType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator PersistentAgentsNamedToolChoiceType(string value) => new PersistentAgentsNamedToolChoiceType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is PersistentAgentsNamedToolChoiceType other && Equals(other); - /// - public bool Equals(PersistentAgentsNamedToolChoiceType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsResponseFormatMode.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsResponseFormatMode.cs deleted file mode 100644 index 2fb40052170d..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsResponseFormatMode.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// Represents the mode in which the model will handle the return format of a tool call. - public readonly partial struct PersistentAgentsResponseFormatMode : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public PersistentAgentsResponseFormatMode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AutoValue = "auto"; - private const string NoneValue = "none"; - - /// Default value. Let the model handle the return format. - public static PersistentAgentsResponseFormatMode Auto { get; } = new PersistentAgentsResponseFormatMode(AutoValue); - /// Setting the value to `none`, will result in a 400 Bad request. - public static PersistentAgentsResponseFormatMode None { get; } = new PersistentAgentsResponseFormatMode(NoneValue); - /// Determines if two values are the same. - public static bool operator ==(PersistentAgentsResponseFormatMode left, PersistentAgentsResponseFormatMode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(PersistentAgentsResponseFormatMode left, PersistentAgentsResponseFormatMode right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator PersistentAgentsResponseFormatMode(string value) => new PersistentAgentsResponseFormatMode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is PersistentAgentsResponseFormatMode other && Equals(other); - /// - public bool Equals(PersistentAgentsResponseFormatMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsToolChoiceOptionMode.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsToolChoiceOptionMode.cs deleted file mode 100644 index a4fba6304715..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsToolChoiceOptionMode.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// Specifies how the tool choice will be used. - public readonly partial struct PersistentAgentsToolChoiceOptionMode : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public PersistentAgentsToolChoiceOptionMode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string NoneValue = "none"; - private const string AutoValue = "auto"; - - /// The model will not call a function and instead generates a message. - public static PersistentAgentsToolChoiceOptionMode None { get; } = new PersistentAgentsToolChoiceOptionMode(NoneValue); - /// The model can pick between generating a message or calling a function. - public static PersistentAgentsToolChoiceOptionMode Auto { get; } = new PersistentAgentsToolChoiceOptionMode(AutoValue); - /// Determines if two values are the same. - public static bool operator ==(PersistentAgentsToolChoiceOptionMode left, PersistentAgentsToolChoiceOptionMode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(PersistentAgentsToolChoiceOptionMode left, PersistentAgentsToolChoiceOptionMode right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator PersistentAgentsToolChoiceOptionMode(string value) => new PersistentAgentsToolChoiceOptionMode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is PersistentAgentsToolChoiceOptionMode other && Equals(other); - /// - public bool Equals(PersistentAgentsToolChoiceOptionMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentThreadMessage.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentThreadMessage.Serialization.cs deleted file mode 100644 index d91e57b5828f..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentThreadMessage.Serialization.cs +++ /dev/null @@ -1,376 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class PersistentThreadMessage : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(PersistentThreadMessage)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("object"u8); - writer.WriteStringValue(Object); - writer.WritePropertyName("created_at"u8); - writer.WriteNumberValue(CreatedAt, "U"); - writer.WritePropertyName("thread_id"u8); - writer.WriteStringValue(ThreadId); - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - if (IncompleteDetails != null) - { - writer.WritePropertyName("incomplete_details"u8); - writer.WriteObjectValue(IncompleteDetails, options); - } - else - { - writer.WriteNull("incomplete_details"); - } - if (CompletedAt != null) - { - writer.WritePropertyName("completed_at"u8); - writer.WriteNumberValue(CompletedAt.Value, "U"); - } - else - { - writer.WriteNull("completed_at"); - } - if (IncompleteAt != null) - { - writer.WritePropertyName("incomplete_at"u8); - writer.WriteNumberValue(IncompleteAt.Value, "U"); - } - else - { - writer.WriteNull("incomplete_at"); - } - writer.WritePropertyName("role"u8); - writer.WriteStringValue(Role.ToString()); - writer.WritePropertyName("content"u8); - writer.WriteStartArray(); - foreach (var item in ContentItems) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - if (AssistantId != null) - { - writer.WritePropertyName("assistant_id"u8); - writer.WriteStringValue(AssistantId); - } - else - { - writer.WriteNull("assistant_id"); - } - if (RunId != null) - { - writer.WritePropertyName("run_id"u8); - writer.WriteStringValue(RunId); - } - else - { - writer.WriteNull("run_id"); - } - if (Attachments != null && Optional.IsCollectionDefined(Attachments)) - { - writer.WritePropertyName("attachments"u8); - writer.WriteStartArray(); - foreach (var item in Attachments) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - else - { - writer.WriteNull("attachments"); - } - if (Metadata != null && Optional.IsCollectionDefined(Metadata)) - { - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("metadata"); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - PersistentThreadMessage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(PersistentThreadMessage)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializePersistentThreadMessage(document.RootElement, options); - } - - internal static PersistentThreadMessage DeserializePersistentThreadMessage(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string @object = default; - DateTimeOffset createdAt = default; - string threadId = default; - MessageStatus status = default; - MessageIncompleteDetails incompleteDetails = default; - DateTimeOffset? completedAt = default; - DateTimeOffset? incompleteAt = default; - MessageRole role = default; - IReadOnlyList content = default; - string assistantId = default; - string runId = default; - IReadOnlyList attachments = default; - IReadOnlyDictionary metadata = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("object"u8)) - { - @object = property.Value.GetString(); - continue; - } - if (property.NameEquals("created_at"u8)) - { - createdAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); - continue; - } - if (property.NameEquals("thread_id"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = new MessageStatus(property.Value.GetString()); - continue; - } - if (property.NameEquals("incomplete_details"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - incompleteDetails = null; - continue; - } - incompleteDetails = MessageIncompleteDetails.DeserializeMessageIncompleteDetails(property.Value, options); - continue; - } - if (property.NameEquals("completed_at"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - completedAt = null; - continue; - } - completedAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); - continue; - } - if (property.NameEquals("incomplete_at"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - incompleteAt = null; - continue; - } - incompleteAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); - continue; - } - if (property.NameEquals("role"u8)) - { - role = new MessageRole(property.Value.GetString()); - continue; - } - if (property.NameEquals("content"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(MessageContent.DeserializeMessageContent(item, options)); - } - content = array; - continue; - } - if (property.NameEquals("assistant_id"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - assistantId = null; - continue; - } - assistantId = property.Value.GetString(); - continue; - } - if (property.NameEquals("run_id"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - runId = null; - continue; - } - runId = property.Value.GetString(); - continue; - } - if (property.NameEquals("attachments"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - attachments = new ChangeTrackingList(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(MessageAttachment.DeserializeMessageAttachment(item, options)); - } - attachments = array; - continue; - } - if (property.NameEquals("metadata"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - metadata = new ChangeTrackingDictionary(); - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new PersistentThreadMessage( - id, - @object, - createdAt, - threadId, - status, - incompleteDetails, - completedAt, - incompleteAt, - role, - content, - assistantId, - runId, - attachments, - metadata, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(PersistentThreadMessage)} does not support writing '{options.Format}' format."); - } - } - - PersistentThreadMessage IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializePersistentThreadMessage(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(PersistentThreadMessage)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static PersistentThreadMessage FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializePersistentThreadMessage(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentThreadMessage.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentThreadMessage.cs deleted file mode 100644 index 0ca15e5430c1..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentThreadMessage.cs +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.AI.Agents.Persistent -{ - /// A single, existing message within an agent thread. - public partial class PersistentThreadMessage - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The identifier, which can be referenced in API endpoints. - /// The Unix timestamp, in seconds, representing when this object was created. - /// The ID of the thread that this message belongs to. - /// The status of the message. - /// On an incomplete message, details about why the message is incomplete. - /// The Unix timestamp (in seconds) for when the message was completed. - /// The Unix timestamp (in seconds) for when the message was marked as incomplete. - /// The role associated with the agent thread message. - /// - /// The list of content items associated with the agent thread message. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - /// If applicable, the ID of the agent that authored this message. - /// If applicable, the ID of the run associated with the authoring of this message. - /// A list of files attached to the message, and the tools they were added to. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// , or is null. - internal PersistentThreadMessage(string id, DateTimeOffset createdAt, string threadId, MessageStatus status, MessageIncompleteDetails incompleteDetails, DateTimeOffset? completedAt, DateTimeOffset? incompleteAt, MessageRole role, IEnumerable contentItems, string assistantId, string runId, IEnumerable attachments, IReadOnlyDictionary metadata) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(threadId, nameof(threadId)); - Argument.AssertNotNull(contentItems, nameof(contentItems)); - - Id = id; - CreatedAt = createdAt; - ThreadId = threadId; - Status = status; - IncompleteDetails = incompleteDetails; - CompletedAt = completedAt; - IncompleteAt = incompleteAt; - Role = role; - ContentItems = contentItems.ToList(); - AssistantId = assistantId; - RunId = runId; - Attachments = attachments?.ToList(); - Metadata = metadata; - } - - /// Initializes a new instance of . - /// The identifier, which can be referenced in API endpoints. - /// The object type, which is always 'thread.message'. - /// The Unix timestamp, in seconds, representing when this object was created. - /// The ID of the thread that this message belongs to. - /// The status of the message. - /// On an incomplete message, details about why the message is incomplete. - /// The Unix timestamp (in seconds) for when the message was completed. - /// The Unix timestamp (in seconds) for when the message was marked as incomplete. - /// The role associated with the agent thread message. - /// - /// The list of content items associated with the agent thread message. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - /// If applicable, the ID of the agent that authored this message. - /// If applicable, the ID of the run associated with the authoring of this message. - /// A list of files attached to the message, and the tools they were added to. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// Keeps track of any properties unknown to the library. - internal PersistentThreadMessage(string id, string @object, DateTimeOffset createdAt, string threadId, MessageStatus status, MessageIncompleteDetails incompleteDetails, DateTimeOffset? completedAt, DateTimeOffset? incompleteAt, MessageRole role, IReadOnlyList contentItems, string assistantId, string runId, IReadOnlyList attachments, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) - { - Id = id; - Object = @object; - CreatedAt = createdAt; - ThreadId = threadId; - Status = status; - IncompleteDetails = incompleteDetails; - CompletedAt = completedAt; - IncompleteAt = incompleteAt; - Role = role; - ContentItems = contentItems; - AssistantId = assistantId; - RunId = runId; - Attachments = attachments; - Metadata = metadata; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal PersistentThreadMessage() - { - } - - /// The identifier, which can be referenced in API endpoints. - public string Id { get; } - - /// The Unix timestamp, in seconds, representing when this object was created. - public DateTimeOffset CreatedAt { get; } - /// The ID of the thread that this message belongs to. - public string ThreadId { get; } - /// The status of the message. - public MessageStatus Status { get; } - /// On an incomplete message, details about why the message is incomplete. - public MessageIncompleteDetails IncompleteDetails { get; } - /// The Unix timestamp (in seconds) for when the message was completed. - public DateTimeOffset? CompletedAt { get; } - /// The Unix timestamp (in seconds) for when the message was marked as incomplete. - public DateTimeOffset? IncompleteAt { get; } - /// The role associated with the agent thread message. - public MessageRole Role { get; } - /// - /// The list of content items associated with the agent thread message. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - public IReadOnlyList ContentItems { get; } - /// If applicable, the ID of the agent that authored this message. - public string AssistantId { get; } - /// If applicable, the ID of the run associated with the authoring of this message. - public string RunId { get; } - /// A list of files attached to the message, and the tools they were added to. - public IReadOnlyList Attachments { get; } - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - public IReadOnlyDictionary Metadata { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentThreadMessageObject.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentThreadMessageObject.cs deleted file mode 100644 index 488600ccd826..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentThreadMessageObject.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// The PersistentThreadMessage_object. - internal readonly partial struct PersistentThreadMessageObject : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public PersistentThreadMessageObject(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ThreadMessageValue = "thread.message"; - - /// thread.message. - public static PersistentThreadMessageObject ThreadMessage { get; } = new PersistentThreadMessageObject(ThreadMessageValue); - /// Determines if two values are the same. - public static bool operator ==(PersistentThreadMessageObject left, PersistentThreadMessageObject right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(PersistentThreadMessageObject left, PersistentThreadMessageObject right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator PersistentThreadMessageObject(string value) => new PersistentThreadMessageObject(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is PersistentThreadMessageObject other && Equals(other); - /// - public bool Equals(PersistentThreadMessageObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredAction.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredAction.Serialization.cs deleted file mode 100644 index ec524fd47d7c..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredAction.Serialization.cs +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - [PersistableModelProxy(typeof(UnknownRequiredAction))] - public partial class RequiredAction : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RequiredAction)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - RequiredAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RequiredAction)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRequiredAction(document.RootElement, options); - } - - internal static RequiredAction DeserializeRequiredAction(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - if (element.TryGetProperty("type", out JsonElement discriminator)) - { - switch (discriminator.GetString()) - { - case "submit_tool_outputs": return SubmitToolOutputsAction.DeserializeSubmitToolOutputsAction(element, options); - } - } - return UnknownRequiredAction.DeserializeUnknownRequiredAction(element, options); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RequiredAction)} does not support writing '{options.Format}' format."); - } - } - - RequiredAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRequiredAction(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RequiredAction)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static RequiredAction FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRequiredAction(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredAction.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredAction.cs deleted file mode 100644 index cfcd4e5b3ff7..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredAction.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// An abstract representation of a required action for an agent thread run to continue. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include . - /// - public abstract partial class RequiredAction - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private protected IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - protected RequiredAction() - { - } - - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - internal RequiredAction(string type, IDictionary serializedAdditionalRawData) - { - Type = type; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The object type. - internal string Type { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredFunctionToolCall.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredFunctionToolCall.Serialization.cs deleted file mode 100644 index 991a9825bd2d..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredFunctionToolCall.Serialization.cs +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class RequiredFunctionToolCall : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RequiredFunctionToolCall)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("function"u8); - writer.WriteObjectValue(InternalDetails, options); - } - - RequiredFunctionToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RequiredFunctionToolCall)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRequiredFunctionToolCall(document.RootElement, options); - } - - internal static RequiredFunctionToolCall DeserializeRequiredFunctionToolCall(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - InternalRequiredFunctionToolCallDetails function = default; - string id = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("function"u8)) - { - function = InternalRequiredFunctionToolCallDetails.DeserializeInternalRequiredFunctionToolCallDetails(property.Value, options); - continue; - } - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RequiredFunctionToolCall(type, serializedAdditionalRawData, id, function); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RequiredFunctionToolCall)} does not support writing '{options.Format}' format."); - } - } - - RequiredFunctionToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRequiredFunctionToolCall(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RequiredFunctionToolCall)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new RequiredFunctionToolCall FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRequiredFunctionToolCall(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredFunctionToolCall.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredFunctionToolCall.cs deleted file mode 100644 index 007f2c608627..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredFunctionToolCall.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// A representation of a requested call to a function tool, needed by the model to continue evaluation of a run. - public partial class RequiredFunctionToolCall : RequiredToolCall - { - /// Initializes a new instance of . - /// The ID of the tool call. This ID must be referenced when submitting tool outputs. - /// Detailed information about the function to be executed by the tool that includes name and arguments. - /// or is null. - internal RequiredFunctionToolCall(string id, InternalRequiredFunctionToolCallDetails internalDetails) : base(id) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(internalDetails, nameof(internalDetails)); - - InternalDetails = internalDetails; - } - - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - /// The ID of the tool call. This ID must be referenced when submitting tool outputs. - /// Detailed information about the function to be executed by the tool that includes name and arguments. - internal RequiredFunctionToolCall(string type, IDictionary serializedAdditionalRawData, string id, InternalRequiredFunctionToolCallDetails internalDetails) : base(type, serializedAdditionalRawData, id) - { - InternalDetails = internalDetails; - } - - /// Initializes a new instance of for deserialization. - internal RequiredFunctionToolCall() - { - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredToolCall.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredToolCall.Serialization.cs deleted file mode 100644 index b9bd76f42c09..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredToolCall.Serialization.cs +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - [PersistableModelProxy(typeof(UnknownRequiredToolCall))] - public partial class RequiredToolCall : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RequiredToolCall)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - - RequiredToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RequiredToolCall)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRequiredToolCall(document.RootElement, options); - } - - internal static RequiredToolCall DeserializeRequiredToolCall(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - if (element.TryGetProperty("type", out JsonElement discriminator)) - { - switch (discriminator.GetString()) - { - case "function": return RequiredFunctionToolCall.DeserializeRequiredFunctionToolCall(element, options); - } - } - return UnknownRequiredToolCall.DeserializeUnknownRequiredToolCall(element, options); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RequiredToolCall)} does not support writing '{options.Format}' format."); - } - } - - RequiredToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRequiredToolCall(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RequiredToolCall)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new RequiredToolCall FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRequiredToolCall(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredToolCall.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredToolCall.cs deleted file mode 100644 index 9f3ee8e0b282..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RequiredToolCall.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// An abstract representation of a tool invocation needed by the model to continue a run. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include . - /// - public abstract partial class RequiredToolCall : RequiredAction - { - /// Initializes a new instance of . - /// The ID of the tool call. This ID must be referenced when submitting tool outputs. - /// is null. - protected RequiredToolCall(string id) - { - Argument.AssertNotNull(id, nameof(id)); - - Id = id; - } - - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - /// The ID of the tool call. This ID must be referenced when submitting tool outputs. - internal RequiredToolCall(string type, IDictionary serializedAdditionalRawData, string id) : base(type, serializedAdditionalRawData) - { - Id = id; - } - - /// Initializes a new instance of for deserialization. - internal RequiredToolCall() - { - } - - /// The ID of the tool call. This ID must be referenced when submitting tool outputs. - public string Id { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormat.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormat.cs deleted file mode 100644 index cfe6f5076c30..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormat.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// Possible API response formats. - internal readonly partial struct ResponseFormat : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ResponseFormat(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string TextValue = "text"; - private const string JsonObjectValue = "json_object"; - - /// `text` format should be used for requests involving any sort of ToolCall. - public static ResponseFormat Text { get; } = new ResponseFormat(TextValue); - /// Using `json_object` format will limit the usage of ToolCall to only functions. - public static ResponseFormat JsonObject { get; } = new ResponseFormat(JsonObjectValue); - /// Determines if two values are the same. - public static bool operator ==(ResponseFormat left, ResponseFormat right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ResponseFormat left, ResponseFormat right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ResponseFormat(string value) => new ResponseFormat(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ResponseFormat other && Equals(other); - /// - public bool Equals(ResponseFormat other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormatJsonSchema.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormatJsonSchema.Serialization.cs deleted file mode 100644 index baeec0e80526..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormatJsonSchema.Serialization.cs +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class ResponseFormatJsonSchema : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ResponseFormatJsonSchema)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - writer.WritePropertyName("schema"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(Schema); -#else - using (JsonDocument document = JsonDocument.Parse(Schema, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ResponseFormatJsonSchema IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ResponseFormatJsonSchema)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResponseFormatJsonSchema(document.RootElement, options); - } - - internal static ResponseFormatJsonSchema DeserializeResponseFormatJsonSchema(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string description = default; - string name = default; - BinaryData schema = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("description"u8)) - { - description = property.Value.GetString(); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("schema"u8)) - { - schema = BinaryData.FromString(property.Value.GetRawText()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ResponseFormatJsonSchema(description, name, schema, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(ResponseFormatJsonSchema)} does not support writing '{options.Format}' format."); - } - } - - ResponseFormatJsonSchema IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeResponseFormatJsonSchema(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResponseFormatJsonSchema)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ResponseFormatJsonSchema FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeResponseFormatJsonSchema(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormatJsonSchema.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormatJsonSchema.cs deleted file mode 100644 index 55ef7e6f3277..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormatJsonSchema.cs +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// A description of what the response format is for, used by the model to determine how to respond in the format. - public partial class ResponseFormatJsonSchema - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The name of a schema. - /// The JSON schema object, describing the response format. - /// or is null. - public ResponseFormatJsonSchema(string name, BinaryData schema) - { - Argument.AssertNotNull(name, nameof(name)); - Argument.AssertNotNull(schema, nameof(schema)); - - Name = name; - Schema = schema; - } - - /// Initializes a new instance of . - /// A description of what the response format is for, used by the model to determine how to respond in the format. - /// The name of a schema. - /// The JSON schema object, describing the response format. - /// Keeps track of any properties unknown to the library. - internal ResponseFormatJsonSchema(string description, string name, BinaryData schema, IDictionary serializedAdditionalRawData) - { - Description = description; - Name = name; - Schema = schema; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ResponseFormatJsonSchema() - { - } - - /// A description of what the response format is for, used by the model to determine how to respond in the format. - public string Description { get; set; } - /// The name of a schema. - public string Name { get; set; } - /// - /// The JSON schema object, describing the response format. - /// - /// To assign an object to this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - public BinaryData Schema { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormatJsonSchemaType.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormatJsonSchemaType.Serialization.cs deleted file mode 100644 index dfb808016b3c..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormatJsonSchemaType.Serialization.cs +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class ResponseFormatJsonSchemaType : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ResponseFormatJsonSchemaType)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type.ToString()); - writer.WritePropertyName("json_schema"u8); - writer.WriteObjectValue(JsonSchema, options); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ResponseFormatJsonSchemaType IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ResponseFormatJsonSchemaType)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResponseFormatJsonSchemaType(document.RootElement, options); - } - - internal static ResponseFormatJsonSchemaType DeserializeResponseFormatJsonSchemaType(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResponseFormatJsonSchemaTypeType type = default; - ResponseFormatJsonSchema jsonSchema = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) - { - type = new ResponseFormatJsonSchemaTypeType(property.Value.GetString()); - continue; - } - if (property.NameEquals("json_schema"u8)) - { - jsonSchema = ResponseFormatJsonSchema.DeserializeResponseFormatJsonSchema(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ResponseFormatJsonSchemaType(type, jsonSchema, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(ResponseFormatJsonSchemaType)} does not support writing '{options.Format}' format."); - } - } - - ResponseFormatJsonSchemaType IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeResponseFormatJsonSchemaType(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResponseFormatJsonSchemaType)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ResponseFormatJsonSchemaType FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeResponseFormatJsonSchemaType(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormatJsonSchemaType.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormatJsonSchemaType.cs deleted file mode 100644 index 81e86210ee9e..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormatJsonSchemaType.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The type of response format being defined: `json_schema`. - public partial class ResponseFormatJsonSchemaType - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The JSON schema, describing response format. - /// is null. - public ResponseFormatJsonSchemaType(ResponseFormatJsonSchema jsonSchema) - { - Argument.AssertNotNull(jsonSchema, nameof(jsonSchema)); - - JsonSchema = jsonSchema; - } - - /// Initializes a new instance of . - /// Type. - /// The JSON schema, describing response format. - /// Keeps track of any properties unknown to the library. - internal ResponseFormatJsonSchemaType(ResponseFormatJsonSchemaTypeType type, ResponseFormatJsonSchema jsonSchema, IDictionary serializedAdditionalRawData) - { - Type = type; - JsonSchema = jsonSchema; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ResponseFormatJsonSchemaType() - { - } - - /// Type. - public ResponseFormatJsonSchemaTypeType Type { get; } = ResponseFormatJsonSchemaTypeType.JsonSchema; - - /// The JSON schema, describing response format. - public ResponseFormatJsonSchema JsonSchema { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormatJsonSchemaTypeType.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormatJsonSchemaTypeType.cs deleted file mode 100644 index 6b8b307b39a6..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ResponseFormatJsonSchemaTypeType.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// The ResponseFormatJsonSchemaType_type. - public readonly partial struct ResponseFormatJsonSchemaTypeType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ResponseFormatJsonSchemaTypeType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string JsonSchemaValue = "json_schema"; - - /// json_schema. - public static ResponseFormatJsonSchemaTypeType JsonSchema { get; } = new ResponseFormatJsonSchemaTypeType(JsonSchemaValue); - /// Determines if two values are the same. - public static bool operator ==(ResponseFormatJsonSchemaTypeType left, ResponseFormatJsonSchemaTypeType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ResponseFormatJsonSchemaTypeType left, ResponseFormatJsonSchemaTypeType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ResponseFormatJsonSchemaTypeType(string value) => new ResponseFormatJsonSchemaTypeType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ResponseFormatJsonSchemaTypeType other && Equals(other); - /// - public bool Equals(ResponseFormatJsonSchemaTypeType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunAdditionalFieldList.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunAdditionalFieldList.cs deleted file mode 100644 index 9cb787a43555..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunAdditionalFieldList.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// A list of additional fields to include in the response. - public readonly partial struct RunAdditionalFieldList : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public RunAdditionalFieldList(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string FileSearchContentsValue = "step_details.tool_calls[*].file_search.results[*].content"; - - /// File search result content. - public static RunAdditionalFieldList FileSearchContents { get; } = new RunAdditionalFieldList(FileSearchContentsValue); - /// Determines if two values are the same. - public static bool operator ==(RunAdditionalFieldList left, RunAdditionalFieldList right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(RunAdditionalFieldList left, RunAdditionalFieldList right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator RunAdditionalFieldList(string value) => new RunAdditionalFieldList(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is RunAdditionalFieldList other && Equals(other); - /// - public bool Equals(RunAdditionalFieldList other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunCompletionUsage.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunCompletionUsage.Serialization.cs deleted file mode 100644 index dc5fda360441..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunCompletionUsage.Serialization.cs +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class RunCompletionUsage : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunCompletionUsage)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("completion_tokens"u8); - writer.WriteNumberValue(CompletionTokens); - writer.WritePropertyName("prompt_tokens"u8); - writer.WriteNumberValue(PromptTokens); - writer.WritePropertyName("total_tokens"u8); - writer.WriteNumberValue(TotalTokens); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - RunCompletionUsage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunCompletionUsage)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunCompletionUsage(document.RootElement, options); - } - - internal static RunCompletionUsage DeserializeRunCompletionUsage(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - long completionTokens = default; - long promptTokens = default; - long totalTokens = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("completion_tokens"u8)) - { - completionTokens = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("prompt_tokens"u8)) - { - promptTokens = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("total_tokens"u8)) - { - totalTokens = property.Value.GetInt64(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunCompletionUsage(completionTokens, promptTokens, totalTokens, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunCompletionUsage)} does not support writing '{options.Format}' format."); - } - } - - RunCompletionUsage IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunCompletionUsage(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunCompletionUsage)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static RunCompletionUsage FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunCompletionUsage(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunCompletionUsage.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunCompletionUsage.cs deleted file mode 100644 index 2ba1f9d88eee..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunCompletionUsage.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.). - public partial class RunCompletionUsage - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// Number of completion tokens used over the course of the run. - /// Number of prompt tokens used over the course of the run. - /// Total number of tokens used (prompt + completion). - internal RunCompletionUsage(long completionTokens, long promptTokens, long totalTokens) - { - CompletionTokens = completionTokens; - PromptTokens = promptTokens; - TotalTokens = totalTokens; - } - - /// Initializes a new instance of . - /// Number of completion tokens used over the course of the run. - /// Number of prompt tokens used over the course of the run. - /// Total number of tokens used (prompt + completion). - /// Keeps track of any properties unknown to the library. - internal RunCompletionUsage(long completionTokens, long promptTokens, long totalTokens, IDictionary serializedAdditionalRawData) - { - CompletionTokens = completionTokens; - PromptTokens = promptTokens; - TotalTokens = totalTokens; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal RunCompletionUsage() - { - } - - /// Number of completion tokens used over the course of the run. - public long CompletionTokens { get; } - /// Number of prompt tokens used over the course of the run. - public long PromptTokens { get; } - /// Total number of tokens used (prompt + completion). - public long TotalTokens { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunError.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunError.Serialization.cs deleted file mode 100644 index e7b1963144bc..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunError.Serialization.cs +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class RunError : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunError)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("code"u8); - writer.WriteStringValue(Code); - writer.WritePropertyName("message"u8); - writer.WriteStringValue(Message); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - RunError IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunError)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunError(document.RootElement, options); - } - - internal static RunError DeserializeRunError(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string code = default; - string message = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("code"u8)) - { - code = property.Value.GetString(); - continue; - } - if (property.NameEquals("message"u8)) - { - message = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunError(code, message, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunError)} does not support writing '{options.Format}' format."); - } - } - - RunError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunError(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunError)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static RunError FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunError(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunError.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunError.cs deleted file mode 100644 index a72f75d7216f..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunError.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The details of an error as encountered by an agent thread run. - public partial class RunError - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The status for the error. - /// The human-readable text associated with the error. - /// or is null. - internal RunError(string code, string message) - { - Argument.AssertNotNull(code, nameof(code)); - Argument.AssertNotNull(message, nameof(message)); - - Code = code; - Message = message; - } - - /// Initializes a new instance of . - /// The status for the error. - /// The human-readable text associated with the error. - /// Keeps track of any properties unknown to the library. - internal RunError(string code, string message, IDictionary serializedAdditionalRawData) - { - Code = code; - Message = message; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal RunError() - { - } - - /// The status for the error. - public string Code { get; } - /// The human-readable text associated with the error. - public string Message { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStatus.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStatus.cs deleted file mode 100644 index 9ad6ab5668c2..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStatus.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// Possible values for the status of an agent thread run. - public readonly partial struct RunStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public RunStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string QueuedValue = "queued"; - private const string InProgressValue = "in_progress"; - private const string RequiresActionValue = "requires_action"; - private const string CancellingValue = "cancelling"; - private const string CancelledValue = "cancelled"; - private const string FailedValue = "failed"; - private const string CompletedValue = "completed"; - private const string ExpiredValue = "expired"; - - /// Represents a run that is queued to start. - public static RunStatus Queued { get; } = new RunStatus(QueuedValue); - /// Represents a run that is in progress. - public static RunStatus InProgress { get; } = new RunStatus(InProgressValue); - /// Represents a run that needs another operation, such as tool output submission, to continue. - public static RunStatus RequiresAction { get; } = new RunStatus(RequiresActionValue); - /// Represents a run that is in the process of cancellation. - public static RunStatus Cancelling { get; } = new RunStatus(CancellingValue); - /// Represents a run that has been cancelled. - public static RunStatus Cancelled { get; } = new RunStatus(CancelledValue); - /// Represents a run that failed. - public static RunStatus Failed { get; } = new RunStatus(FailedValue); - /// Represents a run that successfully completed. - public static RunStatus Completed { get; } = new RunStatus(CompletedValue); - /// Represents a run that expired before it could otherwise finish. - public static RunStatus Expired { get; } = new RunStatus(ExpiredValue); - /// Determines if two values are the same. - public static bool operator ==(RunStatus left, RunStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(RunStatus left, RunStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator RunStatus(string value) => new RunStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is RunStatus other && Equals(other); - /// - public bool Equals(RunStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStep.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStep.Serialization.cs deleted file mode 100644 index e98214dc6830..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStep.Serialization.cs +++ /dev/null @@ -1,357 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class RunStep : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStep)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("object"u8); - writer.WriteStringValue(Object); - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type.ToString()); - writer.WritePropertyName("assistant_id"u8); - writer.WriteStringValue(AssistantId); - writer.WritePropertyName("thread_id"u8); - writer.WriteStringValue(ThreadId); - writer.WritePropertyName("run_id"u8); - writer.WriteStringValue(RunId); - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - writer.WritePropertyName("step_details"u8); - writer.WriteObjectValue(StepDetails, options); - if (LastError != null) - { - writer.WritePropertyName("last_error"u8); - writer.WriteObjectValue(LastError, options); - } - else - { - writer.WriteNull("last_error"); - } - writer.WritePropertyName("created_at"u8); - writer.WriteNumberValue(CreatedAt, "U"); - if (ExpiredAt != null) - { - writer.WritePropertyName("expired_at"u8); - writer.WriteNumberValue(ExpiredAt.Value, "U"); - } - else - { - writer.WriteNull("expired_at"); - } - if (CompletedAt != null) - { - writer.WritePropertyName("completed_at"u8); - writer.WriteNumberValue(CompletedAt.Value, "U"); - } - else - { - writer.WriteNull("completed_at"); - } - if (CancelledAt != null) - { - writer.WritePropertyName("cancelled_at"u8); - writer.WriteNumberValue(CancelledAt.Value, "U"); - } - else - { - writer.WriteNull("cancelled_at"); - } - if (FailedAt != null) - { - writer.WritePropertyName("failed_at"u8); - writer.WriteNumberValue(FailedAt.Value, "U"); - } - else - { - writer.WriteNull("failed_at"); - } - if (Optional.IsDefined(Usage)) - { - if (Usage != null) - { - writer.WritePropertyName("usage"u8); - writer.WriteObjectValue(Usage, options); - } - else - { - writer.WriteNull("usage"); - } - } - if (Metadata != null && Optional.IsCollectionDefined(Metadata)) - { - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("metadata"); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - RunStep IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStep)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStep(document.RootElement, options); - } - - internal static RunStep DeserializeRunStep(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string @object = default; - RunStepType type = default; - string assistantId = default; - string threadId = default; - string runId = default; - RunStepStatus status = default; - RunStepDetails stepDetails = default; - RunStepError lastError = default; - DateTimeOffset createdAt = default; - DateTimeOffset? expiredAt = default; - DateTimeOffset? completedAt = default; - DateTimeOffset? cancelledAt = default; - DateTimeOffset? failedAt = default; - RunStepCompletionUsage usage = default; - IReadOnlyDictionary metadata = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("object"u8)) - { - @object = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new RunStepType(property.Value.GetString()); - continue; - } - if (property.NameEquals("assistant_id"u8)) - { - assistantId = property.Value.GetString(); - continue; - } - if (property.NameEquals("thread_id"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (property.NameEquals("run_id"u8)) - { - runId = property.Value.GetString(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = new RunStepStatus(property.Value.GetString()); - continue; - } - if (property.NameEquals("step_details"u8)) - { - stepDetails = RunStepDetails.DeserializeRunStepDetails(property.Value, options); - continue; - } - if (property.NameEquals("last_error"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - lastError = null; - continue; - } - lastError = RunStepError.DeserializeRunStepError(property.Value, options); - continue; - } - if (property.NameEquals("created_at"u8)) - { - createdAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); - continue; - } - if (property.NameEquals("expired_at"u8)) - { - DeserializeNullableDateTimeOffset(property, ref expiredAt); - continue; - } - if (property.NameEquals("completed_at"u8)) - { - DeserializeNullableDateTimeOffset(property, ref completedAt); - continue; - } - if (property.NameEquals("cancelled_at"u8)) - { - DeserializeNullableDateTimeOffset(property, ref cancelledAt); - continue; - } - if (property.NameEquals("failed_at"u8)) - { - DeserializeNullableDateTimeOffset(property, ref failedAt); - continue; - } - if (property.NameEquals("usage"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - usage = null; - continue; - } - usage = RunStepCompletionUsage.DeserializeRunStepCompletionUsage(property.Value, options); - continue; - } - if (property.NameEquals("metadata"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - metadata = new ChangeTrackingDictionary(); - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStep( - id, - @object, - type, - assistantId, - threadId, - runId, - status, - stepDetails, - lastError, - createdAt, - expiredAt, - completedAt, - cancelledAt, - failedAt, - usage, - metadata, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStep)} does not support writing '{options.Format}' format."); - } - } - - RunStep IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStep(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStep)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static RunStep FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStep(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStep.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStep.cs deleted file mode 100644 index 04f62d69ebda..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStep.cs +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Detailed information about a single step of an agent thread run. - public partial class RunStep - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The identifier, which can be referenced in API endpoints. - /// The type of run step, which can be either message_creation or tool_calls. - /// The ID of the agent associated with the run step. - /// The ID of the thread that was run. - /// The ID of the run that this run step is a part of. - /// The status of this run step. - /// - /// The details for this run step. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - /// If applicable, information about the last error encountered by this run step. - /// The Unix timestamp, in seconds, representing when this object was created. - /// The Unix timestamp, in seconds, representing when this item expired. - /// The Unix timestamp, in seconds, representing when this completed. - /// The Unix timestamp, in seconds, representing when this was cancelled. - /// The Unix timestamp, in seconds, representing when this failed. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// , , , or is null. - internal RunStep(string id, RunStepType type, string assistantId, string threadId, string runId, RunStepStatus status, RunStepDetails stepDetails, RunStepError lastError, DateTimeOffset createdAt, DateTimeOffset? expiredAt, DateTimeOffset? completedAt, DateTimeOffset? cancelledAt, DateTimeOffset? failedAt, IReadOnlyDictionary metadata) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(assistantId, nameof(assistantId)); - Argument.AssertNotNull(threadId, nameof(threadId)); - Argument.AssertNotNull(runId, nameof(runId)); - Argument.AssertNotNull(stepDetails, nameof(stepDetails)); - - Id = id; - Type = type; - AssistantId = assistantId; - ThreadId = threadId; - RunId = runId; - Status = status; - StepDetails = stepDetails; - LastError = lastError; - CreatedAt = createdAt; - ExpiredAt = expiredAt; - CompletedAt = completedAt; - CancelledAt = cancelledAt; - FailedAt = failedAt; - Metadata = metadata; - } - - /// Initializes a new instance of . - /// The identifier, which can be referenced in API endpoints. - /// The object type, which is always 'thread.run.step'. - /// The type of run step, which can be either message_creation or tool_calls. - /// The ID of the agent associated with the run step. - /// The ID of the thread that was run. - /// The ID of the run that this run step is a part of. - /// The status of this run step. - /// - /// The details for this run step. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - /// If applicable, information about the last error encountered by this run step. - /// The Unix timestamp, in seconds, representing when this object was created. - /// The Unix timestamp, in seconds, representing when this item expired. - /// The Unix timestamp, in seconds, representing when this completed. - /// The Unix timestamp, in seconds, representing when this was cancelled. - /// The Unix timestamp, in seconds, representing when this failed. - /// Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// Keeps track of any properties unknown to the library. - internal RunStep(string id, string @object, RunStepType type, string assistantId, string threadId, string runId, RunStepStatus status, RunStepDetails stepDetails, RunStepError lastError, DateTimeOffset createdAt, DateTimeOffset? expiredAt, DateTimeOffset? completedAt, DateTimeOffset? cancelledAt, DateTimeOffset? failedAt, RunStepCompletionUsage usage, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) - { - Id = id; - Object = @object; - Type = type; - AssistantId = assistantId; - ThreadId = threadId; - RunId = runId; - Status = status; - StepDetails = stepDetails; - LastError = lastError; - CreatedAt = createdAt; - ExpiredAt = expiredAt; - CompletedAt = completedAt; - CancelledAt = cancelledAt; - FailedAt = failedAt; - Usage = usage; - Metadata = metadata; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal RunStep() - { - } - - /// The identifier, which can be referenced in API endpoints. - public string Id { get; } - - /// The type of run step, which can be either message_creation or tool_calls. - public RunStepType Type { get; } - /// The ID of the agent associated with the run step. - public string AssistantId { get; } - /// The ID of the thread that was run. - public string ThreadId { get; } - /// The ID of the run that this run step is a part of. - public string RunId { get; } - /// The status of this run step. - public RunStepStatus Status { get; } - /// - /// The details for this run step. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - public RunStepDetails StepDetails { get; } - /// If applicable, information about the last error encountered by this run step. - public RunStepError LastError { get; } - /// The Unix timestamp, in seconds, representing when this object was created. - public DateTimeOffset CreatedAt { get; } - /// The Unix timestamp, in seconds, representing when this item expired. - public DateTimeOffset? ExpiredAt { get; } - /// The Unix timestamp, in seconds, representing when this completed. - public DateTimeOffset? CompletedAt { get; } - /// The Unix timestamp, in seconds, representing when this was cancelled. - public DateTimeOffset? CancelledAt { get; } - /// The Unix timestamp, in seconds, representing when this failed. - public DateTimeOffset? FailedAt { get; } - /// Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. - public RunStepCompletionUsage Usage { get; } - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - public IReadOnlyDictionary Metadata { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepAzureAISearchToolCall.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepAzureAISearchToolCall.Serialization.cs deleted file mode 100644 index 5dcc06551ad2..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepAzureAISearchToolCall.Serialization.cs +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class RunStepAzureAISearchToolCall : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepAzureAISearchToolCall)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("azure_ai_search"u8); - writer.WriteStartObject(); - foreach (var item in AzureAISearch) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - - RunStepAzureAISearchToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepAzureAISearchToolCall)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepAzureAISearchToolCall(document.RootElement, options); - } - - internal static RunStepAzureAISearchToolCall DeserializeRunStepAzureAISearchToolCall(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyDictionary azureAiSearch = default; - string type = default; - string id = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("azure_ai_search"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - azureAiSearch = dictionary; - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepAzureAISearchToolCall(type, id, serializedAdditionalRawData, azureAiSearch); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepAzureAISearchToolCall)} does not support writing '{options.Format}' format."); - } - } - - RunStepAzureAISearchToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepAzureAISearchToolCall(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepAzureAISearchToolCall)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new RunStepAzureAISearchToolCall FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepAzureAISearchToolCall(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepAzureAISearchToolCall.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepAzureAISearchToolCall.cs deleted file mode 100644 index ad27790312ec..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepAzureAISearchToolCall.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// A record of a call to an Azure AI Search tool, issued by the model in evaluation of a defined tool, that represents - /// executed Azure AI search. - /// - public partial class RunStepAzureAISearchToolCall : RunStepToolCall - { - /// Initializes a new instance of . - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Reserved for future use. - /// or is null. - internal RunStepAzureAISearchToolCall(string id, IReadOnlyDictionary azureAISearch) : base(id) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(azureAISearch, nameof(azureAISearch)); - - Type = "azure_ai_search"; - AzureAISearch = azureAISearch; - } - - /// Initializes a new instance of . - /// The object type. - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Keeps track of any properties unknown to the library. - /// Reserved for future use. - internal RunStepAzureAISearchToolCall(string type, string id, IDictionary serializedAdditionalRawData, IReadOnlyDictionary azureAISearch) : base(type, id, serializedAdditionalRawData) - { - AzureAISearch = azureAISearch; - } - - /// Initializes a new instance of for deserialization. - internal RunStepAzureAISearchToolCall() - { - } - - /// Reserved for future use. - public IReadOnlyDictionary AzureAISearch { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepBingCustomSearchToolCall.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepBingCustomSearchToolCall.Serialization.cs deleted file mode 100644 index a9919d4bfecf..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepBingCustomSearchToolCall.Serialization.cs +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class RunStepBingCustomSearchToolCall : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepBingCustomSearchToolCall)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("bing_custom_search"u8); - writer.WriteStartObject(); - foreach (var item in BingCustomSearch) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - - RunStepBingCustomSearchToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepBingCustomSearchToolCall)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepBingCustomSearchToolCall(document.RootElement, options); - } - - internal static RunStepBingCustomSearchToolCall DeserializeRunStepBingCustomSearchToolCall(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyDictionary bingCustomSearch = default; - string type = default; - string id = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("bing_custom_search"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - bingCustomSearch = dictionary; - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepBingCustomSearchToolCall(type, id, serializedAdditionalRawData, bingCustomSearch); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepBingCustomSearchToolCall)} does not support writing '{options.Format}' format."); - } - } - - RunStepBingCustomSearchToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepBingCustomSearchToolCall(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepBingCustomSearchToolCall)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new RunStepBingCustomSearchToolCall FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepBingCustomSearchToolCall(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepBingCustomSearchToolCall.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepBingCustomSearchToolCall.cs deleted file mode 100644 index 7c628d9d04a6..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepBingCustomSearchToolCall.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// A record of a call to a bing custom search tool, issued by the model in evaluation of a defined tool, that represents - /// executed search with bing custom search. - /// - public partial class RunStepBingCustomSearchToolCall : RunStepToolCall - { - /// Initializes a new instance of . - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Reserved for future use. - /// or is null. - internal RunStepBingCustomSearchToolCall(string id, IReadOnlyDictionary bingCustomSearch) : base(id) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(bingCustomSearch, nameof(bingCustomSearch)); - - Type = "bing_custom_search"; - BingCustomSearch = bingCustomSearch; - } - - /// Initializes a new instance of . - /// The object type. - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Keeps track of any properties unknown to the library. - /// Reserved for future use. - internal RunStepBingCustomSearchToolCall(string type, string id, IDictionary serializedAdditionalRawData, IReadOnlyDictionary bingCustomSearch) : base(type, id, serializedAdditionalRawData) - { - BingCustomSearch = bingCustomSearch; - } - - /// Initializes a new instance of for deserialization. - internal RunStepBingCustomSearchToolCall() - { - } - - /// Reserved for future use. - public IReadOnlyDictionary BingCustomSearch { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepBingGroundingToolCall.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepBingGroundingToolCall.Serialization.cs deleted file mode 100644 index 377732d91390..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepBingGroundingToolCall.Serialization.cs +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class RunStepBingGroundingToolCall : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepBingGroundingToolCall)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("bing_grounding"u8); - writer.WriteStartObject(); - foreach (var item in BingGrounding) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - - RunStepBingGroundingToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepBingGroundingToolCall)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepBingGroundingToolCall(document.RootElement, options); - } - - internal static RunStepBingGroundingToolCall DeserializeRunStepBingGroundingToolCall(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyDictionary bingGrounding = default; - string type = default; - string id = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("bing_grounding"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - bingGrounding = dictionary; - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepBingGroundingToolCall(type, id, serializedAdditionalRawData, bingGrounding); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepBingGroundingToolCall)} does not support writing '{options.Format}' format."); - } - } - - RunStepBingGroundingToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepBingGroundingToolCall(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepBingGroundingToolCall)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new RunStepBingGroundingToolCall FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepBingGroundingToolCall(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepBingGroundingToolCall.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepBingGroundingToolCall.cs deleted file mode 100644 index f1e11c513f6b..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepBingGroundingToolCall.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// A record of a call to a bing grounding tool, issued by the model in evaluation of a defined tool, that represents - /// executed search with bing grounding. - /// - public partial class RunStepBingGroundingToolCall : RunStepToolCall - { - /// Initializes a new instance of . - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Reserved for future use. - /// or is null. - internal RunStepBingGroundingToolCall(string id, IReadOnlyDictionary bingGrounding) : base(id) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(bingGrounding, nameof(bingGrounding)); - - Type = "bing_grounding"; - BingGrounding = bingGrounding; - } - - /// Initializes a new instance of . - /// The object type. - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Keeps track of any properties unknown to the library. - /// Reserved for future use. - internal RunStepBingGroundingToolCall(string type, string id, IDictionary serializedAdditionalRawData, IReadOnlyDictionary bingGrounding) : base(type, id, serializedAdditionalRawData) - { - BingGrounding = bingGrounding; - } - - /// Initializes a new instance of for deserialization. - internal RunStepBingGroundingToolCall() - { - } - - /// Reserved for future use. - public IReadOnlyDictionary BingGrounding { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterImageOutput.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterImageOutput.Serialization.cs deleted file mode 100644 index ad5c6d969ddb..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterImageOutput.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class RunStepCodeInterpreterImageOutput : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepCodeInterpreterImageOutput)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("image"u8); - writer.WriteObjectValue(Image, options); - } - - RunStepCodeInterpreterImageOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepCodeInterpreterImageOutput)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepCodeInterpreterImageOutput(document.RootElement, options); - } - - internal static RunStepCodeInterpreterImageOutput DeserializeRunStepCodeInterpreterImageOutput(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - RunStepCodeInterpreterImageReference image = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("image"u8)) - { - image = RunStepCodeInterpreterImageReference.DeserializeRunStepCodeInterpreterImageReference(property.Value, options); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepCodeInterpreterImageOutput(type, serializedAdditionalRawData, image); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepCodeInterpreterImageOutput)} does not support writing '{options.Format}' format."); - } - } - - RunStepCodeInterpreterImageOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepCodeInterpreterImageOutput(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepCodeInterpreterImageOutput)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new RunStepCodeInterpreterImageOutput FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepCodeInterpreterImageOutput(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterImageOutput.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterImageOutput.cs deleted file mode 100644 index e2cee173914d..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterImageOutput.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// A representation of an image output emitted by a code interpreter tool in response to a tool call by the model. - public partial class RunStepCodeInterpreterImageOutput : RunStepCodeInterpreterToolCallOutput - { - /// Initializes a new instance of . - /// Referential information for the image associated with this output. - /// is null. - internal RunStepCodeInterpreterImageOutput(RunStepCodeInterpreterImageReference image) - { - Argument.AssertNotNull(image, nameof(image)); - - Type = "image"; - Image = image; - } - - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - /// Referential information for the image associated with this output. - internal RunStepCodeInterpreterImageOutput(string type, IDictionary serializedAdditionalRawData, RunStepCodeInterpreterImageReference image) : base(type, serializedAdditionalRawData) - { - Image = image; - } - - /// Initializes a new instance of for deserialization. - internal RunStepCodeInterpreterImageOutput() - { - } - - /// Referential information for the image associated with this output. - public RunStepCodeInterpreterImageReference Image { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterImageReference.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterImageReference.Serialization.cs deleted file mode 100644 index 875386a962e5..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterImageReference.Serialization.cs +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class RunStepCodeInterpreterImageReference : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepCodeInterpreterImageReference)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("file_id"u8); - writer.WriteStringValue(FileId); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - RunStepCodeInterpreterImageReference IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepCodeInterpreterImageReference)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepCodeInterpreterImageReference(document.RootElement, options); - } - - internal static RunStepCodeInterpreterImageReference DeserializeRunStepCodeInterpreterImageReference(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string fileId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("file_id"u8)) - { - fileId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepCodeInterpreterImageReference(fileId, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepCodeInterpreterImageReference)} does not support writing '{options.Format}' format."); - } - } - - RunStepCodeInterpreterImageReference IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepCodeInterpreterImageReference(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepCodeInterpreterImageReference)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static RunStepCodeInterpreterImageReference FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepCodeInterpreterImageReference(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterImageReference.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterImageReference.cs deleted file mode 100644 index 145836ccecdf..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterImageReference.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// An image reference emitted by a code interpreter tool in response to a tool call by the model. - public partial class RunStepCodeInterpreterImageReference - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The ID of the file associated with this image. - /// is null. - internal RunStepCodeInterpreterImageReference(string fileId) - { - Argument.AssertNotNull(fileId, nameof(fileId)); - - FileId = fileId; - } - - /// Initializes a new instance of . - /// The ID of the file associated with this image. - /// Keeps track of any properties unknown to the library. - internal RunStepCodeInterpreterImageReference(string fileId, IDictionary serializedAdditionalRawData) - { - FileId = fileId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal RunStepCodeInterpreterImageReference() - { - } - - /// The ID of the file associated with this image. - public string FileId { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterLogOutput.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterLogOutput.Serialization.cs deleted file mode 100644 index 8b93a09238f2..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterLogOutput.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class RunStepCodeInterpreterLogOutput : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepCodeInterpreterLogOutput)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("logs"u8); - writer.WriteStringValue(Logs); - } - - RunStepCodeInterpreterLogOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepCodeInterpreterLogOutput)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepCodeInterpreterLogOutput(document.RootElement, options); - } - - internal static RunStepCodeInterpreterLogOutput DeserializeRunStepCodeInterpreterLogOutput(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string logs = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("logs"u8)) - { - logs = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepCodeInterpreterLogOutput(type, serializedAdditionalRawData, logs); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepCodeInterpreterLogOutput)} does not support writing '{options.Format}' format."); - } - } - - RunStepCodeInterpreterLogOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepCodeInterpreterLogOutput(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepCodeInterpreterLogOutput)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new RunStepCodeInterpreterLogOutput FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepCodeInterpreterLogOutput(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterLogOutput.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterLogOutput.cs deleted file mode 100644 index 27c36231929e..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterLogOutput.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// A representation of a log output emitted by a code interpreter tool in response to a tool call by the model. - public partial class RunStepCodeInterpreterLogOutput : RunStepCodeInterpreterToolCallOutput - { - /// Initializes a new instance of . - /// The serialized log output emitted by the code interpreter. - /// is null. - internal RunStepCodeInterpreterLogOutput(string logs) - { - Argument.AssertNotNull(logs, nameof(logs)); - - Type = "logs"; - Logs = logs; - } - - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - /// The serialized log output emitted by the code interpreter. - internal RunStepCodeInterpreterLogOutput(string type, IDictionary serializedAdditionalRawData, string logs) : base(type, serializedAdditionalRawData) - { - Logs = logs; - } - - /// Initializes a new instance of for deserialization. - internal RunStepCodeInterpreterLogOutput() - { - } - - /// The serialized log output emitted by the code interpreter. - public string Logs { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterToolCall.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterToolCall.Serialization.cs deleted file mode 100644 index 6be5605d1fd0..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterToolCall.Serialization.cs +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class RunStepCodeInterpreterToolCall : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCall)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("code_interpreter"u8); - writer.WriteObjectValue(InternalDetails, options); - } - - RunStepCodeInterpreterToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCall)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepCodeInterpreterToolCall(document.RootElement, options); - } - - internal static RunStepCodeInterpreterToolCall DeserializeRunStepCodeInterpreterToolCall(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - InternalCodeInterpreterToolCallDetails codeInterpreter = default; - string type = default; - string id = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("code_interpreter"u8)) - { - codeInterpreter = InternalCodeInterpreterToolCallDetails.DeserializeInternalCodeInterpreterToolCallDetails(property.Value, options); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepCodeInterpreterToolCall(type, id, serializedAdditionalRawData, codeInterpreter); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCall)} does not support writing '{options.Format}' format."); - } - } - - RunStepCodeInterpreterToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepCodeInterpreterToolCall(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCall)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new RunStepCodeInterpreterToolCall FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepCodeInterpreterToolCall(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterToolCall.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterToolCall.cs deleted file mode 100644 index fcb8e6ae275b..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterToolCall.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// A record of a call to a code interpreter tool, issued by the model in evaluation of a defined tool, that - /// represents inputs and outputs consumed and emitted by the code interpreter. - /// - public partial class RunStepCodeInterpreterToolCall : RunStepToolCall - { - /// Initializes a new instance of . - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// The details of the tool call to the code interpreter tool. - /// or is null. - internal RunStepCodeInterpreterToolCall(string id, InternalCodeInterpreterToolCallDetails internalDetails) : base(id) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(internalDetails, nameof(internalDetails)); - - Type = "code_interpreter"; - InternalDetails = internalDetails; - } - - /// Initializes a new instance of . - /// The object type. - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Keeps track of any properties unknown to the library. - /// The details of the tool call to the code interpreter tool. - internal RunStepCodeInterpreterToolCall(string type, string id, IDictionary serializedAdditionalRawData, InternalCodeInterpreterToolCallDetails internalDetails) : base(type, id, serializedAdditionalRawData) - { - InternalDetails = internalDetails; - } - - /// Initializes a new instance of for deserialization. - internal RunStepCodeInterpreterToolCall() - { - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterToolCallOutput.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterToolCallOutput.Serialization.cs deleted file mode 100644 index 895da6ab9af6..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterToolCallOutput.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - [PersistableModelProxy(typeof(UnknownRunStepCodeInterpreterToolCallOutput))] - public partial class RunStepCodeInterpreterToolCallOutput : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCallOutput)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - RunStepCodeInterpreterToolCallOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCallOutput)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepCodeInterpreterToolCallOutput(document.RootElement, options); - } - - internal static RunStepCodeInterpreterToolCallOutput DeserializeRunStepCodeInterpreterToolCallOutput(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - if (element.TryGetProperty("type", out JsonElement discriminator)) - { - switch (discriminator.GetString()) - { - case "image": return RunStepCodeInterpreterImageOutput.DeserializeRunStepCodeInterpreterImageOutput(element, options); - case "logs": return RunStepCodeInterpreterLogOutput.DeserializeRunStepCodeInterpreterLogOutput(element, options); - } - } - return UnknownRunStepCodeInterpreterToolCallOutput.DeserializeUnknownRunStepCodeInterpreterToolCallOutput(element, options); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCallOutput)} does not support writing '{options.Format}' format."); - } - } - - RunStepCodeInterpreterToolCallOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepCodeInterpreterToolCallOutput(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCallOutput)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static RunStepCodeInterpreterToolCallOutput FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepCodeInterpreterToolCallOutput(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterToolCallOutput.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterToolCallOutput.cs deleted file mode 100644 index cc947aa437ef..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCodeInterpreterToolCallOutput.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// An abstract representation of an emitted output from a code interpreter tool. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - public abstract partial class RunStepCodeInterpreterToolCallOutput - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private protected IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - protected RunStepCodeInterpreterToolCallOutput() - { - } - - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - internal RunStepCodeInterpreterToolCallOutput(string type, IDictionary serializedAdditionalRawData) - { - Type = type; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The object type. - internal string Type { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCompletionUsage.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCompletionUsage.Serialization.cs deleted file mode 100644 index 421f3565fc89..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCompletionUsage.Serialization.cs +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class RunStepCompletionUsage : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepCompletionUsage)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("completion_tokens"u8); - writer.WriteNumberValue(CompletionTokens); - writer.WritePropertyName("prompt_tokens"u8); - writer.WriteNumberValue(PromptTokens); - writer.WritePropertyName("total_tokens"u8); - writer.WriteNumberValue(TotalTokens); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - RunStepCompletionUsage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepCompletionUsage)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepCompletionUsage(document.RootElement, options); - } - - internal static RunStepCompletionUsage DeserializeRunStepCompletionUsage(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - long completionTokens = default; - long promptTokens = default; - long totalTokens = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("completion_tokens"u8)) - { - completionTokens = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("prompt_tokens"u8)) - { - promptTokens = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("total_tokens"u8)) - { - totalTokens = property.Value.GetInt64(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepCompletionUsage(completionTokens, promptTokens, totalTokens, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepCompletionUsage)} does not support writing '{options.Format}' format."); - } - } - - RunStepCompletionUsage IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepCompletionUsage(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepCompletionUsage)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static RunStepCompletionUsage FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepCompletionUsage(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCompletionUsage.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCompletionUsage.cs deleted file mode 100644 index 1999a6fb83c2..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepCompletionUsage.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Usage statistics related to the run step. - public partial class RunStepCompletionUsage - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// Number of completion tokens used over the course of the run step. - /// Number of prompt tokens used over the course of the run step. - /// Total number of tokens used (prompt + completion). - internal RunStepCompletionUsage(long completionTokens, long promptTokens, long totalTokens) - { - CompletionTokens = completionTokens; - PromptTokens = promptTokens; - TotalTokens = totalTokens; - } - - /// Initializes a new instance of . - /// Number of completion tokens used over the course of the run step. - /// Number of prompt tokens used over the course of the run step. - /// Total number of tokens used (prompt + completion). - /// Keeps track of any properties unknown to the library. - internal RunStepCompletionUsage(long completionTokens, long promptTokens, long totalTokens, IDictionary serializedAdditionalRawData) - { - CompletionTokens = completionTokens; - PromptTokens = promptTokens; - TotalTokens = totalTokens; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal RunStepCompletionUsage() - { - } - - /// Number of completion tokens used over the course of the run step. - public long CompletionTokens { get; } - /// Number of prompt tokens used over the course of the run step. - public long PromptTokens { get; } - /// Total number of tokens used (prompt + completion). - public long TotalTokens { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepDetails.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepDetails.Serialization.cs deleted file mode 100644 index 8ed641f702d2..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepDetails.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - [PersistableModelProxy(typeof(UnknownRunStepDetails))] - public partial class RunStepDetails : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDetails)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - RunStepDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepDetails(document.RootElement, options); - } - - internal static RunStepDetails DeserializeRunStepDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - if (element.TryGetProperty("type", out JsonElement discriminator)) - { - switch (discriminator.GetString()) - { - case "message_creation": return RunStepMessageCreationDetails.DeserializeRunStepMessageCreationDetails(element, options); - case "tool_calls": return RunStepToolCallDetails.DeserializeRunStepToolCallDetails(element, options); - } - } - return UnknownRunStepDetails.DeserializeUnknownRunStepDetails(element, options); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepDetails)} does not support writing '{options.Format}' format."); - } - } - - RunStepDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepDetails)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static RunStepDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepDetails(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepDetails.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepDetails.cs deleted file mode 100644 index cf2a6d05625a..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepDetails.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// An abstract representation of the details for a run step. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - public abstract partial class RunStepDetails - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private protected IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - protected RunStepDetails() - { - } - - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - internal RunStepDetails(RunStepType type, IDictionary serializedAdditionalRawData) - { - Type = type; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The object type. - internal RunStepType Type { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepError.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepError.Serialization.cs deleted file mode 100644 index c43f9208d27c..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepError.Serialization.cs +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class RunStepError : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepError)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("code"u8); - writer.WriteStringValue(Code.ToString()); - writer.WritePropertyName("message"u8); - writer.WriteStringValue(Message); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - RunStepError IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepError)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepError(document.RootElement, options); - } - - internal static RunStepError DeserializeRunStepError(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - RunStepErrorCode code = default; - string message = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("code"u8)) - { - code = new RunStepErrorCode(property.Value.GetString()); - continue; - } - if (property.NameEquals("message"u8)) - { - message = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepError(code, message, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepError)} does not support writing '{options.Format}' format."); - } - } - - RunStepError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepError(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepError)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static RunStepError FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepError(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepError.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepError.cs deleted file mode 100644 index 83eec6ff7e14..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepError.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The error information associated with a failed run step. - public partial class RunStepError - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The error code for this error. - /// The human-readable text associated with this error. - /// is null. - internal RunStepError(RunStepErrorCode code, string message) - { - Argument.AssertNotNull(message, nameof(message)); - - Code = code; - Message = message; - } - - /// Initializes a new instance of . - /// The error code for this error. - /// The human-readable text associated with this error. - /// Keeps track of any properties unknown to the library. - internal RunStepError(RunStepErrorCode code, string message, IDictionary serializedAdditionalRawData) - { - Code = code; - Message = message; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal RunStepError() - { - } - - /// The error code for this error. - public RunStepErrorCode Code { get; } - /// The human-readable text associated with this error. - public string Message { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepErrorCode.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepErrorCode.cs deleted file mode 100644 index a880adc3e37d..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepErrorCode.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// Possible error code values attributable to a failed run step. - public readonly partial struct RunStepErrorCode : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public RunStepErrorCode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ServerErrorValue = "server_error"; - private const string RateLimitExceededValue = "rate_limit_exceeded"; - - /// Represents a server error. - public static RunStepErrorCode ServerError { get; } = new RunStepErrorCode(ServerErrorValue); - /// Represents an error indicating configured rate limits were exceeded. - public static RunStepErrorCode RateLimitExceeded { get; } = new RunStepErrorCode(RateLimitExceededValue); - /// Determines if two values are the same. - public static bool operator ==(RunStepErrorCode left, RunStepErrorCode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(RunStepErrorCode left, RunStepErrorCode right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator RunStepErrorCode(string value) => new RunStepErrorCode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is RunStepErrorCode other && Equals(other); - /// - public bool Equals(RunStepErrorCode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepFileSearchToolCall.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepFileSearchToolCall.Serialization.cs deleted file mode 100644 index 4be521f7a852..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepFileSearchToolCall.Serialization.cs +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class RunStepFileSearchToolCall : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepFileSearchToolCall)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("file_search"u8); - writer.WriteObjectValue(FileSearch, options); - } - - RunStepFileSearchToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepFileSearchToolCall)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepFileSearchToolCall(document.RootElement, options); - } - - internal static RunStepFileSearchToolCall DeserializeRunStepFileSearchToolCall(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - RunStepFileSearchToolCallResults fileSearch = default; - string type = default; - string id = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("file_search"u8)) - { - fileSearch = RunStepFileSearchToolCallResults.DeserializeRunStepFileSearchToolCallResults(property.Value, options); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepFileSearchToolCall(type, id, serializedAdditionalRawData, fileSearch); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepFileSearchToolCall)} does not support writing '{options.Format}' format."); - } - } - - RunStepFileSearchToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepFileSearchToolCall(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepFileSearchToolCall)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new RunStepFileSearchToolCall FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepFileSearchToolCall(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepFileSearchToolCall.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepFileSearchToolCall.cs deleted file mode 100644 index cb33e92e5819..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepFileSearchToolCall.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// A record of a call to a file search tool, issued by the model in evaluation of a defined tool, that represents - /// executed file search. - /// - public partial class RunStepFileSearchToolCall : RunStepToolCall - { - /// Initializes a new instance of . - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// For now, this is always going to be an empty object. - /// or is null. - internal RunStepFileSearchToolCall(string id, RunStepFileSearchToolCallResults fileSearch) : base(id) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(fileSearch, nameof(fileSearch)); - - Type = "file_search"; - FileSearch = fileSearch; - } - - /// Initializes a new instance of . - /// The object type. - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Keeps track of any properties unknown to the library. - /// For now, this is always going to be an empty object. - internal RunStepFileSearchToolCall(string type, string id, IDictionary serializedAdditionalRawData, RunStepFileSearchToolCallResults fileSearch) : base(type, id, serializedAdditionalRawData) - { - FileSearch = fileSearch; - } - - /// Initializes a new instance of for deserialization. - internal RunStepFileSearchToolCall() - { - } - - /// For now, this is always going to be an empty object. - public RunStepFileSearchToolCallResults FileSearch { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepFunctionToolCall.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepFunctionToolCall.Serialization.cs deleted file mode 100644 index 02b7d27528ca..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepFunctionToolCall.Serialization.cs +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class RunStepFunctionToolCall : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepFunctionToolCall)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("function"u8); - writer.WriteObjectValue(InternalDetails, options); - } - - RunStepFunctionToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepFunctionToolCall)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepFunctionToolCall(document.RootElement, options); - } - - internal static RunStepFunctionToolCall DeserializeRunStepFunctionToolCall(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - InternalRunStepFunctionToolCallDetails function = default; - string type = default; - string id = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("function"u8)) - { - function = InternalRunStepFunctionToolCallDetails.DeserializeInternalRunStepFunctionToolCallDetails(property.Value, options); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepFunctionToolCall(type, id, serializedAdditionalRawData, function); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepFunctionToolCall)} does not support writing '{options.Format}' format."); - } - } - - RunStepFunctionToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepFunctionToolCall(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepFunctionToolCall)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new RunStepFunctionToolCall FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepFunctionToolCall(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepFunctionToolCall.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepFunctionToolCall.cs deleted file mode 100644 index 8e7effe3e73a..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepFunctionToolCall.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// A record of a call to a function tool, issued by the model in evaluation of a defined tool, that represents the inputs - /// and output consumed and emitted by the specified function. - /// - public partial class RunStepFunctionToolCall : RunStepToolCall - { - /// Initializes a new instance of . - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// The detailed information about the function called by the model. - /// or is null. - internal RunStepFunctionToolCall(string id, InternalRunStepFunctionToolCallDetails internalDetails) : base(id) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(internalDetails, nameof(internalDetails)); - - Type = "function"; - InternalDetails = internalDetails; - } - - /// Initializes a new instance of . - /// The object type. - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Keeps track of any properties unknown to the library. - /// The detailed information about the function called by the model. - internal RunStepFunctionToolCall(string type, string id, IDictionary serializedAdditionalRawData, InternalRunStepFunctionToolCallDetails internalDetails) : base(type, id, serializedAdditionalRawData) - { - InternalDetails = internalDetails; - } - - /// Initializes a new instance of for deserialization. - internal RunStepFunctionToolCall() - { - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMessageCreationDetails.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMessageCreationDetails.Serialization.cs deleted file mode 100644 index 98f743602980..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMessageCreationDetails.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class RunStepMessageCreationDetails : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepMessageCreationDetails)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("message_creation"u8); - writer.WriteObjectValue(MessageCreation, options); - } - - RunStepMessageCreationDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepMessageCreationDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepMessageCreationDetails(document.RootElement, options); - } - - internal static RunStepMessageCreationDetails DeserializeRunStepMessageCreationDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - RunStepMessageCreationReference messageCreation = default; - RunStepType type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("message_creation"u8)) - { - messageCreation = RunStepMessageCreationReference.DeserializeRunStepMessageCreationReference(property.Value, options); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new RunStepType(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepMessageCreationDetails(type, serializedAdditionalRawData, messageCreation); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepMessageCreationDetails)} does not support writing '{options.Format}' format."); - } - } - - RunStepMessageCreationDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepMessageCreationDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepMessageCreationDetails)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new RunStepMessageCreationDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepMessageCreationDetails(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMessageCreationDetails.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMessageCreationDetails.cs deleted file mode 100644 index c08aa7e44347..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMessageCreationDetails.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The detailed information associated with a message creation run step. - public partial class RunStepMessageCreationDetails : RunStepDetails - { - /// Initializes a new instance of . - /// Information about the message creation associated with this run step. - /// is null. - internal RunStepMessageCreationDetails(RunStepMessageCreationReference messageCreation) - { - Argument.AssertNotNull(messageCreation, nameof(messageCreation)); - - Type = RunStepType.MessageCreation; - MessageCreation = messageCreation; - } - - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - /// Information about the message creation associated with this run step. - internal RunStepMessageCreationDetails(RunStepType type, IDictionary serializedAdditionalRawData, RunStepMessageCreationReference messageCreation) : base(type, serializedAdditionalRawData) - { - MessageCreation = messageCreation; - } - - /// Initializes a new instance of for deserialization. - internal RunStepMessageCreationDetails() - { - } - - /// Information about the message creation associated with this run step. - public RunStepMessageCreationReference MessageCreation { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMessageCreationReference.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMessageCreationReference.Serialization.cs deleted file mode 100644 index 488eebd86d0e..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMessageCreationReference.Serialization.cs +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class RunStepMessageCreationReference : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepMessageCreationReference)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("message_id"u8); - writer.WriteStringValue(MessageId); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - RunStepMessageCreationReference IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepMessageCreationReference)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepMessageCreationReference(document.RootElement, options); - } - - internal static RunStepMessageCreationReference DeserializeRunStepMessageCreationReference(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string messageId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("message_id"u8)) - { - messageId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepMessageCreationReference(messageId, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepMessageCreationReference)} does not support writing '{options.Format}' format."); - } - } - - RunStepMessageCreationReference IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepMessageCreationReference(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepMessageCreationReference)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static RunStepMessageCreationReference FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepMessageCreationReference(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMessageCreationReference.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMessageCreationReference.cs deleted file mode 100644 index 6945a200f86a..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMessageCreationReference.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The details of a message created as a part of a run step. - public partial class RunStepMessageCreationReference - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The ID of the message created by this run step. - /// is null. - internal RunStepMessageCreationReference(string messageId) - { - Argument.AssertNotNull(messageId, nameof(messageId)); - - MessageId = messageId; - } - - /// Initializes a new instance of . - /// The ID of the message created by this run step. - /// Keeps track of any properties unknown to the library. - internal RunStepMessageCreationReference(string messageId, IDictionary serializedAdditionalRawData) - { - MessageId = messageId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal RunStepMessageCreationReference() - { - } - - /// The ID of the message created by this run step. - public string MessageId { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMicrosoftFabricToolCall.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMicrosoftFabricToolCall.Serialization.cs deleted file mode 100644 index 8bce669c0034..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMicrosoftFabricToolCall.Serialization.cs +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class RunStepMicrosoftFabricToolCall : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepMicrosoftFabricToolCall)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("fabric_dataagent"u8); - writer.WriteStartObject(); - foreach (var item in MicrosoftFabric) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - - RunStepMicrosoftFabricToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepMicrosoftFabricToolCall)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepMicrosoftFabricToolCall(document.RootElement, options); - } - - internal static RunStepMicrosoftFabricToolCall DeserializeRunStepMicrosoftFabricToolCall(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyDictionary fabricDataagent = default; - string type = default; - string id = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("fabric_dataagent"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - fabricDataagent = dictionary; - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepMicrosoftFabricToolCall(type, id, serializedAdditionalRawData, fabricDataagent); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepMicrosoftFabricToolCall)} does not support writing '{options.Format}' format."); - } - } - - RunStepMicrosoftFabricToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepMicrosoftFabricToolCall(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepMicrosoftFabricToolCall)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new RunStepMicrosoftFabricToolCall FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepMicrosoftFabricToolCall(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMicrosoftFabricToolCall.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMicrosoftFabricToolCall.cs deleted file mode 100644 index a78260a4ae24..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepMicrosoftFabricToolCall.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// A record of a call to a Microsoft Fabric tool, issued by the model in evaluation of a defined tool, that represents - /// executed Microsoft Fabric operations. - /// - public partial class RunStepMicrosoftFabricToolCall : RunStepToolCall - { - /// Initializes a new instance of . - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Reserved for future use. - /// or is null. - internal RunStepMicrosoftFabricToolCall(string id, IReadOnlyDictionary microsoftFabric) : base(id) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(microsoftFabric, nameof(microsoftFabric)); - - Type = "fabric_dataagent"; - MicrosoftFabric = microsoftFabric; - } - - /// Initializes a new instance of . - /// The object type. - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Keeps track of any properties unknown to the library. - /// Reserved for future use. - internal RunStepMicrosoftFabricToolCall(string type, string id, IDictionary serializedAdditionalRawData, IReadOnlyDictionary microsoftFabric) : base(type, id, serializedAdditionalRawData) - { - MicrosoftFabric = microsoftFabric; - } - - /// Initializes a new instance of for deserialization. - internal RunStepMicrosoftFabricToolCall() - { - } - - /// Reserved for future use. - public IReadOnlyDictionary MicrosoftFabric { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepObject.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepObject.cs deleted file mode 100644 index 33e04b8798f8..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepObject.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// The RunStep_object. - internal readonly partial struct RunStepObject : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public RunStepObject(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ThreadRunStepValue = "thread.run.step"; - - /// thread.run.step. - public static RunStepObject ThreadRunStep { get; } = new RunStepObject(ThreadRunStepValue); - /// Determines if two values are the same. - public static bool operator ==(RunStepObject left, RunStepObject right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(RunStepObject left, RunStepObject right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator RunStepObject(string value) => new RunStepObject(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is RunStepObject other && Equals(other); - /// - public bool Equals(RunStepObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepOpenAPIToolCall.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepOpenAPIToolCall.Serialization.cs deleted file mode 100644 index 7b18ca65df21..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepOpenAPIToolCall.Serialization.cs +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class RunStepOpenAPIToolCall : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepOpenAPIToolCall)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("openapi"u8); - writer.WriteStartObject(); - foreach (var item in OpenAPI) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - - RunStepOpenAPIToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepOpenAPIToolCall)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepOpenAPIToolCall(document.RootElement, options); - } - - internal static RunStepOpenAPIToolCall DeserializeRunStepOpenAPIToolCall(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyDictionary openapi = default; - string type = default; - string id = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("openapi"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - openapi = dictionary; - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepOpenAPIToolCall(type, id, serializedAdditionalRawData, openapi); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepOpenAPIToolCall)} does not support writing '{options.Format}' format."); - } - } - - RunStepOpenAPIToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepOpenAPIToolCall(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepOpenAPIToolCall)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new RunStepOpenAPIToolCall FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepOpenAPIToolCall(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepOpenAPIToolCall.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepOpenAPIToolCall.cs deleted file mode 100644 index 5405b48c0941..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepOpenAPIToolCall.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// A record of a call to an OpenAPI tool, issued by the model in evaluation of a defined tool, that represents - /// executed OpenAPI operations. - /// - public partial class RunStepOpenAPIToolCall : RunStepToolCall - { - /// Initializes a new instance of . - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Reserved for future use. - /// or is null. - internal RunStepOpenAPIToolCall(string id, IReadOnlyDictionary openAPI) : base(id) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(openAPI, nameof(openAPI)); - - Type = "openapi"; - OpenAPI = openAPI; - } - - /// Initializes a new instance of . - /// The object type. - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Keeps track of any properties unknown to the library. - /// Reserved for future use. - internal RunStepOpenAPIToolCall(string type, string id, IDictionary serializedAdditionalRawData, IReadOnlyDictionary openAPI) : base(type, id, serializedAdditionalRawData) - { - OpenAPI = openAPI; - } - - /// Initializes a new instance of for deserialization. - internal RunStepOpenAPIToolCall() - { - } - - /// Reserved for future use. - public IReadOnlyDictionary OpenAPI { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepSharepointToolCall.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepSharepointToolCall.Serialization.cs deleted file mode 100644 index aa1aaf4b6af4..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepSharepointToolCall.Serialization.cs +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class RunStepSharepointToolCall : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepSharepointToolCall)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("sharepoint_grounding"u8); - writer.WriteStartObject(); - foreach (var item in SharePoint) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - - RunStepSharepointToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepSharepointToolCall)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepSharepointToolCall(document.RootElement, options); - } - - internal static RunStepSharepointToolCall DeserializeRunStepSharepointToolCall(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyDictionary sharepointGrounding = default; - string type = default; - string id = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("sharepoint_grounding"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - sharepointGrounding = dictionary; - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepSharepointToolCall(type, id, serializedAdditionalRawData, sharepointGrounding); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepSharepointToolCall)} does not support writing '{options.Format}' format."); - } - } - - RunStepSharepointToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepSharepointToolCall(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepSharepointToolCall)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new RunStepSharepointToolCall FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepSharepointToolCall(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepSharepointToolCall.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepSharepointToolCall.cs deleted file mode 100644 index 43a2c6932b4b..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepSharepointToolCall.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// A record of a call to a SharePoint tool, issued by the model in evaluation of a defined tool, that represents - /// executed SharePoint actions. - /// - public partial class RunStepSharepointToolCall : RunStepToolCall - { - /// Initializes a new instance of . - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Reserved for future use. - /// or is null. - internal RunStepSharepointToolCall(string id, IReadOnlyDictionary sharePoint) : base(id) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(sharePoint, nameof(sharePoint)); - - Type = "sharepoint_grounding"; - SharePoint = sharePoint; - } - - /// Initializes a new instance of . - /// The object type. - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Keeps track of any properties unknown to the library. - /// Reserved for future use. - internal RunStepSharepointToolCall(string type, string id, IDictionary serializedAdditionalRawData, IReadOnlyDictionary sharePoint) : base(type, id, serializedAdditionalRawData) - { - SharePoint = sharePoint; - } - - /// Initializes a new instance of for deserialization. - internal RunStepSharepointToolCall() - { - } - - /// Reserved for future use. - public IReadOnlyDictionary SharePoint { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepStatus.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepStatus.cs deleted file mode 100644 index e6402c19762a..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepStatus.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// Possible values for the status of a run step. - public readonly partial struct RunStepStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public RunStepStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string InProgressValue = "in_progress"; - private const string CancelledValue = "cancelled"; - private const string FailedValue = "failed"; - private const string CompletedValue = "completed"; - private const string ExpiredValue = "expired"; - - /// Represents a run step still in progress. - public static RunStepStatus InProgress { get; } = new RunStepStatus(InProgressValue); - /// Represents a run step that was cancelled. - public static RunStepStatus Cancelled { get; } = new RunStepStatus(CancelledValue); - /// Represents a run step that failed. - public static RunStepStatus Failed { get; } = new RunStepStatus(FailedValue); - /// Represents a run step that successfully completed. - public static RunStepStatus Completed { get; } = new RunStepStatus(CompletedValue); - /// Represents a run step that expired before otherwise finishing. - public static RunStepStatus Expired { get; } = new RunStepStatus(ExpiredValue); - /// Determines if two values are the same. - public static bool operator ==(RunStepStatus left, RunStepStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(RunStepStatus left, RunStepStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator RunStepStatus(string value) => new RunStepStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is RunStepStatus other && Equals(other); - /// - public bool Equals(RunStepStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepToolCall.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepToolCall.Serialization.cs deleted file mode 100644 index 75934e58dfca..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepToolCall.Serialization.cs +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - [PersistableModelProxy(typeof(UnknownRunStepToolCall))] - public partial class RunStepToolCall : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepToolCall)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - RunStepToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepToolCall)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepToolCall(document.RootElement, options); - } - - internal static RunStepToolCall DeserializeRunStepToolCall(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - if (element.TryGetProperty("type", out JsonElement discriminator)) - { - switch (discriminator.GetString()) - { - case "azure_ai_search": return RunStepAzureAISearchToolCall.DeserializeRunStepAzureAISearchToolCall(element, options); - case "bing_custom_search": return RunStepBingCustomSearchToolCall.DeserializeRunStepBingCustomSearchToolCall(element, options); - case "bing_grounding": return RunStepBingGroundingToolCall.DeserializeRunStepBingGroundingToolCall(element, options); - case "code_interpreter": return RunStepCodeInterpreterToolCall.DeserializeRunStepCodeInterpreterToolCall(element, options); - case "fabric_dataagent": return RunStepMicrosoftFabricToolCall.DeserializeRunStepMicrosoftFabricToolCall(element, options); - case "file_search": return RunStepFileSearchToolCall.DeserializeRunStepFileSearchToolCall(element, options); - case "function": return RunStepFunctionToolCall.DeserializeRunStepFunctionToolCall(element, options); - case "openapi": return RunStepOpenAPIToolCall.DeserializeRunStepOpenAPIToolCall(element, options); - case "sharepoint_grounding": return RunStepSharepointToolCall.DeserializeRunStepSharepointToolCall(element, options); - } - } - return UnknownRunStepToolCall.DeserializeUnknownRunStepToolCall(element, options); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepToolCall)} does not support writing '{options.Format}' format."); - } - } - - RunStepToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepToolCall(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepToolCall)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static RunStepToolCall FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepToolCall(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepToolCall.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepToolCall.cs deleted file mode 100644 index 2baae9a8d283..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepToolCall.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// An abstract representation of a detailed tool call as recorded within a run step for an existing run. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , and . - /// - public abstract partial class RunStepToolCall - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private protected IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// is null. - protected RunStepToolCall(string id) - { - Argument.AssertNotNull(id, nameof(id)); - - Id = id; - } - - /// Initializes a new instance of . - /// The object type. - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Keeps track of any properties unknown to the library. - internal RunStepToolCall(string type, string id, IDictionary serializedAdditionalRawData) - { - Type = type; - Id = id; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal RunStepToolCall() - { - } - - /// The object type. - internal string Type { get; set; } - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - public string Id { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepToolCallDetails.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepToolCallDetails.Serialization.cs deleted file mode 100644 index d7b13d1fd8a4..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepToolCallDetails.Serialization.cs +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class RunStepToolCallDetails : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepToolCallDetails)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("tool_calls"u8); - writer.WriteStartArray(); - foreach (var item in ToolCalls) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - - RunStepToolCallDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepToolCallDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepToolCallDetails(document.RootElement, options); - } - - internal static RunStepToolCallDetails DeserializeRunStepToolCallDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList toolCalls = default; - RunStepType type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tool_calls"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(RunStepToolCall.DeserializeRunStepToolCall(item, options)); - } - toolCalls = array; - continue; - } - if (property.NameEquals("type"u8)) - { - type = new RunStepType(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepToolCallDetails(type, serializedAdditionalRawData, toolCalls); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepToolCallDetails)} does not support writing '{options.Format}' format."); - } - } - - RunStepToolCallDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepToolCallDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepToolCallDetails)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new RunStepToolCallDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepToolCallDetails(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepToolCallDetails.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepToolCallDetails.cs deleted file mode 100644 index efea73eed8eb..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepToolCallDetails.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.AI.Agents.Persistent -{ - /// The detailed information associated with a run step calling tools. - public partial class RunStepToolCallDetails : RunStepDetails - { - /// Initializes a new instance of . - /// - /// A list of tool call details for this run step. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , and . - /// - /// is null. - internal RunStepToolCallDetails(IEnumerable toolCalls) - { - Argument.AssertNotNull(toolCalls, nameof(toolCalls)); - - Type = RunStepType.ToolCalls; - ToolCalls = toolCalls.ToList(); - } - - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - /// - /// A list of tool call details for this run step. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , and . - /// - internal RunStepToolCallDetails(RunStepType type, IDictionary serializedAdditionalRawData, IReadOnlyList toolCalls) : base(type, serializedAdditionalRawData) - { - ToolCalls = toolCalls; - } - - /// Initializes a new instance of for deserialization. - internal RunStepToolCallDetails() - { - } - - /// - /// A list of tool call details for this run step. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , and . - /// - public IReadOnlyList ToolCalls { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepType.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepType.cs deleted file mode 100644 index fc8be57ed6d3..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/RunStepType.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// The possible types of run steps. - public readonly partial struct RunStepType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public RunStepType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string MessageCreationValue = "message_creation"; - private const string ToolCallsValue = "tool_calls"; - - /// Represents a run step to create a message. - public static RunStepType MessageCreation { get; } = new RunStepType(MessageCreationValue); - /// Represents a run step that calls tools. - public static RunStepType ToolCalls { get; } = new RunStepType(ToolCallsValue); - /// Determines if two values are the same. - public static bool operator ==(RunStepType left, RunStepType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(RunStepType left, RunStepType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator RunStepType(string value) => new RunStepType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is RunStepType other && Equals(other); - /// - public bool Equals(RunStepType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SharepointToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SharepointToolDefinition.Serialization.cs deleted file mode 100644 index 6a039775a53f..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SharepointToolDefinition.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class SharepointToolDefinition : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SharepointToolDefinition)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("sharepoint_grounding"u8); - writer.WriteObjectValue(SharepointGrounding, options); - } - - SharepointToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SharepointToolDefinition)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSharepointToolDefinition(document.RootElement, options); - } - - internal static SharepointToolDefinition DeserializeSharepointToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ToolConnectionList sharepointGrounding = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("sharepoint_grounding"u8)) - { - sharepointGrounding = ToolConnectionList.DeserializeToolConnectionList(property.Value, options); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new SharepointToolDefinition(type, serializedAdditionalRawData, sharepointGrounding); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(SharepointToolDefinition)} does not support writing '{options.Format}' format."); - } - } - - SharepointToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeSharepointToolDefinition(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SharepointToolDefinition)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new SharepointToolDefinition FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeSharepointToolDefinition(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SharepointToolDefinition.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SharepointToolDefinition.cs deleted file mode 100644 index d537d9561dc5..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SharepointToolDefinition.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The input definition information for a sharepoint tool as used to configure an agent. - public partial class SharepointToolDefinition : ToolDefinition - { - /// Initializes a new instance of . - /// The list of connections used by the SharePoint tool. - /// is null. - public SharepointToolDefinition(ToolConnectionList sharepointGrounding) - { - Argument.AssertNotNull(sharepointGrounding, nameof(sharepointGrounding)); - - Type = "sharepoint_grounding"; - SharepointGrounding = sharepointGrounding; - } - - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - /// The list of connections used by the SharePoint tool. - internal SharepointToolDefinition(string type, IDictionary serializedAdditionalRawData, ToolConnectionList sharepointGrounding) : base(type, serializedAdditionalRawData) - { - SharepointGrounding = sharepointGrounding; - } - - /// Initializes a new instance of for deserialization. - internal SharepointToolDefinition() - { - } - - /// The list of connections used by the SharePoint tool. - public ToolConnectionList SharepointGrounding { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SubmitToolOutputsAction.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SubmitToolOutputsAction.Serialization.cs deleted file mode 100644 index e1b6ac4b3814..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SubmitToolOutputsAction.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class SubmitToolOutputsAction : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SubmitToolOutputsAction)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("submit_tool_outputs"u8); - writer.WriteObjectValue(InternalDetails, options); - } - - SubmitToolOutputsAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SubmitToolOutputsAction)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSubmitToolOutputsAction(document.RootElement, options); - } - - internal static SubmitToolOutputsAction DeserializeSubmitToolOutputsAction(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - InternalSubmitToolOutputsDetails submitToolOutputs = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("submit_tool_outputs"u8)) - { - submitToolOutputs = InternalSubmitToolOutputsDetails.DeserializeInternalSubmitToolOutputsDetails(property.Value, options); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new SubmitToolOutputsAction(type, serializedAdditionalRawData, submitToolOutputs); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(SubmitToolOutputsAction)} does not support writing '{options.Format}' format."); - } - } - - SubmitToolOutputsAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeSubmitToolOutputsAction(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SubmitToolOutputsAction)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new SubmitToolOutputsAction FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeSubmitToolOutputsAction(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SubmitToolOutputsAction.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SubmitToolOutputsAction.cs deleted file mode 100644 index 5c03800b1f87..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SubmitToolOutputsAction.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The details for required tool calls that must be submitted for an agent thread run to continue. - public partial class SubmitToolOutputsAction : RequiredAction - { - /// Initializes a new instance of . - /// The details describing tools that should be called to submit tool outputs. - /// is null. - internal SubmitToolOutputsAction(InternalSubmitToolOutputsDetails internalDetails) - { - Argument.AssertNotNull(internalDetails, nameof(internalDetails)); - - Type = "submit_tool_outputs"; - InternalDetails = internalDetails; - } - - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - /// The details describing tools that should be called to submit tool outputs. - internal SubmitToolOutputsAction(string type, IDictionary serializedAdditionalRawData, InternalSubmitToolOutputsDetails internalDetails) : base(type, serializedAdditionalRawData) - { - InternalDetails = internalDetails; - } - - /// Initializes a new instance of for deserialization. - internal SubmitToolOutputsAction() - { - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SubmitToolOutputsToRunRequest.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SubmitToolOutputsToRunRequest.Serialization.cs deleted file mode 100644 index a605db7aa076..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SubmitToolOutputsToRunRequest.Serialization.cs +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class SubmitToolOutputsToRunRequest : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SubmitToolOutputsToRunRequest)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("tool_outputs"u8); - writer.WriteStartArray(); - foreach (var item in ToolOutputs) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Stream)) - { - if (Stream != null) - { - writer.WritePropertyName("stream"u8); - writer.WriteBooleanValue(Stream.Value); - } - else - { - writer.WriteNull("stream"); - } - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - SubmitToolOutputsToRunRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SubmitToolOutputsToRunRequest)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSubmitToolOutputsToRunRequest(document.RootElement, options); - } - - internal static SubmitToolOutputsToRunRequest DeserializeSubmitToolOutputsToRunRequest(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList toolOutputs = default; - bool? stream = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tool_outputs"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ToolOutput.DeserializeToolOutput(item, options)); - } - toolOutputs = array; - continue; - } - if (property.NameEquals("stream"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - stream = null; - continue; - } - stream = property.Value.GetBoolean(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new SubmitToolOutputsToRunRequest(toolOutputs, stream, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(SubmitToolOutputsToRunRequest)} does not support writing '{options.Format}' format."); - } - } - - SubmitToolOutputsToRunRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeSubmitToolOutputsToRunRequest(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SubmitToolOutputsToRunRequest)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static SubmitToolOutputsToRunRequest FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeSubmitToolOutputsToRunRequest(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SubmitToolOutputsToRunRequest.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SubmitToolOutputsToRunRequest.cs deleted file mode 100644 index 8f4a5cc61ed5..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/SubmitToolOutputsToRunRequest.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.AI.Agents.Persistent -{ - /// The SubmitToolOutputsToRunRequest. - internal partial class SubmitToolOutputsToRunRequest - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// A list of tools for which the outputs are being submitted. - /// is null. - internal SubmitToolOutputsToRunRequest(IEnumerable toolOutputs) - { - Argument.AssertNotNull(toolOutputs, nameof(toolOutputs)); - - ToolOutputs = toolOutputs.ToList(); - } - - /// Initializes a new instance of . - /// A list of tools for which the outputs are being submitted. - /// If true, returns a stream of events that happen during the Run as SSE, terminating at `[DONE]`. - /// Keeps track of any properties unknown to the library. - internal SubmitToolOutputsToRunRequest(IReadOnlyList toolOutputs, bool? stream, IDictionary serializedAdditionalRawData) - { - ToolOutputs = toolOutputs; - Stream = stream; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal SubmitToolOutputsToRunRequest() - { - } - - /// A list of tools for which the outputs are being submitted. - public IReadOnlyList ToolOutputs { get; } - /// If true, returns a stream of events that happen during the Run as SSE, terminating at `[DONE]`. - public bool? Stream { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadDeletionStatus.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadDeletionStatus.Serialization.cs deleted file mode 100644 index 76c8ea66436e..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadDeletionStatus.Serialization.cs +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class ThreadDeletionStatus : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ThreadDeletionStatus)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("deleted"u8); - writer.WriteBooleanValue(Deleted); - writer.WritePropertyName("object"u8); - writer.WriteStringValue(Object.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ThreadDeletionStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ThreadDeletionStatus)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeThreadDeletionStatus(document.RootElement, options); - } - - internal static ThreadDeletionStatus DeserializeThreadDeletionStatus(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - bool deleted = default; - ThreadDeletionStatusObject @object = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("deleted"u8)) - { - deleted = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("object"u8)) - { - @object = new ThreadDeletionStatusObject(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ThreadDeletionStatus(id, deleted, @object, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(ThreadDeletionStatus)} does not support writing '{options.Format}' format."); - } - } - - ThreadDeletionStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeThreadDeletionStatus(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ThreadDeletionStatus)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ThreadDeletionStatus FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeThreadDeletionStatus(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadDeletionStatus.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadDeletionStatus.cs deleted file mode 100644 index d4fa859be490..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadDeletionStatus.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The status of a thread deletion operation. - internal partial class ThreadDeletionStatus - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The ID of the resource specified for deletion. - /// A value indicating whether deletion was successful. - /// is null. - internal ThreadDeletionStatus(string id, bool deleted) - { - Argument.AssertNotNull(id, nameof(id)); - - Id = id; - Deleted = deleted; - } - - /// Initializes a new instance of . - /// The ID of the resource specified for deletion. - /// A value indicating whether deletion was successful. - /// The object type, which is always 'thread.deleted'. - /// Keeps track of any properties unknown to the library. - internal ThreadDeletionStatus(string id, bool deleted, ThreadDeletionStatusObject @object, IDictionary serializedAdditionalRawData) - { - Id = id; - Deleted = deleted; - Object = @object; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ThreadDeletionStatus() - { - } - - /// The ID of the resource specified for deletion. - public string Id { get; } - /// A value indicating whether deletion was successful. - public bool Deleted { get; } - /// The object type, which is always 'thread.deleted'. - public ThreadDeletionStatusObject Object { get; } = ThreadDeletionStatusObject.ThreadDeleted; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadDeletionStatusObject.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadDeletionStatusObject.cs deleted file mode 100644 index e692dc571cf8..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadDeletionStatusObject.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// The ThreadDeletionStatus_object. - internal readonly partial struct ThreadDeletionStatusObject : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ThreadDeletionStatusObject(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ThreadDeletedValue = "thread.deleted"; - - /// thread.deleted. - public static ThreadDeletionStatusObject ThreadDeleted { get; } = new ThreadDeletionStatusObject(ThreadDeletedValue); - /// Determines if two values are the same. - public static bool operator ==(ThreadDeletionStatusObject left, ThreadDeletionStatusObject right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ThreadDeletionStatusObject left, ThreadDeletionStatusObject right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ThreadDeletionStatusObject(string value) => new ThreadDeletionStatusObject(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ThreadDeletionStatusObject other && Equals(other); - /// - public bool Equals(ThreadDeletionStatusObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadMessageOptions.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadMessageOptions.Serialization.cs deleted file mode 100644 index bed674d3d630..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadMessageOptions.Serialization.cs +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class ThreadMessageOptions : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ThreadMessageOptions)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("role"u8); - writer.WriteStringValue(Role.ToString()); - writer.WritePropertyName("content"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(Content); -#else - using (JsonDocument document = JsonDocument.Parse(Content, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - if (Optional.IsCollectionDefined(Attachments)) - { - if (Attachments != null) - { - writer.WritePropertyName("attachments"u8); - writer.WriteStartArray(); - foreach (var item in Attachments) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - else - { - writer.WriteNull("attachments"); - } - } - if (Optional.IsCollectionDefined(Metadata)) - { - if (Metadata != null) - { - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("metadata"); - } - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ThreadMessageOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ThreadMessageOptions)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeThreadMessageOptions(document.RootElement, options); - } - - internal static ThreadMessageOptions DeserializeThreadMessageOptions(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MessageRole role = default; - BinaryData content = default; - IList attachments = default; - IDictionary metadata = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("role"u8)) - { - role = new MessageRole(property.Value.GetString()); - continue; - } - if (property.NameEquals("content"u8)) - { - content = BinaryData.FromString(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("attachments"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(MessageAttachment.DeserializeMessageAttachment(item, options)); - } - attachments = array; - continue; - } - if (property.NameEquals("metadata"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ThreadMessageOptions(role, content, attachments ?? new ChangeTrackingList(), metadata ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(ThreadMessageOptions)} does not support writing '{options.Format}' format."); - } - } - - ThreadMessageOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeThreadMessageOptions(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ThreadMessageOptions)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ThreadMessageOptions FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeThreadMessageOptions(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadMessageOptions.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadMessageOptions.cs deleted file mode 100644 index 29f021735adf..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadMessageOptions.cs +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// A single message within an agent thread, - /// as provided during that thread's creation for its initial state. - /// - public partial class ThreadMessageOptions - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// - /// The role of the entity that is creating the message. Allowed values include: - /// `user`, which indicates the message is sent by an actual user (and should be - /// used in most cases to represent user-generated messages), and `assistant`, - /// which indicates the message is generated by the agent (use this value to insert - /// messages from the agent into the conversation). - /// - /// - /// The content of the initial message. This may be a basic string (if you only - /// need text) or an array of typed content blocks (for example, text, image_file, - /// image_url, and so on). - /// - /// is null. - public ThreadMessageOptions(MessageRole role, BinaryData content) - { - Argument.AssertNotNull(content, nameof(content)); - - Role = role; - Content = content; - Attachments = new ChangeTrackingList(); - Metadata = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of . - /// - /// The role of the entity that is creating the message. Allowed values include: - /// `user`, which indicates the message is sent by an actual user (and should be - /// used in most cases to represent user-generated messages), and `assistant`, - /// which indicates the message is generated by the agent (use this value to insert - /// messages from the agent into the conversation). - /// - /// - /// The content of the initial message. This may be a basic string (if you only - /// need text) or an array of typed content blocks (for example, text, image_file, - /// image_url, and so on). - /// - /// A list of files attached to the message, and the tools they should be added to. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// Keeps track of any properties unknown to the library. - internal ThreadMessageOptions(MessageRole role, BinaryData content, IList attachments, IDictionary metadata, IDictionary serializedAdditionalRawData) - { - Role = role; - Content = content; - Attachments = attachments; - Metadata = metadata; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ThreadMessageOptions() - { - } - - /// - /// The role of the entity that is creating the message. Allowed values include: - /// `user`, which indicates the message is sent by an actual user (and should be - /// used in most cases to represent user-generated messages), and `assistant`, - /// which indicates the message is generated by the agent (use this value to insert - /// messages from the agent into the conversation). - /// - public MessageRole Role { get; } - /// - /// The content of the initial message. This may be a basic string (if you only - /// need text) or an array of typed content blocks (for example, text, image_file, - /// image_url, and so on). - /// - /// To assign an object to this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// - /// Supported types: - /// - /// - /// - /// - /// - /// where T is of type - /// - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - public BinaryData Content { get; } - /// A list of files attached to the message, and the tools they should be added to. - public IList Attachments { get; set; } - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - public IDictionary Metadata { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadMessages.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadMessages.cs deleted file mode 100644 index 9e2ef80a7334..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadMessages.cs +++ /dev/null @@ -1,537 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.AI.Agents.Persistent -{ - // Data plane generated sub-client. - /// A collection of message operations under `/threads/{threadId}/messages`. - public partial class ThreadMessages - { - private static readonly string[] AuthorizationScopes = new string[] { "https://ai.azure.com/.default" }; - private readonly TokenCredential _tokenCredential; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// The ClientDiagnostics is used to provide tracing support for the client library. - internal ClientDiagnostics ClientDiagnostics { get; } - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline => _pipeline; - - /// Initializes a new instance of ThreadMessages for mocking. - protected ThreadMessages() - { - } - - /// Initializes a new instance of ThreadMessages. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The token credential to copy. - /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. - /// The API version to use for this operation. - internal ThreadMessages(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string apiVersion) - { - ClientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - _tokenCredential = tokenCredential; - _endpoint = endpoint; - _apiVersion = apiVersion; - } - - /// Creates a new message on a specified thread. - /// Identifier of the thread. - /// - /// The role of the entity that is creating the message. Allowed values include: - /// `user`, which indicates the message is sent by an actual user (and should be - /// used in most cases to represent user-generated messages), and `assistant`, - /// which indicates the message is generated by the agent (use this value to insert - /// messages from the agent into the conversation). - /// - /// - /// The content of the initial message. This may be a basic string (if you only - /// need text) or an array of typed content blocks (for example, text, image_file, - /// image_url, and so on). - /// - /// A list of files attached to the message, and the tools they should be added to. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public virtual async Task> CreateMessageAsync(string threadId, MessageRole role, BinaryData content, IEnumerable attachments = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNull(content, nameof(content)); - - CreateMessageRequest createMessageRequest = new CreateMessageRequest(role, content, attachments?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), metadata ?? new ChangeTrackingDictionary(), null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await CreateMessageAsync(threadId, createMessageRequest.ToRequestContent(), context).ConfigureAwait(false); - return Response.FromValue(PersistentThreadMessage.FromResponse(response), response); - } - - /// Creates a new message on a specified thread. - /// Identifier of the thread. - /// - /// The role of the entity that is creating the message. Allowed values include: - /// `user`, which indicates the message is sent by an actual user (and should be - /// used in most cases to represent user-generated messages), and `assistant`, - /// which indicates the message is generated by the agent (use this value to insert - /// messages from the agent into the conversation). - /// - /// - /// The content of the initial message. This may be a basic string (if you only - /// need text) or an array of typed content blocks (for example, text, image_file, - /// image_url, and so on). - /// - /// A list of files attached to the message, and the tools they should be added to. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public virtual Response CreateMessage(string threadId, MessageRole role, BinaryData content, IEnumerable attachments = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNull(content, nameof(content)); - - CreateMessageRequest createMessageRequest = new CreateMessageRequest(role, content, attachments?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), metadata ?? new ChangeTrackingDictionary(), null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = CreateMessage(threadId, createMessageRequest.ToRequestContent(), context); - return Response.FromValue(PersistentThreadMessage.FromResponse(response), response); - } - - /// - /// [Protocol Method] Creates a new message on a specified thread. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the thread. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task CreateMessageAsync(string threadId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("ThreadMessages.CreateMessage"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateMessageRequest(threadId, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Creates a new message on a specified thread. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the thread. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response CreateMessage(string threadId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("ThreadMessages.CreateMessage"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateMessageRequest(threadId, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Retrieves an existing message. - /// Identifier of the thread. - /// Identifier of the message. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual async Task> GetMessageAsync(string threadId, string messageId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(messageId, nameof(messageId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetMessageAsync(threadId, messageId, context).ConfigureAwait(false); - return Response.FromValue(PersistentThreadMessage.FromResponse(response), response); - } - - /// Retrieves an existing message. - /// Identifier of the thread. - /// Identifier of the message. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual Response GetMessage(string threadId, string messageId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(messageId, nameof(messageId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetMessage(threadId, messageId, context); - return Response.FromValue(PersistentThreadMessage.FromResponse(response), response); - } - - /// - /// [Protocol Method] Retrieves an existing message. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the thread. - /// Identifier of the message. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task GetMessageAsync(string threadId, string messageId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(messageId, nameof(messageId)); - - using var scope = ClientDiagnostics.CreateScope("ThreadMessages.GetMessage"); - scope.Start(); - try - { - using HttpMessage message = CreateGetMessageRequest(threadId, messageId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Retrieves an existing message. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the thread. - /// Identifier of the message. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response GetMessage(string threadId, string messageId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(messageId, nameof(messageId)); - - using var scope = ClientDiagnostics.CreateScope("ThreadMessages.GetMessage"); - scope.Start(); - try - { - using HttpMessage message = CreateGetMessageRequest(threadId, messageId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Modifies an existing message on an existing thread. - /// Identifier of the thread. - /// Identifier of the message. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual async Task> UpdateMessageAsync(string threadId, string messageId, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(messageId, nameof(messageId)); - - UpdateMessageRequest updateMessageRequest = new UpdateMessageRequest(metadata ?? new ChangeTrackingDictionary(), null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await UpdateMessageAsync(threadId, messageId, updateMessageRequest.ToRequestContent(), context).ConfigureAwait(false); - return Response.FromValue(PersistentThreadMessage.FromResponse(response), response); - } - - /// Modifies an existing message on an existing thread. - /// Identifier of the thread. - /// Identifier of the message. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual Response UpdateMessage(string threadId, string messageId, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(messageId, nameof(messageId)); - - UpdateMessageRequest updateMessageRequest = new UpdateMessageRequest(metadata ?? new ChangeTrackingDictionary(), null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = UpdateMessage(threadId, messageId, updateMessageRequest.ToRequestContent(), context); - return Response.FromValue(PersistentThreadMessage.FromResponse(response), response); - } - - /// - /// [Protocol Method] Modifies an existing message on an existing thread. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the thread. - /// Identifier of the message. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task UpdateMessageAsync(string threadId, string messageId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(messageId, nameof(messageId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("ThreadMessages.UpdateMessage"); - scope.Start(); - try - { - using HttpMessage message = CreateUpdateMessageRequest(threadId, messageId, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Modifies an existing message on an existing thread. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the thread. - /// Identifier of the message. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response UpdateMessage(string threadId, string messageId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(messageId, nameof(messageId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("ThreadMessages.UpdateMessage"); - scope.Start(); - try - { - using HttpMessage message = CreateUpdateMessageRequest(threadId, messageId, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - internal HttpMessage CreateCreateMessageRequest(string threadId, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/threads/", false); - uri.AppendPath(threadId, true); - uri.AppendPath("/messages", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateGetMessagesRequest(string threadId, string runId, int? limit, string order, string after, string before, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/threads/", false); - uri.AppendPath(threadId, true); - uri.AppendPath("/messages", false); - if (runId != null) - { - uri.AppendQuery("run_id", runId, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - if (limit != null) - { - uri.AppendQuery("limit", limit.Value, true); - } - if (order != null) - { - uri.AppendQuery("order", order, true); - } - if (after != null) - { - uri.AppendQuery("after", after, true); - } - if (before != null) - { - uri.AppendQuery("before", before, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetMessageRequest(string threadId, string messageId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/threads/", false); - uri.AppendPath(threadId, true); - uri.AppendPath("/messages/", false); - uri.AppendPath(messageId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateUpdateMessageRequest(string threadId, string messageId, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/threads/", false); - uri.AppendPath(threadId, true); - uri.AppendPath("/messages/", false); - uri.AppendPath(messageId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - private static RequestContext DefaultRequestContext = new RequestContext(); - internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) - { - if (!cancellationToken.CanBeCanceled) - { - return DefaultRequestContext; - } - - return new RequestContext() { CancellationToken = cancellationToken }; - } - - private static ResponseClassifier _responseClassifier200; - private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRun.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRun.Serialization.cs deleted file mode 100644 index c4a4245b9c3a..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRun.Serialization.cs +++ /dev/null @@ -1,625 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class ThreadRun : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ThreadRun)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("object"u8); - writer.WriteStringValue(Object); - writer.WritePropertyName("thread_id"u8); - writer.WriteStringValue(ThreadId); - writer.WritePropertyName("assistant_id"u8); - writer.WriteStringValue(AssistantId); - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - if (Optional.IsDefined(RequiredAction)) - { - if (RequiredAction != null) - { - writer.WritePropertyName("required_action"u8); - writer.WriteObjectValue(RequiredAction, options); - } - else - { - writer.WriteNull("required_action"); - } - } - if (LastError != null) - { - writer.WritePropertyName("last_error"u8); - writer.WriteObjectValue(LastError, options); - } - else - { - writer.WriteNull("last_error"); - } - writer.WritePropertyName("model"u8); - writer.WriteStringValue(Model); - writer.WritePropertyName("instructions"u8); - writer.WriteStringValue(Instructions); - writer.WritePropertyName("tools"u8); - writer.WriteStartArray(); - foreach (var item in Tools) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - writer.WritePropertyName("created_at"u8); - writer.WriteNumberValue(CreatedAt, "U"); - if (ExpiresAt != null) - { - writer.WritePropertyName("expires_at"u8); - writer.WriteNumberValue(ExpiresAt.Value, "U"); - } - else - { - writer.WriteNull("expires_at"); - } - if (StartedAt != null) - { - writer.WritePropertyName("started_at"u8); - writer.WriteNumberValue(StartedAt.Value, "U"); - } - else - { - writer.WriteNull("started_at"); - } - if (CompletedAt != null) - { - writer.WritePropertyName("completed_at"u8); - writer.WriteNumberValue(CompletedAt.Value, "U"); - } - else - { - writer.WriteNull("completed_at"); - } - if (CancelledAt != null) - { - writer.WritePropertyName("cancelled_at"u8); - writer.WriteNumberValue(CancelledAt.Value, "U"); - } - else - { - writer.WriteNull("cancelled_at"); - } - if (FailedAt != null) - { - writer.WritePropertyName("failed_at"u8); - writer.WriteNumberValue(FailedAt.Value, "U"); - } - else - { - writer.WriteNull("failed_at"); - } - if (IncompleteDetails != null) - { - writer.WritePropertyName("incomplete_details"u8); - writer.WriteObjectValue(IncompleteDetails, options); - } - else - { - writer.WriteNull("incomplete_details"); - } - if (Usage != null) - { - writer.WritePropertyName("usage"u8); - writer.WriteObjectValue(Usage, options); - } - else - { - writer.WriteNull("usage"); - } - if (Optional.IsDefined(Temperature)) - { - if (Temperature != null) - { - writer.WritePropertyName("temperature"u8); - writer.WriteNumberValue(Temperature.Value); - } - else - { - writer.WriteNull("temperature"); - } - } - if (Optional.IsDefined(TopP)) - { - if (TopP != null) - { - writer.WritePropertyName("top_p"u8); - writer.WriteNumberValue(TopP.Value); - } - else - { - writer.WriteNull("top_p"); - } - } - if (MaxPromptTokens != null) - { - writer.WritePropertyName("max_prompt_tokens"u8); - writer.WriteNumberValue(MaxPromptTokens.Value); - } - else - { - writer.WriteNull("max_prompt_tokens"); - } - if (MaxCompletionTokens != null) - { - writer.WritePropertyName("max_completion_tokens"u8); - writer.WriteNumberValue(MaxCompletionTokens.Value); - } - else - { - writer.WriteNull("max_completion_tokens"); - } - if (TruncationStrategy != null) - { - writer.WritePropertyName("truncation_strategy"u8); - writer.WriteObjectValue(TruncationStrategy, options); - } - else - { - writer.WriteNull("truncation_strategy"); - } - if (ToolChoice != null) - { - writer.WritePropertyName("tool_choice"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(ToolChoice); -#else - using (JsonDocument document = JsonDocument.Parse(ToolChoice, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - else - { - writer.WriteNull("tool_choice"); - } - if (ResponseFormat != null) - { - writer.WritePropertyName("response_format"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(ResponseFormat); -#else - using (JsonDocument document = JsonDocument.Parse(ResponseFormat, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - else - { - writer.WriteNull("response_format"); - } - if (Metadata != null && Optional.IsCollectionDefined(Metadata)) - { - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("metadata"); - } - if (Optional.IsDefined(ToolResources)) - { - if (ToolResources != null) - { - writer.WritePropertyName("tool_resources"u8); - writer.WriteObjectValue(ToolResources, options); - } - else - { - writer.WriteNull("tool_resources"); - } - } - writer.WritePropertyName("parallel_tool_calls"u8); - writer.WriteBooleanValue(ParallelToolCalls); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ThreadRun IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ThreadRun)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeThreadRun(document.RootElement, options); - } - - internal static ThreadRun DeserializeThreadRun(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string @object = default; - string threadId = default; - string assistantId = default; - RunStatus status = default; - RequiredAction requiredAction = default; - RunError lastError = default; - string model = default; - string instructions = default; - IReadOnlyList tools = default; - DateTimeOffset createdAt = default; - DateTimeOffset? expiresAt = default; - DateTimeOffset? startedAt = default; - DateTimeOffset? completedAt = default; - DateTimeOffset? cancelledAt = default; - DateTimeOffset? failedAt = default; - IncompleteRunDetails incompleteDetails = default; - RunCompletionUsage usage = default; - float? temperature = default; - float? topP = default; - int? maxPromptTokens = default; - int? maxCompletionTokens = default; - Truncation truncationStrategy = default; - BinaryData toolChoice = default; - BinaryData responseFormat = default; - IReadOnlyDictionary metadata = default; - UpdateToolResourcesOptions toolResources = default; - bool parallelToolCalls = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("object"u8)) - { - @object = property.Value.GetString(); - continue; - } - if (property.NameEquals("thread_id"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (property.NameEquals("assistant_id"u8)) - { - assistantId = property.Value.GetString(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = new RunStatus(property.Value.GetString()); - continue; - } - if (property.NameEquals("required_action"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - requiredAction = null; - continue; - } - requiredAction = RequiredAction.DeserializeRequiredAction(property.Value, options); - continue; - } - if (property.NameEquals("last_error"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - lastError = null; - continue; - } - lastError = RunError.DeserializeRunError(property.Value, options); - continue; - } - if (property.NameEquals("model"u8)) - { - model = property.Value.GetString(); - continue; - } - if (property.NameEquals("instructions"u8)) - { - instructions = property.Value.GetString(); - continue; - } - if (property.NameEquals("tools"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ToolDefinition.DeserializeToolDefinition(item, options)); - } - tools = array; - continue; - } - if (property.NameEquals("created_at"u8)) - { - createdAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); - continue; - } - if (property.NameEquals("expires_at"u8)) - { - DeserializeNullableDateTimeOffset(property, ref expiresAt); - continue; - } - if (property.NameEquals("started_at"u8)) - { - DeserializeNullableDateTimeOffset(property, ref startedAt); - continue; - } - if (property.NameEquals("completed_at"u8)) - { - DeserializeNullableDateTimeOffset(property, ref completedAt); - continue; - } - if (property.NameEquals("cancelled_at"u8)) - { - DeserializeNullableDateTimeOffset(property, ref cancelledAt); - continue; - } - if (property.NameEquals("failed_at"u8)) - { - DeserializeNullableDateTimeOffset(property, ref failedAt); - continue; - } - if (property.NameEquals("incomplete_details"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - incompleteDetails = null; - continue; - } - incompleteDetails = IncompleteRunDetails.DeserializeIncompleteRunDetails(property.Value, options); - continue; - } - if (property.NameEquals("usage"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - usage = null; - continue; - } - usage = RunCompletionUsage.DeserializeRunCompletionUsage(property.Value, options); - continue; - } - if (property.NameEquals("temperature"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - temperature = null; - continue; - } - temperature = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("top_p"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - topP = null; - continue; - } - topP = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("max_prompt_tokens"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - maxPromptTokens = null; - continue; - } - maxPromptTokens = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("max_completion_tokens"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - maxCompletionTokens = null; - continue; - } - maxCompletionTokens = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("truncation_strategy"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - truncationStrategy = null; - continue; - } - truncationStrategy = Truncation.DeserializeTruncation(property.Value, options); - continue; - } - if (property.NameEquals("tool_choice"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - toolChoice = null; - continue; - } - toolChoice = BinaryData.FromString(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("response_format"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - responseFormat = null; - continue; - } - responseFormat = BinaryData.FromString(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("metadata"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - metadata = new ChangeTrackingDictionary(); - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (property.NameEquals("tool_resources"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - toolResources = null; - continue; - } - toolResources = UpdateToolResourcesOptions.DeserializeUpdateToolResourcesOptions(property.Value, options); - continue; - } - if (property.NameEquals("parallel_tool_calls"u8)) - { - parallelToolCalls = property.Value.GetBoolean(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ThreadRun( - id, - @object, - threadId, - assistantId, - status, - requiredAction, - lastError, - model, - instructions, - tools, - createdAt, - expiresAt, - startedAt, - completedAt, - cancelledAt, - failedAt, - incompleteDetails, - usage, - temperature, - topP, - maxPromptTokens, - maxCompletionTokens, - truncationStrategy, - toolChoice, - responseFormat, - metadata, - toolResources, - parallelToolCalls, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(ThreadRun)} does not support writing '{options.Format}' format."); - } - } - - ThreadRun IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeThreadRun(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ThreadRun)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ThreadRun FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeThreadRun(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRun.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRun.cs deleted file mode 100644 index 195dfe8c9d4d..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRun.cs +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.AI.Agents.Persistent -{ - /// Data representing a single evaluation run of an agent thread. - public partial class ThreadRun - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The identifier, which can be referenced in API endpoints. - /// The ID of the thread associated with this run. - /// The ID of the agent associated with the thread this run was performed against. - /// The status of the agent thread run. - /// The last error, if any, encountered by this agent thread run. - /// The ID of the model to use. - /// The overridden system instructions used for this agent thread run. - /// - /// The overridden enabled tools used for this agent thread run. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , , and . - /// - /// The Unix timestamp, in seconds, representing when this object was created. - /// The Unix timestamp, in seconds, representing when this item expires. - /// The Unix timestamp, in seconds, representing when this item was started. - /// The Unix timestamp, in seconds, representing when this completed. - /// The Unix timestamp, in seconds, representing when this was cancelled. - /// The Unix timestamp, in seconds, representing when this failed. - /// Details on why the run is incomplete. Will be `null` if the run is not incomplete. - /// Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.). - /// The maximum number of prompt tokens specified to have been used over the course of the run. - /// The maximum number of completion tokens specified to have been used over the course of the run. - /// The strategy to use for dropping messages as the context windows moves forward. - /// Controls whether or not and which tool is called by the model. - /// The response format of the tool calls used in this run. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// Determines if tools can be executed in parallel within the run. - /// , , , , or is null. - internal ThreadRun(string id, string threadId, string assistantId, RunStatus status, RunError lastError, string model, string instructions, IEnumerable tools, DateTimeOffset createdAt, DateTimeOffset? expiresAt, DateTimeOffset? startedAt, DateTimeOffset? completedAt, DateTimeOffset? cancelledAt, DateTimeOffset? failedAt, IncompleteRunDetails incompleteDetails, RunCompletionUsage usage, int? maxPromptTokens, int? maxCompletionTokens, Truncation truncationStrategy, BinaryData toolChoice, BinaryData responseFormat, IReadOnlyDictionary metadata, bool parallelToolCalls) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(threadId, nameof(threadId)); - Argument.AssertNotNull(assistantId, nameof(assistantId)); - Argument.AssertNotNull(model, nameof(model)); - Argument.AssertNotNull(instructions, nameof(instructions)); - Argument.AssertNotNull(tools, nameof(tools)); - - Id = id; - ThreadId = threadId; - AssistantId = assistantId; - Status = status; - LastError = lastError; - Model = model; - Instructions = instructions; - Tools = tools.ToList(); - CreatedAt = createdAt; - ExpiresAt = expiresAt; - StartedAt = startedAt; - CompletedAt = completedAt; - CancelledAt = cancelledAt; - FailedAt = failedAt; - IncompleteDetails = incompleteDetails; - Usage = usage; - MaxPromptTokens = maxPromptTokens; - MaxCompletionTokens = maxCompletionTokens; - TruncationStrategy = truncationStrategy; - ToolChoice = toolChoice; - ResponseFormat = responseFormat; - Metadata = metadata; - ParallelToolCalls = parallelToolCalls; - } - - /// Initializes a new instance of . - /// The identifier, which can be referenced in API endpoints. - /// The object type, which is always 'thread.run'. - /// The ID of the thread associated with this run. - /// The ID of the agent associated with the thread this run was performed against. - /// The status of the agent thread run. - /// - /// The details of the action required for the agent thread run to continue. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include . - /// - /// The last error, if any, encountered by this agent thread run. - /// The ID of the model to use. - /// The overridden system instructions used for this agent thread run. - /// - /// The overridden enabled tools used for this agent thread run. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , , and . - /// - /// The Unix timestamp, in seconds, representing when this object was created. - /// The Unix timestamp, in seconds, representing when this item expires. - /// The Unix timestamp, in seconds, representing when this item was started. - /// The Unix timestamp, in seconds, representing when this completed. - /// The Unix timestamp, in seconds, representing when this was cancelled. - /// The Unix timestamp, in seconds, representing when this failed. - /// Details on why the run is incomplete. Will be `null` if the run is not incomplete. - /// Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.). - /// The sampling temperature used for this run. If not set, defaults to 1. - /// The nucleus sampling value used for this run. If not set, defaults to 1. - /// The maximum number of prompt tokens specified to have been used over the course of the run. - /// The maximum number of completion tokens specified to have been used over the course of the run. - /// The strategy to use for dropping messages as the context windows moves forward. - /// Controls whether or not and which tool is called by the model. - /// The response format of the tool calls used in this run. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. - /// Determines if tools can be executed in parallel within the run. - /// Keeps track of any properties unknown to the library. - internal ThreadRun(string id, string @object, string threadId, string assistantId, RunStatus status, RequiredAction requiredAction, RunError lastError, string model, string instructions, IReadOnlyList tools, DateTimeOffset createdAt, DateTimeOffset? expiresAt, DateTimeOffset? startedAt, DateTimeOffset? completedAt, DateTimeOffset? cancelledAt, DateTimeOffset? failedAt, IncompleteRunDetails incompleteDetails, RunCompletionUsage usage, float? temperature, float? topP, int? maxPromptTokens, int? maxCompletionTokens, Truncation truncationStrategy, BinaryData toolChoice, BinaryData responseFormat, IReadOnlyDictionary metadata, UpdateToolResourcesOptions toolResources, bool parallelToolCalls, IDictionary serializedAdditionalRawData) - { - Id = id; - Object = @object; - ThreadId = threadId; - AssistantId = assistantId; - Status = status; - RequiredAction = requiredAction; - LastError = lastError; - Model = model; - Instructions = instructions; - Tools = tools; - CreatedAt = createdAt; - ExpiresAt = expiresAt; - StartedAt = startedAt; - CompletedAt = completedAt; - CancelledAt = cancelledAt; - FailedAt = failedAt; - IncompleteDetails = incompleteDetails; - Usage = usage; - Temperature = temperature; - TopP = topP; - MaxPromptTokens = maxPromptTokens; - MaxCompletionTokens = maxCompletionTokens; - TruncationStrategy = truncationStrategy; - ToolChoice = toolChoice; - ResponseFormat = responseFormat; - Metadata = metadata; - ToolResources = toolResources; - ParallelToolCalls = parallelToolCalls; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ThreadRun() - { - } - - /// The identifier, which can be referenced in API endpoints. - public string Id { get; } - - /// The ID of the thread associated with this run. - public string ThreadId { get; } - /// The ID of the agent associated with the thread this run was performed against. - public string AssistantId { get; } - /// The status of the agent thread run. - public RunStatus Status { get; } - /// - /// The details of the action required for the agent thread run to continue. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include . - /// - public RequiredAction RequiredAction { get; } - /// The last error, if any, encountered by this agent thread run. - public RunError LastError { get; } - /// The ID of the model to use. - public string Model { get; } - /// The overridden system instructions used for this agent thread run. - public string Instructions { get; } - /// - /// The overridden enabled tools used for this agent thread run. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , , and . - /// - public IReadOnlyList Tools { get; } - /// The Unix timestamp, in seconds, representing when this object was created. - public DateTimeOffset CreatedAt { get; } - /// The Unix timestamp, in seconds, representing when this item expires. - public DateTimeOffset? ExpiresAt { get; } - /// The Unix timestamp, in seconds, representing when this item was started. - public DateTimeOffset? StartedAt { get; } - /// The Unix timestamp, in seconds, representing when this completed. - public DateTimeOffset? CompletedAt { get; } - /// The Unix timestamp, in seconds, representing when this was cancelled. - public DateTimeOffset? CancelledAt { get; } - /// The Unix timestamp, in seconds, representing when this failed. - public DateTimeOffset? FailedAt { get; } - /// Details on why the run is incomplete. Will be `null` if the run is not incomplete. - public IncompleteRunDetails IncompleteDetails { get; } - /// Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.). - public RunCompletionUsage Usage { get; } - /// The sampling temperature used for this run. If not set, defaults to 1. - public float? Temperature { get; } - /// The nucleus sampling value used for this run. If not set, defaults to 1. - public float? TopP { get; } - /// The maximum number of prompt tokens specified to have been used over the course of the run. - public int? MaxPromptTokens { get; } - /// The maximum number of completion tokens specified to have been used over the course of the run. - public int? MaxCompletionTokens { get; } - /// The strategy to use for dropping messages as the context windows moves forward. - public Truncation TruncationStrategy { get; } - /// - /// Controls whether or not and which tool is called by the model. - /// - /// To assign an object to this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// - /// Supported types: - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - public BinaryData ToolChoice { get; } - /// - /// The response format of the tool calls used in this run. - /// - /// To assign an object to this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// - /// Supported types: - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - public BinaryData ResponseFormat { get; } - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - public IReadOnlyDictionary Metadata { get; } - /// Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. - public UpdateToolResourcesOptions ToolResources { get; } - /// Determines if tools can be executed in parallel within the run. - public bool ParallelToolCalls { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRunObject.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRunObject.cs deleted file mode 100644 index 00df52a2869e..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRunObject.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// The ThreadRun_object. - internal readonly partial struct ThreadRunObject : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ThreadRunObject(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ThreadRunValue = "thread.run"; - - /// thread.run. - public static ThreadRunObject ThreadRun { get; } = new ThreadRunObject(ThreadRunValue); - /// Determines if two values are the same. - public static bool operator ==(ThreadRunObject left, ThreadRunObject right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ThreadRunObject left, ThreadRunObject right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ThreadRunObject(string value) => new ThreadRunObject(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ThreadRunObject other && Equals(other); - /// - public bool Equals(ThreadRunObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRunSteps.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRunSteps.cs deleted file mode 100644 index e2a831fdb9fb..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRunSteps.cs +++ /dev/null @@ -1,270 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.AI.Agents.Persistent -{ - // Data plane generated sub-client. - /// - /// A collection of run‐step operations under - /// `/threads/{threadId}/runs/{runId}/steps`. - /// - public partial class ThreadRunSteps - { - private static readonly string[] AuthorizationScopes = new string[] { "https://ai.azure.com/.default" }; - private readonly TokenCredential _tokenCredential; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// The ClientDiagnostics is used to provide tracing support for the client library. - internal ClientDiagnostics ClientDiagnostics { get; } - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline => _pipeline; - - /// Initializes a new instance of ThreadRunSteps for mocking. - protected ThreadRunSteps() - { - } - - /// Initializes a new instance of ThreadRunSteps. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The token credential to copy. - /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. - /// The API version to use for this operation. - internal ThreadRunSteps(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string apiVersion) - { - ClientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - _tokenCredential = tokenCredential; - _endpoint = endpoint; - _apiVersion = apiVersion; - } - - /// Retrieves a single run step from a thread run. - /// Identifier of the thread. - /// Identifier of the run. - /// Identifier of the run step. - /// - /// A list of additional fields to include in the response. - /// Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. - /// - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public virtual async Task> GetRunStepAsync(string threadId, string runId, string stepId, IEnumerable include = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(runId, nameof(runId)); - Argument.AssertNotNullOrEmpty(stepId, nameof(stepId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetRunStepAsync(threadId, runId, stepId, include, context).ConfigureAwait(false); - return Response.FromValue(RunStep.FromResponse(response), response); - } - - /// Retrieves a single run step from a thread run. - /// Identifier of the thread. - /// Identifier of the run. - /// Identifier of the run step. - /// - /// A list of additional fields to include in the response. - /// Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. - /// - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public virtual Response GetRunStep(string threadId, string runId, string stepId, IEnumerable include = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(runId, nameof(runId)); - Argument.AssertNotNullOrEmpty(stepId, nameof(stepId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetRunStep(threadId, runId, stepId, include, context); - return Response.FromValue(RunStep.FromResponse(response), response); - } - - /// - /// [Protocol Method] Retrieves a single run step from a thread run. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the thread. - /// Identifier of the run. - /// Identifier of the run step. - /// - /// A list of additional fields to include in the response. - /// Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. - /// - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task GetRunStepAsync(string threadId, string runId, string stepId, IEnumerable include, RequestContext context) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(runId, nameof(runId)); - Argument.AssertNotNullOrEmpty(stepId, nameof(stepId)); - - using var scope = ClientDiagnostics.CreateScope("ThreadRunSteps.GetRunStep"); - scope.Start(); - try - { - using HttpMessage message = CreateGetRunStepRequest(threadId, runId, stepId, include, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Retrieves a single run step from a thread run. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the thread. - /// Identifier of the run. - /// Identifier of the run step. - /// - /// A list of additional fields to include in the response. - /// Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. - /// - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response GetRunStep(string threadId, string runId, string stepId, IEnumerable include, RequestContext context) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(runId, nameof(runId)); - Argument.AssertNotNullOrEmpty(stepId, nameof(stepId)); - - using var scope = ClientDiagnostics.CreateScope("ThreadRunSteps.GetRunStep"); - scope.Start(); - try - { - using HttpMessage message = CreateGetRunStepRequest(threadId, runId, stepId, include, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - internal HttpMessage CreateGetRunStepRequest(string threadId, string runId, string stepId, IEnumerable include, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/threads/", false); - uri.AppendPath(threadId, true); - uri.AppendPath("/runs/", false); - uri.AppendPath(runId, true); - uri.AppendPath("/steps/", false); - uri.AppendPath(stepId, true); - uri.AppendQuery("api-version", _apiVersion, true); - if (include != null && !(include is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined)) - { - uri.AppendQueryDelimited("include[]", include, ",", true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetRunStepsRequest(string threadId, string runId, IEnumerable include, int? limit, string order, string after, string before, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/threads/", false); - uri.AppendPath(threadId, true); - uri.AppendPath("/runs/", false); - uri.AppendPath(runId, true); - uri.AppendPath("/steps", false); - if (include != null && !(include is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined)) - { - uri.AppendQueryDelimited("include[]", include, ",", true); - } - uri.AppendQuery("api-version", _apiVersion, true); - if (limit != null) - { - uri.AppendQuery("limit", limit.Value, true); - } - if (order != null) - { - uri.AppendQuery("order", order, true); - } - if (after != null) - { - uri.AppendQuery("after", after, true); - } - if (before != null) - { - uri.AppendQuery("before", before, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - private static RequestContext DefaultRequestContext = new RequestContext(); - internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) - { - if (!cancellationToken.CanBeCanceled) - { - return DefaultRequestContext; - } - - return new RequestContext() { CancellationToken = cancellationToken }; - } - - private static ResponseClassifier _responseClassifier200; - private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRuns.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRuns.cs deleted file mode 100644 index 73e1a965b95e..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ThreadRuns.cs +++ /dev/null @@ -1,793 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.AI.Agents.Persistent -{ - // Data plane generated sub-client. - /// A collection of run operations under `/threads/{threadId}/runs`. - public partial class ThreadRuns - { - private static readonly string[] AuthorizationScopes = new string[] { "https://ai.azure.com/.default" }; - private readonly TokenCredential _tokenCredential; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// The ClientDiagnostics is used to provide tracing support for the client library. - internal ClientDiagnostics ClientDiagnostics { get; } - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline => _pipeline; - - /// Initializes a new instance of ThreadRuns for mocking. - protected ThreadRuns() - { - } - - /// Initializes a new instance of ThreadRuns. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The token credential to copy. - /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. - /// The API version to use for this operation. - internal ThreadRuns(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string apiVersion) - { - ClientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - _tokenCredential = tokenCredential; - _endpoint = endpoint; - _apiVersion = apiVersion; - } - - /// Creates a new run for an agent thread. - /// Identifier of the thread. - /// The ID of the agent that should run the thread. - /// The overridden model name that the agent should use to run the thread. - /// The overridden system instructions that the agent should use to run the thread. - /// - /// Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior - /// on a per-run basis without overriding other instructions. - /// - /// Adds additional messages to the thread before creating the run. - /// The overridden list of enabled tools that the agent should use to run the thread. - /// - /// If `true`, returns a stream of events that happen during the Run as server-sent events, - /// terminating when the Run enters a terminal state with a `data: [DONE]` message. - /// - /// - /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output - /// more random, while lower values like 0.2 will make it more focused and deterministic. - /// - /// - /// An alternative to sampling with temperature, called nucleus sampling, where the model - /// considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens - /// comprising the top 10% probability mass are considered. - /// - /// We generally recommend altering this or temperature but not both. - /// - /// - /// The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only - /// the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, - /// the run will end with status `incomplete`. See `incomplete_details` for more info. - /// - /// - /// The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort - /// to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of - /// completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. - /// - /// The strategy to use for dropping messages as the context windows moves forward. - /// Controls whether or not and which tool is called by the model. - /// Specifies the format that the model must output. - /// If `true` functions will run in parallel during tool use. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// - /// A list of additional fields to include in the response. - /// Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` - /// to fetch the file search result content. - /// - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public virtual async Task> CreateRunAsync(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, IEnumerable additionalMessages = null, IEnumerable overrideTools = null, bool? stream = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, Truncation truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, bool? parallelToolCalls = null, IReadOnlyDictionary metadata = null, IEnumerable include = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNull(assistantId, nameof(assistantId)); - - CreateRunRequest createRunRequest = new CreateRunRequest( - assistantId, - overrideModelName, - overrideInstructions, - additionalInstructions, - additionalMessages?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), - overrideTools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), - stream, - temperature, - topP, - maxPromptTokens, - maxCompletionTokens, - truncationStrategy, - toolChoice, - responseFormat, - parallelToolCalls, - metadata ?? new ChangeTrackingDictionary(), - null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await CreateRunAsync(threadId, createRunRequest.ToRequestContent(), include, context).ConfigureAwait(false); - return Response.FromValue(ThreadRun.FromResponse(response), response); - } - - /// Creates a new run for an agent thread. - /// Identifier of the thread. - /// The ID of the agent that should run the thread. - /// The overridden model name that the agent should use to run the thread. - /// The overridden system instructions that the agent should use to run the thread. - /// - /// Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior - /// on a per-run basis without overriding other instructions. - /// - /// Adds additional messages to the thread before creating the run. - /// The overridden list of enabled tools that the agent should use to run the thread. - /// - /// If `true`, returns a stream of events that happen during the Run as server-sent events, - /// terminating when the Run enters a terminal state with a `data: [DONE]` message. - /// - /// - /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output - /// more random, while lower values like 0.2 will make it more focused and deterministic. - /// - /// - /// An alternative to sampling with temperature, called nucleus sampling, where the model - /// considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens - /// comprising the top 10% probability mass are considered. - /// - /// We generally recommend altering this or temperature but not both. - /// - /// - /// The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only - /// the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, - /// the run will end with status `incomplete`. See `incomplete_details` for more info. - /// - /// - /// The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort - /// to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of - /// completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. - /// - /// The strategy to use for dropping messages as the context windows moves forward. - /// Controls whether or not and which tool is called by the model. - /// Specifies the format that the model must output. - /// If `true` functions will run in parallel during tool use. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// - /// A list of additional fields to include in the response. - /// Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` - /// to fetch the file search result content. - /// - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public virtual Response CreateRun(string threadId, string assistantId, string overrideModelName = null, string overrideInstructions = null, string additionalInstructions = null, IEnumerable additionalMessages = null, IEnumerable overrideTools = null, bool? stream = null, float? temperature = null, float? topP = null, int? maxPromptTokens = null, int? maxCompletionTokens = null, Truncation truncationStrategy = null, BinaryData toolChoice = null, BinaryData responseFormat = null, bool? parallelToolCalls = null, IReadOnlyDictionary metadata = null, IEnumerable include = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNull(assistantId, nameof(assistantId)); - - CreateRunRequest createRunRequest = new CreateRunRequest( - assistantId, - overrideModelName, - overrideInstructions, - additionalInstructions, - additionalMessages?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), - overrideTools?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), - stream, - temperature, - topP, - maxPromptTokens, - maxCompletionTokens, - truncationStrategy, - toolChoice, - responseFormat, - parallelToolCalls, - metadata ?? new ChangeTrackingDictionary(), - null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = CreateRun(threadId, createRunRequest.ToRequestContent(), include, context); - return Response.FromValue(ThreadRun.FromResponse(response), response); - } - - /// - /// [Protocol Method] Creates a new run for an agent thread. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the thread. - /// The content to send as the body of the request. - /// - /// A list of additional fields to include in the response. - /// Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` - /// to fetch the file search result content. - /// - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task CreateRunAsync(string threadId, RequestContent content, IEnumerable include = null, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("ThreadRuns.CreateRun"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateRunRequest(threadId, content, include, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Creates a new run for an agent thread. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the thread. - /// The content to send as the body of the request. - /// - /// A list of additional fields to include in the response. - /// Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` - /// to fetch the file search result content. - /// - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response CreateRun(string threadId, RequestContent content, IEnumerable include = null, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("ThreadRuns.CreateRun"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateRunRequest(threadId, content, include, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets an existing run from an existing thread. - /// Identifier of the thread. - /// Identifier of the run. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual async Task> GetRunAsync(string threadId, string runId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(runId, nameof(runId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetRunAsync(threadId, runId, context).ConfigureAwait(false); - return Response.FromValue(ThreadRun.FromResponse(response), response); - } - - /// Gets an existing run from an existing thread. - /// Identifier of the thread. - /// Identifier of the run. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual Response GetRun(string threadId, string runId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(runId, nameof(runId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetRun(threadId, runId, context); - return Response.FromValue(ThreadRun.FromResponse(response), response); - } - - /// - /// [Protocol Method] Gets an existing run from an existing thread. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the thread. - /// Identifier of the run. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task GetRunAsync(string threadId, string runId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(runId, nameof(runId)); - - using var scope = ClientDiagnostics.CreateScope("ThreadRuns.GetRun"); - scope.Start(); - try - { - using HttpMessage message = CreateGetRunRequest(threadId, runId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets an existing run from an existing thread. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the thread. - /// Identifier of the run. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response GetRun(string threadId, string runId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(runId, nameof(runId)); - - using var scope = ClientDiagnostics.CreateScope("ThreadRuns.GetRun"); - scope.Start(); - try - { - using HttpMessage message = CreateGetRunRequest(threadId, runId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Modifies an existing thread run. - /// Identifier of the thread. - /// Identifier of the run. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual async Task> UpdateRunAsync(string threadId, string runId, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(runId, nameof(runId)); - - UpdateRunRequest updateRunRequest = new UpdateRunRequest(metadata ?? new ChangeTrackingDictionary(), null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await UpdateRunAsync(threadId, runId, updateRunRequest.ToRequestContent(), context).ConfigureAwait(false); - return Response.FromValue(ThreadRun.FromResponse(response), response); - } - - /// Modifies an existing thread run. - /// Identifier of the thread. - /// Identifier of the run. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual Response UpdateRun(string threadId, string runId, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(runId, nameof(runId)); - - UpdateRunRequest updateRunRequest = new UpdateRunRequest(metadata ?? new ChangeTrackingDictionary(), null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = UpdateRun(threadId, runId, updateRunRequest.ToRequestContent(), context); - return Response.FromValue(ThreadRun.FromResponse(response), response); - } - - /// - /// [Protocol Method] Modifies an existing thread run. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the thread. - /// Identifier of the run. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task UpdateRunAsync(string threadId, string runId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(runId, nameof(runId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("ThreadRuns.UpdateRun"); - scope.Start(); - try - { - using HttpMessage message = CreateUpdateRunRequest(threadId, runId, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Modifies an existing thread run. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the thread. - /// Identifier of the run. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response UpdateRun(string threadId, string runId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(runId, nameof(runId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("ThreadRuns.UpdateRun"); - scope.Start(); - try - { - using HttpMessage message = CreateUpdateRunRequest(threadId, runId, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Cancels a run of an in‐progress thread. - /// Identifier of the thread. - /// Identifier of the run. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual async Task> CancelRunAsync(string threadId, string runId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(runId, nameof(runId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await CancelRunAsync(threadId, runId, context).ConfigureAwait(false); - return Response.FromValue(ThreadRun.FromResponse(response), response); - } - - /// Cancels a run of an in‐progress thread. - /// Identifier of the thread. - /// Identifier of the run. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual Response CancelRun(string threadId, string runId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(runId, nameof(runId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = CancelRun(threadId, runId, context); - return Response.FromValue(ThreadRun.FromResponse(response), response); - } - - /// - /// [Protocol Method] Cancels a run of an in‐progress thread. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the thread. - /// Identifier of the run. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task CancelRunAsync(string threadId, string runId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(runId, nameof(runId)); - - using var scope = ClientDiagnostics.CreateScope("ThreadRuns.CancelRun"); - scope.Start(); - try - { - using HttpMessage message = CreateCancelRunRequest(threadId, runId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Cancels a run of an in‐progress thread. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the thread. - /// Identifier of the run. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response CancelRun(string threadId, string runId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNullOrEmpty(runId, nameof(runId)); - - using var scope = ClientDiagnostics.CreateScope("ThreadRuns.CancelRun"); - scope.Start(); - try - { - using HttpMessage message = CreateCancelRunRequest(threadId, runId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - internal HttpMessage CreateCreateRunRequest(string threadId, RequestContent content, IEnumerable include, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/threads/", false); - uri.AppendPath(threadId, true); - uri.AppendPath("/runs", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (include != null && !(include is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined)) - { - uri.AppendQueryDelimited("include[]", include, ",", true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateGetRunsRequest(string threadId, int? limit, string order, string after, string before, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/threads/", false); - uri.AppendPath(threadId, true); - uri.AppendPath("/runs", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (limit != null) - { - uri.AppendQuery("limit", limit.Value, true); - } - if (order != null) - { - uri.AppendQuery("order", order, true); - } - if (after != null) - { - uri.AppendQuery("after", after, true); - } - if (before != null) - { - uri.AppendQuery("before", before, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetRunRequest(string threadId, string runId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/threads/", false); - uri.AppendPath(threadId, true); - uri.AppendPath("/runs/", false); - uri.AppendPath(runId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateUpdateRunRequest(string threadId, string runId, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/threads/", false); - uri.AppendPath(threadId, true); - uri.AppendPath("/runs/", false); - uri.AppendPath(runId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateSubmitToolOutputsToRunRequest(string threadId, string runId, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/threads/", false); - uri.AppendPath(threadId, true); - uri.AppendPath("/runs/", false); - uri.AppendPath(runId, true); - uri.AppendPath("/submit_tool_outputs", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateCancelRunRequest(string threadId, string runId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/threads/", false); - uri.AppendPath(threadId, true); - uri.AppendPath("/runs/", false); - uri.AppendPath(runId, true); - uri.AppendPath("/cancel", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - private static RequestContext DefaultRequestContext = new RequestContext(); - internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) - { - if (!cancellationToken.CanBeCanceled) - { - return DefaultRequestContext; - } - - return new RequestContext() { CancellationToken = cancellationToken }; - } - - private static ResponseClassifier _responseClassifier200; - private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/Threads.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/Threads.cs deleted file mode 100644 index fe578a2d0538..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/Threads.cs +++ /dev/null @@ -1,608 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.AI.Agents.Persistent -{ - // Data plane generated sub-client. - /// A collection of thread operations under `/threads`. - public partial class Threads - { - private static readonly string[] AuthorizationScopes = new string[] { "https://ai.azure.com/.default" }; - private readonly TokenCredential _tokenCredential; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// The ClientDiagnostics is used to provide tracing support for the client library. - internal ClientDiagnostics ClientDiagnostics { get; } - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline => _pipeline; - - /// Initializes a new instance of Threads for mocking. - protected Threads() - { - } - - /// Initializes a new instance of Threads. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The token credential to copy. - /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. - /// The API version to use for this operation. - internal Threads(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string apiVersion) - { - ClientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - _tokenCredential = tokenCredential; - _endpoint = endpoint; - _apiVersion = apiVersion; - } - - /// Creates a new thread. Threads contain messages and can be run by agents. - /// The initial messages to associate with the new thread. - /// - /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the - /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires - /// a list of vector store IDs. - /// - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// The cancellation token to use. - public virtual async Task> CreateThreadAsync(IEnumerable messages = null, ToolResources toolResources = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) - { - CreateThreadRequest createThreadRequest = new CreateThreadRequest(messages?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), toolResources, metadata ?? new ChangeTrackingDictionary(), null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await CreateThreadAsync(createThreadRequest.ToRequestContent(), context).ConfigureAwait(false); - return Response.FromValue(PersistentAgentThread.FromResponse(response), response); - } - - /// Creates a new thread. Threads contain messages and can be run by agents. - /// The initial messages to associate with the new thread. - /// - /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the - /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires - /// a list of vector store IDs. - /// - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// The cancellation token to use. - public virtual Response CreateThread(IEnumerable messages = null, ToolResources toolResources = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) - { - CreateThreadRequest createThreadRequest = new CreateThreadRequest(messages?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), toolResources, metadata ?? new ChangeTrackingDictionary(), null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = CreateThread(createThreadRequest.ToRequestContent(), context); - return Response.FromValue(PersistentAgentThread.FromResponse(response), response); - } - - /// - /// [Protocol Method] Creates a new thread. Threads contain messages and can be run by agents. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task CreateThreadAsync(RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("Threads.CreateThread"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateThreadRequest(content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Creates a new thread. Threads contain messages and can be run by agents. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response CreateThread(RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("Threads.CreateThread"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateThreadRequest(content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets information about an existing thread. - /// Identifier of the thread. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual async Task> GetThreadAsync(string threadId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetThreadAsync(threadId, context).ConfigureAwait(false); - return Response.FromValue(PersistentAgentThread.FromResponse(response), response); - } - - /// Gets information about an existing thread. - /// Identifier of the thread. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual Response GetThread(string threadId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetThread(threadId, context); - return Response.FromValue(PersistentAgentThread.FromResponse(response), response); - } - - /// - /// [Protocol Method] Gets information about an existing thread. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the thread. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task GetThreadAsync(string threadId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - - using var scope = ClientDiagnostics.CreateScope("Threads.GetThread"); - scope.Start(); - try - { - using HttpMessage message = CreateGetThreadRequest(threadId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets information about an existing thread. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the thread. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response GetThread(string threadId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - - using var scope = ClientDiagnostics.CreateScope("Threads.GetThread"); - scope.Start(); - try - { - using HttpMessage message = CreateGetThreadRequest(threadId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Modifies an existing thread. - /// The ID of the thread to modify. - /// - /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the - /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires - /// a list of vector store IDs - /// - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual async Task> UpdateThreadAsync(string threadId, ToolResources toolResources = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - - UpdateThreadRequest updateThreadRequest = new UpdateThreadRequest(toolResources, metadata ?? new ChangeTrackingDictionary(), null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await UpdateThreadAsync(threadId, updateThreadRequest.ToRequestContent(), context).ConfigureAwait(false); - return Response.FromValue(PersistentAgentThread.FromResponse(response), response); - } - - /// Modifies an existing thread. - /// The ID of the thread to modify. - /// - /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the - /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires - /// a list of vector store IDs - /// - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual Response UpdateThread(string threadId, ToolResources toolResources = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - - UpdateThreadRequest updateThreadRequest = new UpdateThreadRequest(toolResources, metadata ?? new ChangeTrackingDictionary(), null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = UpdateThread(threadId, updateThreadRequest.ToRequestContent(), context); - return Response.FromValue(PersistentAgentThread.FromResponse(response), response); - } - - /// - /// [Protocol Method] Modifies an existing thread. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The ID of the thread to modify. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task UpdateThreadAsync(string threadId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("Threads.UpdateThread"); - scope.Start(); - try - { - using HttpMessage message = CreateUpdateThreadRequest(threadId, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Modifies an existing thread. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The ID of the thread to modify. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response UpdateThread(string threadId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("Threads.UpdateThread"); - scope.Start(); - try - { - using HttpMessage message = CreateUpdateThreadRequest(threadId, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Deletes an existing thread. - /// Identifier of the thread. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - internal virtual async Task> InternalDeleteThreadAsync(string threadId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await InternalDeleteThreadAsync(threadId, context).ConfigureAwait(false); - return Response.FromValue(ThreadDeletionStatus.FromResponse(response), response); - } - - /// Deletes an existing thread. - /// Identifier of the thread. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - internal virtual Response InternalDeleteThread(string threadId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = InternalDeleteThread(threadId, context); - return Response.FromValue(ThreadDeletionStatus.FromResponse(response), response); - } - - /// - /// [Protocol Method] Deletes an existing thread. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the thread. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual async Task InternalDeleteThreadAsync(string threadId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - - using var scope = ClientDiagnostics.CreateScope("Threads.InternalDeleteThread"); - scope.Start(); - try - { - using HttpMessage message = CreateInternalDeleteThreadRequest(threadId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Deletes an existing thread. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the thread. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual Response InternalDeleteThread(string threadId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(threadId, nameof(threadId)); - - using var scope = ClientDiagnostics.CreateScope("Threads.InternalDeleteThread"); - scope.Start(); - try - { - using HttpMessage message = CreateInternalDeleteThreadRequest(threadId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - internal HttpMessage CreateCreateThreadRequest(RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/threads", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateGetThreadsRequest(int? limit, string order, string after, string before, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/threads", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (limit != null) - { - uri.AppendQuery("limit", limit.Value, true); - } - if (order != null) - { - uri.AppendQuery("order", order, true); - } - if (after != null) - { - uri.AppendQuery("after", after, true); - } - if (before != null) - { - uri.AppendQuery("before", before, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetThreadRequest(string threadId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/threads/", false); - uri.AppendPath(threadId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateUpdateThreadRequest(string threadId, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/threads/", false); - uri.AppendPath(threadId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateInternalDeleteThreadRequest(string threadId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/threads/", false); - uri.AppendPath(threadId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - private static RequestContext DefaultRequestContext = new RequestContext(); - internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) - { - if (!cancellationToken.CanBeCanceled) - { - return DefaultRequestContext; - } - - return new RequestContext() { CancellationToken = cancellationToken }; - } - - private static ResponseClassifier _responseClassifier200; - private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolConnection.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolConnection.Serialization.cs deleted file mode 100644 index 76ae573eabcc..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolConnection.Serialization.cs +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class ToolConnection : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ToolConnection)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("connection_id"u8); - writer.WriteStringValue(ConnectionId); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ToolConnection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ToolConnection)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeToolConnection(document.RootElement, options); - } - - internal static ToolConnection DeserializeToolConnection(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string connectionId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("connection_id"u8)) - { - connectionId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ToolConnection(connectionId, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(ToolConnection)} does not support writing '{options.Format}' format."); - } - } - - ToolConnection IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeToolConnection(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ToolConnection)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ToolConnection FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeToolConnection(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolConnection.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolConnection.cs deleted file mode 100644 index cc6f72bb901c..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolConnection.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// A connection resource. - public partial class ToolConnection - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// A connection in a ToolConnectionList attached to this tool. - /// is null. - public ToolConnection(string connectionId) - { - Argument.AssertNotNull(connectionId, nameof(connectionId)); - - ConnectionId = connectionId; - } - - /// Initializes a new instance of . - /// A connection in a ToolConnectionList attached to this tool. - /// Keeps track of any properties unknown to the library. - internal ToolConnection(string connectionId, IDictionary serializedAdditionalRawData) - { - ConnectionId = connectionId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ToolConnection() - { - } - - /// A connection in a ToolConnectionList attached to this tool. - public string ConnectionId { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolConnectionList.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolConnectionList.Serialization.cs deleted file mode 100644 index 0d4ac6da1f05..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolConnectionList.Serialization.cs +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class ToolConnectionList : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ToolConnectionList)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(ConnectionList)) - { - writer.WritePropertyName("connections"u8); - writer.WriteStartArray(); - foreach (var item in ConnectionList) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ToolConnectionList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ToolConnectionList)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeToolConnectionList(document.RootElement, options); - } - - internal static ToolConnectionList DeserializeToolConnectionList(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList connections = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("connections"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ToolConnection.DeserializeToolConnection(item, options)); - } - connections = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ToolConnectionList(connections ?? new ChangeTrackingList(), serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(ToolConnectionList)} does not support writing '{options.Format}' format."); - } - } - - ToolConnectionList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeToolConnectionList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ToolConnectionList)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ToolConnectionList FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeToolConnectionList(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolConnectionList.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolConnectionList.cs deleted file mode 100644 index a6dfc67c583d..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolConnectionList.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// A set of connection resources currently used by either the `bing_grounding`, `fabric_dataagent`, or `sharepoint_grounding` tools. - public partial class ToolConnectionList - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public ToolConnectionList() - { - ConnectionList = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// - /// The connections attached to this tool. There can be a maximum of 1 connection - /// resource attached to the tool. - /// - /// Keeps track of any properties unknown to the library. - internal ToolConnectionList(IList connectionList, IDictionary serializedAdditionalRawData) - { - ConnectionList = connectionList; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// - /// The connections attached to this tool. There can be a maximum of 1 connection - /// resource attached to the tool. - /// - public IList ConnectionList { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolDefinition.Serialization.cs deleted file mode 100644 index 6532e2849db9..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolDefinition.Serialization.cs +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - [PersistableModelProxy(typeof(UnknownToolDefinition))] - public partial class ToolDefinition : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ToolDefinition)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ToolDefinition)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeToolDefinition(document.RootElement, options); - } - - internal static ToolDefinition DeserializeToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - if (element.TryGetProperty("type", out JsonElement discriminator)) - { - switch (discriminator.GetString()) - { - case "azure_ai_search": return AzureAISearchToolDefinition.DeserializeAzureAISearchToolDefinition(element, options); - case "azure_function": return AzureFunctionToolDefinition.DeserializeAzureFunctionToolDefinition(element, options); - case "bing_custom_search": return BingCustomSearchToolDefinition.DeserializeBingCustomSearchToolDefinition(element, options); - case "bing_grounding": return BingGroundingToolDefinition.DeserializeBingGroundingToolDefinition(element, options); - case "code_interpreter": return CodeInterpreterToolDefinition.DeserializeCodeInterpreterToolDefinition(element, options); - case "connected_agent": return ConnectedAgentToolDefinition.DeserializeConnectedAgentToolDefinition(element, options); - case "fabric_dataagent": return MicrosoftFabricToolDefinition.DeserializeMicrosoftFabricToolDefinition(element, options); - case "file_search": return FileSearchToolDefinition.DeserializeFileSearchToolDefinition(element, options); - case "function": return FunctionToolDefinition.DeserializeFunctionToolDefinition(element, options); - case "openapi": return OpenApiToolDefinition.DeserializeOpenApiToolDefinition(element, options); - case "sharepoint_grounding": return SharepointToolDefinition.DeserializeSharepointToolDefinition(element, options); - } - } - return UnknownToolDefinition.DeserializeUnknownToolDefinition(element, options); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(ToolDefinition)} does not support writing '{options.Format}' format."); - } - } - - ToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeToolDefinition(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ToolDefinition)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ToolDefinition FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeToolDefinition(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolDefinition.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolDefinition.cs deleted file mode 100644 index a632f3baa004..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolDefinition.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// An abstract representation of an input tool definition that an agent can use. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , , and . - /// - public abstract partial class ToolDefinition - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private protected IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - protected ToolDefinition() - { - } - - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - internal ToolDefinition(string type, IDictionary serializedAdditionalRawData) - { - Type = type; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The object type. - internal string Type { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolOutput.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolOutput.Serialization.cs deleted file mode 100644 index 6c2911e2bc3e..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolOutput.Serialization.cs +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class ToolOutput : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ToolOutput)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ToolCallId)) - { - writer.WritePropertyName("tool_call_id"u8); - writer.WriteStringValue(ToolCallId); - } - if (Optional.IsDefined(Output)) - { - writer.WritePropertyName("output"u8); - writer.WriteStringValue(Output); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ToolOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ToolOutput)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeToolOutput(document.RootElement, options); - } - - internal static ToolOutput DeserializeToolOutput(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string toolCallId = default; - string output = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tool_call_id"u8)) - { - toolCallId = property.Value.GetString(); - continue; - } - if (property.NameEquals("output"u8)) - { - output = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ToolOutput(toolCallId, output, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(ToolOutput)} does not support writing '{options.Format}' format."); - } - } - - ToolOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeToolOutput(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ToolOutput)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ToolOutput FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeToolOutput(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolOutput.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolOutput.cs deleted file mode 100644 index 6c70059aa838..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolOutput.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The data provided during a tool outputs submission to resolve pending tool calls and allow the model to continue. - public partial class ToolOutput - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public ToolOutput() - { - } - - /// Initializes a new instance of . - /// The ID of the tool call being resolved, as provided in the tool calls of a required action from a run. - /// The output from the tool to be submitted. - /// Keeps track of any properties unknown to the library. - internal ToolOutput(string toolCallId, string output, IDictionary serializedAdditionalRawData) - { - ToolCallId = toolCallId; - Output = output; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The ID of the tool call being resolved, as provided in the tool calls of a required action from a run. - public string ToolCallId { get; set; } - /// The output from the tool to be submitted. - public string Output { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolResources.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolResources.cs index b4932dbc99d5..27a052626898 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolResources.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/ToolResources.cs @@ -50,7 +50,7 @@ public partial class ToolResources private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public ToolResources() + internal ToolResources() { } @@ -68,10 +68,10 @@ internal ToolResources(CodeInterpreterToolResource codeInterpreter, FileSearchTo } /// Resources to be used by the `code_interpreter` tool consisting of file IDs. - public CodeInterpreterToolResource CodeInterpreter { get; set; } + public CodeInterpreterToolResource CodeInterpreter { get; } /// Resources to be used by the `file_search` tool consisting of vector store IDs. - public FileSearchToolResource FileSearch { get; set; } + public FileSearchToolResource FileSearch { get; } /// Resources to be used by the `azure_ai_search` tool consisting of index IDs and names. - public AzureAISearchResource AzureAISearch { get; set; } + public AzureAISearchResource AzureAISearch { get; } } } diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/Truncation.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/Truncation.Serialization.cs deleted file mode 100644 index 7489242e3944..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/Truncation.Serialization.cs +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class Truncation : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(Truncation)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type.ToString()); - if (Optional.IsDefined(LastMessages)) - { - if (LastMessages != null) - { - writer.WritePropertyName("last_messages"u8); - writer.WriteNumberValue(LastMessages.Value); - } - else - { - writer.WriteNull("last_messages"); - } - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - Truncation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(Truncation)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeTruncation(document.RootElement, options); - } - - internal static Truncation DeserializeTruncation(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - TruncationStrategy type = default; - int? lastMessages = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) - { - type = new TruncationStrategy(property.Value.GetString()); - continue; - } - if (property.NameEquals("last_messages"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - lastMessages = null; - continue; - } - lastMessages = property.Value.GetInt32(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new Truncation(type, lastMessages, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(Truncation)} does not support writing '{options.Format}' format."); - } - } - - Truncation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeTruncation(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(Truncation)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static Truncation FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeTruncation(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/Truncation.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/Truncation.cs deleted file mode 100644 index 7a81277dc33e..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/Truncation.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// Controls for how a thread will be truncated prior to the run. Use this to control the initial - /// context window of the run. - /// - public partial class Truncation - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// - /// The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will - /// be truncated to the `lastMessages` count most recent messages in the thread. When set to `auto`, messages in the middle of the thread - /// will be dropped to fit the context length of the model, `max_prompt_tokens`. - /// - public Truncation(TruncationStrategy type) - { - Type = type; - } - - /// Initializes a new instance of . - /// - /// The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will - /// be truncated to the `lastMessages` count most recent messages in the thread. When set to `auto`, messages in the middle of the thread - /// will be dropped to fit the context length of the model, `max_prompt_tokens`. - /// - /// The number of most recent messages from the thread when constructing the context for the run. - /// Keeps track of any properties unknown to the library. - internal Truncation(TruncationStrategy type, int? lastMessages, IDictionary serializedAdditionalRawData) - { - Type = type; - LastMessages = lastMessages; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal Truncation() - { - } - - /// - /// The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will - /// be truncated to the `lastMessages` count most recent messages in the thread. When set to `auto`, messages in the middle of the thread - /// will be dropped to fit the context length of the model, `max_prompt_tokens`. - /// - public TruncationStrategy Type { get; set; } - /// The number of most recent messages from the thread when constructing the context for the run. - public int? LastMessages { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/TruncationStrategy.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/TruncationStrategy.cs deleted file mode 100644 index ae0cf797332f..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/TruncationStrategy.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Agents.Persistent -{ - /// Possible truncation strategies for the thread. - public readonly partial struct TruncationStrategy : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public TruncationStrategy(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AutoValue = "auto"; - private const string LastMessagesValue = "last_messages"; - - /// Default value. Messages in the middle of the thread will be dropped to fit the context length of the model. - public static TruncationStrategy Auto { get; } = new TruncationStrategy(AutoValue); - /// The thread will truncate to the `lastMessages` count of recent messages. - public static TruncationStrategy LastMessages { get; } = new TruncationStrategy(LastMessagesValue); - /// Determines if two values are the same. - public static bool operator ==(TruncationStrategy left, TruncationStrategy right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(TruncationStrategy left, TruncationStrategy right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator TruncationStrategy(string value) => new TruncationStrategy(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is TruncationStrategy other && Equals(other); - /// - public bool Equals(TruncationStrategy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownMessageInputContentBlock.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownMessageInputContentBlock.Serialization.cs deleted file mode 100644 index 0cedb5d99ede..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownMessageInputContentBlock.Serialization.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class UnknownMessageInputContentBlock : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageInputContentBlock)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - MessageInputContentBlock IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageInputContentBlock)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageInputContentBlock(document.RootElement, options); - } - - internal static UnknownMessageInputContentBlock DeserializeUnknownMessageInputContentBlock(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MessageBlockType type = "Unknown"; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) - { - type = new MessageBlockType(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UnknownMessageInputContentBlock(type, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(MessageInputContentBlock)} does not support writing '{options.Format}' format."); - } - } - - MessageInputContentBlock IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMessageInputContentBlock(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageInputContentBlock)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new UnknownMessageInputContentBlock FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUnknownMessageInputContentBlock(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownMessageInputContentBlock.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownMessageInputContentBlock.cs deleted file mode 100644 index a1c1cbc4de69..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownMessageInputContentBlock.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Unknown version of MessageInputContentBlock. - internal partial class UnknownMessageInputContentBlock : MessageInputContentBlock - { - /// Initializes a new instance of . - /// Specifies which kind of content block this is (text, image_file, image_url, etc.). - /// Keeps track of any properties unknown to the library. - internal UnknownMessageInputContentBlock(MessageBlockType type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal UnknownMessageInputContentBlock() - { - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownOpenApiAuthDetails.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownOpenApiAuthDetails.Serialization.cs deleted file mode 100644 index 72f25bb0953d..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownOpenApiAuthDetails.Serialization.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class UnknownOpenApiAuthDetails : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - OpenApiAuthDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeOpenApiAuthDetails(document.RootElement, options); - } - - internal static UnknownOpenApiAuthDetails DeserializeUnknownOpenApiAuthDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - OpenApiAuthType type = "Unknown"; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) - { - type = new OpenApiAuthType(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UnknownOpenApiAuthDetails(type, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support writing '{options.Format}' format."); - } - } - - OpenApiAuthDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOpenApiAuthDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(OpenApiAuthDetails)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new UnknownOpenApiAuthDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUnknownOpenApiAuthDetails(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownOpenApiAuthDetails.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownOpenApiAuthDetails.cs deleted file mode 100644 index ede8bd1e9a26..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownOpenApiAuthDetails.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Unknown version of OpenApiAuthDetails. - internal partial class UnknownOpenApiAuthDetails : OpenApiAuthDetails - { - /// Initializes a new instance of . - /// The type of authentication, must be anonymous/connection/managed_identity. - /// Keeps track of any properties unknown to the library. - internal UnknownOpenApiAuthDetails(OpenApiAuthType type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal UnknownOpenApiAuthDetails() - { - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRequiredAction.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRequiredAction.Serialization.cs deleted file mode 100644 index 24fa2180a5f4..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRequiredAction.Serialization.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class UnknownRequiredAction : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RequiredAction)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - RequiredAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RequiredAction)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRequiredAction(document.RootElement, options); - } - - internal static UnknownRequiredAction DeserializeUnknownRequiredAction(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string type = "Unknown"; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UnknownRequiredAction(type, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RequiredAction)} does not support writing '{options.Format}' format."); - } - } - - RequiredAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRequiredAction(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RequiredAction)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new UnknownRequiredAction FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUnknownRequiredAction(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRequiredAction.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRequiredAction.cs deleted file mode 100644 index cf0a643c4f31..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRequiredAction.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Unknown version of RequiredAction. - internal partial class UnknownRequiredAction : RequiredAction - { - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - internal UnknownRequiredAction(string type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal UnknownRequiredAction() - { - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRequiredToolCall.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRequiredToolCall.Serialization.cs deleted file mode 100644 index 3b233d28c996..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRequiredToolCall.Serialization.cs +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class UnknownRequiredToolCall : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RequiredToolCall)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - RequiredToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RequiredToolCall)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRequiredToolCall(document.RootElement, options); - } - - internal static UnknownRequiredToolCall DeserializeUnknownRequiredToolCall(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string type = "Unknown"; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UnknownRequiredToolCall(type, serializedAdditionalRawData, id); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RequiredToolCall)} does not support writing '{options.Format}' format."); - } - } - - RequiredToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRequiredToolCall(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RequiredToolCall)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new UnknownRequiredToolCall FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUnknownRequiredToolCall(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRequiredToolCall.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRequiredToolCall.cs deleted file mode 100644 index 22fbcf34c202..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRequiredToolCall.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Unknown version of RequiredToolCall. - internal partial class UnknownRequiredToolCall : RequiredToolCall - { - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - /// The ID of the tool call. This ID must be referenced when submitting tool outputs. - internal UnknownRequiredToolCall(string type, IDictionary serializedAdditionalRawData, string id) : base(type, serializedAdditionalRawData, id) - { - } - - /// Initializes a new instance of for deserialization. - internal UnknownRequiredToolCall() - { - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepCodeInterpreterToolCallOutput.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepCodeInterpreterToolCallOutput.Serialization.cs deleted file mode 100644 index 33473b8abe47..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepCodeInterpreterToolCallOutput.Serialization.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class UnknownRunStepCodeInterpreterToolCallOutput : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCallOutput)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - RunStepCodeInterpreterToolCallOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCallOutput)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepCodeInterpreterToolCallOutput(document.RootElement, options); - } - - internal static UnknownRunStepCodeInterpreterToolCallOutput DeserializeUnknownRunStepCodeInterpreterToolCallOutput(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string type = "Unknown"; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UnknownRunStepCodeInterpreterToolCallOutput(type, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCallOutput)} does not support writing '{options.Format}' format."); - } - } - - RunStepCodeInterpreterToolCallOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepCodeInterpreterToolCallOutput(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepCodeInterpreterToolCallOutput)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new UnknownRunStepCodeInterpreterToolCallOutput FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUnknownRunStepCodeInterpreterToolCallOutput(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepCodeInterpreterToolCallOutput.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepCodeInterpreterToolCallOutput.cs deleted file mode 100644 index 1ddea1da0260..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepCodeInterpreterToolCallOutput.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Unknown version of RunStepCodeInterpreterToolCallOutput. - internal partial class UnknownRunStepCodeInterpreterToolCallOutput : RunStepCodeInterpreterToolCallOutput - { - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - internal UnknownRunStepCodeInterpreterToolCallOutput(string type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal UnknownRunStepCodeInterpreterToolCallOutput() - { - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepDetails.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepDetails.Serialization.cs deleted file mode 100644 index e285f9459038..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepDetails.Serialization.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class UnknownRunStepDetails : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDetails)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - RunStepDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepDetails(document.RootElement, options); - } - - internal static UnknownRunStepDetails DeserializeUnknownRunStepDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - RunStepType type = "Unknown"; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) - { - type = new RunStepType(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UnknownRunStepDetails(type, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepDetails)} does not support writing '{options.Format}' format."); - } - } - - RunStepDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepDetails)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new UnknownRunStepDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUnknownRunStepDetails(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepDetails.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepDetails.cs deleted file mode 100644 index 43dcbd37ffbe..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepDetails.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Unknown version of RunStepDetails. - internal partial class UnknownRunStepDetails : RunStepDetails - { - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - internal UnknownRunStepDetails(RunStepType type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal UnknownRunStepDetails() - { - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepToolCall.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepToolCall.Serialization.cs deleted file mode 100644 index bc305bd37c88..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepToolCall.Serialization.cs +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class UnknownRunStepToolCall : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepToolCall)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - RunStepToolCall IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepToolCall)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepToolCall(document.RootElement, options); - } - - internal static UnknownRunStepToolCall DeserializeUnknownRunStepToolCall(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string type = "Unknown"; - string id = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UnknownRunStepToolCall(type, id, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(RunStepToolCall)} does not support writing '{options.Format}' format."); - } - } - - RunStepToolCall IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRunStepToolCall(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepToolCall)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new UnknownRunStepToolCall FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUnknownRunStepToolCall(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepToolCall.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepToolCall.cs deleted file mode 100644 index 2a5404d18adf..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownRunStepToolCall.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Unknown version of RunStepToolCall. - internal partial class UnknownRunStepToolCall : RunStepToolCall - { - /// Initializes a new instance of . - /// The object type. - /// The ID of the tool call. This ID must be referenced when you submit tool outputs. - /// Keeps track of any properties unknown to the library. - internal UnknownRunStepToolCall(string type, string id, IDictionary serializedAdditionalRawData) : base(type, id, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal UnknownRunStepToolCall() - { - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownToolDefinition.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownToolDefinition.Serialization.cs deleted file mode 100644 index 37849c3d872e..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownToolDefinition.Serialization.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class UnknownToolDefinition : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ToolDefinition)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - ToolDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ToolDefinition)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeToolDefinition(document.RootElement, options); - } - - internal static UnknownToolDefinition DeserializeUnknownToolDefinition(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string type = "Unknown"; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UnknownToolDefinition(type, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(ToolDefinition)} does not support writing '{options.Format}' format."); - } - } - - ToolDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeToolDefinition(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ToolDefinition)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new UnknownToolDefinition FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUnknownToolDefinition(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownToolDefinition.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownToolDefinition.cs deleted file mode 100644 index e4ab651bbd6d..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UnknownToolDefinition.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Unknown version of ToolDefinition. - internal partial class UnknownToolDefinition : ToolDefinition - { - /// Initializes a new instance of . - /// The object type. - /// Keeps track of any properties unknown to the library. - internal UnknownToolDefinition(string type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal UnknownToolDefinition() - { - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateAgentRequest.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateAgentRequest.Serialization.cs deleted file mode 100644 index d7d739887379..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateAgentRequest.Serialization.cs +++ /dev/null @@ -1,374 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class UpdateAgentRequest : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(UpdateAgentRequest)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Model)) - { - writer.WritePropertyName("model"u8); - writer.WriteStringValue(Model); - } - if (Optional.IsDefined(Name)) - { - if (Name != null) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - else - { - writer.WriteNull("name"); - } - } - if (Optional.IsDefined(Description)) - { - if (Description != null) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - else - { - writer.WriteNull("description"); - } - } - if (Optional.IsDefined(Instructions)) - { - if (Instructions != null) - { - writer.WritePropertyName("instructions"u8); - writer.WriteStringValue(Instructions); - } - else - { - writer.WriteNull("instructions"); - } - } - if (Optional.IsCollectionDefined(Tools)) - { - writer.WritePropertyName("tools"u8); - writer.WriteStartArray(); - foreach (var item in Tools) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(ToolResources)) - { - writer.WritePropertyName("tool_resources"u8); - writer.WriteObjectValue(ToolResources, options); - } - if (Optional.IsDefined(Temperature)) - { - if (Temperature != null) - { - writer.WritePropertyName("temperature"u8); - writer.WriteNumberValue(Temperature.Value); - } - else - { - writer.WriteNull("temperature"); - } - } - if (Optional.IsDefined(TopP)) - { - if (TopP != null) - { - writer.WritePropertyName("top_p"u8); - writer.WriteNumberValue(TopP.Value); - } - else - { - writer.WriteNull("top_p"); - } - } - if (Optional.IsDefined(ResponseFormat)) - { - if (ResponseFormat != null) - { - writer.WritePropertyName("response_format"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(ResponseFormat); -#else - using (JsonDocument document = JsonDocument.Parse(ResponseFormat, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - else - { - writer.WriteNull("response_format"); - } - } - if (Optional.IsCollectionDefined(Metadata)) - { - if (Metadata != null) - { - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("metadata"); - } - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - UpdateAgentRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(UpdateAgentRequest)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeUpdateAgentRequest(document.RootElement, options); - } - - internal static UpdateAgentRequest DeserializeUpdateAgentRequest(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string model = default; - string name = default; - string description = default; - string instructions = default; - IReadOnlyList tools = default; - ToolResources toolResources = default; - float? temperature = default; - float? topP = default; - BinaryData responseFormat = default; - IReadOnlyDictionary metadata = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("model"u8)) - { - model = property.Value.GetString(); - continue; - } - if (property.NameEquals("name"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - name = null; - continue; - } - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("description"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - description = null; - continue; - } - description = property.Value.GetString(); - continue; - } - if (property.NameEquals("instructions"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - instructions = null; - continue; - } - instructions = property.Value.GetString(); - continue; - } - if (property.NameEquals("tools"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ToolDefinition.DeserializeToolDefinition(item, options)); - } - tools = array; - continue; - } - if (property.NameEquals("tool_resources"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - toolResources = ToolResources.DeserializeToolResources(property.Value, options); - continue; - } - if (property.NameEquals("temperature"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - temperature = null; - continue; - } - temperature = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("top_p"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - topP = null; - continue; - } - topP = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("response_format"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - responseFormat = null; - continue; - } - responseFormat = BinaryData.FromString(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("metadata"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UpdateAgentRequest( - model, - name, - description, - instructions, - tools ?? new ChangeTrackingList(), - toolResources, - temperature, - topP, - responseFormat, - metadata ?? new ChangeTrackingDictionary(), - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(UpdateAgentRequest)} does not support writing '{options.Format}' format."); - } - } - - UpdateAgentRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUpdateAgentRequest(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(UpdateAgentRequest)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static UpdateAgentRequest FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUpdateAgentRequest(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateAgentRequest.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateAgentRequest.cs deleted file mode 100644 index 7b84d42ae316..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateAgentRequest.cs +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The UpdateAgentRequest. - internal partial class UpdateAgentRequest - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal UpdateAgentRequest() - { - Tools = new ChangeTrackingList(); - Metadata = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of . - /// The ID of the model to use. - /// The modified name for the agent to use. - /// The modified description for the agent to use. - /// The modified system instructions for the new agent to use. - /// - /// The modified collection of tools to enable for the agent. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , , and . - /// - /// - /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, - /// the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. - /// - /// - /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, - /// while lower values like 0.2 will make it more focused and deterministic. - /// - /// - /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. - /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. - /// - /// We generally recommend altering this or temperature but not both. - /// - /// The response format of the tool calls used by this agent. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// Keeps track of any properties unknown to the library. - internal UpdateAgentRequest(string model, string name, string description, string instructions, IReadOnlyList tools, ToolResources toolResources, float? temperature, float? topP, BinaryData responseFormat, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) - { - Model = model; - Name = name; - Description = description; - Instructions = instructions; - Tools = tools; - ToolResources = toolResources; - Temperature = temperature; - TopP = topP; - ResponseFormat = responseFormat; - Metadata = metadata; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The ID of the model to use. - public string Model { get; } - /// The modified name for the agent to use. - public string Name { get; } - /// The modified description for the agent to use. - public string Description { get; } - /// The modified system instructions for the new agent to use. - public string Instructions { get; } - /// - /// The modified collection of tools to enable for the agent. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , , and . - /// - public IReadOnlyList Tools { get; } - /// - /// A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, - /// the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. - /// - public ToolResources ToolResources { get; } - /// - /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, - /// while lower values like 0.2 will make it more focused and deterministic. - /// - public float? Temperature { get; } - /// - /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. - /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. - /// - /// We generally recommend altering this or temperature but not both. - /// - public float? TopP { get; } - /// - /// The response format of the tool calls used by this agent. - /// - /// To assign an object to this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// - /// Supported types: - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - public BinaryData ResponseFormat { get; } - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - public IReadOnlyDictionary Metadata { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateCodeInterpreterToolResourceOptions.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateCodeInterpreterToolResourceOptions.Serialization.cs deleted file mode 100644 index 5e4fae6a5921..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateCodeInterpreterToolResourceOptions.Serialization.cs +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class UpdateCodeInterpreterToolResourceOptions : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(UpdateCodeInterpreterToolResourceOptions)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(FileIds)) - { - writer.WritePropertyName("file_ids"u8); - writer.WriteStartArray(); - foreach (var item in FileIds) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - UpdateCodeInterpreterToolResourceOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(UpdateCodeInterpreterToolResourceOptions)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeUpdateCodeInterpreterToolResourceOptions(document.RootElement, options); - } - - internal static UpdateCodeInterpreterToolResourceOptions DeserializeUpdateCodeInterpreterToolResourceOptions(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList fileIds = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("file_ids"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - fileIds = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UpdateCodeInterpreterToolResourceOptions(fileIds ?? new ChangeTrackingList(), serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(UpdateCodeInterpreterToolResourceOptions)} does not support writing '{options.Format}' format."); - } - } - - UpdateCodeInterpreterToolResourceOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUpdateCodeInterpreterToolResourceOptions(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(UpdateCodeInterpreterToolResourceOptions)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static UpdateCodeInterpreterToolResourceOptions FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUpdateCodeInterpreterToolResourceOptions(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateCodeInterpreterToolResourceOptions.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateCodeInterpreterToolResourceOptions.cs deleted file mode 100644 index 1f9bea0cb5c5..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateCodeInterpreterToolResourceOptions.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Request object to update `code_interpreted` tool resources. - public partial class UpdateCodeInterpreterToolResourceOptions - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public UpdateCodeInterpreterToolResourceOptions() - { - FileIds = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// A list of file IDs to override the current list of the agent. - /// Keeps track of any properties unknown to the library. - internal UpdateCodeInterpreterToolResourceOptions(IList fileIds, IDictionary serializedAdditionalRawData) - { - FileIds = fileIds; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// A list of file IDs to override the current list of the agent. - public IList FileIds { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateFileSearchToolResourceOptions.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateFileSearchToolResourceOptions.Serialization.cs deleted file mode 100644 index 1f76fc928e42..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateFileSearchToolResourceOptions.Serialization.cs +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class UpdateFileSearchToolResourceOptions : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(UpdateFileSearchToolResourceOptions)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(VectorStoreIds)) - { - writer.WritePropertyName("vector_store_ids"u8); - writer.WriteStartArray(); - foreach (var item in VectorStoreIds) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - UpdateFileSearchToolResourceOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(UpdateFileSearchToolResourceOptions)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeUpdateFileSearchToolResourceOptions(document.RootElement, options); - } - - internal static UpdateFileSearchToolResourceOptions DeserializeUpdateFileSearchToolResourceOptions(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList vectorStoreIds = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("vector_store_ids"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - vectorStoreIds = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UpdateFileSearchToolResourceOptions(vectorStoreIds ?? new ChangeTrackingList(), serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(UpdateFileSearchToolResourceOptions)} does not support writing '{options.Format}' format."); - } - } - - UpdateFileSearchToolResourceOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUpdateFileSearchToolResourceOptions(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(UpdateFileSearchToolResourceOptions)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static UpdateFileSearchToolResourceOptions FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUpdateFileSearchToolResourceOptions(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateFileSearchToolResourceOptions.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateFileSearchToolResourceOptions.cs deleted file mode 100644 index 70ef70317495..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateFileSearchToolResourceOptions.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// Request object to update `file_search` tool resources. - public partial class UpdateFileSearchToolResourceOptions - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public UpdateFileSearchToolResourceOptions() - { - VectorStoreIds = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// A list of vector store IDs to override the current list of the agent. - /// Keeps track of any properties unknown to the library. - internal UpdateFileSearchToolResourceOptions(IList vectorStoreIds, IDictionary serializedAdditionalRawData) - { - VectorStoreIds = vectorStoreIds; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// A list of vector store IDs to override the current list of the agent. - public IList VectorStoreIds { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateMessageRequest.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateMessageRequest.Serialization.cs deleted file mode 100644 index c872a1927e7d..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateMessageRequest.Serialization.cs +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class UpdateMessageRequest : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(UpdateMessageRequest)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(Metadata)) - { - if (Metadata != null) - { - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("metadata"); - } - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - UpdateMessageRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(UpdateMessageRequest)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeUpdateMessageRequest(document.RootElement, options); - } - - internal static UpdateMessageRequest DeserializeUpdateMessageRequest(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyDictionary metadata = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("metadata"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UpdateMessageRequest(metadata ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(UpdateMessageRequest)} does not support writing '{options.Format}' format."); - } - } - - UpdateMessageRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUpdateMessageRequest(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(UpdateMessageRequest)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static UpdateMessageRequest FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUpdateMessageRequest(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateMessageRequest.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateMessageRequest.cs deleted file mode 100644 index 015fdd8a9112..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateMessageRequest.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The UpdateMessageRequest. - internal partial class UpdateMessageRequest - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal UpdateMessageRequest() - { - Metadata = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of . - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// Keeps track of any properties unknown to the library. - internal UpdateMessageRequest(IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) - { - Metadata = metadata; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - public IReadOnlyDictionary Metadata { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateRunRequest.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateRunRequest.Serialization.cs deleted file mode 100644 index 4f41c6178b55..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateRunRequest.Serialization.cs +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class UpdateRunRequest : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(UpdateRunRequest)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(Metadata)) - { - if (Metadata != null) - { - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("metadata"); - } - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - UpdateRunRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(UpdateRunRequest)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeUpdateRunRequest(document.RootElement, options); - } - - internal static UpdateRunRequest DeserializeUpdateRunRequest(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyDictionary metadata = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("metadata"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UpdateRunRequest(metadata ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(UpdateRunRequest)} does not support writing '{options.Format}' format."); - } - } - - UpdateRunRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUpdateRunRequest(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(UpdateRunRequest)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static UpdateRunRequest FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUpdateRunRequest(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateRunRequest.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateRunRequest.cs deleted file mode 100644 index 6cfe173970ac..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateRunRequest.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The UpdateRunRequest. - internal partial class UpdateRunRequest - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal UpdateRunRequest() - { - Metadata = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of . - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// Keeps track of any properties unknown to the library. - internal UpdateRunRequest(IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) - { - Metadata = metadata; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - public IReadOnlyDictionary Metadata { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateThreadRequest.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateThreadRequest.Serialization.cs deleted file mode 100644 index c7f1c9c708e1..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateThreadRequest.Serialization.cs +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class UpdateThreadRequest : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(UpdateThreadRequest)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ToolResources)) - { - if (ToolResources != null) - { - writer.WritePropertyName("tool_resources"u8); - writer.WriteObjectValue(ToolResources, options); - } - else - { - writer.WriteNull("tool_resources"); - } - } - if (Optional.IsCollectionDefined(Metadata)) - { - if (Metadata != null) - { - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("metadata"); - } - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - UpdateThreadRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(UpdateThreadRequest)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeUpdateThreadRequest(document.RootElement, options); - } - - internal static UpdateThreadRequest DeserializeUpdateThreadRequest(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ToolResources toolResources = default; - IReadOnlyDictionary metadata = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tool_resources"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - toolResources = null; - continue; - } - toolResources = ToolResources.DeserializeToolResources(property.Value, options); - continue; - } - if (property.NameEquals("metadata"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UpdateThreadRequest(toolResources, metadata ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(UpdateThreadRequest)} does not support writing '{options.Format}' format."); - } - } - - UpdateThreadRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUpdateThreadRequest(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(UpdateThreadRequest)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static UpdateThreadRequest FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUpdateThreadRequest(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateThreadRequest.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateThreadRequest.cs deleted file mode 100644 index 2463002920b7..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateThreadRequest.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The UpdateThreadRequest. - internal partial class UpdateThreadRequest - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal UpdateThreadRequest() - { - Metadata = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of . - /// - /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the - /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires - /// a list of vector store IDs - /// - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// Keeps track of any properties unknown to the library. - internal UpdateThreadRequest(ToolResources toolResources, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) - { - ToolResources = toolResources; - Metadata = metadata; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// - /// A set of resources that are made available to the agent's tools in this thread. The resources are specific to the - /// type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires - /// a list of vector store IDs - /// - public ToolResources ToolResources { get; } - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - public IReadOnlyDictionary Metadata { get; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateToolResourcesOptions.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateToolResourcesOptions.Serialization.cs deleted file mode 100644 index a51b16bbd7ab..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateToolResourcesOptions.Serialization.cs +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - public partial class UpdateToolResourcesOptions : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(UpdateToolResourcesOptions)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(CodeInterpreter)) - { - writer.WritePropertyName("code_interpreter"u8); - writer.WriteObjectValue(CodeInterpreter, options); - } - if (Optional.IsDefined(FileSearch)) - { - writer.WritePropertyName("file_search"u8); - writer.WriteObjectValue(FileSearch, options); - } - if (Optional.IsDefined(AzureAISearch)) - { - writer.WritePropertyName("azure_ai_search"u8); - writer.WriteObjectValue(AzureAISearch, options); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - UpdateToolResourcesOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(UpdateToolResourcesOptions)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeUpdateToolResourcesOptions(document.RootElement, options); - } - - internal static UpdateToolResourcesOptions DeserializeUpdateToolResourcesOptions(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - UpdateCodeInterpreterToolResourceOptions codeInterpreter = default; - UpdateFileSearchToolResourceOptions fileSearch = default; - AzureAISearchResource azureAiSearch = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("code_interpreter"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - codeInterpreter = UpdateCodeInterpreterToolResourceOptions.DeserializeUpdateCodeInterpreterToolResourceOptions(property.Value, options); - continue; - } - if (property.NameEquals("file_search"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - fileSearch = UpdateFileSearchToolResourceOptions.DeserializeUpdateFileSearchToolResourceOptions(property.Value, options); - continue; - } - if (property.NameEquals("azure_ai_search"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - azureAiSearch = AzureAISearchResource.DeserializeAzureAISearchResource(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UpdateToolResourcesOptions(codeInterpreter, fileSearch, azureAiSearch, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - default: - throw new FormatException($"The model {nameof(UpdateToolResourcesOptions)} does not support writing '{options.Format}' format."); - } - } - - UpdateToolResourcesOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUpdateToolResourcesOptions(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(UpdateToolResourcesOptions)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static UpdateToolResourcesOptions FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUpdateToolResourcesOptions(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateToolResourcesOptions.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateToolResourcesOptions.cs deleted file mode 100644 index ff39241299ab..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UpdateToolResourcesOptions.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// - /// Request object. A set of resources that are used by the agent's tools. The resources are specific to the type of tool. - /// For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of - /// vector store IDs. - /// - public partial class UpdateToolResourcesOptions - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public UpdateToolResourcesOptions() - { - } - - /// Initializes a new instance of . - /// - /// Overrides the list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files - /// associated with the tool. - /// - /// Overrides the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent. - /// Overrides the resources to be used by the `azure_ai_search` tool consisting of index IDs and names. - /// Keeps track of any properties unknown to the library. - internal UpdateToolResourcesOptions(UpdateCodeInterpreterToolResourceOptions codeInterpreter, UpdateFileSearchToolResourceOptions fileSearch, AzureAISearchResource azureAISearch, IDictionary serializedAdditionalRawData) - { - CodeInterpreter = codeInterpreter; - FileSearch = fileSearch; - AzureAISearch = azureAISearch; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// - /// Overrides the list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files - /// associated with the tool. - /// - public UpdateCodeInterpreterToolResourceOptions CodeInterpreter { get; set; } - /// Overrides the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent. - public UpdateFileSearchToolResourceOptions FileSearch { get; set; } - /// Overrides the resources to be used by the `azure_ai_search` tool consisting of index IDs and names. - public AzureAISearchResource AzureAISearch { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UploadFileRequest.Serialization.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UploadFileRequest.Serialization.cs deleted file mode 100644 index 630757d555d5..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UploadFileRequest.Serialization.cs +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.IO; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Agents.Persistent -{ - internal partial class UploadFileRequest : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(UploadFileRequest)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("file"u8); - writer.WriteObjectValue(Data, options); - writer.WritePropertyName("purpose"u8); - writer.WriteStringValue(Purpose.ToString()); - if (Optional.IsDefined(Filename)) - { - writer.WritePropertyName("filename"u8); - writer.WriteStringValue(Filename); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - UploadFileRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(UploadFileRequest)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeUploadFileRequest(document.RootElement, options); - } - - internal static UploadFileRequest DeserializeUploadFileRequest(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - File file = default; - PersistentAgentFilePurpose purpose = default; - string filename = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("file"u8)) - { - file = File.DeserializeFile(property.Value, options); - continue; - } - if (property.NameEquals("purpose"u8)) - { - purpose = new PersistentAgentFilePurpose(property.Value.GetString()); - continue; - } - if (property.NameEquals("filename"u8)) - { - filename = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UploadFileRequest(file, purpose, filename, serializedAdditionalRawData); - } - - private BinaryData SerializeMultipart(ModelReaderWriterOptions options) - { - using MultipartFormDataRequestContent content = ToMultipartRequestContent(); - using MemoryStream stream = new MemoryStream(); - content.WriteTo(stream); - if (stream.Position > int.MaxValue) - { - return BinaryData.FromStream(stream); - } - else - { - return new BinaryData(stream.GetBuffer().AsMemory(0, (int)stream.Position)); - } - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAIAgentsPersistentContext.Default); - case "MFD": - return SerializeMultipart(options); - default: - throw new FormatException($"The model {nameof(UploadFileRequest)} does not support writing '{options.Format}' format."); - } - } - - UploadFileRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUploadFileRequest(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(UploadFileRequest)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "MFD"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static UploadFileRequest FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUploadFileRequest(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UploadFileRequest.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UploadFileRequest.cs deleted file mode 100644 index de3f5be1f220..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/UploadFileRequest.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Agents.Persistent -{ - /// The UploadFileRequest. - internal partial class UploadFileRequest - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The file data, in bytes. - /// The intended purpose of the uploaded file. Use `assistants` for Agents and Message files, `vision` for Agents image file inputs, `batch` for Batch API, and `fine-tune` for Fine-tuning. - /// is null. - public UploadFileRequest(File data, PersistentAgentFilePurpose purpose) - { - Argument.AssertNotNull(data, nameof(data)); - - Data = data; - Purpose = purpose; - } - - /// Initializes a new instance of . - /// The file data, in bytes. - /// The intended purpose of the uploaded file. Use `assistants` for Agents and Message files, `vision` for Agents image file inputs, `batch` for Batch API, and `fine-tune` for Fine-tuning. - /// The name of the file. - /// Keeps track of any properties unknown to the library. - internal UploadFileRequest(File data, PersistentAgentFilePurpose purpose, string filename, IDictionary serializedAdditionalRawData) - { - Data = data; - Purpose = purpose; - Filename = filename; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal UploadFileRequest() - { - } - - /// The file data, in bytes. - public File Data { get; } - /// The intended purpose of the uploaded file. Use `assistants` for Agents and Message files, `vision` for Agents image file inputs, `batch` for Batch API, and `fine-tune` for Fine-tuning. - public PersistentAgentFilePurpose Purpose { get; } - /// The name of the file. - public string Filename { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoreConfigurations.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoreConfigurations.cs index 68e38f91a945..c8244dae132b 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoreConfigurations.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoreConfigurations.cs @@ -49,7 +49,7 @@ public partial class VectorStoreConfigurations /// Name. /// Configurations. /// or is null. - public VectorStoreConfigurations(string storeName, VectorStoreConfiguration storeConfiguration) + internal VectorStoreConfigurations(string storeName, VectorStoreConfiguration storeConfiguration) { Argument.AssertNotNull(storeName, nameof(storeName)); Argument.AssertNotNull(storeConfiguration, nameof(storeConfiguration)); @@ -75,8 +75,8 @@ internal VectorStoreConfigurations() } /// Name. - public string StoreName { get; set; } + public string StoreName { get; } /// Configurations. - public VectorStoreConfiguration StoreConfiguration { get; set; } + public VectorStoreConfiguration StoreConfiguration { get; } } } diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoreDataSource.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoreDataSource.cs index 7bc62b744a63..3ed142f7a3a9 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoreDataSource.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoreDataSource.cs @@ -77,8 +77,8 @@ internal VectorStoreDataSource() } /// Asset URI. - public string AssetIdentifier { get; set; } + public string AssetIdentifier { get; } /// The asset type. - public VectorStoreDataSourceAssetType AssetType { get; set; } + public VectorStoreDataSourceAssetType AssetType { get; } } } diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoreFileBatches.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoreFileBatches.cs deleted file mode 100644 index 0f5fac22d94d..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoreFileBatches.cs +++ /dev/null @@ -1,508 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.AI.Agents.Persistent -{ - // Data plane generated sub-client. - /// - /// A collection of file-batch operations under - /// `/vector_stores/{vectorStoreId}/file_batches`. - /// - public partial class VectorStoreFileBatches - { - private static readonly string[] AuthorizationScopes = new string[] { "https://ai.azure.com/.default" }; - private readonly TokenCredential _tokenCredential; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// The ClientDiagnostics is used to provide tracing support for the client library. - internal ClientDiagnostics ClientDiagnostics { get; } - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline => _pipeline; - - /// Initializes a new instance of VectorStoreFileBatches for mocking. - protected VectorStoreFileBatches() - { - } - - /// Initializes a new instance of VectorStoreFileBatches. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The token credential to copy. - /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. - /// The API version to use for this operation. - internal VectorStoreFileBatches(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string apiVersion) - { - ClientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - _tokenCredential = tokenCredential; - _endpoint = endpoint; - _apiVersion = apiVersion; - } - - /// Create a vector store file batch. - /// Identifier of the vector store. - /// List of file identifiers. - /// List of Azure assets. - /// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual async Task> CreateVectorStoreFileBatchAsync(string vectorStoreId, IEnumerable fileIds = null, IEnumerable dataSources = null, VectorStoreChunkingStrategy chunkingStrategy = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - - CreateVectorStoreFileBatchRequest createVectorStoreFileBatchRequest = new CreateVectorStoreFileBatchRequest(fileIds?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), dataSources?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), chunkingStrategy, null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await CreateVectorStoreFileBatchAsync(vectorStoreId, createVectorStoreFileBatchRequest.ToRequestContent(), context).ConfigureAwait(false); - return Response.FromValue(VectorStoreFileBatch.FromResponse(response), response); - } - - /// Create a vector store file batch. - /// Identifier of the vector store. - /// List of file identifiers. - /// List of Azure assets. - /// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual Response CreateVectorStoreFileBatch(string vectorStoreId, IEnumerable fileIds = null, IEnumerable dataSources = null, VectorStoreChunkingStrategy chunkingStrategy = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - - CreateVectorStoreFileBatchRequest createVectorStoreFileBatchRequest = new CreateVectorStoreFileBatchRequest(fileIds?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), dataSources?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), chunkingStrategy, null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = CreateVectorStoreFileBatch(vectorStoreId, createVectorStoreFileBatchRequest.ToRequestContent(), context); - return Response.FromValue(VectorStoreFileBatch.FromResponse(response), response); - } - - /// - /// [Protocol Method] Create a vector store file batch. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the vector store. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task CreateVectorStoreFileBatchAsync(string vectorStoreId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("VectorStoreFileBatches.CreateVectorStoreFileBatch"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateVectorStoreFileBatchRequest(vectorStoreId, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Create a vector store file batch. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the vector store. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response CreateVectorStoreFileBatch(string vectorStoreId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("VectorStoreFileBatches.CreateVectorStoreFileBatch"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateVectorStoreFileBatchRequest(vectorStoreId, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Retrieve a vector store file batch. - /// Identifier of the vector store. - /// Identifier of the file batch. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual async Task> GetVectorStoreFileBatchAsync(string vectorStoreId, string batchId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetVectorStoreFileBatchAsync(vectorStoreId, batchId, context).ConfigureAwait(false); - return Response.FromValue(VectorStoreFileBatch.FromResponse(response), response); - } - - /// Retrieve a vector store file batch. - /// Identifier of the vector store. - /// Identifier of the file batch. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual Response GetVectorStoreFileBatch(string vectorStoreId, string batchId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetVectorStoreFileBatch(vectorStoreId, batchId, context); - return Response.FromValue(VectorStoreFileBatch.FromResponse(response), response); - } - - /// - /// [Protocol Method] Retrieve a vector store file batch. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the vector store. - /// Identifier of the file batch. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task GetVectorStoreFileBatchAsync(string vectorStoreId, string batchId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); - - using var scope = ClientDiagnostics.CreateScope("VectorStoreFileBatches.GetVectorStoreFileBatch"); - scope.Start(); - try - { - using HttpMessage message = CreateGetVectorStoreFileBatchRequest(vectorStoreId, batchId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Retrieve a vector store file batch. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the vector store. - /// Identifier of the file batch. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response GetVectorStoreFileBatch(string vectorStoreId, string batchId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); - - using var scope = ClientDiagnostics.CreateScope("VectorStoreFileBatches.GetVectorStoreFileBatch"); - scope.Start(); - try - { - using HttpMessage message = CreateGetVectorStoreFileBatchRequest(vectorStoreId, batchId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. - /// Identifier of the vector store. - /// Identifier of the file batch. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual async Task> CancelVectorStoreFileBatchAsync(string vectorStoreId, string batchId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await CancelVectorStoreFileBatchAsync(vectorStoreId, batchId, context).ConfigureAwait(false); - return Response.FromValue(VectorStoreFileBatch.FromResponse(response), response); - } - - /// Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. - /// Identifier of the vector store. - /// Identifier of the file batch. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual Response CancelVectorStoreFileBatch(string vectorStoreId, string batchId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = CancelVectorStoreFileBatch(vectorStoreId, batchId, context); - return Response.FromValue(VectorStoreFileBatch.FromResponse(response), response); - } - - /// - /// [Protocol Method] Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the vector store. - /// Identifier of the file batch. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task CancelVectorStoreFileBatchAsync(string vectorStoreId, string batchId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); - - using var scope = ClientDiagnostics.CreateScope("VectorStoreFileBatches.CancelVectorStoreFileBatch"); - scope.Start(); - try - { - using HttpMessage message = CreateCancelVectorStoreFileBatchRequest(vectorStoreId, batchId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the vector store. - /// Identifier of the file batch. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response CancelVectorStoreFileBatch(string vectorStoreId, string batchId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); - - using var scope = ClientDiagnostics.CreateScope("VectorStoreFileBatches.CancelVectorStoreFileBatch"); - scope.Start(); - try - { - using HttpMessage message = CreateCancelVectorStoreFileBatchRequest(vectorStoreId, batchId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - internal HttpMessage CreateCreateVectorStoreFileBatchRequest(string vectorStoreId, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/vector_stores/", false); - uri.AppendPath(vectorStoreId, true); - uri.AppendPath("/file_batches", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateGetVectorStoreFileBatchRequest(string vectorStoreId, string batchId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/vector_stores/", false); - uri.AppendPath(vectorStoreId, true); - uri.AppendPath("/file_batches/", false); - uri.AppendPath(batchId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateCancelVectorStoreFileBatchRequest(string vectorStoreId, string batchId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/vector_stores/", false); - uri.AppendPath(vectorStoreId, true); - uri.AppendPath("/file_batches/", false); - uri.AppendPath(batchId, true); - uri.AppendPath("/cancel", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetVectorStoreFileBatchFilesRequest(string vectorStoreId, string batchId, string filter, int? limit, string order, string after, string before, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/vector_stores/", false); - uri.AppendPath(vectorStoreId, true); - uri.AppendPath("/file_batches/", false); - uri.AppendPath(batchId, true); - uri.AppendPath("/files", false); - if (filter != null) - { - uri.AppendQuery("filter", filter, true); - } - if (limit != null) - { - uri.AppendQuery("limit", limit.Value, true); - } - if (order != null) - { - uri.AppendQuery("order", order, true); - } - if (after != null) - { - uri.AppendQuery("after", after, true); - } - if (before != null) - { - uri.AppendQuery("before", before, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - private static RequestContext DefaultRequestContext = new RequestContext(); - internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) - { - if (!cancellationToken.CanBeCanceled) - { - return DefaultRequestContext; - } - - return new RequestContext() { CancellationToken = cancellationToken }; - } - - private static ResponseClassifier _responseClassifier200; - private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoreFiles.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoreFiles.cs deleted file mode 100644 index d67776d9ebf0..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoreFiles.cs +++ /dev/null @@ -1,505 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.AI.Agents.Persistent -{ - // Data plane generated sub-client. - /// - /// A collection of vector-store file operations under - /// `/vector_stores/{vectorStoreId}/files`. - /// - public partial class VectorStoreFiles - { - private static readonly string[] AuthorizationScopes = new string[] { "https://ai.azure.com/.default" }; - private readonly TokenCredential _tokenCredential; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// The ClientDiagnostics is used to provide tracing support for the client library. - internal ClientDiagnostics ClientDiagnostics { get; } - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline => _pipeline; - - /// Initializes a new instance of VectorStoreFiles for mocking. - protected VectorStoreFiles() - { - } - - /// Initializes a new instance of VectorStoreFiles. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The token credential to copy. - /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. - /// The API version to use for this operation. - internal VectorStoreFiles(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string apiVersion) - { - ClientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - _tokenCredential = tokenCredential; - _endpoint = endpoint; - _apiVersion = apiVersion; - } - - /// Create a vector store file by attaching a file to a vector store. - /// Identifier of the vector store. - /// Identifier of the file. - /// Azure asset ID. - /// The chunking strategy used to chunk the file. If not set, uses the auto strategy. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual async Task> CreateVectorStoreFileAsync(string vectorStoreId, string fileId = null, VectorStoreDataSource dataSource = null, VectorStoreChunkingStrategy chunkingStrategy = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - - CreateVectorStoreFileRequest createVectorStoreFileRequest = new CreateVectorStoreFileRequest(fileId, dataSource, chunkingStrategy, null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await CreateVectorStoreFileAsync(vectorStoreId, createVectorStoreFileRequest.ToRequestContent(), context).ConfigureAwait(false); - return Response.FromValue(VectorStoreFile.FromResponse(response), response); - } - - /// Create a vector store file by attaching a file to a vector store. - /// Identifier of the vector store. - /// Identifier of the file. - /// Azure asset ID. - /// The chunking strategy used to chunk the file. If not set, uses the auto strategy. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual Response CreateVectorStoreFile(string vectorStoreId, string fileId = null, VectorStoreDataSource dataSource = null, VectorStoreChunkingStrategy chunkingStrategy = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - - CreateVectorStoreFileRequest createVectorStoreFileRequest = new CreateVectorStoreFileRequest(fileId, dataSource, chunkingStrategy, null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = CreateVectorStoreFile(vectorStoreId, createVectorStoreFileRequest.ToRequestContent(), context); - return Response.FromValue(VectorStoreFile.FromResponse(response), response); - } - - /// - /// [Protocol Method] Create a vector store file by attaching a file to a vector store. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the vector store. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task CreateVectorStoreFileAsync(string vectorStoreId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("VectorStoreFiles.CreateVectorStoreFile"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateVectorStoreFileRequest(vectorStoreId, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Create a vector store file by attaching a file to a vector store. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the vector store. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response CreateVectorStoreFile(string vectorStoreId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("VectorStoreFiles.CreateVectorStoreFile"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateVectorStoreFileRequest(vectorStoreId, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Retrieves a vector store file. - /// Identifier of the vector store. - /// Identifier of the file. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual async Task> GetVectorStoreFileAsync(string vectorStoreId, string fileId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetVectorStoreFileAsync(vectorStoreId, fileId, context).ConfigureAwait(false); - return Response.FromValue(VectorStoreFile.FromResponse(response), response); - } - - /// Retrieves a vector store file. - /// Identifier of the vector store. - /// Identifier of the file. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual Response GetVectorStoreFile(string vectorStoreId, string fileId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetVectorStoreFile(vectorStoreId, fileId, context); - return Response.FromValue(VectorStoreFile.FromResponse(response), response); - } - - /// - /// [Protocol Method] Retrieves a vector store file. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the vector store. - /// Identifier of the file. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task GetVectorStoreFileAsync(string vectorStoreId, string fileId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); - - using var scope = ClientDiagnostics.CreateScope("VectorStoreFiles.GetVectorStoreFile"); - scope.Start(); - try - { - using HttpMessage message = CreateGetVectorStoreFileRequest(vectorStoreId, fileId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Retrieves a vector store file. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the vector store. - /// Identifier of the file. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response GetVectorStoreFile(string vectorStoreId, string fileId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); - - using var scope = ClientDiagnostics.CreateScope("VectorStoreFiles.GetVectorStoreFile"); - scope.Start(); - try - { - using HttpMessage message = CreateGetVectorStoreFileRequest(vectorStoreId, fileId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Deletes a vector store file. This removes the file‐to‐store link (does not delete the file itself). - /// Identifier of the vector store. - /// Identifier of the file. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - internal virtual async Task> InternalDeleteVectorStoreFileAsync(string vectorStoreId, string fileId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await InternalDeleteVectorStoreFileAsync(vectorStoreId, fileId, context).ConfigureAwait(false); - return Response.FromValue(InternalVectorStoreFileDeletionStatus.FromResponse(response), response); - } - - /// Deletes a vector store file. This removes the file‐to‐store link (does not delete the file itself). - /// Identifier of the vector store. - /// Identifier of the file. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - internal virtual Response InternalDeleteVectorStoreFile(string vectorStoreId, string fileId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = InternalDeleteVectorStoreFile(vectorStoreId, fileId, context); - return Response.FromValue(InternalVectorStoreFileDeletionStatus.FromResponse(response), response); - } - - /// - /// [Protocol Method] Deletes a vector store file. This removes the file‐to‐store link (does not delete the file itself). - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the vector store. - /// Identifier of the file. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual async Task InternalDeleteVectorStoreFileAsync(string vectorStoreId, string fileId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); - - using var scope = ClientDiagnostics.CreateScope("VectorStoreFiles.InternalDeleteVectorStoreFile"); - scope.Start(); - try - { - using HttpMessage message = CreateInternalDeleteVectorStoreFileRequest(vectorStoreId, fileId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Deletes a vector store file. This removes the file‐to‐store link (does not delete the file itself). - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the vector store. - /// Identifier of the file. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual Response InternalDeleteVectorStoreFile(string vectorStoreId, string fileId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); - - using var scope = ClientDiagnostics.CreateScope("VectorStoreFiles.InternalDeleteVectorStoreFile"); - scope.Start(); - try - { - using HttpMessage message = CreateInternalDeleteVectorStoreFileRequest(vectorStoreId, fileId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - internal HttpMessage CreateGetVectorStoreFilesRequest(string vectorStoreId, string filter, int? limit, string order, string after, string before, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/vector_stores/", false); - uri.AppendPath(vectorStoreId, true); - uri.AppendPath("/files", false); - if (filter != null) - { - uri.AppendQuery("filter", filter, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - if (limit != null) - { - uri.AppendQuery("limit", limit.Value, true); - } - if (order != null) - { - uri.AppendQuery("order", order, true); - } - if (after != null) - { - uri.AppendQuery("after", after, true); - } - if (before != null) - { - uri.AppendQuery("before", before, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateCreateVectorStoreFileRequest(string vectorStoreId, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/vector_stores/", false); - uri.AppendPath(vectorStoreId, true); - uri.AppendPath("/files", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateGetVectorStoreFileRequest(string vectorStoreId, string fileId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/vector_stores/", false); - uri.AppendPath(vectorStoreId, true); - uri.AppendPath("/files/", false); - uri.AppendPath(fileId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateInternalDeleteVectorStoreFileRequest(string vectorStoreId, string fileId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/vector_stores/", false); - uri.AppendPath(vectorStoreId, true); - uri.AppendPath("/files/", false); - uri.AppendPath(fileId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - private static RequestContext DefaultRequestContext = new RequestContext(); - internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) - { - if (!cancellationToken.CanBeCanceled) - { - return DefaultRequestContext; - } - - return new RequestContext() { CancellationToken = cancellationToken }; - } - - private static ResponseClassifier _responseClassifier200; - private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStores.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStores.cs deleted file mode 100644 index 46d62ede6ffd..000000000000 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStores.cs +++ /dev/null @@ -1,614 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.AI.Agents.Persistent -{ - // Data plane generated sub-client. - /// A collection of vector-store operations under `/vector_stores`. - public partial class VectorStores - { - private static readonly string[] AuthorizationScopes = new string[] { "https://ai.azure.com/.default" }; - private readonly TokenCredential _tokenCredential; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// The ClientDiagnostics is used to provide tracing support for the client library. - internal ClientDiagnostics ClientDiagnostics { get; } - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline => _pipeline; - - /// Initializes a new instance of VectorStores for mocking. - protected VectorStores() - { - } - - /// Initializes a new instance of VectorStores. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The token credential to copy. - /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. - /// The API version to use for this operation. - internal VectorStores(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string apiVersion) - { - ClientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - _tokenCredential = tokenCredential; - _endpoint = endpoint; - _apiVersion = apiVersion; - } - - /// Creates a vector store. - /// A list of file IDs that the vector store should use. Useful for tools like `file_search` that can access files. - /// The name of the vector store. - /// The vector store configuration, used when vector store is created from Azure asset URIs. - /// Details on when this vector store expires. - /// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. Only applicable if file_ids is non-empty. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// The cancellation token to use. - public virtual async Task> CreateVectorStoreAsync(IEnumerable fileIds = null, string name = null, VectorStoreConfiguration storeConfiguration = null, VectorStoreExpirationPolicy expiresAfter = null, VectorStoreChunkingStrategy chunkingStrategy = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) - { - CreateVectorStoreRequest createVectorStoreRequest = new CreateVectorStoreRequest( - fileIds?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), - name, - storeConfiguration, - expiresAfter, - chunkingStrategy, - metadata ?? new ChangeTrackingDictionary(), - null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await CreateVectorStoreAsync(createVectorStoreRequest.ToRequestContent(), context).ConfigureAwait(false); - return Response.FromValue(PersistentAgentsVectorStore.FromResponse(response), response); - } - - /// Creates a vector store. - /// A list of file IDs that the vector store should use. Useful for tools like `file_search` that can access files. - /// The name of the vector store. - /// The vector store configuration, used when vector store is created from Azure asset URIs. - /// Details on when this vector store expires. - /// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. Only applicable if file_ids is non-empty. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// The cancellation token to use. - public virtual Response CreateVectorStore(IEnumerable fileIds = null, string name = null, VectorStoreConfiguration storeConfiguration = null, VectorStoreExpirationPolicy expiresAfter = null, VectorStoreChunkingStrategy chunkingStrategy = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) - { - CreateVectorStoreRequest createVectorStoreRequest = new CreateVectorStoreRequest( - fileIds?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), - name, - storeConfiguration, - expiresAfter, - chunkingStrategy, - metadata ?? new ChangeTrackingDictionary(), - null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = CreateVectorStore(createVectorStoreRequest.ToRequestContent(), context); - return Response.FromValue(PersistentAgentsVectorStore.FromResponse(response), response); - } - - /// - /// [Protocol Method] Creates a vector store. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task CreateVectorStoreAsync(RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("VectorStores.CreateVectorStore"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateVectorStoreRequest(content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Creates a vector store. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response CreateVectorStore(RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("VectorStores.CreateVectorStore"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateVectorStoreRequest(content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Returns the vector store object matching the specified ID. - /// Identifier of the vector store. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual async Task> GetVectorStoreAsync(string vectorStoreId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetVectorStoreAsync(vectorStoreId, context).ConfigureAwait(false); - return Response.FromValue(PersistentAgentsVectorStore.FromResponse(response), response); - } - - /// Returns the vector store object matching the specified ID. - /// Identifier of the vector store. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual Response GetVectorStore(string vectorStoreId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetVectorStore(vectorStoreId, context); - return Response.FromValue(PersistentAgentsVectorStore.FromResponse(response), response); - } - - /// - /// [Protocol Method] Returns the vector store object matching the specified ID. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the vector store. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task GetVectorStoreAsync(string vectorStoreId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - - using var scope = ClientDiagnostics.CreateScope("VectorStores.GetVectorStore"); - scope.Start(); - try - { - using HttpMessage message = CreateGetVectorStoreRequest(vectorStoreId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Returns the vector store object matching the specified ID. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the vector store. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response GetVectorStore(string vectorStoreId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - - using var scope = ClientDiagnostics.CreateScope("VectorStores.GetVectorStore"); - scope.Start(); - try - { - using HttpMessage message = CreateGetVectorStoreRequest(vectorStoreId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Modifies an existing vector store. - /// Identifier of the vector store. - /// The name of the vector store. - /// Details on when this vector store expires. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual async Task> ModifyVectorStoreAsync(string vectorStoreId, string name = null, VectorStoreExpirationPolicy expiresAfter = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - - ModifyVectorStoreRequest modifyVectorStoreRequest = new ModifyVectorStoreRequest(name, expiresAfter, metadata ?? new ChangeTrackingDictionary(), null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await ModifyVectorStoreAsync(vectorStoreId, modifyVectorStoreRequest.ToRequestContent(), context).ConfigureAwait(false); - return Response.FromValue(PersistentAgentsVectorStore.FromResponse(response), response); - } - - /// Modifies an existing vector store. - /// Identifier of the vector store. - /// The name of the vector store. - /// Details on when this vector store expires. - /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual Response ModifyVectorStore(string vectorStoreId, string name = null, VectorStoreExpirationPolicy expiresAfter = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - - ModifyVectorStoreRequest modifyVectorStoreRequest = new ModifyVectorStoreRequest(name, expiresAfter, metadata ?? new ChangeTrackingDictionary(), null); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = ModifyVectorStore(vectorStoreId, modifyVectorStoreRequest.ToRequestContent(), context); - return Response.FromValue(PersistentAgentsVectorStore.FromResponse(response), response); - } - - /// - /// [Protocol Method] Modifies an existing vector store. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the vector store. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task ModifyVectorStoreAsync(string vectorStoreId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("VectorStores.ModifyVectorStore"); - scope.Start(); - try - { - using HttpMessage message = CreateModifyVectorStoreRequest(vectorStoreId, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Modifies an existing vector store. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the vector store. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response ModifyVectorStore(string vectorStoreId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("VectorStores.ModifyVectorStore"); - scope.Start(); - try - { - using HttpMessage message = CreateModifyVectorStoreRequest(vectorStoreId, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Deletes the vector store object matching the specified ID. - /// Identifier of the vector store. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - internal virtual async Task> InternalDeleteVectorStoreAsync(string vectorStoreId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await InternalDeleteVectorStoreAsync(vectorStoreId, context).ConfigureAwait(false); - return Response.FromValue(InternalVectorStoreDeletionStatus.FromResponse(response), response); - } - - /// Deletes the vector store object matching the specified ID. - /// Identifier of the vector store. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - internal virtual Response InternalDeleteVectorStore(string vectorStoreId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = InternalDeleteVectorStore(vectorStoreId, context); - return Response.FromValue(InternalVectorStoreDeletionStatus.FromResponse(response), response); - } - - /// - /// [Protocol Method] Deletes the vector store object matching the specified ID. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the vector store. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual async Task InternalDeleteVectorStoreAsync(string vectorStoreId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - - using var scope = ClientDiagnostics.CreateScope("VectorStores.InternalDeleteVectorStore"); - scope.Start(); - try - { - using HttpMessage message = CreateInternalDeleteVectorStoreRequest(vectorStoreId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Deletes the vector store object matching the specified ID. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Identifier of the vector store. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual Response InternalDeleteVectorStore(string vectorStoreId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); - - using var scope = ClientDiagnostics.CreateScope("VectorStores.InternalDeleteVectorStore"); - scope.Start(); - try - { - using HttpMessage message = CreateInternalDeleteVectorStoreRequest(vectorStoreId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - internal HttpMessage CreateGetVectorStoresRequest(int? limit, string order, string after, string before, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/vector_stores", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (limit != null) - { - uri.AppendQuery("limit", limit.Value, true); - } - if (order != null) - { - uri.AppendQuery("order", order, true); - } - if (after != null) - { - uri.AppendQuery("after", after, true); - } - if (before != null) - { - uri.AppendQuery("before", before, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateCreateVectorStoreRequest(RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/vector_stores", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateGetVectorStoreRequest(string vectorStoreId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/vector_stores/", false); - uri.AppendPath(vectorStoreId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateModifyVectorStoreRequest(string vectorStoreId, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/vector_stores/", false); - uri.AppendPath(vectorStoreId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateInternalDeleteVectorStoreRequest(string vectorStoreId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/vector_stores/", false); - uri.AppendPath(vectorStoreId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - private static RequestContext DefaultRequestContext = new RequestContext(); - internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) - { - if (!cancellationToken.CanBeCanceled) - { - return DefaultRequestContext; - } - - return new RequestContext() { CancellationToken = cancellationToken }; - } - - private static ResponseClassifier _responseClassifier200; - private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); - } -} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoresClient.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoresClient.cs new file mode 100644 index 000000000000..b5c9a4b97497 --- /dev/null +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoresClient.cs @@ -0,0 +1,1837 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Agents.Persistent +{ + // Data plane generated client. + /// The VectorStores service client. + public partial class VectorStoresClient + { + private static readonly string[] AuthorizationScopes = new string[] { "https://ai.azure.com/.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of VectorStoresClient for mocking. + protected VectorStoresClient() + { + } + + /// Initializes a new instance of VectorStoresClient. + /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public VectorStoresClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new VectorStoresClientOptions()) + { + } + + /// Initializes a new instance of VectorStoresClient. + /// Project endpoint in the form of: https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public VectorStoresClient(Uri endpoint, TokenCredential credential, VectorStoresClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new VectorStoresClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// Creates a vector store. + /// A list of file IDs that the vector store should use. Useful for tools like `file_search` that can access files. + /// The name of the vector store. + /// The vector store configuration, used when vector store is created from Azure asset URIs. + /// Details on when this vector store expires. + /// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. Only applicable if file_ids is non-empty. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// + public virtual async Task> CreateVectorStoreAsync(IEnumerable fileIds = null, string name = null, VectorStoreConfiguration storeConfiguration = null, VectorStoreExpirationPolicy expiresAfter = null, VectorStoreChunkingStrategy chunkingStrategy = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + CreateVectorStoreRequest createVectorStoreRequest = new CreateVectorStoreRequest( + fileIds?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), + name, + storeConfiguration, + expiresAfter, + chunkingStrategy, + metadata ?? new ChangeTrackingDictionary(), + null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await CreateVectorStoreAsync(createVectorStoreRequest.ToRequestContent(), context).ConfigureAwait(false); + return Response.FromValue(PersistentAgentsVectorStore.FromResponse(response), response); + } + + /// Creates a vector store. + /// A list of file IDs that the vector store should use. Useful for tools like `file_search` that can access files. + /// The name of the vector store. + /// The vector store configuration, used when vector store is created from Azure asset URIs. + /// Details on when this vector store expires. + /// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. Only applicable if file_ids is non-empty. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// + public virtual Response CreateVectorStore(IEnumerable fileIds = null, string name = null, VectorStoreConfiguration storeConfiguration = null, VectorStoreExpirationPolicy expiresAfter = null, VectorStoreChunkingStrategy chunkingStrategy = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + CreateVectorStoreRequest createVectorStoreRequest = new CreateVectorStoreRequest( + fileIds?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), + name, + storeConfiguration, + expiresAfter, + chunkingStrategy, + metadata ?? new ChangeTrackingDictionary(), + null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = CreateVectorStore(createVectorStoreRequest.ToRequestContent(), context); + return Response.FromValue(PersistentAgentsVectorStore.FromResponse(response), response); + } + + /// + /// [Protocol Method] Creates a vector store. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateVectorStoreAsync(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("VectorStoresClient.CreateVectorStore"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateVectorStoreRequest(content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Creates a vector store. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateVectorStore(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("VectorStoresClient.CreateVectorStore"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateVectorStoreRequest(content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns the vector store object matching the specified ID. + /// Identifier of the vector store. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetVectorStoreAsync(string vectorStoreId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetVectorStoreAsync(vectorStoreId, context).ConfigureAwait(false); + return Response.FromValue(PersistentAgentsVectorStore.FromResponse(response), response); + } + + /// Returns the vector store object matching the specified ID. + /// Identifier of the vector store. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetVectorStore(string vectorStoreId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetVectorStore(vectorStoreId, context); + return Response.FromValue(PersistentAgentsVectorStore.FromResponse(response), response); + } + + /// + /// [Protocol Method] Returns the vector store object matching the specified ID. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetVectorStoreAsync(string vectorStoreId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + using var scope = ClientDiagnostics.CreateScope("VectorStoresClient.GetVectorStore"); + scope.Start(); + try + { + using HttpMessage message = CreateGetVectorStoreRequest(vectorStoreId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Returns the vector store object matching the specified ID. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetVectorStore(string vectorStoreId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + using var scope = ClientDiagnostics.CreateScope("VectorStoresClient.GetVectorStore"); + scope.Start(); + try + { + using HttpMessage message = CreateGetVectorStoreRequest(vectorStoreId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Modifies an existing vector store. + /// Identifier of the vector store. + /// The name of the vector store. + /// Details on when this vector store expires. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> ModifyVectorStoreAsync(string vectorStoreId, string name = null, VectorStoreExpirationPolicy expiresAfter = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + ModifyVectorStoreRequest modifyVectorStoreRequest = new ModifyVectorStoreRequest(name, expiresAfter, metadata ?? new ChangeTrackingDictionary(), null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await ModifyVectorStoreAsync(vectorStoreId, modifyVectorStoreRequest.ToRequestContent(), context).ConfigureAwait(false); + return Response.FromValue(PersistentAgentsVectorStore.FromResponse(response), response); + } + + /// Modifies an existing vector store. + /// Identifier of the vector store. + /// The name of the vector store. + /// Details on when this vector store expires. + /// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response ModifyVectorStore(string vectorStoreId, string name = null, VectorStoreExpirationPolicy expiresAfter = null, IReadOnlyDictionary metadata = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + ModifyVectorStoreRequest modifyVectorStoreRequest = new ModifyVectorStoreRequest(name, expiresAfter, metadata ?? new ChangeTrackingDictionary(), null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = ModifyVectorStore(vectorStoreId, modifyVectorStoreRequest.ToRequestContent(), context); + return Response.FromValue(PersistentAgentsVectorStore.FromResponse(response), response); + } + + /// + /// [Protocol Method] Modifies an existing vector store. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task ModifyVectorStoreAsync(string vectorStoreId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("VectorStoresClient.ModifyVectorStore"); + scope.Start(); + try + { + using HttpMessage message = CreateModifyVectorStoreRequest(vectorStoreId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Modifies an existing vector store. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response ModifyVectorStore(string vectorStoreId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("VectorStoresClient.ModifyVectorStore"); + scope.Start(); + try + { + using HttpMessage message = CreateModifyVectorStoreRequest(vectorStoreId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes the vector store object matching the specified ID. + /// Identifier of the vector store. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + internal virtual async Task> InternalDeleteVectorStoreAsync(string vectorStoreId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await InternalDeleteVectorStoreAsync(vectorStoreId, context).ConfigureAwait(false); + return Response.FromValue(InternalVectorStoreDeletionStatus.FromResponse(response), response); + } + + /// Deletes the vector store object matching the specified ID. + /// Identifier of the vector store. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + internal virtual Response InternalDeleteVectorStore(string vectorStoreId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = InternalDeleteVectorStore(vectorStoreId, context); + return Response.FromValue(InternalVectorStoreDeletionStatus.FromResponse(response), response); + } + + /// + /// [Protocol Method] Deletes the vector store object matching the specified ID. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual async Task InternalDeleteVectorStoreAsync(string vectorStoreId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + using var scope = ClientDiagnostics.CreateScope("VectorStoresClient.InternalDeleteVectorStore"); + scope.Start(); + try + { + using HttpMessage message = CreateInternalDeleteVectorStoreRequest(vectorStoreId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Deletes the vector store object matching the specified ID. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual Response InternalDeleteVectorStore(string vectorStoreId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + using var scope = ClientDiagnostics.CreateScope("VectorStoresClient.InternalDeleteVectorStore"); + scope.Start(); + try + { + using HttpMessage message = CreateInternalDeleteVectorStoreRequest(vectorStoreId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a vector store file by attaching a file to a vector store. + /// Identifier of the vector store. + /// Identifier of the file. + /// Azure asset ID. + /// The chunking strategy used to chunk the file. If not set, uses the auto strategy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> CreateVectorStoreFileAsync(string vectorStoreId, string fileId = null, VectorStoreDataSource dataSource = null, VectorStoreChunkingStrategy chunkingStrategy = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + CreateVectorStoreFileRequest createVectorStoreFileRequest = new CreateVectorStoreFileRequest(fileId, dataSource, chunkingStrategy, null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await CreateVectorStoreFileAsync(vectorStoreId, createVectorStoreFileRequest.ToRequestContent(), context).ConfigureAwait(false); + return Response.FromValue(VectorStoreFile.FromResponse(response), response); + } + + /// Create a vector store file by attaching a file to a vector store. + /// Identifier of the vector store. + /// Identifier of the file. + /// Azure asset ID. + /// The chunking strategy used to chunk the file. If not set, uses the auto strategy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CreateVectorStoreFile(string vectorStoreId, string fileId = null, VectorStoreDataSource dataSource = null, VectorStoreChunkingStrategy chunkingStrategy = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + CreateVectorStoreFileRequest createVectorStoreFileRequest = new CreateVectorStoreFileRequest(fileId, dataSource, chunkingStrategy, null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = CreateVectorStoreFile(vectorStoreId, createVectorStoreFileRequest.ToRequestContent(), context); + return Response.FromValue(VectorStoreFile.FromResponse(response), response); + } + + /// + /// [Protocol Method] Create a vector store file by attaching a file to a vector store. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateVectorStoreFileAsync(string vectorStoreId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("VectorStoresClient.CreateVectorStoreFile"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateVectorStoreFileRequest(vectorStoreId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Create a vector store file by attaching a file to a vector store. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateVectorStoreFile(string vectorStoreId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("VectorStoresClient.CreateVectorStoreFile"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateVectorStoreFileRequest(vectorStoreId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves a vector store file. + /// Identifier of the file. + /// Identifier of the vector store. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetVectorStoreFileAsync(string fileId, string vectorStoreId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetVectorStoreFileAsync(fileId, vectorStoreId, context).ConfigureAwait(false); + return Response.FromValue(VectorStoreFile.FromResponse(response), response); + } + + /// Retrieves a vector store file. + /// Identifier of the file. + /// Identifier of the vector store. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response GetVectorStoreFile(string fileId, string vectorStoreId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetVectorStoreFile(fileId, vectorStoreId, context); + return Response.FromValue(VectorStoreFile.FromResponse(response), response); + } + + /// + /// [Protocol Method] Retrieves a vector store file. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the file. + /// Identifier of the vector store. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetVectorStoreFileAsync(string fileId, string vectorStoreId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + using var scope = ClientDiagnostics.CreateScope("VectorStoresClient.GetVectorStoreFile"); + scope.Start(); + try + { + using HttpMessage message = CreateGetVectorStoreFileRequest(fileId, vectorStoreId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Retrieves a vector store file. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the file. + /// Identifier of the vector store. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetVectorStoreFile(string fileId, string vectorStoreId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + using var scope = ClientDiagnostics.CreateScope("VectorStoresClient.GetVectorStoreFile"); + scope.Start(); + try + { + using HttpMessage message = CreateGetVectorStoreFileRequest(fileId, vectorStoreId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a vector store file. This removes the file‐to‐store link (does not delete the file itself). + /// Identifier of the file. + /// Identifier of the vector store. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + internal virtual async Task> InternalDeleteVectorStoreFileAsync(string fileId, string vectorStoreId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await InternalDeleteVectorStoreFileAsync(fileId, vectorStoreId, context).ConfigureAwait(false); + return Response.FromValue(InternalVectorStoreFileDeletionStatus.FromResponse(response), response); + } + + /// Deletes a vector store file. This removes the file‐to‐store link (does not delete the file itself). + /// Identifier of the file. + /// Identifier of the vector store. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + internal virtual Response InternalDeleteVectorStoreFile(string fileId, string vectorStoreId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = InternalDeleteVectorStoreFile(fileId, vectorStoreId, context); + return Response.FromValue(InternalVectorStoreFileDeletionStatus.FromResponse(response), response); + } + + /// + /// [Protocol Method] Deletes a vector store file. This removes the file‐to‐store link (does not delete the file itself). + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the file. + /// Identifier of the vector store. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual async Task InternalDeleteVectorStoreFileAsync(string fileId, string vectorStoreId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + using var scope = ClientDiagnostics.CreateScope("VectorStoresClient.InternalDeleteVectorStoreFile"); + scope.Start(); + try + { + using HttpMessage message = CreateInternalDeleteVectorStoreFileRequest(fileId, vectorStoreId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Deletes a vector store file. This removes the file‐to‐store link (does not delete the file itself). + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the file. + /// Identifier of the vector store. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual Response InternalDeleteVectorStoreFile(string fileId, string vectorStoreId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(fileId, nameof(fileId)); + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + using var scope = ClientDiagnostics.CreateScope("VectorStoresClient.InternalDeleteVectorStoreFile"); + scope.Start(); + try + { + using HttpMessage message = CreateInternalDeleteVectorStoreFileRequest(fileId, vectorStoreId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a vector store file batch. + /// Identifier of the vector store. + /// List of file identifiers. + /// List of Azure assets. + /// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> CreateVectorStoreFileBatchAsync(string vectorStoreId, IEnumerable fileIds = null, IEnumerable dataSources = null, VectorStoreChunkingStrategy chunkingStrategy = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + CreateVectorStoreFileBatchRequest createVectorStoreFileBatchRequest = new CreateVectorStoreFileBatchRequest(fileIds?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), dataSources?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), chunkingStrategy, null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await CreateVectorStoreFileBatchAsync(vectorStoreId, createVectorStoreFileBatchRequest.ToRequestContent(), context).ConfigureAwait(false); + return Response.FromValue(VectorStoreFileBatch.FromResponse(response), response); + } + + /// Create a vector store file batch. + /// Identifier of the vector store. + /// List of file identifiers. + /// List of Azure assets. + /// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CreateVectorStoreFileBatch(string vectorStoreId, IEnumerable fileIds = null, IEnumerable dataSources = null, VectorStoreChunkingStrategy chunkingStrategy = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + CreateVectorStoreFileBatchRequest createVectorStoreFileBatchRequest = new CreateVectorStoreFileBatchRequest(fileIds?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), dataSources?.ToList() as IReadOnlyList ?? new ChangeTrackingList(), chunkingStrategy, null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = CreateVectorStoreFileBatch(vectorStoreId, createVectorStoreFileBatchRequest.ToRequestContent(), context); + return Response.FromValue(VectorStoreFileBatch.FromResponse(response), response); + } + + /// + /// [Protocol Method] Create a vector store file batch. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateVectorStoreFileBatchAsync(string vectorStoreId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("VectorStoresClient.CreateVectorStoreFileBatch"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateVectorStoreFileBatchRequest(vectorStoreId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Create a vector store file batch. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateVectorStoreFileBatch(string vectorStoreId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("VectorStoresClient.CreateVectorStoreFileBatch"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateVectorStoreFileBatchRequest(vectorStoreId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieve a vector store file batch. + /// Identifier of the file batch. + /// Identifier of the vector store. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetVectorStoreFileBatchAsync(string batchId, string vectorStoreId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetVectorStoreFileBatchAsync(batchId, vectorStoreId, context).ConfigureAwait(false); + return Response.FromValue(VectorStoreFileBatch.FromResponse(response), response); + } + + /// Retrieve a vector store file batch. + /// Identifier of the file batch. + /// Identifier of the vector store. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response GetVectorStoreFileBatch(string batchId, string vectorStoreId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetVectorStoreFileBatch(batchId, vectorStoreId, context); + return Response.FromValue(VectorStoreFileBatch.FromResponse(response), response); + } + + /// + /// [Protocol Method] Retrieve a vector store file batch. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the file batch. + /// Identifier of the vector store. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetVectorStoreFileBatchAsync(string batchId, string vectorStoreId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + using var scope = ClientDiagnostics.CreateScope("VectorStoresClient.GetVectorStoreFileBatch"); + scope.Start(); + try + { + using HttpMessage message = CreateGetVectorStoreFileBatchRequest(batchId, vectorStoreId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Retrieve a vector store file batch. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the file batch. + /// Identifier of the vector store. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetVectorStoreFileBatch(string batchId, string vectorStoreId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + using var scope = ClientDiagnostics.CreateScope("VectorStoresClient.GetVectorStoreFileBatch"); + scope.Start(); + try + { + using HttpMessage message = CreateGetVectorStoreFileBatchRequest(batchId, vectorStoreId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. + /// Identifier of the file batch. + /// Identifier of the vector store. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> CancelVectorStoreFileBatchAsync(string batchId, string vectorStoreId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await CancelVectorStoreFileBatchAsync(batchId, vectorStoreId, context).ConfigureAwait(false); + return Response.FromValue(VectorStoreFileBatch.FromResponse(response), response); + } + + /// Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. + /// Identifier of the file batch. + /// Identifier of the vector store. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response CancelVectorStoreFileBatch(string batchId, string vectorStoreId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = CancelVectorStoreFileBatch(batchId, vectorStoreId, context); + return Response.FromValue(VectorStoreFileBatch.FromResponse(response), response); + } + + /// + /// [Protocol Method] Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the file batch. + /// Identifier of the vector store. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CancelVectorStoreFileBatchAsync(string batchId, string vectorStoreId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + using var scope = ClientDiagnostics.CreateScope("VectorStoresClient.CancelVectorStoreFileBatch"); + scope.Start(); + try + { + using HttpMessage message = CreateCancelVectorStoreFileBatchRequest(batchId, vectorStoreId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the file batch. + /// Identifier of the vector store. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CancelVectorStoreFileBatch(string batchId, string vectorStoreId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + using var scope = ClientDiagnostics.CreateScope("VectorStoresClient.CancelVectorStoreFileBatch"); + scope.Start(); + try + { + using HttpMessage message = CreateCancelVectorStoreFileBatchRequest(batchId, vectorStoreId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a list of vector stores. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + /// 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. + /// 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. + /// The cancellation token to use. + /// + public virtual AsyncPageable GetVectorStoresAsync(int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetVectorStoresRequest(limit, order?.ToString(), after, before, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => PersistentAgentsVectorStore.DeserializePersistentAgentsVectorStore(e), ClientDiagnostics, _pipeline, "VectorStoresClient.GetVectorStores", "data", null, context); + } + + /// Returns a list of vector stores. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + /// 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. + /// 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. + /// The cancellation token to use. + /// + public virtual Pageable GetVectorStores(int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetVectorStoresRequest(limit, order?.ToString(), after, before, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => PersistentAgentsVectorStore.DeserializePersistentAgentsVectorStore(e), ClientDiagnostics, _pipeline, "VectorStoresClient.GetVectorStores", "data", null, context); + } + + /// + /// [Protocol Method] Returns a list of vector stores. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc". + /// 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. + /// 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. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetVectorStoresAsync(int? limit, string order, string after, string before, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetVectorStoresRequest(limit, order, after, before, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "VectorStoresClient.GetVectorStores", "data", null, context); + } + + /// + /// [Protocol Method] Returns a list of vector stores. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc". + /// 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. + /// 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. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetVectorStores(int? limit, string order, string after, string before, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetVectorStoresRequest(limit, order, after, before, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "VectorStoresClient.GetVectorStores", "data", null, context); + } + + /// Returns a list of vector store files. + /// Identifier of the vector store. + /// Filter by file status. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + /// 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. + /// 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. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual AsyncPageable GetVectorStoreFilesAsync(string vectorStoreId, VectorStoreFileStatusFilter? filter = null, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetVectorStoreFilesRequest(vectorStoreId, filter?.ToString(), limit, order?.ToString(), after, before, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => VectorStoreFile.DeserializeVectorStoreFile(e), ClientDiagnostics, _pipeline, "VectorStoresClient.GetVectorStoreFiles", "data", null, context); + } + + /// Returns a list of vector store files. + /// Identifier of the vector store. + /// Filter by file status. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + /// 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. + /// 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. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Pageable GetVectorStoreFiles(string vectorStoreId, VectorStoreFileStatusFilter? filter = null, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetVectorStoreFilesRequest(vectorStoreId, filter?.ToString(), limit, order?.ToString(), after, before, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => VectorStoreFile.DeserializeVectorStoreFile(e), ClientDiagnostics, _pipeline, "VectorStoresClient.GetVectorStoreFiles", "data", null, context); + } + + /// + /// [Protocol Method] Returns a list of vector store files. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// Filter by file status. Allowed values: "in_progress" | "completed" | "failed" | "cancelled". + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc". + /// 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. + /// 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. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetVectorStoreFilesAsync(string vectorStoreId, string filter, int? limit, string order, string after, string before, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetVectorStoreFilesRequest(vectorStoreId, filter, limit, order, after, before, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "VectorStoresClient.GetVectorStoreFiles", "data", null, context); + } + + /// + /// [Protocol Method] Returns a list of vector store files. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the vector store. + /// Filter by file status. Allowed values: "in_progress" | "completed" | "failed" | "cancelled". + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc". + /// 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. + /// 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. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetVectorStoreFiles(string vectorStoreId, string filter, int? limit, string order, string after, string before, RequestContext context) + { + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetVectorStoreFilesRequest(vectorStoreId, filter, limit, order, after, before, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "VectorStoresClient.GetVectorStoreFiles", "data", null, context); + } + + /// Returns a list of vector store files in a batch. + /// Identifier of the file batch. + /// Identifier of the vector store. + /// Filter by file status. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + /// 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. + /// 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. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual AsyncPageable GetVectorStoreFileBatchFilesAsync(string batchId, string vectorStoreId, VectorStoreFileStatusFilter? filter = null, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetVectorStoreFileBatchFilesRequest(batchId, vectorStoreId, filter?.ToString(), limit, order?.ToString(), after, before, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => VectorStoreFile.DeserializeVectorStoreFile(e), ClientDiagnostics, _pipeline, "VectorStoresClient.GetVectorStoreFileBatchFiles", "data", null, context); + } + + /// Returns a list of vector store files in a batch. + /// Identifier of the file batch. + /// Identifier of the vector store. + /// Filter by file status. + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + /// 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. + /// 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. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Pageable GetVectorStoreFileBatchFiles(string batchId, string vectorStoreId, VectorStoreFileStatusFilter? filter = null, int? limit = null, ListSortOrder? order = null, string after = null, string before = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetVectorStoreFileBatchFilesRequest(batchId, vectorStoreId, filter?.ToString(), limit, order?.ToString(), after, before, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => VectorStoreFile.DeserializeVectorStoreFile(e), ClientDiagnostics, _pipeline, "VectorStoresClient.GetVectorStoreFileBatchFiles", "data", null, context); + } + + /// + /// [Protocol Method] Returns a list of vector store files in a batch. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the file batch. + /// Identifier of the vector store. + /// Filter by file status. Allowed values: "in_progress" | "completed" | "failed" | "cancelled". + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc". + /// 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. + /// 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. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetVectorStoreFileBatchFilesAsync(string batchId, string vectorStoreId, string filter, int? limit, string order, string after, string before, RequestContext context) + { + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetVectorStoreFileBatchFilesRequest(batchId, vectorStoreId, filter, limit, order, after, before, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "VectorStoresClient.GetVectorStoreFileBatchFiles", "data", null, context); + } + + /// + /// [Protocol Method] Returns a list of vector store files in a batch. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Identifier of the file batch. + /// Identifier of the vector store. + /// Filter by file status. Allowed values: "in_progress" | "completed" | "failed" | "cancelled". + /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc" | "desc". + /// 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. + /// 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. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetVectorStoreFileBatchFiles(string batchId, string vectorStoreId, string filter, int? limit, string order, string after, string before, RequestContext context) + { + Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); + Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetVectorStoreFileBatchFilesRequest(batchId, vectorStoreId, filter, limit, order, after, before, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "VectorStoresClient.GetVectorStoreFileBatchFiles", "data", null, context); + } + + internal HttpMessage CreateGetVectorStoresRequest(int? limit, string order, string after, string before, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (limit != null) + { + uri.AppendQuery("limit", limit.Value, true); + } + if (order != null) + { + uri.AppendQuery("order", order, true); + } + if (after != null) + { + uri.AppendQuery("after", after, true); + } + if (before != null) + { + uri.AppendQuery("before", before, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateVectorStoreRequest(RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetVectorStoreRequest(string vectorStoreId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(vectorStoreId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateModifyVectorStoreRequest(string vectorStoreId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(vectorStoreId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateInternalDeleteVectorStoreRequest(string vectorStoreId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(vectorStoreId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetVectorStoreFilesRequest(string vectorStoreId, string filter, int? limit, string order, string after, string before, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(vectorStoreId, true); + if (filter != null) + { + uri.AppendQuery("filter", filter, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + if (limit != null) + { + uri.AppendQuery("limit", limit.Value, true); + } + if (order != null) + { + uri.AppendQuery("order", order, true); + } + if (after != null) + { + uri.AppendQuery("after", after, true); + } + if (before != null) + { + uri.AppendQuery("before", before, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateVectorStoreFileRequest(string vectorStoreId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(vectorStoreId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetVectorStoreFileRequest(string fileId, string vectorStoreId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(fileId, true); + uri.AppendPath("/", false); + uri.AppendPath(vectorStoreId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateInternalDeleteVectorStoreFileRequest(string fileId, string vectorStoreId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(fileId, true); + uri.AppendPath("/", false); + uri.AppendPath(vectorStoreId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateVectorStoreFileBatchRequest(string vectorStoreId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(vectorStoreId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetVectorStoreFileBatchRequest(string batchId, string vectorStoreId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(batchId, true); + uri.AppendPath("/", false); + uri.AppendPath(vectorStoreId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCancelVectorStoreFileBatchRequest(string batchId, string vectorStoreId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(batchId, true); + uri.AppendPath("/cancel/", false); + uri.AppendPath(vectorStoreId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetVectorStoreFileBatchFilesRequest(string batchId, string vectorStoreId, string filter, int? limit, string order, string after, string before, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(batchId, true); + uri.AppendPath("/files/", false); + uri.AppendPath(vectorStoreId, true); + if (filter != null) + { + uri.AppendQuery("filter", filter, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + if (limit != null) + { + uri.AppendQuery("limit", limit.Value, true); + } + if (order != null) + { + uri.AppendQuery("order", order, true); + } + if (after != null) + { + uri.AppendQuery("after", after, true); + } + if (before != null) + { + uri.AppendQuery("before", before, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + private static RequestContext DefaultRequestContext = new RequestContext(); + internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) + { + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new RequestContext() { CancellationToken = cancellationToken }; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + } +} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsAdministrationClientOptions.cs b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoresClientOptions.cs similarity index 70% rename from sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsAdministrationClientOptions.cs rename to sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoresClientOptions.cs index 9cb1de8e0318..29941a4e8f70 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/PersistentAgentsAdministrationClientOptions.cs +++ b/sdk/ai/Azure.AI.Agents.Persistent/src/Generated/VectorStoresClientOptions.cs @@ -10,8 +10,8 @@ namespace Azure.AI.Agents.Persistent { - /// Client options for PersistentAgentsAdministrationClient. - public partial class PersistentAgentsAdministrationClientOptions : ClientOptions + /// Client options for VectorStoresClient. + public partial class VectorStoresClientOptions : ClientOptions { private const ServiceVersion LatestVersion = ServiceVersion.V1; @@ -26,8 +26,8 @@ public enum ServiceVersion internal string Version { get; } - /// Initializes new instance of PersistentAgentsAdministrationClientOptions. - public PersistentAgentsAdministrationClientOptions(ServiceVersion version = LatestVersion) + /// Initializes new instance of VectorStoresClientOptions. + public VectorStoresClientOptions(ServiceVersion version = LatestVersion) { Version = version switch { diff --git a/sdk/ai/Azure.AI.Agents.Persistent/tests/Generated/Samples/Samples_VectorStoresClient.cs b/sdk/ai/Azure.AI.Agents.Persistent/tests/Generated/Samples/Samples_VectorStoresClient.cs new file mode 100644 index 000000000000..05575ca8e5d7 --- /dev/null +++ b/sdk/ai/Azure.AI.Agents.Persistent/tests/Generated/Samples/Samples_VectorStoresClient.cs @@ -0,0 +1,5395 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.AI.Agents.Persistent.Samples +{ + public partial class Samples_VectorStoresClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_CreateVectorStore_VectorStoresCreateVectorStoreMaximumSet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + file_ids = new object[] + { +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt" + }, + name = "u", + configuration = new + { + data_sources = new object[] + { +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +} + }, + }, + expires_after = new + { + anchor = "last_active_at", + days = 73, + }, + metadata = new + { + key9029 = "ghicfhykvpyj", + }, + }); + Response response = client.CreateVectorStore(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_CreateVectorStore_VectorStoresCreateVectorStoreMaximumSet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + file_ids = new object[] + { +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt", +"hileejdmsljnblywbqgrycpbeczbt" + }, + name = "u", + configuration = new + { + data_sources = new object[] + { +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +} + }, + }, + expires_after = new + { + anchor = "last_active_at", + days = 73, + }, + metadata = new + { + key9029 = "ghicfhykvpyj", + }, + }); + Response response = await client.CreateVectorStoreAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_CreateVectorStore_VectorStoresCreateVectorStoreMaximumSet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.CreateVectorStore(); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_CreateVectorStore_VectorStoresCreateVectorStoreMaximumSet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.CreateVectorStoreAsync(); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_CreateVectorStore_VectorStoresCreateVectorStoreMinimumSet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.CreateVectorStore(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_CreateVectorStore_VectorStoresCreateVectorStoreMinimumSet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.CreateVectorStoreAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_CreateVectorStore_VectorStoresCreateVectorStoreMinimumSet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.CreateVectorStore(); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_CreateVectorStore_VectorStoresCreateVectorStoreMinimumSet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.CreateVectorStoreAsync(); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStore_VectorStoresGetVectorStoreMaximumSet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.GetVectorStore("vjsfufonwjwzvygdq", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStore_VectorStoresGetVectorStoreMaximumSet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.GetVectorStoreAsync("vjsfufonwjwzvygdq", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStore_VectorStoresGetVectorStoreMaximumSet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.GetVectorStore("vjsfufonwjwzvygdq"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStore_VectorStoresGetVectorStoreMaximumSet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.GetVectorStoreAsync("vjsfufonwjwzvygdq"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStore_VectorStoresGetVectorStoreMinimumSet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.GetVectorStore("jhrejmwmyblsdagsx", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStore_VectorStoresGetVectorStoreMinimumSet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.GetVectorStoreAsync("jhrejmwmyblsdagsx", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStore_VectorStoresGetVectorStoreMinimumSet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.GetVectorStore("jhrejmwmyblsdagsx"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStore_VectorStoresGetVectorStoreMinimumSet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.GetVectorStoreAsync("jhrejmwmyblsdagsx"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_ModifyVectorStore_VectorStoresModifyVectorStoreMaximumSet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + name = "jcrzfsgxsgelufbkjidfvnu", + expires_after = new + { + anchor = "last_active_at", + days = 73, + }, + metadata = new + { + key9792 = "cxmmdtwupsjnjixdoaravhbkrqqqm", + }, + }); + Response response = client.ModifyVectorStore("pqhrqxzleymrjogjppdtlmxlsfculn", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_ModifyVectorStore_VectorStoresModifyVectorStoreMaximumSet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + name = "jcrzfsgxsgelufbkjidfvnu", + expires_after = new + { + anchor = "last_active_at", + days = 73, + }, + metadata = new + { + key9792 = "cxmmdtwupsjnjixdoaravhbkrqqqm", + }, + }); + Response response = await client.ModifyVectorStoreAsync("pqhrqxzleymrjogjppdtlmxlsfculn", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_ModifyVectorStore_VectorStoresModifyVectorStoreMaximumSet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.ModifyVectorStore("pqhrqxzleymrjogjppdtlmxlsfculn"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_ModifyVectorStore_VectorStoresModifyVectorStoreMaximumSet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.ModifyVectorStoreAsync("pqhrqxzleymrjogjppdtlmxlsfculn"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_ModifyVectorStore_VectorStoresModifyVectorStoreMinimumSet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.ModifyVectorStore("jlamdmhxwayxxeiexcyulxcocw", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_ModifyVectorStore_VectorStoresModifyVectorStoreMinimumSet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.ModifyVectorStoreAsync("jlamdmhxwayxxeiexcyulxcocw", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_ModifyVectorStore_VectorStoresModifyVectorStoreMinimumSet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.ModifyVectorStore("jlamdmhxwayxxeiexcyulxcocw"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_ModifyVectorStore_VectorStoresModifyVectorStoreMinimumSet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.ModifyVectorStoreAsync("jlamdmhxwayxxeiexcyulxcocw"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_CreateVectorStoreFile_VectorStoreFilesCreateVectorStoreFileMaximumSet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + file_id = "emdzaopxo", + data_source = new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + }); + Response response = client.CreateVectorStoreFile("kox", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_CreateVectorStoreFile_VectorStoreFilesCreateVectorStoreFileMaximumSet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + file_id = "emdzaopxo", + data_source = new + { + uri = "soctjzrqyjyxixlqr", + type = "uri_asset", + }, + }); + Response response = await client.CreateVectorStoreFileAsync("kox", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_CreateVectorStoreFile_VectorStoreFilesCreateVectorStoreFileMaximumSet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.CreateVectorStoreFile("kox"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_CreateVectorStoreFile_VectorStoreFilesCreateVectorStoreFileMaximumSet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.CreateVectorStoreFileAsync("kox"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStoreFile_VectorStoreFilesGetVectorStoreFileMaximumSet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.GetVectorStoreFile("qusinxkarhcskvxntuym", "bds", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStoreFile_VectorStoreFilesGetVectorStoreFileMaximumSet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.GetVectorStoreFileAsync("qusinxkarhcskvxntuym", "bds", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStoreFile_VectorStoreFilesGetVectorStoreFileMaximumSet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.GetVectorStoreFile("qusinxkarhcskvxntuym", "bds"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStoreFile_VectorStoreFilesGetVectorStoreFileMaximumSet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.GetVectorStoreFileAsync("qusinxkarhcskvxntuym", "bds"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStoreFile_VectorStoreFilesGetVectorStoreFileMinimumSet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.GetVectorStoreFile("sar", "fakyvuniwxszpqxxcovnohhacypzp", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStoreFile_VectorStoreFilesGetVectorStoreFileMinimumSet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.GetVectorStoreFileAsync("sar", "fakyvuniwxszpqxxcovnohhacypzp", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStoreFile_VectorStoreFilesGetVectorStoreFileMinimumSet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.GetVectorStoreFile("sar", "fakyvuniwxszpqxxcovnohhacypzp"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStoreFile_VectorStoreFilesGetVectorStoreFileMinimumSet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.GetVectorStoreFileAsync("sar", "fakyvuniwxszpqxxcovnohhacypzp"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_CreateVectorStoreFileBatch_VectorStoreFileBatchesCreateVectorStoreFileBatchMaximumSet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + file_ids = new object[] + { +"sseovtmhsfpghlqyzulhnhhhasall", +"sseovtmhsfpghlqyzulhnhhhasall", +"sseovtmhsfpghlqyzulhnhhhasall", +"sseovtmhsfpghlqyzulhnhhhasall", +"sseovtmhsfpghlqyzulhnhhhasall", +"sseovtmhsfpghlqyzulhnhhhasall", +"sseovtmhsfpghlqyzulhnhhhasall", +"sseovtmhsfpghlqyzulhnhhhasall" + }, + data_sources = new object[] + { +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +} + }, + }); + Response response = client.CreateVectorStoreFileBatch("bvcjtemrnqtycjuaerlxllednm", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_CreateVectorStoreFileBatch_VectorStoreFileBatchesCreateVectorStoreFileBatchMaximumSet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + file_ids = new object[] + { +"sseovtmhsfpghlqyzulhnhhhasall", +"sseovtmhsfpghlqyzulhnhhhasall", +"sseovtmhsfpghlqyzulhnhhhasall", +"sseovtmhsfpghlqyzulhnhhhasall", +"sseovtmhsfpghlqyzulhnhhhasall", +"sseovtmhsfpghlqyzulhnhhhasall", +"sseovtmhsfpghlqyzulhnhhhasall", +"sseovtmhsfpghlqyzulhnhhhasall" + }, + data_sources = new object[] + { +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +}, +new +{ +uri = "soctjzrqyjyxixlqr", +type = "uri_asset", +} + }, + }); + Response response = await client.CreateVectorStoreFileBatchAsync("bvcjtemrnqtycjuaerlxllednm", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_CreateVectorStoreFileBatch_VectorStoreFileBatchesCreateVectorStoreFileBatchMaximumSet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.CreateVectorStoreFileBatch("bvcjtemrnqtycjuaerlxllednm"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_CreateVectorStoreFileBatch_VectorStoreFileBatchesCreateVectorStoreFileBatchMaximumSet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.CreateVectorStoreFileBatchAsync("bvcjtemrnqtycjuaerlxllednm"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_CreateVectorStoreFileBatch_VectorStoreFileBatchesCreateVectorStoreFileBatchMinimumSet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.CreateVectorStoreFileBatch("eyxdrn", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_CreateVectorStoreFileBatch_VectorStoreFileBatchesCreateVectorStoreFileBatchMinimumSet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.CreateVectorStoreFileBatchAsync("eyxdrn", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_CreateVectorStoreFileBatch_VectorStoreFileBatchesCreateVectorStoreFileBatchMinimumSet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.CreateVectorStoreFileBatch("eyxdrn"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_CreateVectorStoreFileBatch_VectorStoreFileBatchesCreateVectorStoreFileBatchMinimumSet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.CreateVectorStoreFileBatchAsync("eyxdrn"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStoreFileBatch_VectorStoreFileBatchesGetVectorStoreFileBatchMaximumSet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.GetVectorStoreFileBatch("juytv", "kdcqszoqvfaipuhvijnwxmegovmeuv", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStoreFileBatch_VectorStoreFileBatchesGetVectorStoreFileBatchMaximumSet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.GetVectorStoreFileBatchAsync("juytv", "kdcqszoqvfaipuhvijnwxmegovmeuv", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStoreFileBatch_VectorStoreFileBatchesGetVectorStoreFileBatchMaximumSet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.GetVectorStoreFileBatch("juytv", "kdcqszoqvfaipuhvijnwxmegovmeuv"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStoreFileBatch_VectorStoreFileBatchesGetVectorStoreFileBatchMaximumSet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.GetVectorStoreFileBatchAsync("juytv", "kdcqszoqvfaipuhvijnwxmegovmeuv"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStoreFileBatch_VectorStoreFileBatchesGetVectorStoreFileBatchMinimumSet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.GetVectorStoreFileBatch("pmzxfueg", "kz", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStoreFileBatch_VectorStoreFileBatchesGetVectorStoreFileBatchMinimumSet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.GetVectorStoreFileBatchAsync("pmzxfueg", "kz", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStoreFileBatch_VectorStoreFileBatchesGetVectorStoreFileBatchMinimumSet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.GetVectorStoreFileBatch("pmzxfueg", "kz"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStoreFileBatch_VectorStoreFileBatchesGetVectorStoreFileBatchMinimumSet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.GetVectorStoreFileBatchAsync("pmzxfueg", "kz"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_CancelVectorStoreFileBatch_VectorStoreFileBatchesCancelVectorStoreFileBatchMaximumSet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.CancelVectorStoreFileBatch("lqtvimqtqecqy", "kpjojtaxsspjvzyxmfgwxusqde", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_CancelVectorStoreFileBatch_VectorStoreFileBatchesCancelVectorStoreFileBatchMaximumSet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.CancelVectorStoreFileBatchAsync("lqtvimqtqecqy", "kpjojtaxsspjvzyxmfgwxusqde", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_CancelVectorStoreFileBatch_VectorStoreFileBatchesCancelVectorStoreFileBatchMaximumSet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.CancelVectorStoreFileBatch("lqtvimqtqecqy", "kpjojtaxsspjvzyxmfgwxusqde"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_CancelVectorStoreFileBatch_VectorStoreFileBatchesCancelVectorStoreFileBatchMaximumSet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.CancelVectorStoreFileBatchAsync("lqtvimqtqecqy", "kpjojtaxsspjvzyxmfgwxusqde"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_CancelVectorStoreFileBatch_VectorStoreFileBatchesCancelVectorStoreFileBatchMinimumSet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.CancelVectorStoreFileBatch("qsniwwejf", "fldyjeftzzkqinhz", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_CancelVectorStoreFileBatch_VectorStoreFileBatchesCancelVectorStoreFileBatchMinimumSet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.CancelVectorStoreFileBatchAsync("qsniwwejf", "fldyjeftzzkqinhz", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_CancelVectorStoreFileBatch_VectorStoreFileBatchesCancelVectorStoreFileBatchMinimumSet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = client.CancelVectorStoreFileBatch("qsniwwejf", "fldyjeftzzkqinhz"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_CancelVectorStoreFileBatch_VectorStoreFileBatchesCancelVectorStoreFileBatchMinimumSet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + Response response = await client.CancelVectorStoreFileBatchAsync("qsniwwejf", "fldyjeftzzkqinhz"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStores_VectorStoresListVectorStoresMaximumSet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + foreach (BinaryData item in client.GetVectorStores(20, "asc", "cfgbzxzpyyflnolbxpkbsz", "forspimiuzzd", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStores_VectorStoresListVectorStoresMaximumSet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + await foreach (BinaryData item in client.GetVectorStoresAsync(20, "asc", "cfgbzxzpyyflnolbxpkbsz", "forspimiuzzd", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStores_VectorStoresListVectorStoresMaximumSet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + foreach (PersistentAgentsVectorStore item in client.GetVectorStores()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStores_VectorStoresListVectorStoresMaximumSet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + await foreach (PersistentAgentsVectorStore item in client.GetVectorStoresAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStores_VectorStoresListVectorStoresMinimumSet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + foreach (BinaryData item in client.GetVectorStores(null, null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStores_VectorStoresListVectorStoresMinimumSet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + await foreach (BinaryData item in client.GetVectorStoresAsync(null, null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("in_progress").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("cancelled").ToString()); + Console.WriteLine(result.GetProperty("file_counts").GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_active_at").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStores_VectorStoresListVectorStoresMinimumSet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + foreach (PersistentAgentsVectorStore item in client.GetVectorStores()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStores_VectorStoresListVectorStoresMinimumSet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + await foreach (PersistentAgentsVectorStore item in client.GetVectorStoresAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStoreFiles_VectorStoreFilesListVectorStoreFilesMaximumSet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + foreach (BinaryData item in client.GetVectorStoreFiles("nuppye", "in_progress", 8, "asc", "cayfrop", "rdxomcqockbejgfxd", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStoreFiles_VectorStoreFilesListVectorStoreFilesMaximumSet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + await foreach (BinaryData item in client.GetVectorStoreFilesAsync("nuppye", "in_progress", 8, "asc", "cayfrop", "rdxomcqockbejgfxd", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStoreFiles_VectorStoreFilesListVectorStoreFilesMaximumSet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + foreach (VectorStoreFile item in client.GetVectorStoreFiles("nuppye")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStoreFiles_VectorStoreFilesListVectorStoreFilesMaximumSet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + await foreach (VectorStoreFile item in client.GetVectorStoreFilesAsync("nuppye")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStoreFiles_VectorStoreFilesListVectorStoreFilesMinimumSet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + foreach (BinaryData item in client.GetVectorStoreFiles("rijuypqar", null, null, null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStoreFiles_VectorStoreFilesListVectorStoreFilesMinimumSet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + await foreach (BinaryData item in client.GetVectorStoreFilesAsync("rijuypqar", null, null, null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStoreFiles_VectorStoreFilesListVectorStoreFilesMinimumSet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + foreach (VectorStoreFile item in client.GetVectorStoreFiles("rijuypqar")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStoreFiles_VectorStoreFilesListVectorStoreFilesMinimumSet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + await foreach (VectorStoreFile item in client.GetVectorStoreFilesAsync("rijuypqar")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStoreFileBatchFiles_VectorStoreFileBatchesListVectorStoreFileBatchFilesMaximumSet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + foreach (BinaryData item in client.GetVectorStoreFileBatchFiles("b", "itweqinnhpanpqxkxwqfi", "in_progress", 22, "asc", "uotopjkuhxuxypqooudmdt", "lunnzgjqyjlrlvsldrkhrjvaqfovp", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStoreFileBatchFiles_VectorStoreFileBatchesListVectorStoreFileBatchFilesMaximumSet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + await foreach (BinaryData item in client.GetVectorStoreFileBatchFilesAsync("b", "itweqinnhpanpqxkxwqfi", "in_progress", 22, "asc", "uotopjkuhxuxypqooudmdt", "lunnzgjqyjlrlvsldrkhrjvaqfovp", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStoreFileBatchFiles_VectorStoreFileBatchesListVectorStoreFileBatchFilesMaximumSet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + foreach (VectorStoreFile item in client.GetVectorStoreFileBatchFiles("b", "itweqinnhpanpqxkxwqfi")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStoreFileBatchFiles_VectorStoreFileBatchesListVectorStoreFileBatchFilesMaximumSet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + await foreach (VectorStoreFile item in client.GetVectorStoreFileBatchFilesAsync("b", "itweqinnhpanpqxkxwqfi")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStoreFileBatchFiles_VectorStoreFileBatchesListVectorStoreFileBatchFilesMinimumSet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + foreach (BinaryData item in client.GetVectorStoreFileBatchFiles("gipykvmemjcss", "awzuqhqpzl", null, null, null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStoreFileBatchFiles_VectorStoreFileBatchesListVectorStoreFileBatchFilesMinimumSet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + await foreach (BinaryData item in client.GetVectorStoreFileBatchFilesAsync("gipykvmemjcss", "awzuqhqpzl", null, null, null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("object").ToString()); + Console.WriteLine(result.GetProperty("usage_bytes").ToString()); + Console.WriteLine(result.GetProperty("created_at").ToString()); + Console.WriteLine(result.GetProperty("vector_store_id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("last_error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("chunking_strategy").GetProperty("type").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_VectorStoresClient_GetVectorStoreFileBatchFiles_VectorStoreFileBatchesListVectorStoreFileBatchFilesMinimumSet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + foreach (VectorStoreFile item in client.GetVectorStoreFileBatchFiles("gipykvmemjcss", "awzuqhqpzl")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_VectorStoresClient_GetVectorStoreFileBatchFiles_VectorStoreFileBatchesListVectorStoreFileBatchFilesMinimumSet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + VectorStoresClient client = new VectorStoresClient(endpoint, credential); + + await foreach (VectorStoreFile item in client.GetVectorStoreFileBatchFilesAsync("gipykvmemjcss", "awzuqhqpzl")) + { + } + } + } +} diff --git a/sdk/ai/Azure.AI.Agents.Persistent/tsp-location.yaml b/sdk/ai/Azure.AI.Agents.Persistent/tsp-location.yaml index 35e2e6045ef4..7332748afaae 100644 --- a/sdk/ai/Azure.AI.Agents.Persistent/tsp-location.yaml +++ b/sdk/ai/Azure.AI.Agents.Persistent/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/ai/Azure.AI.Agents -commit: 6625eb323d07755a1d77c17dc713e484d3c1e00e +commit: 6533a07088b57ded7ee08eb377d72cfbbd0dfccc repo: Azure/azure-rest-api-specs additionalDirectories: