Skip to content

Commit

Permalink
[QA] regen with DPG (Azure#25350)
Browse files Browse the repository at this point in the history
* combine runtime and authoring swagger readmes

* regen runtime client with latest dpg

* regen authoring client with DPG and rename projects client to authoring client

* uncomment swagger readme

* update link

* regenerate with latest DPG version 6.1.5

* fix cspell

* update commit for authoring and regenerate
  • Loading branch information
kristapratico authored and mccoyp committed Sep 22, 2022
1 parent 6a400d5 commit 79d1b9e
Show file tree
Hide file tree
Showing 55 changed files with 8,763 additions and 3,746 deletions.
4 changes: 4 additions & 0 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,10 @@
"filename": "sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_text*.py",
"words": ["groovin", "Olufsen"]
},
{
"filename": "sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/**/_serialization.py",
"words": ["ctxt", "wday", "mday", "astimezone", "unflattened", "JSONify", "deseralize"]
},
{
"filename": "sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/tests/*.py",
"words": ["Apim", "cognituve"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
### Features Added

### Breaking Changes
* `QuestionAnsweringProjectsClient` was renamed to `QuestionAnsweringAuthoringClient`.
* The `azure.ai.language.questionanswering.projects` namespace was renamed to `azure.ai.language.questionanswering.authoring`

### Bugs Fixed

Expand Down
22 changes: 11 additions & 11 deletions sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pip install azure-ai-language-questionanswering --pre

### Authenticate the client

In order to interact with the Question Answering service, you'll need to create an instance of the [QuestionAnsweringClient][questionanswering_client_class] class or an instance of the [QuestionAnsweringProjectsClient][questionansweringprojects_client_class] for managing projects within your resource. You will need an **endpoint**, and an **API key** to instantiate a client object. For more information regarding authenticating with Cognitive Services, see [Authenticate requests to Azure Cognitive Services][cognitive_auth].
In order to interact with the Question Answering service, you'll need to create an instance of the [QuestionAnsweringClient][questionanswering_client_class] class or an instance of the [QuestionAnsweringAuthoringClient][questionansweringauthoring_client_class] for managing projects within your resource. You will need an **endpoint**, and an **API key** to instantiate a client object. For more information regarding authenticating with Cognitive Services, see [Authenticate requests to Azure Cognitive Services][cognitive_auth].

#### Get an API key

Expand All @@ -54,17 +54,17 @@ credential = AzureKeyCredential("{api-key}")
client = QuestionAnsweringClient(endpoint, credential)
```

#### Create QuestionAnsweringProjectsClient
With your endpoint and API key, you can instantiate a [QuestionAnsweringProjectsClient][questionansweringprojects_client_class]:
#### Create QuestionAnsweringAuthoringClient
With your endpoint and API key, you can instantiate a [QuestionAnsweringAuthoringClient][questionansweringauthoring_client_class]:

```python
from azure.core.credentials import AzureKeyCredential
from azure.ai.language.questionanswering.projects import QuestionAnsweringProjectsClient
from azure.ai.language.questionanswering.authoring import QuestionAnsweringAuthoringClient

endpoint = "https://{myaccount}.api.cognitive.microsoft.com"
credential = AzureKeyCredential("{api-key}")

client = QuestionAnsweringProjectsClient(endpoint, credential)
client = QuestionAnsweringAuthoringClient(endpoint, credential)
```

#### Create a client with an Azure Active Directory Credential
Expand Down Expand Up @@ -105,8 +105,8 @@ client = QuestionAnsweringClient(endpoint="https://<my-custom-subdomain>.cogniti
The [QuestionAnsweringClient][questionanswering_client_class] is the primary interface for asking questions using a knowledge base with your own information, or text input using pre-trained models.
For asynchronous operations, an async `QuestionAnsweringClient` is in the `azure.ai.language.questionanswering.aio` namespace.

### QuestionAnsweringProjectsClient
The [QuestionAnsweringProjectsClient][questionansweringprojects_client_class] provides an interface for managing Question Answering projects. Examples of the available operations include creating and deploying projects, updating your knowledge sources, and updating question and answer pairs. It provides both synchronous and asynchronous APIs.
### QuestionAnsweringAuthoringClient
The [QuestionAnsweringAuthoringClient][questionansweringauthoring_client_class] provides an interface for managing Question Answering projects. Examples of the available operations include creating and deploying projects, updating your knowledge sources, and updating question and answer pairs. It provides both synchronous and asynchronous APIs.

## Examples

Expand Down Expand Up @@ -175,21 +175,21 @@ output = await client.get_answers(
)
```

### QuestionAnsweringProjectsClient
### QuestionAnsweringAuthoringClient

#### Create a new project

```python
import os
from azure.core.credentials import AzureKeyCredential
from azure.ai.language.questionanswering.projects import QuestionAnsweringProjectsClient
from azure.ai.language.questionanswering.authoring import QuestionAnsweringAuthoringClient

# get service secrets
endpoint = os.environ["AZURE_QUESTIONANSWERING_ENDPOINT"]
key = os.environ["AZURE_QUESTIONANSWERING_KEY"]

# create client
client = QuestionAnsweringProjectsClient(endpoint, AzureKeyCredential(key))
client = QuestionAnsweringAuthoringClient(endpoint, AzureKeyCredential(key))
with client:

# create project
Expand Down Expand Up @@ -335,7 +335,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con
[azure_core_readme]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
[pip_link]: https://pypi.org/project/pip/
[questionanswering_client_class]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/latest/azure.ai.language.questionanswering.html#azure.ai.language.questionanswering.QuestionAnsweringClient
[questionansweringprojects_client_class]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/projects/_question_answering_projects_client.py
[questionansweringauthoring_client_class]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/authoring/_client.py
[questionanswering_refdocs_prompts]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/latest/azure.ai.language.questionanswering.models.html#azure.ai.language.questionanswering.models.KnowledgeBaseAnswerDialog
[questionanswering_client_src]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-questionanswering/
[questionanswering_docs]: https://azure.microsoft.com/services/cognitive-services/qna-maker/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._question_answering_client import QuestionAnsweringClient
from ._client import QuestionAnsweringClient
from ._version import VERSION

__version__ = VERSION

from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk

__all__ = ["QuestionAnsweringClient"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,29 @@
from copy import deepcopy
from typing import Any

from msrest import Deserializer, Serializer

from azure.core import PipelineClient
from azure.core.credentials import AzureKeyCredential
from azure.core.rest import HttpRequest, HttpResponse

from . import models
from ._configuration import QuestionAnsweringClientConfiguration
from ._operations import QuestionAnsweringClientOperationsMixin
from ._serialization import Deserializer, Serializer


class QuestionAnsweringClient(QuestionAnsweringClientOperationsMixin):
class QuestionAnsweringClient(
QuestionAnsweringClientOperationsMixin
): # pylint: disable=client-accepts-api-version-keyword
"""The language service API is a suite of natural language processing (NLP) skills built with
best-in-class Microsoft machine learning algorithms. The API can be used to analyze
unstructured text for tasks such as sentiment analysis, key phrase extraction, language
detection and question answering. Further documentation can be found in :code:`<a
href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview">https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview</a>`.
:param endpoint: Supported Cognitive Services endpoint (e.g.,
https://:code:`<resource-name>`.api.cognitiveservices.azure.com).
https://:code:`<resource-name>`.api.cognitiveservices.azure.com). Required.
:type endpoint: str
:param credential: Credential needed for the client to connect to Azure.
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential
:keyword api_version: Api Version. Default value is "2021-10-01". Note that overriding this
default value may result in unsupported behavior.
Expand All @@ -56,7 +57,7 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
>>> response = client.send_request(request)
<HttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class QuestionAnsweringClientConfiguration(Configuration): # pylint: disable=to
attributes.
:param endpoint: Supported Cognitive Services endpoint (e.g.,
https://:code:`<resource-name>`.api.cognitiveservices.azure.com).
https://:code:`<resource-name>`.api.cognitiveservices.azure.com). Required.
:type endpoint: str
:param credential: Credential needed for the client to connect to Azure.
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential
:keyword api_version: Api Version. Default value is "2021-10-01". Note that overriding this
default value may result in unsupported behavior.
Expand Down
Loading

0 comments on commit 79d1b9e

Please sign in to comment.