diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.net8.0.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.net8.0.cs index 90a06fa80331..7ecd7ff58c49 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.net8.0.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.net8.0.cs @@ -36,7 +36,7 @@ public ConversationAnalysisClient(System.Uri endpoint, Azure.Core.TokenCredentia } public partial class ConversationsClientOptions : Azure.Core.ClientOptions { - public ConversationsClientOptions(Azure.AI.Language.Conversations.ConversationsClientOptions.ServiceVersion version = Azure.AI.Language.Conversations.ConversationsClientOptions.ServiceVersion.V2024_11_15_Preview) { } + public ConversationsClientOptions(Azure.AI.Language.Conversations.ConversationsClientOptions.ServiceVersion version = Azure.AI.Language.Conversations.ConversationsClientOptions.ServiceVersion.V2025_05_15_Preview) { } public enum ServiceVersion { V2022_05_01 = 1, @@ -44,12 +44,14 @@ public enum ServiceVersion V2024_05_01 = 3, V2024_11_01 = 4, V2024_11_15_Preview = 5, + V2025_05_15_Preview = 6, } } public static partial class ConversationsModelFactory { public static Azure.AI.Language.Conversations.Models.AgeResolution AgeResolution(double value = 0, Azure.AI.Language.Conversations.Models.AgeUnit unit = default(Azure.AI.Language.Conversations.Models.AgeUnit)) { throw null; } - public static Azure.AI.Language.Conversations.Models.AnalyzeConversationOperationInput AnalyzeConversationOperationInput(string displayName = null, Azure.AI.Language.Conversations.Models.MultiLanguageConversationInput conversationInput = null, System.Collections.Generic.IEnumerable actions = null) { throw null; } + public static Azure.AI.Language.Conversations.Models.AIConversationLanguageUnderstandingActionContent AIConversationLanguageUnderstandingActionContent(string projectName = null, string deploymentName = null, Azure.AI.Language.Conversations.Models.StringIndexType? stringIndexType = default(Azure.AI.Language.Conversations.Models.StringIndexType?)) { throw null; } + public static Azure.AI.Language.Conversations.Models.AnalyzeConversationOperationInput AnalyzeConversationOperationInput(string displayName = null, Azure.AI.Language.Conversations.Models.MultiLanguageConversationInput conversationInput = null, System.Collections.Generic.IEnumerable actions = null, float? cancelAfter = default(float?)) { throw null; } public static Azure.AI.Language.Conversations.Models.AnalyzeConversationOperationResult AnalyzeConversationOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Conversations.Models.ConversationActionState status = default(Azure.AI.Language.Conversations.Models.ConversationActionState), string name = null, string kind = null) { throw null; } public static Azure.AI.Language.Conversations.Models.AnalyzeConversationOperationState AnalyzeConversationOperationState(string displayName = null, System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), System.Guid jobId = default(System.Guid), System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.Conversations.Models.ConversationActionState status = default(Azure.AI.Language.Conversations.Models.ConversationActionState), System.Collections.Generic.IEnumerable errors = null, string nextLink = null, Azure.AI.Language.Conversations.Models.ConversationActions actions = null, Azure.AI.Language.Conversations.Models.ConversationRequestStatistics statistics = null) { throw null; } public static Azure.AI.Language.Conversations.Models.AnalyzeConversationResult AnalyzeConversationResult(string query = null, string detectedLanguage = null, Azure.AI.Language.Conversations.Models.PredictionBase prediction = null) { throw null; } @@ -60,11 +62,18 @@ public static partial class ConversationsModelFactory public static Azure.AI.Language.Conversations.Models.BooleanResolution BooleanResolution(bool value = false) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationActionResult ConversationActionResult(Azure.AI.Language.Conversations.Models.AnalyzeConversationResult result = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationActions ConversationActions(int completed = 0, int failed = 0, int inProgress = 0, int total = 0, System.Collections.Generic.IEnumerable items = null) { throw null; } + public static Azure.AI.Language.Conversations.Models.ConversationalAIAnalysis ConversationalAIAnalysis(string id = null, System.Collections.Generic.IEnumerable intents = null, System.Collections.Generic.IEnumerable entities = null) { throw null; } + public static Azure.AI.Language.Conversations.Models.ConversationalAIEntity ConversationalAIEntity(string name = null, string text = null, float confidenceScore = 0f, int offset = 0, int length = 0, string conversationItemId = null, int? conversationItemIndex = default(int?), System.Collections.Generic.IEnumerable resolutions = null, System.Collections.Generic.IEnumerable extraInformation = null) { throw null; } + public static Azure.AI.Language.Conversations.Models.ConversationalAIIntent ConversationalAIIntent(string name = null, string type = null, System.Collections.Generic.IEnumerable conversationItemRanges = null, System.Collections.Generic.IEnumerable entities = null) { throw null; } + public static Azure.AI.Language.Conversations.Models.ConversationalAIResult ConversationalAIResult(System.Collections.Generic.IEnumerable conversations = null, System.Collections.Generic.IEnumerable warnings = null) { throw null; } + public static Azure.AI.Language.Conversations.Models.ConversationalAITask ConversationalAITask(Azure.AI.Language.Conversations.Models.ConversationalAIAnalysisInput analysisInput = null, Azure.AI.Language.Conversations.Models.AIConversationLanguageUnderstandingActionContent parameters = null) { throw null; } + public static Azure.AI.Language.Conversations.Models.ConversationalAITaskResult ConversationalAITaskResult(Azure.AI.Language.Conversations.Models.ConversationalAIResult result = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationalPiiResult ConversationalPiiResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Conversations.Models.ConversationStatistics statistics = null, System.Collections.Generic.IEnumerable conversationItems = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationEntity ConversationEntity(string category = null, string text = null, int offset = 0, int length = 0, float confidence = 0f, System.Collections.Generic.IEnumerable resolutions = null, System.Collections.Generic.IEnumerable extraInformation = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationError ConversationError(Azure.AI.Language.Conversations.Models.ConversationErrorCode code = default(Azure.AI.Language.Conversations.Models.ConversationErrorCode), string message = null, string target = null, System.Collections.Generic.IEnumerable details = null, Azure.AI.Language.Conversations.Models.InnerErrorModel innererror = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationInput ConversationInput(string id = null, string language = null, string modality = null, Azure.AI.Language.Conversations.Models.ConversationDomain? domain = default(Azure.AI.Language.Conversations.Models.ConversationDomain?)) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationIntent ConversationIntent(string category = null, float confidence = 0f) { throw null; } + public static Azure.AI.Language.Conversations.Models.ConversationItemRange ConversationItemRange(int offset = 0, int count = 0) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent ConversationLanguageUnderstandingActionContent(string projectName = null, string deploymentName = null, bool? verbose = default(bool?), bool? isLoggingEnabled = default(bool?), Azure.AI.Language.Conversations.Models.StringIndexType? stringIndexType = default(Azure.AI.Language.Conversations.Models.StringIndexType?), string directTarget = null, System.Collections.Generic.IDictionary targetProjectParameters = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingInput ConversationLanguageUnderstandingInput(Azure.AI.Language.Conversations.Models.ConversationAnalysisInput conversationInput = null, Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent actionContent = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationPiiItemResult ConversationPiiItemResult(string id = null, Azure.AI.Language.Conversations.Models.RedactedTranscriptContent redactedContent = null, System.Collections.Generic.IEnumerable entities = null) { throw null; } @@ -235,6 +244,33 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public static bool operator !=(Azure.AI.Language.Conversations.Models.AgeUnit left, Azure.AI.Language.Conversations.Models.AgeUnit right) { throw null; } public override string ToString() { throw null; } } + public partial class AIConversation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AIConversation(string id, Azure.AI.Language.Conversations.Models.InputModality modality, string language, System.Collections.Generic.IEnumerable conversationItems) { } + public System.Collections.Generic.IList ConversationItems { get { throw null; } } + public string Id { get { throw null; } } + public string Language { get { throw null; } } + public Azure.AI.Language.Conversations.Models.InputModality Modality { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.AIConversation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.AIConversation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AIConversationLanguageUnderstandingActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AIConversationLanguageUnderstandingActionContent(string projectName, string deploymentName) { } + public string DeploymentName { get { throw null; } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Conversations.Models.StringIndexType? StringIndexType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.AIConversationLanguageUnderstandingActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.AIConversationLanguageUnderstandingActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public abstract partial class AnalysisConfig : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { protected AnalysisConfig() { } @@ -281,6 +317,7 @@ public partial class AnalyzeConversationOperationInput : System.ClientModel.Prim { public AnalyzeConversationOperationInput(Azure.AI.Language.Conversations.Models.MultiLanguageConversationInput conversationInput, System.Collections.Generic.IEnumerable actions) { } public System.Collections.Generic.IList Actions { get { throw null; } } + public float? CancelAfter { get { throw null; } set { } } public Azure.AI.Language.Conversations.Models.MultiLanguageConversationInput ConversationInput { get { throw null; } } public string DisplayName { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -495,6 +532,111 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.AI.Language.Conversations.Models.ConversationActionState left, Azure.AI.Language.Conversations.Models.ConversationActionState right) { throw null; } public override string ToString() { throw null; } } + public partial class ConversationalAIAnalysis : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ConversationalAIAnalysis() { } + public System.Collections.Generic.IReadOnlyList Entities { get { throw null; } } + public string Id { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Intents { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIAnalysis System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIAnalysis System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ConversationalAIAnalysisInput : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConversationalAIAnalysisInput(System.Collections.Generic.IEnumerable conversations) { } + public System.Collections.Generic.IList Conversations { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIAnalysisInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIAnalysisInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ConversationalAIEntity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ConversationalAIEntity() { } + public float ConfidenceScore { get { throw null; } } + public string ConversationItemId { get { throw null; } } + public int? ConversationItemIndex { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ExtraInformation { get { throw null; } } + public int Length { get { throw null; } } + public string Name { get { throw null; } } + public int Offset { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Resolutions { get { throw null; } } + public string Text { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIEntity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIEntity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ConversationalAIIntent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ConversationalAIIntent() { } + public System.Collections.Generic.IReadOnlyList ConversationItemRanges { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Entities { get { throw null; } } + public string Name { get { throw null; } } + public string Type { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIIntent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIIntent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ConversationalAIItem : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConversationalAIItem(string id, string participantId, string text) { } + public string Id { get { throw null; } } + public string ParticipantId { get { throw null; } } + public string Text { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIItem System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIItem System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ConversationalAIResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ConversationalAIResult() { } + public System.Collections.Generic.IReadOnlyList Conversations { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ConversationalAITask : Azure.AI.Language.Conversations.Models.AnalyzeConversationInput, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConversationalAITask(Azure.AI.Language.Conversations.Models.ConversationalAIAnalysisInput analysisInput, Azure.AI.Language.Conversations.Models.AIConversationLanguageUnderstandingActionContent parameters) { } + public Azure.AI.Language.Conversations.Models.ConversationalAIAnalysisInput AnalysisInput { get { throw null; } } + public Azure.AI.Language.Conversations.Models.AIConversationLanguageUnderstandingActionContent Parameters { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAITask System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAITask System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ConversationalAITaskResult : Azure.AI.Language.Conversations.Models.AnalyzeConversationActionResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ConversationalAITaskResult() { } + public Azure.AI.Language.Conversations.Models.ConversationalAIResult Result { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAITaskResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAITaskResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class ConversationalPiiResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal ConversationalPiiResult() { } @@ -676,6 +818,18 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class ConversationItemRange : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ConversationItemRange() { } + public int Count { get { throw null; } } + public int Offset { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationItemRange System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationItemRange System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class ConversationLanguageUnderstandingActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ConversationLanguageUnderstandingActionContent(string projectName, string deploymentName) { } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.netstandard2.0.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.netstandard2.0.cs index 90a06fa80331..7ecd7ff58c49 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.netstandard2.0.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.netstandard2.0.cs @@ -36,7 +36,7 @@ public ConversationAnalysisClient(System.Uri endpoint, Azure.Core.TokenCredentia } public partial class ConversationsClientOptions : Azure.Core.ClientOptions { - public ConversationsClientOptions(Azure.AI.Language.Conversations.ConversationsClientOptions.ServiceVersion version = Azure.AI.Language.Conversations.ConversationsClientOptions.ServiceVersion.V2024_11_15_Preview) { } + public ConversationsClientOptions(Azure.AI.Language.Conversations.ConversationsClientOptions.ServiceVersion version = Azure.AI.Language.Conversations.ConversationsClientOptions.ServiceVersion.V2025_05_15_Preview) { } public enum ServiceVersion { V2022_05_01 = 1, @@ -44,12 +44,14 @@ public enum ServiceVersion V2024_05_01 = 3, V2024_11_01 = 4, V2024_11_15_Preview = 5, + V2025_05_15_Preview = 6, } } public static partial class ConversationsModelFactory { public static Azure.AI.Language.Conversations.Models.AgeResolution AgeResolution(double value = 0, Azure.AI.Language.Conversations.Models.AgeUnit unit = default(Azure.AI.Language.Conversations.Models.AgeUnit)) { throw null; } - public static Azure.AI.Language.Conversations.Models.AnalyzeConversationOperationInput AnalyzeConversationOperationInput(string displayName = null, Azure.AI.Language.Conversations.Models.MultiLanguageConversationInput conversationInput = null, System.Collections.Generic.IEnumerable actions = null) { throw null; } + public static Azure.AI.Language.Conversations.Models.AIConversationLanguageUnderstandingActionContent AIConversationLanguageUnderstandingActionContent(string projectName = null, string deploymentName = null, Azure.AI.Language.Conversations.Models.StringIndexType? stringIndexType = default(Azure.AI.Language.Conversations.Models.StringIndexType?)) { throw null; } + public static Azure.AI.Language.Conversations.Models.AnalyzeConversationOperationInput AnalyzeConversationOperationInput(string displayName = null, Azure.AI.Language.Conversations.Models.MultiLanguageConversationInput conversationInput = null, System.Collections.Generic.IEnumerable actions = null, float? cancelAfter = default(float?)) { throw null; } public static Azure.AI.Language.Conversations.Models.AnalyzeConversationOperationResult AnalyzeConversationOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Conversations.Models.ConversationActionState status = default(Azure.AI.Language.Conversations.Models.ConversationActionState), string name = null, string kind = null) { throw null; } public static Azure.AI.Language.Conversations.Models.AnalyzeConversationOperationState AnalyzeConversationOperationState(string displayName = null, System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), System.Guid jobId = default(System.Guid), System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.Conversations.Models.ConversationActionState status = default(Azure.AI.Language.Conversations.Models.ConversationActionState), System.Collections.Generic.IEnumerable errors = null, string nextLink = null, Azure.AI.Language.Conversations.Models.ConversationActions actions = null, Azure.AI.Language.Conversations.Models.ConversationRequestStatistics statistics = null) { throw null; } public static Azure.AI.Language.Conversations.Models.AnalyzeConversationResult AnalyzeConversationResult(string query = null, string detectedLanguage = null, Azure.AI.Language.Conversations.Models.PredictionBase prediction = null) { throw null; } @@ -60,11 +62,18 @@ public static partial class ConversationsModelFactory public static Azure.AI.Language.Conversations.Models.BooleanResolution BooleanResolution(bool value = false) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationActionResult ConversationActionResult(Azure.AI.Language.Conversations.Models.AnalyzeConversationResult result = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationActions ConversationActions(int completed = 0, int failed = 0, int inProgress = 0, int total = 0, System.Collections.Generic.IEnumerable items = null) { throw null; } + public static Azure.AI.Language.Conversations.Models.ConversationalAIAnalysis ConversationalAIAnalysis(string id = null, System.Collections.Generic.IEnumerable intents = null, System.Collections.Generic.IEnumerable entities = null) { throw null; } + public static Azure.AI.Language.Conversations.Models.ConversationalAIEntity ConversationalAIEntity(string name = null, string text = null, float confidenceScore = 0f, int offset = 0, int length = 0, string conversationItemId = null, int? conversationItemIndex = default(int?), System.Collections.Generic.IEnumerable resolutions = null, System.Collections.Generic.IEnumerable extraInformation = null) { throw null; } + public static Azure.AI.Language.Conversations.Models.ConversationalAIIntent ConversationalAIIntent(string name = null, string type = null, System.Collections.Generic.IEnumerable conversationItemRanges = null, System.Collections.Generic.IEnumerable entities = null) { throw null; } + public static Azure.AI.Language.Conversations.Models.ConversationalAIResult ConversationalAIResult(System.Collections.Generic.IEnumerable conversations = null, System.Collections.Generic.IEnumerable warnings = null) { throw null; } + public static Azure.AI.Language.Conversations.Models.ConversationalAITask ConversationalAITask(Azure.AI.Language.Conversations.Models.ConversationalAIAnalysisInput analysisInput = null, Azure.AI.Language.Conversations.Models.AIConversationLanguageUnderstandingActionContent parameters = null) { throw null; } + public static Azure.AI.Language.Conversations.Models.ConversationalAITaskResult ConversationalAITaskResult(Azure.AI.Language.Conversations.Models.ConversationalAIResult result = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationalPiiResult ConversationalPiiResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Conversations.Models.ConversationStatistics statistics = null, System.Collections.Generic.IEnumerable conversationItems = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationEntity ConversationEntity(string category = null, string text = null, int offset = 0, int length = 0, float confidence = 0f, System.Collections.Generic.IEnumerable resolutions = null, System.Collections.Generic.IEnumerable extraInformation = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationError ConversationError(Azure.AI.Language.Conversations.Models.ConversationErrorCode code = default(Azure.AI.Language.Conversations.Models.ConversationErrorCode), string message = null, string target = null, System.Collections.Generic.IEnumerable details = null, Azure.AI.Language.Conversations.Models.InnerErrorModel innererror = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationInput ConversationInput(string id = null, string language = null, string modality = null, Azure.AI.Language.Conversations.Models.ConversationDomain? domain = default(Azure.AI.Language.Conversations.Models.ConversationDomain?)) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationIntent ConversationIntent(string category = null, float confidence = 0f) { throw null; } + public static Azure.AI.Language.Conversations.Models.ConversationItemRange ConversationItemRange(int offset = 0, int count = 0) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent ConversationLanguageUnderstandingActionContent(string projectName = null, string deploymentName = null, bool? verbose = default(bool?), bool? isLoggingEnabled = default(bool?), Azure.AI.Language.Conversations.Models.StringIndexType? stringIndexType = default(Azure.AI.Language.Conversations.Models.StringIndexType?), string directTarget = null, System.Collections.Generic.IDictionary targetProjectParameters = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingInput ConversationLanguageUnderstandingInput(Azure.AI.Language.Conversations.Models.ConversationAnalysisInput conversationInput = null, Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent actionContent = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationPiiItemResult ConversationPiiItemResult(string id = null, Azure.AI.Language.Conversations.Models.RedactedTranscriptContent redactedContent = null, System.Collections.Generic.IEnumerable entities = null) { throw null; } @@ -235,6 +244,33 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public static bool operator !=(Azure.AI.Language.Conversations.Models.AgeUnit left, Azure.AI.Language.Conversations.Models.AgeUnit right) { throw null; } public override string ToString() { throw null; } } + public partial class AIConversation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AIConversation(string id, Azure.AI.Language.Conversations.Models.InputModality modality, string language, System.Collections.Generic.IEnumerable conversationItems) { } + public System.Collections.Generic.IList ConversationItems { get { throw null; } } + public string Id { get { throw null; } } + public string Language { get { throw null; } } + public Azure.AI.Language.Conversations.Models.InputModality Modality { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.AIConversation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.AIConversation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AIConversationLanguageUnderstandingActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AIConversationLanguageUnderstandingActionContent(string projectName, string deploymentName) { } + public string DeploymentName { get { throw null; } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Conversations.Models.StringIndexType? StringIndexType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.AIConversationLanguageUnderstandingActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.AIConversationLanguageUnderstandingActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public abstract partial class AnalysisConfig : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { protected AnalysisConfig() { } @@ -281,6 +317,7 @@ public partial class AnalyzeConversationOperationInput : System.ClientModel.Prim { public AnalyzeConversationOperationInput(Azure.AI.Language.Conversations.Models.MultiLanguageConversationInput conversationInput, System.Collections.Generic.IEnumerable actions) { } public System.Collections.Generic.IList Actions { get { throw null; } } + public float? CancelAfter { get { throw null; } set { } } public Azure.AI.Language.Conversations.Models.MultiLanguageConversationInput ConversationInput { get { throw null; } } public string DisplayName { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -495,6 +532,111 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.AI.Language.Conversations.Models.ConversationActionState left, Azure.AI.Language.Conversations.Models.ConversationActionState right) { throw null; } public override string ToString() { throw null; } } + public partial class ConversationalAIAnalysis : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ConversationalAIAnalysis() { } + public System.Collections.Generic.IReadOnlyList Entities { get { throw null; } } + public string Id { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Intents { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIAnalysis System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIAnalysis System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ConversationalAIAnalysisInput : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConversationalAIAnalysisInput(System.Collections.Generic.IEnumerable conversations) { } + public System.Collections.Generic.IList Conversations { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIAnalysisInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIAnalysisInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ConversationalAIEntity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ConversationalAIEntity() { } + public float ConfidenceScore { get { throw null; } } + public string ConversationItemId { get { throw null; } } + public int? ConversationItemIndex { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ExtraInformation { get { throw null; } } + public int Length { get { throw null; } } + public string Name { get { throw null; } } + public int Offset { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Resolutions { get { throw null; } } + public string Text { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIEntity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIEntity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ConversationalAIIntent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ConversationalAIIntent() { } + public System.Collections.Generic.IReadOnlyList ConversationItemRanges { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Entities { get { throw null; } } + public string Name { get { throw null; } } + public string Type { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIIntent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIIntent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ConversationalAIItem : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConversationalAIItem(string id, string participantId, string text) { } + public string Id { get { throw null; } } + public string ParticipantId { get { throw null; } } + public string Text { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIItem System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIItem System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ConversationalAIResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ConversationalAIResult() { } + public System.Collections.Generic.IReadOnlyList Conversations { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAIResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ConversationalAITask : Azure.AI.Language.Conversations.Models.AnalyzeConversationInput, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConversationalAITask(Azure.AI.Language.Conversations.Models.ConversationalAIAnalysisInput analysisInput, Azure.AI.Language.Conversations.Models.AIConversationLanguageUnderstandingActionContent parameters) { } + public Azure.AI.Language.Conversations.Models.ConversationalAIAnalysisInput AnalysisInput { get { throw null; } } + public Azure.AI.Language.Conversations.Models.AIConversationLanguageUnderstandingActionContent Parameters { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAITask System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAITask System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ConversationalAITaskResult : Azure.AI.Language.Conversations.Models.AnalyzeConversationActionResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ConversationalAITaskResult() { } + public Azure.AI.Language.Conversations.Models.ConversationalAIResult Result { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAITaskResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationalAITaskResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class ConversationalPiiResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal ConversationalPiiResult() { } @@ -676,6 +818,18 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class ConversationItemRange : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ConversationItemRange() { } + public int Count { get { throw null; } } + public int Offset { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationItemRange System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationItemRange System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class ConversationLanguageUnderstandingActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ConversationLanguageUnderstandingActionContent(string projectName, string deploymentName) { } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsClientOptions.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsClientOptions.cs index d44da9f8c426..a028b7d1ca96 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsClientOptions.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsClientOptions.cs @@ -13,7 +13,7 @@ namespace Azure.AI.Language.Conversations /// Client options for ConversationAnalysisClient. public partial class ConversationsClientOptions : ClientOptions { - private const ServiceVersion LatestVersion = ServiceVersion.V2024_11_15_Preview; + private const ServiceVersion LatestVersion = ServiceVersion.V2025_05_15_Preview; /// The version of the service to use. public enum ServiceVersion @@ -28,6 +28,8 @@ public enum ServiceVersion V2024_11_01 = 4, /// Service version "2024-11-15-preview". V2024_11_15_Preview = 5, + /// Service version "2025-05-15-preview". + V2025_05_15_Preview = 6, } internal string Version { get; } @@ -42,6 +44,7 @@ public ConversationsClientOptions(ServiceVersion version = LatestVersion) ServiceVersion.V2024_05_01 => "2024-05-01", ServiceVersion.V2024_11_01 => "2024-11-01", ServiceVersion.V2024_11_15_Preview => "2024-11-15-preview", + ServiceVersion.V2025_05_15_Preview => "2025-05-15-preview", _ => throw new NotSupportedException() }; } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsModelFactory.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsModelFactory.cs index 969afa1b41ec..98d30a03b075 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsModelFactory.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsModelFactory.cs @@ -15,6 +15,25 @@ namespace Azure.AI.Language.Conversations /// Model factory for models. public static partial class ConversationsModelFactory { + /// Initializes a new instance of . + /// The input ConversationItem and its optional parameters. + /// Input parameters necessary for a Conversation language understanding task. + /// A new instance for mocking. + public static ConversationalAITask ConversationalAITask(ConversationalAIAnalysisInput analysisInput = null, AIConversationLanguageUnderstandingActionContent parameters = null) + { + return new ConversationalAITask(AnalyzeConversationInputKind.ConversationalAI, serializedAdditionalRawData: null, analysisInput, parameters); + } + + /// Initializes a new instance of . + /// The name of the project to use. + /// The name of the deployment to use. + /// Specifies the method used to interpret string offsets. Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/text-analytics-offsets. + /// A new instance for mocking. + public static AIConversationLanguageUnderstandingActionContent AIConversationLanguageUnderstandingActionContent(string projectName = null, string deploymentName = null, StringIndexType? stringIndexType = null) + { + return new AIConversationLanguageUnderstandingActionContent(projectName, deploymentName, stringIndexType, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The input ConversationItem and its optional parameters. /// Input parameters necessary for a Conversation language understanding task. @@ -81,87 +100,94 @@ public static KnowledgeBaseAnswerContext KnowledgeBaseAnswerContext(int previous return new KnowledgeBaseAnswerContext(previousQnaId, previousQuestion, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Represents a conversation analysis response. - /// A new instance for mocking. - public static ConversationActionResult ConversationActionResult(AnalyzeConversationResult result = null) + /// Initializes a new instance of . + /// Represents the conversational analysis response. + /// A new instance for mocking. + public static ConversationalAITaskResult ConversationalAITaskResult(ConversationalAIResult result = null) { - return new ConversationActionResult(AnalyzeConversationResultKind.ConversationResult, serializedAdditionalRawData: null, result); + return new ConversationalAITaskResult(AnalyzeConversationResultKind.ConversationalAIResult, serializedAdditionalRawData: null, result); } - /// Initializes a new instance of . - /// The conversation utterance given by the caller. - /// The system detected language for the query in BCP 47 language representation.. - /// - /// The prediction result of a conversation project. - /// 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 AnalyzeConversationResult AnalyzeConversationResult(string query = null, string detectedLanguage = null, PredictionBase prediction = null) + /// Initializes a new instance of . + /// Multiple multi-turn conversations analyzed. + /// Any warnings encountered during processing. + /// A new instance for mocking. + public static ConversationalAIResult ConversationalAIResult(IEnumerable conversations = null, IEnumerable warnings = null) { - return new AnalyzeConversationResult(query, detectedLanguage, prediction, serializedAdditionalRawData: null); + conversations ??= new List(); + warnings ??= new List(); + + return new ConversationalAIResult(conversations?.ToList(), warnings?.ToList(), serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The type of the project. - /// The intent with the highest score. - /// A new instance for mocking. - public static PredictionBase PredictionBase(string projectKind = null, string topIntent = null) + /// Initializes a new instance of . + /// The ID of the conversation. + /// The intent classification results for this conversation. + /// Global entities that are matched but not associated with any specific intent. + /// A new instance for mocking. + public static ConversationalAIAnalysis ConversationalAIAnalysis(string id = null, IEnumerable intents = null, IEnumerable entities = null) { - return new UnknownPredictionBase(projectKind == null ? default : new ProjectKind(projectKind), topIntent, serializedAdditionalRawData: null); + intents ??= new List(); + entities ??= new List(); + + return new ConversationalAIAnalysis(id, intents?.ToList(), entities?.ToList(), serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The intent with the highest score. - /// The intent classification results. - /// The entity extraction results. - /// A new instance for mocking. - public static ConversationPrediction ConversationPrediction(string topIntent = null, IEnumerable intents = null, IEnumerable entities = null) + /// Initializes a new instance of . + /// The name of the detected intent. + /// The type of intent, either "action" or "question". + /// The ranges of conversation items where this intent was identified. + /// The entities associated with this intent. + /// A new instance for mocking. + public static ConversationalAIIntent ConversationalAIIntent(string name = null, string type = null, IEnumerable conversationItemRanges = null, IEnumerable entities = null) { - intents ??= new List(); - entities ??= new List(); + conversationItemRanges ??= new List(); + entities ??= new List(); - return new ConversationPrediction(ProjectKind.Conversation, topIntent, serializedAdditionalRawData: null, intents?.ToList(), entities?.ToList()); + return new ConversationalAIIntent(name, type, conversationItemRanges?.ToList(), entities?.ToList(), serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// A predicted class. - /// The confidence score of the class from 0.0 to 1.0. - /// A new instance for mocking. - public static ConversationIntent ConversationIntent(string category = null, float confidence = default) + /// Initializes a new instance of . + /// The starting index of the intent occurrence within the conversation. + /// The number of continuous conversation items for this intent. + /// A new instance for mocking. + public static ConversationItemRange ConversationItemRange(int offset = default, int count = default) { - return new ConversationIntent(category, confidence, serializedAdditionalRawData: null); + return new ConversationItemRange(offset, count, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The entity category. - /// The predicted entity text. - /// The starting index of this entity in the query. - /// The length of the text. - /// The entity confidence score. + /// Initializes a new instance of . + /// The entity name or category. + /// The detected text of the entity. + /// The confidence score of the entity detection (0.0 to 1.0). + /// The starting index of the entity in the query. + /// The length of the detected entity text. + /// The ID of the conversation item where the entity appears. + /// The index of the conversation item where the entity appears. /// - /// The collection of entity resolution objects. + /// Entity resolution details, if available. /// 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 collection of entity extra information objects. + /// Additional entity metadata. /// 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 ConversationEntity ConversationEntity(string category = null, string text = null, int offset = default, int length = default, float confidence = default, IEnumerable resolutions = null, IEnumerable extraInformation = null) + /// A new instance for mocking. + public static ConversationalAIEntity ConversationalAIEntity(string name = null, string text = null, float confidenceScore = default, int offset = default, int length = default, string conversationItemId = null, int? conversationItemIndex = null, IEnumerable resolutions = null, IEnumerable extraInformation = null) { resolutions ??= new List(); extraInformation ??= new List(); - return new ConversationEntity( - category, + return new ConversationalAIEntity( + name, text, + confidenceScore, offset, length, - confidence, + conversationItemId, + conversationItemIndex, resolutions?.ToList(), extraInformation?.ToList(), serializedAdditionalRawData: null); @@ -359,6 +385,92 @@ public static RegexKey RegexKey(string key = null, string regexPattern = null) return new RegexKey(ExtraInformationKind.RegexKey, serializedAdditionalRawData: null, key, regexPattern); } + /// Initializes a new instance of . + /// Represents a conversation analysis response. + /// A new instance for mocking. + public static ConversationActionResult ConversationActionResult(AnalyzeConversationResult result = null) + { + return new ConversationActionResult(AnalyzeConversationResultKind.ConversationResult, serializedAdditionalRawData: null, result); + } + + /// Initializes a new instance of . + /// The conversation utterance given by the caller. + /// The system detected language for the query in BCP 47 language representation.. + /// + /// The prediction result of a conversation project. + /// 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 AnalyzeConversationResult AnalyzeConversationResult(string query = null, string detectedLanguage = null, PredictionBase prediction = null) + { + return new AnalyzeConversationResult(query, detectedLanguage, prediction, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The type of the project. + /// The intent with the highest score. + /// A new instance for mocking. + public static PredictionBase PredictionBase(string projectKind = null, string topIntent = null) + { + return new UnknownPredictionBase(projectKind == null ? default : new ProjectKind(projectKind), topIntent, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The intent with the highest score. + /// The intent classification results. + /// The entity extraction results. + /// A new instance for mocking. + public static ConversationPrediction ConversationPrediction(string topIntent = null, IEnumerable intents = null, IEnumerable entities = null) + { + intents ??= new List(); + entities ??= new List(); + + return new ConversationPrediction(ProjectKind.Conversation, topIntent, serializedAdditionalRawData: null, intents?.ToList(), entities?.ToList()); + } + + /// Initializes a new instance of . + /// A predicted class. + /// The confidence score of the class from 0.0 to 1.0. + /// A new instance for mocking. + public static ConversationIntent ConversationIntent(string category = null, float confidence = default) + { + return new ConversationIntent(category, confidence, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The entity category. + /// The predicted entity text. + /// The starting index of this entity in the query. + /// The length of the text. + /// The entity confidence score. + /// + /// The collection of entity resolution objects. + /// 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 collection of entity extra information objects. + /// 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 ConversationEntity ConversationEntity(string category = null, string text = null, int offset = default, int length = default, float confidence = default, IEnumerable resolutions = null, IEnumerable extraInformation = null) + { + resolutions ??= new List(); + extraInformation ??= new List(); + + return new ConversationEntity( + category, + text, + offset, + length, + confidence, + resolutions?.ToList(), + extraInformation?.ToList(), + serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The intent with the highest score. /// @@ -903,12 +1015,13 @@ public static ConversationRequestStatistics ConversationRequestStatistics(int do /// 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 . /// + /// Optional duration in seconds after which the job will be canceled if not completed. /// A new instance for mocking. - public static AnalyzeConversationOperationInput AnalyzeConversationOperationInput(string displayName = null, MultiLanguageConversationInput conversationInput = null, IEnumerable actions = null) + public static AnalyzeConversationOperationInput AnalyzeConversationOperationInput(string displayName = null, MultiLanguageConversationInput conversationInput = null, IEnumerable actions = null, float? cancelAfter = null) { actions ??= new List(); - return new AnalyzeConversationOperationInput(displayName, conversationInput, actions?.ToList(), serializedAdditionalRawData: null); + return new AnalyzeConversationOperationInput(displayName, conversationInput, actions?.ToList(), cancelAfter, serializedAdditionalRawData: null); } /// Initializes a new instance of . diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAnalysisClient.xml b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAnalysisClient.xml index d44a199b3ac6..79982e8603a8 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAnalysisClient.xml +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAnalysisClient.xml @@ -9,6 +9,32 @@ Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); +AnalyzeConversationInput analyzeConversationInput = new ConversationalAITask(new ConversationalAIAnalysisInput(new AIConversation[] +{ + new AIConversation("order", InputModality.Text, "en", new ConversationalAIItem[] + { + new ConversationalAIItem("1", "user", "Hi!"), + new ConversationalAIItem("2", "bot", "Hello, how can I help you?"), + new ConversationalAIItem("3", "user", "I would like to book a flight from Paris to Berlin on Oct 10th."), + new ConversationalAIItem("4", "bot", "Do you have any airline preference?"), + new ConversationalAIItem("5", "user", "No."), + new ConversationalAIItem("6", "user", "I like New York and Boston."), + new ConversationalAIItem("7", "user", "Actualy, change the destination to New York."), + new ConversationalAIItem("8", "user", "Wait, I do not like the food in New York."), + new ConversationalAIItem("9", "user", "Ok, change the destination back to Berlin.") + }) +}), new AIConversationLanguageUnderstandingActionContent("project1", "deployment1") +{ + StringIndexType = StringIndexType.Utf16CodeUnit, +}); +Response response = await client.AnalyzeConversationAsync(analyzeConversationInput); +]]> +This sample shows how to call AnalyzeConversationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Book a flight to Seattle on Oct 10th")), new ConversationLanguageUnderstandingActionContent("{project-name}", "{deployment-name}") { StringIndexType = new StringIndexType("TextElement_V8"), @@ -69,6 +95,32 @@ Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); +AnalyzeConversationInput analyzeConversationInput = new ConversationalAITask(new ConversationalAIAnalysisInput(new AIConversation[] +{ + new AIConversation("order", InputModality.Text, "en", new ConversationalAIItem[] + { + new ConversationalAIItem("1", "user", "Hi!"), + new ConversationalAIItem("2", "bot", "Hello, how can I help you?"), + new ConversationalAIItem("3", "user", "I would like to book a flight from Paris to Berlin on Oct 10th."), + new ConversationalAIItem("4", "bot", "Do you have any airline preference?"), + new ConversationalAIItem("5", "user", "No."), + new ConversationalAIItem("6", "user", "I like New York and Boston."), + new ConversationalAIItem("7", "user", "Actualy, change the destination to New York."), + new ConversationalAIItem("8", "user", "Wait, I do not like the food in New York."), + new ConversationalAIItem("9", "user", "Ok, change the destination back to Berlin.") + }) +}), new AIConversationLanguageUnderstandingActionContent("project1", "deployment1") +{ + StringIndexType = StringIndexType.Utf16CodeUnit, +}); +Response response = client.AnalyzeConversation(analyzeConversationInput); +]]> +This sample shows how to call AnalyzeConversation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Book a flight to Seattle on Oct 10th")), new ConversationLanguageUnderstandingActionContent("{project-name}", "{deployment-name}") { StringIndexType = new StringIndexType("TextElement_V8"), @@ -129,6 +181,96 @@ Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); +using RequestContent content = RequestContent.Create(new +{ + kind = "ConversationalAI", + parameters = new + { + projectName = "project1", + deploymentName = "deployment1", + stringIndexType = "Utf16CodeUnit", + }, + analysisInput = new + { + conversations = new object[] + { + new + { + id = "order", + language = "en", + modality = "text", + conversationItems = new object[] + { + new + { + participantId = "user", + id = "1", + text = "Hi!", + }, + new + { + participantId = "bot", + id = "2", + text = "Hello, how can I help you?", + }, + new + { + participantId = "user", + id = "3", + text = "I would like to book a flight from Paris to Berlin on Oct 10th.", + }, + new + { + participantId = "bot", + id = "4", + text = "Do you have any airline preference?", + }, + new + { + participantId = "user", + id = "5", + text = "No.", + }, + new + { + participantId = "user", + id = "6", + text = "I like New York and Boston.", + }, + new + { + participantId = "user", + id = "7", + text = "Actualy, change the destination to New York.", + }, + new + { + participantId = "user", + id = "8", + text = "Wait, I do not like the food in New York.", + }, + new + { + participantId = "user", + id = "9", + text = "Ok, change the destination back to Berlin.", + } + }, + } + }, + }, +}); +Response response = await client.AnalyzeConversationAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeConversationAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + using RequestContent content = RequestContent.Create(new { kind = "Conversation", @@ -243,6 +385,96 @@ Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); +using RequestContent content = RequestContent.Create(new +{ + kind = "ConversationalAI", + parameters = new + { + projectName = "project1", + deploymentName = "deployment1", + stringIndexType = "Utf16CodeUnit", + }, + analysisInput = new + { + conversations = new object[] + { + new + { + id = "order", + language = "en", + modality = "text", + conversationItems = new object[] + { + new + { + participantId = "user", + id = "1", + text = "Hi!", + }, + new + { + participantId = "bot", + id = "2", + text = "Hello, how can I help you?", + }, + new + { + participantId = "user", + id = "3", + text = "I would like to book a flight from Paris to Berlin on Oct 10th.", + }, + new + { + participantId = "bot", + id = "4", + text = "Do you have any airline preference?", + }, + new + { + participantId = "user", + id = "5", + text = "No.", + }, + new + { + participantId = "user", + id = "6", + text = "I like New York and Boston.", + }, + new + { + participantId = "user", + id = "7", + text = "Actualy, change the destination to New York.", + }, + new + { + participantId = "user", + id = "8", + text = "Wait, I do not like the food in New York.", + }, + new + { + participantId = "user", + id = "9", + text = "Ok, change the destination back to Berlin.", + } + }, + } + }, + }, +}); +Response response = client.AnalyzeConversation(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeConversation and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + using RequestContent content = RequestContent.Create(new { kind = "Conversation", diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AIConversation.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AIConversation.Serialization.cs new file mode 100644 index 000000000000..0565cfa1cd14 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AIConversation.Serialization.cs @@ -0,0 +1,176 @@ +// 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.Language.Conversations.Models +{ + public partial class AIConversation : 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(AIConversation)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("modality"u8); + writer.WriteStringValue(Modality.ToString()); + writer.WritePropertyName("language"u8); + writer.WriteStringValue(Language); + writer.WritePropertyName("conversationItems"u8); + writer.WriteStartArray(); + foreach (var item in ConversationItems) + { + 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 + } + } + } + + AIConversation 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(AIConversation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAIConversation(document.RootElement, options); + } + + internal static AIConversation DeserializeAIConversation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + InputModality modality = default; + string language = default; + IList conversationItems = 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("modality"u8)) + { + modality = new InputModality(property.Value.GetString()); + continue; + } + if (property.NameEquals("language"u8)) + { + language = property.Value.GetString(); + continue; + } + if (property.NameEquals("conversationItems"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConversationalAIItem.DeserializeConversationalAIItem(item, options)); + } + conversationItems = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AIConversation(id, modality, language, conversationItems, 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, AzureAILanguageConversationsContext.Default); + default: + throw new FormatException($"The model {nameof(AIConversation)} does not support writing '{options.Format}' format."); + } + } + + AIConversation 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 DeserializeAIConversation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AIConversation)} 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 AIConversation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAIConversation(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/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AIConversation.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AIConversation.cs new file mode 100644 index 000000000000..ace9cfdce0d6 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AIConversation.cs @@ -0,0 +1,96 @@ +// 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.Language.Conversations.Models +{ + /// The Conversations for ai conversation analysis. + public partial class AIConversation + { + /// + /// 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 conversation. + /// Default modality for all conversation items. + /// Default language for all conversation items in BCP 47 language representation. + /// List of conversation items. + /// , or is null. + public AIConversation(string id, InputModality modality, string language, IEnumerable conversationItems) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(language, nameof(language)); + Argument.AssertNotNull(conversationItems, nameof(conversationItems)); + + Id = id; + Modality = modality; + Language = language; + ConversationItems = conversationItems.ToList(); + } + + /// Initializes a new instance of . + /// The ID of the conversation. + /// Default modality for all conversation items. + /// Default language for all conversation items in BCP 47 language representation. + /// List of conversation items. + /// Keeps track of any properties unknown to the library. + internal AIConversation(string id, InputModality modality, string language, IList conversationItems, IDictionary serializedAdditionalRawData) + { + Id = id; + Modality = modality; + Language = language; + ConversationItems = conversationItems; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AIConversation() + { + } + + /// The ID of the conversation. + public string Id { get; } + /// Default modality for all conversation items. + public InputModality Modality { get; } + /// Default language for all conversation items in BCP 47 language representation. + public string Language { get; } + /// List of conversation items. + public IList ConversationItems { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AIConversationLanguageUnderstandingActionContent.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AIConversationLanguageUnderstandingActionContent.Serialization.cs new file mode 100644 index 000000000000..461822e50c2d --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AIConversationLanguageUnderstandingActionContent.Serialization.cs @@ -0,0 +1,165 @@ +// 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.Language.Conversations.Models +{ + public partial class AIConversationLanguageUnderstandingActionContent : 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(AIConversationLanguageUnderstandingActionContent)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + if (Optional.IsDefined(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.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 + } + } + } + + AIConversationLanguageUnderstandingActionContent 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(AIConversationLanguageUnderstandingActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAIConversationLanguageUnderstandingActionContent(document.RootElement, options); + } + + internal static AIConversationLanguageUnderstandingActionContent DeserializeAIConversationLanguageUnderstandingActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string projectName = default; + string deploymentName = default; + StringIndexType? stringIndexType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AIConversationLanguageUnderstandingActionContent(projectName, deploymentName, stringIndexType, 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, AzureAILanguageConversationsContext.Default); + default: + throw new FormatException($"The model {nameof(AIConversationLanguageUnderstandingActionContent)} does not support writing '{options.Format}' format."); + } + } + + AIConversationLanguageUnderstandingActionContent 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 DeserializeAIConversationLanguageUnderstandingActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AIConversationLanguageUnderstandingActionContent)} 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 AIConversationLanguageUnderstandingActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAIConversationLanguageUnderstandingActionContent(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/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AIConversationLanguageUnderstandingActionContent.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AIConversationLanguageUnderstandingActionContent.cs new file mode 100644 index 000000000000..17da5308cb8f --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AIConversationLanguageUnderstandingActionContent.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Input parameters base for a Conversation task. + public partial class AIConversationLanguageUnderstandingActionContent + { + /// + /// 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 project to use. + /// The name of the deployment to use. + /// or is null. + public AIConversationLanguageUnderstandingActionContent(string projectName, string deploymentName) + { + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + + ProjectName = projectName; + DeploymentName = deploymentName; + } + + /// Initializes a new instance of . + /// The name of the project to use. + /// The name of the deployment to use. + /// Specifies the method used to interpret string offsets. Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/text-analytics-offsets. + /// Keeps track of any properties unknown to the library. + internal AIConversationLanguageUnderstandingActionContent(string projectName, string deploymentName, StringIndexType? stringIndexType, IDictionary serializedAdditionalRawData) + { + ProjectName = projectName; + DeploymentName = deploymentName; + StringIndexType = stringIndexType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AIConversationLanguageUnderstandingActionContent() + { + } + + /// The name of the project to use. + public string ProjectName { get; } + /// The name of the deployment to use. + public string DeploymentName { get; } + /// Specifies the method used to interpret string offsets. Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/text-analytics-offsets. + public StringIndexType? StringIndexType { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationActionResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationActionResult.Serialization.cs index 668ac4981376..58d685b911a2 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationActionResult.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationActionResult.Serialization.cs @@ -77,6 +77,7 @@ internal static AnalyzeConversationActionResult DeserializeAnalyzeConversationAc { switch (discriminator.GetString()) { + case "ConversationalAIResult": return ConversationalAITaskResult.DeserializeConversationalAITaskResult(element, options); case "ConversationResult": return ConversationActionResult.DeserializeConversationActionResult(element, options); } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationActionResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationActionResult.cs index bebd1c06e073..6ffb213f3bd6 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationActionResult.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationActionResult.cs @@ -13,7 +13,7 @@ namespace Azure.AI.Language.Conversations.Models /// /// The base class of a conversation input task result. /// 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 available derived classes include and . /// public abstract partial class AnalyzeConversationActionResult { diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInput.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInput.Serialization.cs index c275fe9ee157..ef7674aa6a0d 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInput.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInput.Serialization.cs @@ -78,6 +78,7 @@ internal static AnalyzeConversationInput DeserializeAnalyzeConversationInput(Jso switch (discriminator.GetString()) { case "Conversation": return ConversationLanguageUnderstandingInput.DeserializeConversationLanguageUnderstandingInput(element, options); + case "ConversationalAI": return ConversationalAITask.DeserializeConversationalAITask(element, options); } } return UnknownAnalyzeConversationInput.DeserializeUnknownAnalyzeConversationInput(element, options); diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInput.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInput.cs index 47017c4aff6f..eea6091fb785 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInput.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInput.cs @@ -13,7 +13,7 @@ namespace Azure.AI.Language.Conversations.Models /// /// The base class of a conversation input task. /// 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 available derived classes include and . /// public abstract partial class AnalyzeConversationInput { diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInputKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInputKind.cs index 68abead3b048..514dfd4789eb 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInputKind.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInputKind.cs @@ -23,9 +23,12 @@ public AnalyzeConversationInputKind(string value) } private const string ConversationValue = "Conversation"; + private const string ConversationalAIValue = "ConversationalAI"; /// Conversation task kind. public static AnalyzeConversationInputKind Conversation { get; } = new AnalyzeConversationInputKind(ConversationValue); + /// Conversation task kind. + public static AnalyzeConversationInputKind ConversationalAI { get; } = new AnalyzeConversationInputKind(ConversationalAIValue); /// Determines if two values are the same. public static bool operator ==(AnalyzeConversationInputKind left, AnalyzeConversationInputKind right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationInput.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationInput.Serialization.cs index 8a41b85616e6..2ad1156991cf 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationInput.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationInput.Serialization.cs @@ -48,6 +48,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WriteObjectValue(item, options); } writer.WriteEndArray(); + if (Optional.IsDefined(CancelAfter)) + { + writer.WritePropertyName("cancelAfter"u8); + writer.WriteNumberValue(CancelAfter.Value); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -88,6 +93,7 @@ internal static AnalyzeConversationOperationInput DeserializeAnalyzeConversation string displayName = default; MultiLanguageConversationInput analysisInput = default; IList tasks = default; + float? cancelAfter = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -112,13 +118,22 @@ internal static AnalyzeConversationOperationInput DeserializeAnalyzeConversation tasks = array; continue; } + if (property.NameEquals("cancelAfter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cancelAfter = property.Value.GetSingle(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new AnalyzeConversationOperationInput(displayName, analysisInput, tasks, serializedAdditionalRawData); + return new AnalyzeConversationOperationInput(displayName, analysisInput, tasks, cancelAfter, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationInput.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationInput.cs index eb05c4127ece..3448d5e2227f 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationInput.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationInput.cs @@ -71,12 +71,14 @@ public AnalyzeConversationOperationInput(MultiLanguageConversationInput conversa /// 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 . /// + /// Optional duration in seconds after which the job will be canceled if not completed. /// Keeps track of any properties unknown to the library. - internal AnalyzeConversationOperationInput(string displayName, MultiLanguageConversationInput conversationInput, IList actions, IDictionary serializedAdditionalRawData) + internal AnalyzeConversationOperationInput(string displayName, MultiLanguageConversationInput conversationInput, IList actions, float? cancelAfter, IDictionary serializedAdditionalRawData) { DisplayName = displayName; ConversationInput = conversationInput; Actions = actions; + CancelAfter = cancelAfter; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -95,5 +97,7 @@ internal AnalyzeConversationOperationInput() /// The available derived classes include , and . /// public IList Actions { get; } + /// Optional duration in seconds after which the job will be canceled if not completed. + public float? CancelAfter { get; set; } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationResultKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationResultKind.cs index d0aa79cdc7ad..8fc98cb59c8a 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationResultKind.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationResultKind.cs @@ -23,9 +23,12 @@ public AnalyzeConversationResultKind(string value) } private const string ConversationResultValue = "ConversationResult"; + private const string ConversationalAIResultValue = "ConversationalAIResult"; /// Conversation result task kind. public static AnalyzeConversationResultKind ConversationResult { get; } = new AnalyzeConversationResultKind(ConversationResultValue); + /// Conversation result task kind. + public static AnalyzeConversationResultKind ConversationalAIResult { get; } = new AnalyzeConversationResultKind(ConversationalAIResultValue); /// Determines if two values are the same. public static bool operator ==(AnalyzeConversationResultKind left, AnalyzeConversationResultKind right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationItemRange.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationItemRange.Serialization.cs new file mode 100644 index 000000000000..7ced2d0d3e4a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationItemRange.Serialization.cs @@ -0,0 +1,150 @@ +// 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.Language.Conversations.Models +{ + public partial class ConversationItemRange : 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(ConversationItemRange)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset); + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count); + 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 + } + } + } + + ConversationItemRange 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(ConversationItemRange)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationItemRange(document.RootElement, options); + } + + internal static ConversationItemRange DeserializeConversationItemRange(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int offset = default; + int count = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("count"u8)) + { + count = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationItemRange(offset, count, 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, AzureAILanguageConversationsContext.Default); + default: + throw new FormatException($"The model {nameof(ConversationItemRange)} does not support writing '{options.Format}' format."); + } + } + + ConversationItemRange 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 DeserializeConversationItemRange(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationItemRange)} 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 ConversationItemRange FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationItemRange(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/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationItemRange.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationItemRange.cs new file mode 100644 index 000000000000..1426841d90cb --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationItemRange.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The ranges of conversation items where this intent was identified. + public partial class ConversationItemRange + { + /// + /// 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 starting index of the intent occurrence within the conversation. + /// The number of continuous conversation items for this intent. + internal ConversationItemRange(int offset, int count) + { + Offset = offset; + Count = count; + } + + /// Initializes a new instance of . + /// The starting index of the intent occurrence within the conversation. + /// The number of continuous conversation items for this intent. + /// Keeps track of any properties unknown to the library. + internal ConversationItemRange(int offset, int count, IDictionary serializedAdditionalRawData) + { + Offset = offset; + Count = count; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationItemRange() + { + } + + /// The starting index of the intent occurrence within the conversation. + public int Offset { get; } + /// The number of continuous conversation items for this intent. + public int Count { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIAnalysis.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIAnalysis.Serialization.cs new file mode 100644 index 000000000000..132f97a86bfe --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIAnalysis.Serialization.cs @@ -0,0 +1,185 @@ +// 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.Language.Conversations.Models +{ + public partial class ConversationalAIAnalysis : 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(ConversationalAIAnalysis)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("intents"u8); + writer.WriteStartArray(); + foreach (var item in Intents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsCollectionDefined(Entities)) + { + writer.WritePropertyName("entities"u8); + writer.WriteStartArray(); + foreach (var item in Entities) + { + 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 + } + } + } + + ConversationalAIAnalysis 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(ConversationalAIAnalysis)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationalAIAnalysis(document.RootElement, options); + } + + internal static ConversationalAIAnalysis DeserializeConversationalAIAnalysis(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList intents = default; + IReadOnlyList entities = 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("intents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConversationalAIIntent.DeserializeConversationalAIIntent(item, options)); + } + intents = array; + continue; + } + if (property.NameEquals("entities"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConversationalAIEntity.DeserializeConversationalAIEntity(item, options)); + } + entities = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationalAIAnalysis(id, intents, entities ?? 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, AzureAILanguageConversationsContext.Default); + default: + throw new FormatException($"The model {nameof(ConversationalAIAnalysis)} does not support writing '{options.Format}' format."); + } + } + + ConversationalAIAnalysis 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 DeserializeConversationalAIAnalysis(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationalAIAnalysis)} 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 ConversationalAIAnalysis FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationalAIAnalysis(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/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIAnalysis.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIAnalysis.cs new file mode 100644 index 000000000000..58e897dcf95d --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIAnalysis.cs @@ -0,0 +1,88 @@ +// 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.Language.Conversations.Models +{ + /// Multiple multi-turn conversations analyzed. + public partial class ConversationalAIAnalysis + { + /// + /// 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 conversation. + /// The intent classification results for this conversation. + /// or is null. + internal ConversationalAIAnalysis(string id, IEnumerable intents) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(intents, nameof(intents)); + + Id = id; + Intents = intents.ToList(); + Entities = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The ID of the conversation. + /// The intent classification results for this conversation. + /// Global entities that are matched but not associated with any specific intent. + /// Keeps track of any properties unknown to the library. + internal ConversationalAIAnalysis(string id, IReadOnlyList intents, IReadOnlyList entities, IDictionary serializedAdditionalRawData) + { + Id = id; + Intents = intents; + Entities = entities; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationalAIAnalysis() + { + } + + /// The ID of the conversation. + public string Id { get; } + /// The intent classification results for this conversation. + public IReadOnlyList Intents { get; } + /// Global entities that are matched but not associated with any specific intent. + public IReadOnlyList Entities { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIAnalysisInput.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIAnalysisInput.Serialization.cs new file mode 100644 index 000000000000..5d417bea0023 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIAnalysisInput.Serialization.cs @@ -0,0 +1,152 @@ +// 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.Language.Conversations.Models +{ + public partial class ConversationalAIAnalysisInput : 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(ConversationalAIAnalysisInput)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("conversations"u8); + writer.WriteStartArray(); + foreach (var item in Conversations) + { + 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 + } + } + } + + ConversationalAIAnalysisInput 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(ConversationalAIAnalysisInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationalAIAnalysisInput(document.RootElement, options); + } + + internal static ConversationalAIAnalysisInput DeserializeConversationalAIAnalysisInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList conversations = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("conversations"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AIConversation.DeserializeAIConversation(item, options)); + } + conversations = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationalAIAnalysisInput(conversations, 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, AzureAILanguageConversationsContext.Default); + default: + throw new FormatException($"The model {nameof(ConversationalAIAnalysisInput)} does not support writing '{options.Format}' format."); + } + } + + ConversationalAIAnalysisInput 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 DeserializeConversationalAIAnalysisInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationalAIAnalysisInput)} 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 ConversationalAIAnalysisInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationalAIAnalysisInput(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/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIAnalysisInput.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIAnalysisInput.cs new file mode 100644 index 000000000000..4f8775f55e65 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIAnalysisInput.cs @@ -0,0 +1,76 @@ +// 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.Language.Conversations.Models +{ + /// The input ConversationItem and its optional parameters. + public partial class ConversationalAIAnalysisInput + { + /// + /// 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 . + /// List of multiple conversations. + /// is null. + public ConversationalAIAnalysisInput(IEnumerable conversations) + { + Argument.AssertNotNull(conversations, nameof(conversations)); + + Conversations = conversations.ToList(); + } + + /// Initializes a new instance of . + /// List of multiple conversations. + /// Keeps track of any properties unknown to the library. + internal ConversationalAIAnalysisInput(IList conversations, IDictionary serializedAdditionalRawData) + { + Conversations = conversations; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationalAIAnalysisInput() + { + } + + /// List of multiple conversations. + public IList Conversations { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIEntity.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIEntity.Serialization.cs new file mode 100644 index 000000000000..9289df4a2fd7 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIEntity.Serialization.cs @@ -0,0 +1,257 @@ +// 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.Language.Conversations.Models +{ + public partial class ConversationalAIEntity : 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(ConversationalAIEntity)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(ConfidenceScore); + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset); + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length); + writer.WritePropertyName("conversationItemId"u8); + writer.WriteStringValue(ConversationItemId); + if (Optional.IsDefined(ConversationItemIndex)) + { + writer.WritePropertyName("conversationItemIndex"u8); + writer.WriteNumberValue(ConversationItemIndex.Value); + } + if (Optional.IsCollectionDefined(Resolutions)) + { + writer.WritePropertyName("resolutions"u8); + writer.WriteStartArray(); + foreach (var item in Resolutions) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ExtraInformation)) + { + writer.WritePropertyName("extraInformation"u8); + writer.WriteStartArray(); + foreach (var item in ExtraInformation) + { + 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 + } + } + } + + ConversationalAIEntity 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(ConversationalAIEntity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationalAIEntity(document.RootElement, options); + } + + internal static ConversationalAIEntity DeserializeConversationalAIEntity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string text = default; + float confidenceScore = default; + int offset = default; + int length = default; + string conversationItemId = default; + int? conversationItemIndex = default; + IReadOnlyList resolutions = default; + IReadOnlyList extraInformation = 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("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("conversationItemId"u8)) + { + conversationItemId = property.Value.GetString(); + continue; + } + if (property.NameEquals("conversationItemIndex"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + conversationItemIndex = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("resolutions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResolutionBase.DeserializeResolutionBase(item, options)); + } + resolutions = array; + continue; + } + if (property.NameEquals("extraInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConversationEntityExtraInformation.DeserializeConversationEntityExtraInformation(item, options)); + } + extraInformation = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationalAIEntity( + name, + text, + confidenceScore, + offset, + length, + conversationItemId, + conversationItemIndex, + resolutions ?? new ChangeTrackingList(), + extraInformation ?? 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, AzureAILanguageConversationsContext.Default); + default: + throw new FormatException($"The model {nameof(ConversationalAIEntity)} does not support writing '{options.Format}' format."); + } + } + + ConversationalAIEntity 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 DeserializeConversationalAIEntity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationalAIEntity)} 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 ConversationalAIEntity FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationalAIEntity(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/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIEntity.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIEntity.cs new file mode 100644 index 000000000000..5b22d5da4625 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIEntity.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The entity associated with this intent. + public partial class ConversationalAIEntity + { + /// + /// 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 entity name or category. + /// The detected text of the entity. + /// The confidence score of the entity detection (0.0 to 1.0). + /// The starting index of the entity in the query. + /// The length of the detected entity text. + /// The ID of the conversation item where the entity appears. + /// , or is null. + internal ConversationalAIEntity(string name, string text, float confidenceScore, int offset, int length, string conversationItemId) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(text, nameof(text)); + Argument.AssertNotNull(conversationItemId, nameof(conversationItemId)); + + Name = name; + Text = text; + ConfidenceScore = confidenceScore; + Offset = offset; + Length = length; + ConversationItemId = conversationItemId; + Resolutions = new ChangeTrackingList(); + ExtraInformation = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The entity name or category. + /// The detected text of the entity. + /// The confidence score of the entity detection (0.0 to 1.0). + /// The starting index of the entity in the query. + /// The length of the detected entity text. + /// The ID of the conversation item where the entity appears. + /// The index of the conversation item where the entity appears. + /// + /// Entity resolution details, if available. + /// 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 . + /// + /// + /// Additional entity metadata. + /// 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 ConversationalAIEntity(string name, string text, float confidenceScore, int offset, int length, string conversationItemId, int? conversationItemIndex, IReadOnlyList resolutions, IReadOnlyList extraInformation, IDictionary serializedAdditionalRawData) + { + Name = name; + Text = text; + ConfidenceScore = confidenceScore; + Offset = offset; + Length = length; + ConversationItemId = conversationItemId; + ConversationItemIndex = conversationItemIndex; + Resolutions = resolutions; + ExtraInformation = extraInformation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationalAIEntity() + { + } + + /// The entity name or category. + public string Name { get; } + /// The detected text of the entity. + public string Text { get; } + /// The confidence score of the entity detection (0.0 to 1.0). + public float ConfidenceScore { get; } + /// The starting index of the entity in the query. + public int Offset { get; } + /// The length of the detected entity text. + public int Length { get; } + /// The ID of the conversation item where the entity appears. + public string ConversationItemId { get; } + /// The index of the conversation item where the entity appears. + public int? ConversationItemIndex { get; } + /// + /// Entity resolution details, if available. + /// 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 Resolutions { get; } + /// + /// Additional entity metadata. + /// 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 ExtraInformation { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIIntent.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIIntent.Serialization.cs new file mode 100644 index 000000000000..34903c8c7475 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIIntent.Serialization.cs @@ -0,0 +1,186 @@ +// 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.Language.Conversations.Models +{ + public partial class ConversationalAIIntent : 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(ConversationalAIIntent)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + writer.WritePropertyName("conversationItemRanges"u8); + writer.WriteStartArray(); + foreach (var item in ConversationItemRanges) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("entities"u8); + writer.WriteStartArray(); + foreach (var item in Entities) + { + 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 + } + } + } + + ConversationalAIIntent 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(ConversationalAIIntent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationalAIIntent(document.RootElement, options); + } + + internal static ConversationalAIIntent DeserializeConversationalAIIntent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string type = default; + IReadOnlyList conversationItemRanges = default; + IReadOnlyList entities = 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("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("conversationItemRanges"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConversationItemRange.DeserializeConversationItemRange(item, options)); + } + conversationItemRanges = array; + continue; + } + if (property.NameEquals("entities"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConversationalAIEntity.DeserializeConversationalAIEntity(item, options)); + } + entities = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationalAIIntent(name, type, conversationItemRanges, entities, 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, AzureAILanguageConversationsContext.Default); + default: + throw new FormatException($"The model {nameof(ConversationalAIIntent)} does not support writing '{options.Format}' format."); + } + } + + ConversationalAIIntent 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 DeserializeConversationalAIIntent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationalAIIntent)} 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 ConversationalAIIntent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationalAIIntent(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/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIIntent.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIIntent.cs new file mode 100644 index 000000000000..d3092e7745dc --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIIntent.cs @@ -0,0 +1,97 @@ +// 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.Language.Conversations.Models +{ + /// The intent classification result for this conversation. + public partial class ConversationalAIIntent + { + /// + /// 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 detected intent. + /// The type of intent, either "action" or "question". + /// The ranges of conversation items where this intent was identified. + /// The entities associated with this intent. + /// , , or is null. + internal ConversationalAIIntent(string name, string type, IEnumerable conversationItemRanges, IEnumerable entities) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(type, nameof(type)); + Argument.AssertNotNull(conversationItemRanges, nameof(conversationItemRanges)); + Argument.AssertNotNull(entities, nameof(entities)); + + Name = name; + Type = type; + ConversationItemRanges = conversationItemRanges.ToList(); + Entities = entities.ToList(); + } + + /// Initializes a new instance of . + /// The name of the detected intent. + /// The type of intent, either "action" or "question". + /// The ranges of conversation items where this intent was identified. + /// The entities associated with this intent. + /// Keeps track of any properties unknown to the library. + internal ConversationalAIIntent(string name, string type, IReadOnlyList conversationItemRanges, IReadOnlyList entities, IDictionary serializedAdditionalRawData) + { + Name = name; + Type = type; + ConversationItemRanges = conversationItemRanges; + Entities = entities; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationalAIIntent() + { + } + + /// The name of the detected intent. + public string Name { get; } + /// The type of intent, either "action" or "question". + public string Type { get; } + /// The ranges of conversation items where this intent was identified. + public IReadOnlyList ConversationItemRanges { get; } + /// The entities associated with this intent. + public IReadOnlyList Entities { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIItem.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIItem.Serialization.cs new file mode 100644 index 000000000000..ba43d18c2c54 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIItem.Serialization.cs @@ -0,0 +1,158 @@ +// 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.Language.Conversations.Models +{ + public partial class ConversationalAIItem : 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(ConversationalAIItem)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("participantId"u8); + writer.WriteStringValue(ParticipantId); + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + 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 + } + } + } + + ConversationalAIItem 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(ConversationalAIItem)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationalAIItem(document.RootElement, options); + } + + internal static ConversationalAIItem DeserializeConversationalAIItem(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string participantId = default; + string text = 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("participantId"u8)) + { + participantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationalAIItem(id, participantId, text, 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, AzureAILanguageConversationsContext.Default); + default: + throw new FormatException($"The model {nameof(ConversationalAIItem)} does not support writing '{options.Format}' format."); + } + } + + ConversationalAIItem 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 DeserializeConversationalAIItem(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationalAIItem)} 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 ConversationalAIItem FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationalAIItem(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/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIItem.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIItem.cs new file mode 100644 index 000000000000..7dac48ab7fad --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIItem.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// List of conversation items. + public partial class ConversationalAIItem + { + /// + /// 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 a conversation item. + /// The participant ID of a conversation item. + /// The text input. + /// , or is null. + public ConversationalAIItem(string id, string participantId, string text) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(participantId, nameof(participantId)); + Argument.AssertNotNull(text, nameof(text)); + + Id = id; + ParticipantId = participantId; + Text = text; + } + + /// Initializes a new instance of . + /// The ID of a conversation item. + /// The participant ID of a conversation item. + /// The text input. + /// Keeps track of any properties unknown to the library. + internal ConversationalAIItem(string id, string participantId, string text, IDictionary serializedAdditionalRawData) + { + Id = id; + ParticipantId = participantId; + Text = text; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationalAIItem() + { + } + + /// The ID of a conversation item. + public string Id { get; } + /// The participant ID of a conversation item. + public string ParticipantId { get; } + /// The text input. + public string Text { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIResult.Serialization.cs new file mode 100644 index 000000000000..a6b9e3c75ca6 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIResult.Serialization.cs @@ -0,0 +1,177 @@ +// 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.Language.Conversations.Models +{ + public partial class ConversationalAIResult : 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(ConversationalAIResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("conversations"u8); + writer.WriteStartArray(); + foreach (var item in Conversations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsCollectionDefined(Warnings)) + { + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + 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 + } + } + } + + ConversationalAIResult 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(ConversationalAIResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationalAIResult(document.RootElement, options); + } + + internal static ConversationalAIResult DeserializeConversationalAIResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList conversations = default; + IReadOnlyList warnings = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("conversations"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConversationalAIAnalysis.DeserializeConversationalAIAnalysis(item, options)); + } + conversations = array; + continue; + } + if (property.NameEquals("warnings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + warnings = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationalAIResult(conversations, warnings ?? 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, AzureAILanguageConversationsContext.Default); + default: + throw new FormatException($"The model {nameof(ConversationalAIResult)} does not support writing '{options.Format}' format."); + } + } + + ConversationalAIResult 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 DeserializeConversationalAIResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationalAIResult)} 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 ConversationalAIResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationalAIResult(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/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIResult.cs new file mode 100644 index 000000000000..d9d9f3be4ff8 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAIResult.cs @@ -0,0 +1,81 @@ +// 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.Language.Conversations.Models +{ + /// Represents the conversational analysis response. + public partial class ConversationalAIResult + { + /// + /// 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 . + /// Multiple multi-turn conversations analyzed. + /// is null. + internal ConversationalAIResult(IEnumerable conversations) + { + Argument.AssertNotNull(conversations, nameof(conversations)); + + Conversations = conversations.ToList(); + Warnings = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Multiple multi-turn conversations analyzed. + /// Any warnings encountered during processing. + /// Keeps track of any properties unknown to the library. + internal ConversationalAIResult(IReadOnlyList conversations, IReadOnlyList warnings, IDictionary serializedAdditionalRawData) + { + Conversations = conversations; + Warnings = warnings; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationalAIResult() + { + } + + /// Multiple multi-turn conversations analyzed. + public IReadOnlyList Conversations { get; } + /// Any warnings encountered during processing. + public IReadOnlyList Warnings { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAITask.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAITask.Serialization.cs new file mode 100644 index 000000000000..3214b814b79b --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAITask.Serialization.cs @@ -0,0 +1,142 @@ +// 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.Language.Conversations.Models +{ + public partial class ConversationalAITask : 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(ConversationalAITask)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("analysisInput"u8); + writer.WriteObjectValue(AnalysisInput, options); + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(Parameters, options); + } + + ConversationalAITask 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(ConversationalAITask)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationalAITask(document.RootElement, options); + } + + internal static ConversationalAITask DeserializeConversationalAITask(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ConversationalAIAnalysisInput analysisInput = default; + AIConversationLanguageUnderstandingActionContent parameters = default; + AnalyzeConversationInputKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("analysisInput"u8)) + { + analysisInput = ConversationalAIAnalysisInput.DeserializeConversationalAIAnalysisInput(property.Value, options); + continue; + } + if (property.NameEquals("parameters"u8)) + { + parameters = AIConversationLanguageUnderstandingActionContent.DeserializeAIConversationLanguageUnderstandingActionContent(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeConversationInputKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationalAITask(kind, serializedAdditionalRawData, analysisInput, parameters); + } + + 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, AzureAILanguageConversationsContext.Default); + default: + throw new FormatException($"The model {nameof(ConversationalAITask)} does not support writing '{options.Format}' format."); + } + } + + ConversationalAITask 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 DeserializeConversationalAITask(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationalAITask)} 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 ConversationalAITask FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationalAITask(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/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAITask.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAITask.cs new file mode 100644 index 000000000000..c337fe3a8a52 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAITask.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// A conversational AI task. + public partial class ConversationalAITask : AnalyzeConversationInput + { + /// Initializes a new instance of . + /// The input ConversationItem and its optional parameters. + /// Input parameters necessary for a Conversation language understanding task. + /// or is null. + public ConversationalAITask(ConversationalAIAnalysisInput analysisInput, AIConversationLanguageUnderstandingActionContent parameters) + { + Argument.AssertNotNull(analysisInput, nameof(analysisInput)); + Argument.AssertNotNull(parameters, nameof(parameters)); + + Kind = AnalyzeConversationInputKind.ConversationalAI; + AnalysisInput = analysisInput; + Parameters = parameters; + } + + /// Initializes a new instance of . + /// The base class of a conversation input task. + /// Keeps track of any properties unknown to the library. + /// The input ConversationItem and its optional parameters. + /// Input parameters necessary for a Conversation language understanding task. + internal ConversationalAITask(AnalyzeConversationInputKind kind, IDictionary serializedAdditionalRawData, ConversationalAIAnalysisInput analysisInput, AIConversationLanguageUnderstandingActionContent parameters) : base(kind, serializedAdditionalRawData) + { + AnalysisInput = analysisInput; + Parameters = parameters; + } + + /// Initializes a new instance of for deserialization. + internal ConversationalAITask() + { + } + + /// The input ConversationItem and its optional parameters. + public ConversationalAIAnalysisInput AnalysisInput { get; } + /// Input parameters necessary for a Conversation language understanding task. + public AIConversationLanguageUnderstandingActionContent Parameters { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAITaskResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAITaskResult.Serialization.cs new file mode 100644 index 000000000000..2c7bd9d89ccb --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAITaskResult.Serialization.cs @@ -0,0 +1,134 @@ +// 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.Language.Conversations.Models +{ + public partial class ConversationalAITaskResult : 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(ConversationalAITaskResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("result"u8); + writer.WriteObjectValue(Result, options); + } + + ConversationalAITaskResult 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(ConversationalAITaskResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationalAITaskResult(document.RootElement, options); + } + + internal static ConversationalAITaskResult DeserializeConversationalAITaskResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ConversationalAIResult result = default; + AnalyzeConversationResultKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("result"u8)) + { + result = ConversationalAIResult.DeserializeConversationalAIResult(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeConversationResultKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationalAITaskResult(kind, serializedAdditionalRawData, result); + } + + 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, AzureAILanguageConversationsContext.Default); + default: + throw new FormatException($"The model {nameof(ConversationalAITaskResult)} does not support writing '{options.Format}' format."); + } + } + + ConversationalAITaskResult 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 DeserializeConversationalAITaskResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationalAITaskResult)} 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 ConversationalAITaskResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationalAITaskResult(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/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAITaskResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAITaskResult.cs new file mode 100644 index 000000000000..f24dea39f90e --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalAITaskResult.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The results of a ConversationalAI task. + public partial class ConversationalAITaskResult : AnalyzeConversationActionResult + { + /// Initializes a new instance of . + /// Represents the conversational analysis response. + /// is null. + internal ConversationalAITaskResult(ConversationalAIResult result) + { + Argument.AssertNotNull(result, nameof(result)); + + Kind = AnalyzeConversationResultKind.ConversationalAIResult; + Result = result; + } + + /// Initializes a new instance of . + /// The base class of a conversation input task result. + /// Keeps track of any properties unknown to the library. + /// Represents the conversational analysis response. + internal ConversationalAITaskResult(AnalyzeConversationResultKind kind, IDictionary serializedAdditionalRawData, ConversationalAIResult result) : base(kind, serializedAdditionalRawData) + { + Result = result; + } + + /// Initializes a new instance of for deserialization. + internal ConversationalAITaskResult() + { + } + + /// Represents the conversational analysis response. + public ConversationalAIResult Result { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ProjectKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ProjectKind.cs index 89c8375b5261..1f3aec42e21a 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ProjectKind.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ProjectKind.cs @@ -24,11 +24,14 @@ public ProjectKind(string value) private const string ConversationValue = "Conversation"; private const string OrchestrationValue = "Orchestration"; + private const string ConversationalAIValue = "ConversationalAI"; /// Conversation type. public static ProjectKind Conversation { get; } = new ProjectKind(ConversationValue); /// Orchestration type. public static ProjectKind Orchestration { get; } = new ProjectKind(OrchestrationValue); + /// Conversation type. + public static ProjectKind ConversationalAI { get; } = new ProjectKind(ConversationalAIValue); /// Determines if two values are the same. public static bool operator ==(ProjectKind left, ProjectKind right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAnalysisClient.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAnalysisClient.cs index b26154d2269d..5bc6852c44a4 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAnalysisClient.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAnalysisClient.cs @@ -17,6 +17,250 @@ namespace Azure.AI.Language.Conversations.Samples { public partial class Samples_ConversationAnalysisClient { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversations_AnalyzeConversation_SuccessfulAnalyzeConversationalAITask() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "ConversationalAI", + parameters = new + { + projectName = "project1", + deploymentName = "deployment1", + stringIndexType = "Utf16CodeUnit", + }, + analysisInput = new + { + conversations = new object[] + { +new +{ +id = "order", +language = "en", +modality = "text", +conversationItems = new object[] +{ +new +{ +participantId = "user", +id = "1", +text = "Hi!", +}, +new +{ +participantId = "bot", +id = "2", +text = "Hello, how can I help you?", +}, +new +{ +participantId = "user", +id = "3", +text = "I would like to book a flight from Paris to Berlin on Oct 10th.", +}, +new +{ +participantId = "bot", +id = "4", +text = "Do you have any airline preference?", +}, +new +{ +participantId = "user", +id = "5", +text = "No.", +}, +new +{ +participantId = "user", +id = "6", +text = "I like New York and Boston.", +}, +new +{ +participantId = "user", +id = "7", +text = "Actualy, change the destination to New York.", +}, +new +{ +participantId = "user", +id = "8", +text = "Wait, I do not like the food in New York.", +}, +new +{ +participantId = "user", +id = "9", +text = "Ok, change the destination back to Berlin.", +} +}, +} + }, + }, + }); + Response response = client.AnalyzeConversation(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversations_AnalyzeConversation_SuccessfulAnalyzeConversationalAITask_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "ConversationalAI", + parameters = new + { + projectName = "project1", + deploymentName = "deployment1", + stringIndexType = "Utf16CodeUnit", + }, + analysisInput = new + { + conversations = new object[] + { +new +{ +id = "order", +language = "en", +modality = "text", +conversationItems = new object[] +{ +new +{ +participantId = "user", +id = "1", +text = "Hi!", +}, +new +{ +participantId = "bot", +id = "2", +text = "Hello, how can I help you?", +}, +new +{ +participantId = "user", +id = "3", +text = "I would like to book a flight from Paris to Berlin on Oct 10th.", +}, +new +{ +participantId = "bot", +id = "4", +text = "Do you have any airline preference?", +}, +new +{ +participantId = "user", +id = "5", +text = "No.", +}, +new +{ +participantId = "user", +id = "6", +text = "I like New York and Boston.", +}, +new +{ +participantId = "user", +id = "7", +text = "Actualy, change the destination to New York.", +}, +new +{ +participantId = "user", +id = "8", +text = "Wait, I do not like the food in New York.", +}, +new +{ +participantId = "user", +id = "9", +text = "Ok, change the destination back to Berlin.", +} +}, +} + }, + }, + }); + Response response = await client.AnalyzeConversationAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversations_AnalyzeConversation_SuccessfulAnalyzeConversationalAITask_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + AnalyzeConversationInput analyzeConversationInput = new ConversationalAITask(new ConversationalAIAnalysisInput(new AIConversation[] + { +new AIConversation("order", InputModality.Text, "en", new ConversationalAIItem[] +{ +new ConversationalAIItem("1", "user", "Hi!"), +new ConversationalAIItem("2", "bot", "Hello, how can I help you?"), +new ConversationalAIItem("3", "user", "I would like to book a flight from Paris to Berlin on Oct 10th."), +new ConversationalAIItem("4", "bot", "Do you have any airline preference?"), +new ConversationalAIItem("5", "user", "No."), +new ConversationalAIItem("6", "user", "I like New York and Boston."), +new ConversationalAIItem("7", "user", "Actualy, change the destination to New York."), +new ConversationalAIItem("8", "user", "Wait, I do not like the food in New York."), +new ConversationalAIItem("9", "user", "Ok, change the destination back to Berlin.") +}) + }), new AIConversationLanguageUnderstandingActionContent("project1", "deployment1") + { + StringIndexType = StringIndexType.Utf16CodeUnit, + }); + Response response = client.AnalyzeConversation(analyzeConversationInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversations_AnalyzeConversation_SuccessfulAnalyzeConversationalAITask_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + AnalyzeConversationInput analyzeConversationInput = new ConversationalAITask(new ConversationalAIAnalysisInput(new AIConversation[] + { +new AIConversation("order", InputModality.Text, "en", new ConversationalAIItem[] +{ +new ConversationalAIItem("1", "user", "Hi!"), +new ConversationalAIItem("2", "bot", "Hello, how can I help you?"), +new ConversationalAIItem("3", "user", "I would like to book a flight from Paris to Berlin on Oct 10th."), +new ConversationalAIItem("4", "bot", "Do you have any airline preference?"), +new ConversationalAIItem("5", "user", "No."), +new ConversationalAIItem("6", "user", "I like New York and Boston."), +new ConversationalAIItem("7", "user", "Actualy, change the destination to New York."), +new ConversationalAIItem("8", "user", "Wait, I do not like the food in New York."), +new ConversationalAIItem("9", "user", "Ok, change the destination back to Berlin.") +}) + }), new AIConversationLanguageUnderstandingActionContent("project1", "deployment1") + { + StringIndexType = StringIndexType.Utf16CodeUnit, + }); + Response response = await client.AnalyzeConversationAsync(analyzeConversationInput); + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_Conversations_AnalyzeConversation_SuccessfulAnalyzeConversations() diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tsp-location.yaml b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tsp-location.yaml index cdfc1a22c59f..c3bdb2f59e87 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tsp-location.yaml +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tsp-location.yaml @@ -1,3 +1,4 @@ directory: specification/cognitiveservices/Language.Conversations -commit: 462574dbd02088c209bb1da3eef0d93f699e8de2 +commit: cc9e89d408b98d80cc23504a968fb70bb308eac5 repo: Azure/azure-rest-api-specs +additionalDirectories: