Пример #1
0
        internal static AnalyzeConversationPIITask DeserializeAnalyzeConversationPIITask(JsonElement element)
        {
            Optional <ConversationPIITaskParameters> parameters = default;
            AnalyzeConversationLROTaskKind           kind       = default;
            Optional <string> taskName = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("parameters"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    parameters = ConversationPIITaskParameters.DeserializeConversationPIITaskParameters(property.Value);
                    continue;
                }
                if (property.NameEquals("kind"))
                {
                    kind = new AnalyzeConversationLROTaskKind(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("taskName"))
                {
                    taskName = property.Value.GetString();
                    continue;
                }
            }
            return(new AnalyzeConversationPIITask(taskName.Value, kind, parameters.Value));
        }
Пример #2
0
        internal static AnalyzeConversationLROTask DeserializeAnalyzeConversationLROTask(JsonElement element)
        {
            if (element.TryGetProperty("kind", out JsonElement discriminator))
            {
                switch (discriminator.GetString())
                {
                case "ConversationalPIITask": return(AnalyzeConversationPIITask.DeserializeAnalyzeConversationPIITask(element));

                case "ConversationalSummarizationTask": return(AnalyzeConversationSummarizationTask.DeserializeAnalyzeConversationSummarizationTask(element));
                }
            }
            AnalyzeConversationLROTaskKind kind = default;
            Optional <string> taskName          = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("kind"))
                {
                    kind = new AnalyzeConversationLROTaskKind(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("taskName"))
                {
                    taskName = property.Value.GetString();
                    continue;
                }
            }
            return(new AnalyzeConversationLROTask(taskName.Value, kind));
        }