public static ConversationPrediction ConversationPrediction(ProjectKind projectKind = default, string topIntent = null, IEnumerable <ConversationIntent> intents = null, IEnumerable <ConversationEntity> entities = null) { intents ??= new List <ConversationIntent>(); entities ??= new List <ConversationEntity>(); return(new ConversationPrediction(projectKind, topIntent, intents?.ToList(), entities?.ToList())); }
internal static OrchestrationPrediction DeserializeOrchestrationPrediction(JsonElement element) { IReadOnlyDictionary <string, TargetIntentResult> intents = default; ProjectKind projectKind = default; Optional <string> topIntent = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("intents")) { Dictionary <string, TargetIntentResult> dictionary = new Dictionary <string, TargetIntentResult>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, TargetIntentResult.DeserializeTargetIntentResult(property0.Value)); } intents = dictionary; continue; } if (property.NameEquals("projectKind")) { projectKind = new ProjectKind(property.Value.GetString()); continue; } if (property.NameEquals("topIntent")) { topIntent = property.Value.GetString(); continue; } } return(new OrchestrationPrediction(projectKind, topIntent.Value, intents)); }
internal static BasePrediction DeserializeBasePrediction(JsonElement element) { if (element.TryGetProperty("projectKind", out JsonElement discriminator)) { switch (discriminator.GetString()) { case "workflow": return(OrchestratorPrediction.DeserializeOrchestratorPrediction(element)); case "conversation": return(ConversationPrediction.DeserializeConversationPrediction(element)); } } ProjectKind projectKind = default; Optional <string> topIntent = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("projectKind")) { projectKind = new ProjectKind(property.Value.GetString()); continue; } if (property.NameEquals("topIntent")) { topIntent = property.Value.GetString(); continue; } } return(new BasePrediction(projectKind, topIntent.Value)); }
internal static ConversationPrediction DeserializeConversationPrediction(JsonElement element) { IReadOnlyList <ConversationIntent> intents = default; IReadOnlyList <ConversationEntity> entities = default; ProjectKind projectKind = default; Optional <string> topIntent = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("intents")) { List <ConversationIntent> array = new List <ConversationIntent>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ConversationIntent.DeserializeConversationIntent(item)); } intents = array; continue; } if (property.NameEquals("entities")) { List <ConversationEntity> array = new List <ConversationEntity>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ConversationEntity.DeserializeConversationEntity(item)); } entities = array; continue; } if (property.NameEquals("projectKind")) { projectKind = new ProjectKind(property.Value.GetString()); continue; } if (property.NameEquals("topIntent")) { topIntent = property.Value.GetString(); continue; } } return(new ConversationPrediction(projectKind, topIntent.Value, intents, entities)); }
public static BasePrediction BasePrediction(ProjectKind projectKind = default, string topIntent = null) { return(new BasePrediction(projectKind, topIntent)); }
public static OrchestratorPrediction OrchestratorPrediction(ProjectKind projectKind = default, string topIntent = null, IReadOnlyDictionary <string, TargetIntentResult> intents = null) { intents ??= new Dictionary <string, TargetIntentResult>(); return(new OrchestratorPrediction(projectKind, topIntent, intents)); }
internal OrchestratorPrediction(ProjectKind projectKind, string topIntent, IReadOnlyDictionary <string, TargetIntentResult> intents) : base(projectKind, topIntent) { Intents = intents; ProjectKind = projectKind; }
internal ConversationPrediction(ProjectKind projectKind, string topIntent, IReadOnlyList <ConversationIntent> intents, IReadOnlyList <ConversationEntity> entities) : base(projectKind, topIntent) { Intents = intents; Entities = entities; ProjectKind = projectKind; }