/// <summary> /// Gets details of a specific knowledgebase. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='kbId'> /// Knowledgebase id. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <KnowledgebaseDTO> GetDetailsAsync(this IKnowledgebase operations, string kbId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetDetailsWithHttpMessagesAsync(kbId, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Download the knowledgebase. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='kbId'> /// Knowledgebase id. /// </param> /// <param name='environment'> /// Specifies whether environment is Test or Prod. Possible values include: /// 'Prod', 'Test' /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <QnADocumentsDTO> DownloadAsync(this IKnowledgebase operations, string kbId, string environment, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.DownloadWithHttpMessagesAsync(kbId, environment, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Gets all knowledgebases for a user. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <KnowledgebasesDTO> ListAllAsync(this IKnowledgebase operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListAllWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Asynchronous operation to create a new knowledgebase. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='createKbPayload'> /// Post body of the request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <Operation> CreateAsync(this IKnowledgebase operations, CreateKbDTO createKbPayload, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateWithHttpMessagesAsync(createKbPayload, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Asynchronous operation to modify a knowledgebase. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='kbId'> /// Knowledgebase id. /// </param> /// <param name='updateKb'> /// Post body of the request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <Operation> UpdateAsync(this IKnowledgebase operations, string kbId, UpdateKbOperationDTO updateKb, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateWithHttpMessagesAsync(kbId, updateKb, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// GenerateAnswer call to query knowledgebase (QnA Maker Managed). /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='kbId'> /// Knowledgebase id. /// </param> /// <param name='generateAnswerPayload'> /// Post body of the request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <QnASearchResultList> GenerateAnswerAsync(this IKnowledgebase operations, string kbId, QueryDTO generateAnswerPayload, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GenerateAnswerWithHttpMessagesAsync(kbId, generateAnswerPayload, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public IEnumerable <Justification> Evaluate(IKnowledgebase kb, RuleSettings settings) { var args = m_left.Arguments; var count = args.Count; object[] pattern = new object[count + 1]; Dictionary <VariableExpression, Variable> mapping = new Dictionary <VariableExpression, Variable>(); for (int i = 0; i < count; ++i) { if (args[i] is ConstantExpression constant) { pattern[i + 1] = constant.Value; } else if (args[i] is VariableExpression variable) { Logic.Variable x; if (!mapping.TryGetValue(variable, out x)) { x = new Variable(); mapping.Add(variable, x); } pattern[i + 1] = x; } else { throw new NotImplementedException(); } } if (m_right is ConstantExpression constant2) { pattern[0] = constant2.Value; } else if (m_right is VariableExpression variable2) { Logic.Variable x; if (!mapping.TryGetValue(variable2, out x)) { x = new Variable(); mapping.Add(variable2, x); } pattern[0] = x; } return(kb.Match(m_left.Functor, Mode.StoredAndDerivedAdditions, pattern, settings)); }
public SearchController(IKnowledgebase knowledgebase, ICategory category) { _knowledgebase = knowledgebase; _category = category; }
public KnowledgebaseController(ICategory category, IKnowledgebase knowledgebase) { _category = category; _knowledgebase = knowledgebase; }
/// <summary> /// Publishes all changes in test index of a knowledgebase to its prod index. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='kbId'> /// Knowledgebase id. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task PublishAsync(this IKnowledgebase operations, string kbId, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.PublishWithHttpMessagesAsync(kbId, null, cancellationToken).ConfigureAwait(false)).Dispose(); }
/// <summary> /// Replace knowledgebase contents. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='kbId'> /// Knowledgebase id. /// </param> /// <param name='replaceKb'> /// An instance of ReplaceKbDTO which contains list of qnas to be uploaded /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task ReplaceAsync(this IKnowledgebase operations, string kbId, ReplaceKbDTO replaceKb, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.ReplaceWithHttpMessagesAsync(kbId, replaceKb, null, cancellationToken).ConfigureAwait(false)).Dispose(); }
/// <summary> /// Train call to add suggestions to knowledgebase (QnAMaker Managed). /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='kbId'> /// Knowledgebase id. /// </param> /// <param name='trainPayload'> /// Post body of the request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task TrainAsync(this IKnowledgebase operations, string kbId, FeedbackRecordsDTO trainPayload, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.TrainWithHttpMessagesAsync(kbId, trainPayload, null, cancellationToken).ConfigureAwait(false)).Dispose(); }