Skip to content

Commit

Permalink
Add simple overloads for QueryKnowledgeBase
Browse files Browse the repository at this point in the history
Resolves Azure#24172. Also regenerated with transform swagger as needed for Azure#24067, but that is waiting on the final expected swagger changes.
  • Loading branch information
heaths committed Sep 23, 2021
1 parent 8b1e73c commit 5a5385b
Show file tree
Hide file tree
Showing 42 changed files with 489 additions and 337 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@

### Features Added

- Added support for API version 2021-07-15-preview.

### Breaking Changes

- Made `projectName` and `deploymentName` parameters required for `QuestionAnsweringClient` methods.
- Moved `QueryKnowledgeBaseOptions`, `QueryTextOptions`, and `TextRecord` to `Azure.AI.Language.QuestionAnswering` namespace.

### Bugs Fixed

### Other Changes
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using Azure.Core;

namespace Azure.AI.Language.QuestionAnswering
{
[CodeGenModel("KnowledgeBaseQueryOptions")]
public partial class QueryKnowledgeBaseOptions
{
/// <summary>
/// Creates a new instance of the <see cref="QueryKnowledgeBaseOptions"/> class with the specified <paramref name="question"/>.
/// </summary>
/// <param name="projectName">The name of the project to use.</param>
/// <param name="deploymentName">The deployment name of the project to use, such as "test" or "prod".</param>
/// <param name="question">The question to answer.</param>
/// <exception cref="ArgumentException"><paramref name="question"/> is an empty string.</exception>
/// <exception cref="ArgumentNullException"><paramref name="projectName"/>, <paramref name="deploymentName"/>, or <paramref name="question"/> is null.</exception>
public QueryKnowledgeBaseOptions(string projectName, string deploymentName, string question)
{
ProjectName = Argument.CheckNotNull(projectName, nameof(projectName));
DeploymentName = Argument.CheckNotNull(deploymentName, nameof(deploymentName));
Question = Argument.CheckNotNullOrEmpty(question, nameof(question));
}

/// <summary>
/// Creates a new instance of the <see cref="QueryKnowledgeBaseOptions"/> class with an exact QnA ID.
/// </summary>
/// <param name="projectName">The name of the project to use.</param>
/// <param name="deploymentName">The deployment name of the project to use, such as "test" or "prod".</param>
/// <param name="qnaId">A specific question and answer ID to retrieve.</param>
/// <exception cref="ArgumentNullException"><paramref name="projectName"/> or <paramref name="deploymentName"/> is null.</exception>
public QueryKnowledgeBaseOptions(string projectName, string deploymentName, int qnaId)
{
ProjectName = Argument.CheckNotNull(projectName, nameof(projectName));
DeploymentName = Argument.CheckNotNull(deploymentName, nameof(deploymentName));
QnaId = qnaId;
}

private QueryKnowledgeBaseOptions()
{
}

/// <summary>
/// Gets the name of the project to use.
/// </summary>
public string ProjectName { get; }

/// <summary>
/// Gets the deployment name of the project to use, such as "test" or "prod".
/// </summary>
public string DeploymentName { get; }

/// <summary>
/// Exact QnA ID to fetch from the knowledgebase. This field takes priority over <see cref="Question"/>.
/// </summary>
public int? QnaId { get; }

/// <summary>
/// User question to query against the knowledge base.
/// </summary>
public string Question { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Linq;
using Azure.Core;

namespace Azure.AI.Language.QuestionAnswering.Models
namespace Azure.AI.Language.QuestionAnswering
{
[CodeGenModel("TextQueryOptions")]
public partial class QueryTextOptions
Expand Down
Loading

0 comments on commit 5a5385b

Please sign in to comment.