// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; using AdaptiveExpressions.Properties; using Microsoft.Bot.Builder.AI.QnA.Models; using Microsoft.Bot.Schema; using Newtonsoft.Json; namespace Microsoft.Bot.Builder.AI.QnA { /// /// This class represents all the trace info that we collect from the QnAMaker Middleware. /// public class QnAMakerTraceInfo { /// /// Gets or sets message which instigated the query to QnAMaker. /// /// /// Message which instigated the query to QnAMaker. /// [JsonProperty("message")] public Activity Message { get; set; } /// /// Gets or sets results that QnAMaker returned. /// /// /// Results that QnAMaker returned. /// [JsonProperty("queryResults")] #pragma warning disable CA1819 // Properties should not return arrays (we can't change this without breaking binary compat) public QueryResult[] QueryResults { get; set; } #pragma warning restore CA1819 // Properties should not return arrays /// /// Gets or sets iD of the Knowledgebase that is being used. /// /// /// ID of the Knowledgebase that is being used. /// [JsonProperty("knowledgeBaseId")] public string KnowledgeBaseId { get; set; } /// /// Gets or sets the minimum score threshold, used to filter returned results. /// /// Scores are normalized to the range of 0.0 to 1.0 /// before filtering. /// /// The minimum score threshold, used to filter returned results. /// [JsonProperty("scoreThreshold")] public float ScoreThreshold { get; set; } /// /// Gets or sets number of ranked results that are asked to be returned. /// /// /// Number of ranked results that are asked to be returned. /// [JsonProperty("top")] public int Top { get; set; } /// /// Gets or sets the filters used to return answers that have the specified metadata. /// /// /// The filters used to return answers that have the specified metadata. /// [JsonProperty("strictFilters")] #pragma warning disable CA1819 // Properties should not return arrays (we can't change this without breaking binary compat) public Metadata[] StrictFilters { get; set; } #pragma warning restore CA1819 // Properties should not return arrays /// /// Gets or sets context for multi-turn responses. /// /// /// The context from which the QnA was extracted. /// [JsonProperty("context")] public QnARequestContext Context { get; set; } /// /// Gets or sets QnA Id of the current question asked. /// /// /// Id of the current question asked. /// [JsonProperty("qnaId")] public int QnAId { get; set; } /// /// Gets or sets a value indicating whether gets or sets environment of knowledgebase to be called. /// /// /// A value indicating whether to call test or prod environment of knowledgebase. /// [JsonProperty("isTest")] public bool IsTest { get; set; } /// /// Gets or sets ranker Types. /// /// /// Ranker Types. /// [JsonProperty("rankerType")] public string RankerType { get; set; } /// /// Gets or sets the collection to be sent when calling QnA Maker to boost results. /// /// /// An array of . /// [Obsolete("This property is no longer used and will be ignored")] [JsonIgnore] #pragma warning disable CA1819 // Properties should not return arrays (this property is obsolete and we won't change it) public Metadata[] MetadataBoost { get; set; } #pragma warning restore CA1819 // Properties should not return arrays /// /// Gets or sets the metadata and sources used to filter QnA Maker results. /// /// /// An object with metadata, source filters and corresponding operators. /// [JsonProperty("filters")] public Filters Filters { get; set; } /// /// Gets or sets a value indicating whether to enable or disable Answer Span prediction. /// /// /// True or False, defaults to False. /// [JsonProperty("enablePreciseAnswer")] public BoolExpression EnablePreciseAnswer { get; set; } = true; /// /// Gets or sets a value indicating whether to enable Query over Unstructured Sources. /// /// True/False, defaults to true. [JsonProperty("includeUnstructuredSources")] public BoolExpression IncludeUnstructuredSources { get; set; } = true; } }