diff --git a/eng/guardian-tools/policheck/PolicheckExclusions.xml b/eng/guardian-tools/policheck/PolicheckExclusions.xml
new file mode 100644
index 000000000000..8aff06de6994
--- /dev/null
+++ b/eng/guardian-tools/policheck/PolicheckExclusions.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/eng/pipelines/aggregate-reports.yml b/eng/pipelines/aggregate-reports.yml
index 4c40cfcf7b4b..2aa8b4923389 100644
--- a/eng/pipelines/aggregate-reports.yml
+++ b/eng/pipelines/aggregate-reports.yml
@@ -8,60 +8,105 @@ pr:
include:
- eng/pipelines/aggregate-reports.yml
-jobs:
-- job: 'ValidateDependencies'
- variables:
+pool:
+ name: azsdk-pool-mms-win-2019-general
+ vmImage: MMS2019
+
+variables:
- template: ./templates/variables/globals.yml
- pool:
- name: azsdk-pool-mms-win-2019-general
- vmImage: MMS2019
-
- steps:
- - template: /eng/pipelines/templates/steps/analyze_dependency.yml
-
- - task: AzureFileCopy@2
- displayName: 'Upload dependency report'
- condition: and(succeededOrFailed(), eq(variables['System.TeamProject'], 'internal'))
- inputs:
- sourcePath: '$(Build.ArtifactStagingDirectory)/reports'
- azureSubscription: 'Azure SDK Artifacts'
- destination: AzureBlob
- storage: azuresdkartifacts
- containerName: 'azure-sdk-for-python'
- blobPrefix: dependencies
-
- - task: PowerShell@2
- displayName: "Verify Repository Resource Refs"
- inputs:
- pwsh: true
- workingDirectory: $(Build.SourcesDirectory)
- filePath: eng/common/scripts/Verify-Resource-Ref.ps1
-
- - task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@3
- displayName: 'Run CredScan'
- condition: succeededOrFailed()
- inputs:
- suppressionsFile: 'eng\CredScanSuppression.json'
- - task: securedevelopmentteam.vss-secure-development-tools.build-task-postanalysis.PostAnalysis@2
- displayName: 'Post Analysis'
- condition: succeededOrFailed()
- inputs:
- GdnBreakAllTools: false
- GdnBreakGdnToolCredScan: true
- GdnBreakGdnToolCredScanSeverity: Error
- GdnBreakBaselineFiles: $(Build.SourcesDirectory)\eng\python.gdnbaselines
- GdnBreakBaselines: baseline
- # Used for generating baseline file.
- # GdnBreakOutputBaselineFile: python
- # GdnBreakOutputBaseline: baseline
- continueOnError: true
- - task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@3
- displayName: 'Publish Security Analysis Logs'
- continueOnError: true
- condition: succeededOrFailed()
- - template: ../common/pipelines/templates/steps/verify-links.yml
- parameters:
- Directory: ""
- CheckLinkGuidance: $true
- Condition: succeededOrFailed()
+stages:
+ - stage: ValidateDependencies
+ displayName: Validate Dependencies
+
+ jobs:
+ - job: ValidateDependencies
+ timeoutInMinutes: 120
+ steps:
+
+ - template: /eng/pipelines/templates/steps/analyze_dependency.yml
+
+ - task: AzureFileCopy@2
+ displayName: 'Upload dependency report'
+ condition: and(succeededOrFailed(), eq(variables['System.TeamProject'], 'internal'))
+ inputs:
+ sourcePath: '$(Build.ArtifactStagingDirectory)/reports'
+ azureSubscription: 'Azure SDK Artifacts'
+ destination: AzureBlob
+ storage: azuresdkartifacts
+ containerName: 'azure-sdk-for-python'
+ blobPrefix: dependencies
+
+ - task: PowerShell@2
+ displayName: "Verify Repository Resource Refs"
+ inputs:
+ pwsh: true
+ workingDirectory: $(Build.SourcesDirectory)
+ filePath: eng/common/scripts/Verify-Resource-Ref.ps1
+
+ - template: ../common/pipelines/templates/steps/verify-links.yml
+ parameters:
+ Directory: ""
+ CheckLinkGuidance: $true
+ Condition: succeededOrFailed()
+
+ - stage: ComplianceTools
+ displayName: Compliance Tools
+ dependsOn: []
+
+ jobs:
+ - job: ComplianceTools
+ timeoutInMinutes: 120
+ steps:
+ - task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@3
+ displayName: 'Run CredScan'
+ condition: succeededOrFailed()
+ inputs:
+ suppressionsFile: 'eng\CredScanSuppression.json'
+
+ - task: securedevelopmentteam.vss-secure-development-tools.build-task-postanalysis.PostAnalysis@2
+ displayName: 'Post Analysis'
+ condition: succeededOrFailed()
+ inputs:
+ GdnBreakAllTools: false
+ GdnBreakGdnToolCredScan: true
+ GdnBreakGdnToolCredScanSeverity: Error
+ GdnBreakBaselineFiles: $(Build.SourcesDirectory)\eng\python.gdnbaselines
+ GdnBreakBaselines: baseline
+ # Used for generating baseline file.
+ # GdnBreakOutputBaselineFile: python
+ # GdnBreakOutputBaseline: baseline
+ continueOnError: true
+
+ - pwsh: |
+ azcopy copy "https://azuresdkartifacts.blob.core.windows.net/policheck/PythonPoliCheckExclusion.mdb?$(azuresdk-policheck-blob-SAS)" `
+ "$(Build.BinariesDirectory)"
+ displayName: 'Download PoliCheck Exclusion Database'
+ condition: succeededOrFailed()
+
+ - task: securedevelopmentteam.vss-secure-development-tools.build-task-policheck.PoliCheck@2
+ displayName: 'Run PoliCheck'
+ inputs:
+ targetType: F
+ targetArgument: '$(Build.SourcesDirectory)'
+ result: PoliCheck.sarif
+ optionsFC: 0
+ optionsXS: 1
+ optionsPE: 1|2|3|4
+ optionsRulesDBPath: "$(Build.BinariesDirectory)/PythonPoliCheckExclusion.mdb"
+ optionsUEPATH: "$(Build.SourcesDirectory)/eng/guardian-tools/policheck/PolicheckExclusions.xml"
+ condition: succeededOrFailed()
+
+ - task: securedevelopmentteam.vss-secure-development-tools.build-task-postanalysis.PostAnalysis@2
+ displayName: 'Post Analysis (PoliCheck)'
+ inputs:
+ GdnBreakAllTools: false
+ GdnBreakGdnToolPoliCheck: true
+ GdnBreakGdnToolPoliCheckSeverity: Warning
+ condition: succeededOrFailed()
+ continueOnError: true
+
+ - task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@3
+ displayName: 'Publish Security Analysis Logs'
+ continueOnError: true
+ condition: succeededOrFailed()
diff --git a/scripts/devops_tasks/test_run_samples.py b/scripts/devops_tasks/test_run_samples.py
index 2dae08c2f310..aeb14e8cdb35 100644
--- a/scripts/devops_tasks/test_run_samples.py
+++ b/scripts/devops_tasks/test_run_samples.py
@@ -125,6 +125,10 @@
"sample_list_translations_with_filters.py",
"sample_translation_with_custom_model.py",
"sample_translation_with_custom_model_async.py",
+ ],
+ "azure-ai-formrecognizer": [
+ "sample_manage_custom_models.py",
+ "sample_manage_custom_models_async.py",
]
}
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md b/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md
index 8df38ca5c8f8..15558180c1de 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md
@@ -5,10 +5,20 @@
* We are now targeting service version `2021-07-15-preview`
### Breaking changes
+
* The method `QuestionAnsweringClient.query_knowledgebase` has been renamed to `query_knowledge_base`.
+* Options bag model `KnowledgeBaseQueryOptions` for `query_knowledge_base` is renamed to `QueryKnowledgeBaseOptions`
+* Options bag model `TextQueryOptions` for `query_text` is renamed to `QueryTextOptions`
+* The filters model `StrictFilters` is renamed to `QueryFilters`
+* Enum `CompoundOperationKind` is renamed to `LogicalOperationKind`
+* We have removed the `string_index_type` input to all models and operations. We have also removed the `StringIndexType` enum.
+* The type of input `metadata` to `MetadataFilter` has changed from a dictionary of strings to a list of key-value tuples. For example, the input has changed from `{"key": "value"}` to `[("key", "value")]`.
+* The input to the `query_knowledge_base` and `query_text` overloads that take in a positional model for the body should be considered positional only.
### Features Added
+
* The method `QuestionAnsweringClient.query_text` now supports a list of records as strings, where the ID value will be automatically populated.
+* Added keyword argument `default_language` onto `QuestionAnsweringClient`, which has default value `'en'`. The default language for any operation call will be this default language value.
## 1.0.0b1 (2021-07-27)
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md b/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md
index 06fb24064963..2e3979bc06b8 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md
@@ -6,13 +6,17 @@ Question Answering is a cloud-based API service that lets you create a conversat
[Source code][questionanswering_client_src] | [Package (PyPI)][questionanswering_pypi_package] | [API reference documentation][questionanswering_refdocs] | [Product documentation][questionanswering_docs] | [Samples][questionanswering_samples]
+## _Disclaimer_
+
+_Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
+
## Getting started
### Prerequisites
-* Python 2.7, or 3.6 or later is required to use this package.
-* An [Azure subscription][azure_subscription]
-* An existing Question Answering resource
+- Python 2.7, or 3.6 or later is required to use this package.
+- An [Azure subscription][azure_subscription]
+- An existing Question Answering resource
> Note: the new unified Cognitive Language Services are not currently available for deployment.
@@ -56,7 +60,7 @@ client = QuestionAnsweringClient(endpoint, credential)
### QuestionAnsweringClient
-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.
+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.
## Examples
@@ -64,6 +68,7 @@ For asynchronous operations, an async `QuestionAnsweringClient` is in the `azure
The `azure-ai-language-questionanswering` client library provides both synchronous and asynchronous APIs.
The following examples show common scenarios using the `client` [created above](#create-questionansweringclient).
+
- [Ask a question](#ask-a-question)
- [Ask a follow-up question](#ask-a-follow-up-question)
- [Asynchronous operations](#asynchronous-operations)
@@ -75,7 +80,7 @@ The only input required to ask a question using a knowledge base is just the que
```python
from azure.ai.language.questionanswering import models as qna
-params = qna.KnowledgeBaseQueryOptions(
+params = qna.QueryKnowledgeBaseOptions(
question="How long should my Surface battery last?"
)
@@ -89,14 +94,14 @@ for candidate in output.answers:
```
-You can set additional properties on `KnowledgeBaseQueryOptions` to limit the number of answers, specify a minimum confidence score, and more.
+You can set additional properties on `QueryKnowledgeBaseOptions` to limit the number of answers, specify a minimum confidence score, and more.
### Ask a follow-up question
If your knowledge base is configured for [chit-chat][questionanswering_docs_chat], the answers from the knowledge base may include suggested [prompts for follow-up questions][questionanswering_refdocs_prompts] to initiate a conversation. You can ask a follow-up question by providing the ID of your chosen answer as the context for the continued conversation:
```python
-params = qna.models.KnowledgeBaseQueryOptions(
+params = qna.models.QueryKnowledgeBaseOptions(
question="How long should charging take?"
context=qna.models.KnowledgeBaseAnswerRequestContext(
previous_qna_id=previous_answer.id
@@ -112,9 +117,11 @@ for candidate in output.answers:
print("Source: {}".format(candidate.source))
```
+
### Asynchronous operations
The above examples can also be run asynchronously using the client in the `aio` namespace:
+
```python
from azure.core.credentials import AzureKeyCredential
from azure.ai.language.questionanswering.aio import QuestionAnsweringClient
@@ -122,7 +129,7 @@ from azure.ai.language.questionanswering import models as qna
client = QuestionAnsweringClient(endpoint, credential)
-params = qna.KnowledgeBaseQueryOptions(
+params = qna.QueryKnowledgeBaseOptions(
question="How long should my Surface battery last?"
)
@@ -133,11 +140,13 @@ output = await client.query_knowledgebase(
```
## Optional Configuration
+
Optional keyword arguments can be passed in at the client and per-operation level. The azure-core [reference documentation][azure_core_ref_docs] describes available configurations for retries, logging, transport protocols, and more.
## Troubleshooting
### General
+
Azure QuestionAnswering clients raise exceptions defined in [Azure Core][azure_core_readme].
When you interact with the Cognitive Language Services Question Answering client library using the Python SDK, errors returned by the service correspond to the same HTTP status codes returned for [REST API][questionanswering_rest_docs] requests.
@@ -156,6 +165,7 @@ except HttpResponseError as error:
```
### Logging
+
This library uses the standard
[logging][python_logging] library for logging.
Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO
@@ -168,9 +178,9 @@ See full SDK logging documentation with examples [here][sdk_logging_docs].
## Next steps
-* View our [samples][questionanswering_samples].
-* Read about the different [features][questionanswering_docs_features] of the Question Answering service.
-* Try our service [demos][questionanswering_docs_demos].
+- View our [samples][questionanswering_samples].
+- Read about the different [features][questionanswering_docs_features] of the Question Answering service.
+- Try our service [demos][questionanswering_docs_demos].
## Contributing
@@ -183,6 +193,7 @@ When you submit a pull request, a CLA-bot will automatically determine whether y
This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.
+
[azure_cli]: https://docs.microsoft.com/cli/azure/
[azure_portal]: https://portal.azure.com/
[azure_subscription]: https://azure.microsoft.com/free/
@@ -196,7 +207,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con
[sdk_logging_docs]: https://docs.microsoft.com/azure/developer/python/azure-sdk-logging
[azure_core_ref_docs]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-core/latest/azure.core.html
[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/
+[pip_link]: https://pypi.org/project/pip/
[questionanswering_client_class]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/1.0.0b1/azure.ai.language.questionanswering.html#azure.ai.language.questionanswering.QuestionAnsweringClient
[questionanswering_refdocs_prompts]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/1.0.0b1/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/
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_patch.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_patch.py
index 7308492dcdab..44a5cd3f4d5c 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_patch.py
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_patch.py
@@ -36,3 +36,29 @@ def _validate_text_records(records):
else:
request_batch.append(doc)
return request_batch
+
+def _get_positional_body(*args, **kwargs):
+ """Verify args and kwargs are valid, and then return the positional body, if users passed it in."""
+ if len(args) > 1:
+ raise TypeError("There can only be one positional argument, which is the POST body of this request.")
+ if args and "options" in kwargs:
+ raise TypeError(
+ "You have already supplied the request body as a positional parameter, "
+ "you can not supply it as a keyword argument as well."
+ )
+ return args[0] if args else None
+
+def _verify_qna_id_and_question(query_knowledgebase_options):
+ """For query_knowledge_base we require either `question` or `qna_id`."""
+ try:
+ qna_id = query_knowledgebase_options.qna_id
+ question = query_knowledgebase_options.question
+ except AttributeError:
+ qna_id = query_knowledgebase_options.get("qna_id") or query_knowledgebase_options.get("qnaId")
+ question = query_knowledgebase_options.get("question")
+ if not (qna_id or question):
+ raise TypeError(
+ "You need to pass in either `qna_id` or `question`."
+ )
+ if qna_id and question:
+ raise TypeError("You can not specify both `qna_id` and `question`.")
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_question_answering_client.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_question_answering_client.py
index 9de9e08df077..96c7eb2e28fc 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_question_answering_client.py
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_question_answering_client.py
@@ -32,6 +32,7 @@ class QuestionAnsweringClient(QuestionAnsweringClientOperationsMixin):
:type endpoint: str
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.AzureKeyCredential
+ :keyword str default_language: Sets the default language to use for all operations.
"""
def __init__(
@@ -49,6 +50,7 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
+ self._default_language = kwargs.pop("default_language", None)
def send_request(
self,
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_question_answering_client.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_question_answering_client.py
index 6994f258008f..a506cabb9960 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_question_answering_client.py
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_question_answering_client.py
@@ -27,6 +27,7 @@ class QuestionAnsweringClient(QuestionAnsweringClientOperationsMixin):
:type endpoint: str
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.AzureKeyCredential
+ :keyword str default_language: Sets the default language to use for all operations.
"""
def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None:
@@ -38,6 +39,7 @@ def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any)
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
+ self._default_language = kwargs.pop("default_language", None)
def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py
index 6775164a54ba..0c6cde294709 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py
@@ -22,7 +22,7 @@
from ... import models as _models
from ...operations._operations import build_query_knowledge_base_request, build_query_text_request
-from ..._patch import _validate_text_records
+from ..._patch import _validate_text_records, _get_positional_body, _verify_qna_id_and_question
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -32,23 +32,22 @@ class QuestionAnsweringClientOperationsMixin:
@overload
async def query_knowledge_base(
self,
- knowledge_base_query_options: "_models.KnowledgeBaseQueryOptions",
+ options: "_models.QueryKnowledgeBaseOptions",
*,
project_name: str,
- deployment_name: Optional[str] = None,
+ deployment_name: str,
**kwargs: Any
) -> "_models.KnowledgeBaseAnswers":
"""Answers the specified question using your knowledge base.
- :param knowledge_base_query_options: Post body of the request.
- :type knowledge_base_query_options:
- ~azure.ai.language.questionanswering.models.KnowledgeBaseQueryOptions
+ :param options: Positional-only POST body of the request.
+ :type options:
+ ~azure.ai.language.questionanswering.models.QueryKnowledgeBaseOptions
:keyword project_name: The name of the project to use.
:paramtype project_name: str
:keyword deployment_name: The name of the specific deployment of the project to use.
:paramtype deployment_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :return: KnowledgeBaseAnswers, or the result of cls(response)
+ :return: KnowledgeBaseAnswers
:rtype: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswers
:raises: ~azure.core.exceptions.HttpResponseError
"""
@@ -59,7 +58,7 @@ async def query_knowledge_base(
self,
*,
project_name: str,
- deployment_name: Optional[str] = None,
+ deployment_name: str,
qna_id: Optional[int] = None,
question: Optional[str] = None,
top: Optional[int] = None,
@@ -67,7 +66,7 @@ async def query_knowledge_base(
confidence_score_threshold: Optional[float] = None,
context: Optional["_models.KnowledgeBaseAnswerRequestContext"] = None,
ranker_type: Optional[Union[str, "_models.RankerType"]] = None,
- strict_filters: Optional["_models.StrictFilters"] = None,
+ filters: Optional["_models.QueryFilters"] = None,
answer_span_request: Optional["_models.AnswerSpanRequest"] = None,
include_unstructured_sources: Optional[bool] = None,
**kwargs: Any
@@ -95,14 +94,12 @@ async def query_knowledge_base(
:keyword ranker_type: (Optional) Set to 'QuestionOnly' for using a question only Ranker. Possible
values include: "Default", "QuestionOnly".
:paramtype ranker_type: str or ~azure.ai.language.questionanswering.models.RankerType
- :keyword strict_filters: Filter QnAs based on give metadata list and knowledge base source names.
- :paramtype strict_filters: ~azure.ai.language.questionanswering.models.StrictFilters
+ :keyword filters: Filter QnAs based on give metadata list and knowledge base source names.
+ :paramtype filters: ~azure.ai.language.questionanswering.models.QueryFilters
:keyword answer_span_request: To configure Answer span prediction feature.
:paramtype answer_span_request: ~azure.ai.language.questionanswering.models.AnswerSpanRequest
:keyword include_unstructured_sources: (Optional) Flag to enable Query over Unstructured Sources.
:paramtype include_unstructured_sources: bool
- :keyword callable cls: A custom type or function that will be passed the direct response
- :return: KnowledgeBaseAnswers, or the result of cls(response)
:rtype: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswers
:raises: ~azure.core.exceptions.HttpResponseError
"""
@@ -115,17 +112,17 @@ async def query_knowledge_base(
) -> "_models.KnowledgeBaseAnswers":
"""Answers the specified question using your knowledge base.
- :param knowledge_base_query_options: Post body of the request. Provide either `knowledge_base_query_options`, OR
+ :param options: POST body of the request. Provide either `options`, OR
individual keyword arguments. If both are provided, only the options object will be used.
- :type knowledge_base_query_options:
- ~azure.ai.language.questionanswering.models.KnowledgeBaseQueryOptions
+ :type options:
+ ~azure.ai.language.questionanswering.models.QueryKnowledgeBaseOptions
:keyword project_name: The name of the project to use.
:paramtype project_name: str
:keyword deployment_name: The name of the specific deployment of the project to use.
:paramtype deployment_name: str
:keyword qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over question.
:paramtype qna_id: int
- :keyword question: User question to query against the knowledge base. Provide either `knowledge_base_query_options`, OR
+ :keyword question: User question to query against the knowledge base. Provide either `options`, OR
individual keyword arguments. If both are provided, only the options object will be used.
:paramtype question: str
:keyword top: Max number of answers to be returned for the question.
@@ -139,40 +136,37 @@ async def query_knowledge_base(
:keyword ranker_type: (Optional) Set to 'QuestionOnly' for using a question only Ranker. Possible
values include: "Default", "QuestionOnly".
:paramtype ranker_type: str or ~azure.ai.language.questionanswering.models.RankerType
- :keyword strict_filters: Filter QnAs based on give metadata list and knowledge base source names.
- :paramtype strict_filters: ~azure.ai.language.questionanswering.models.StrictFilters
+ :keyword filters: Filter QnAs based on give metadata list and knowledge base source names.
+ :paramtype filters: ~azure.ai.language.questionanswering.models.QueryFilters
:keyword answer_span_request: To configure Answer span prediction feature.
:paramtype answer_span_request: ~azure.ai.language.questionanswering.models.AnswerSpanRequest
:keyword include_unstructured_sources: (Optional) Flag to enable Query over Unstructured Sources.
:paramtype include_unstructured_sources: bool
- :keyword callable cls: A custom type or function that will be passed the direct response
- :return: KnowledgeBaseAnswers, or the result of cls(response)
+ :return: KnowledgeBaseAnswers
:rtype: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswers
:raises: ~azure.core.exceptions.HttpResponseError
"""
- if args:
- knowledge_base_query_options = args[0]
- else:
- knowledge_base_query_options = _models.KnowledgeBaseQueryOptions(
- qna_id=kwargs.pop("qna_id", None),
- question=kwargs.pop("question", None),
- top=kwargs.pop("top", None),
- user_id=kwargs.pop("user_id", None),
- confidence_score_threshold=kwargs.pop("confidence_score_threshold", None),
- context=kwargs.pop("context", None),
- ranker_type=kwargs.pop("ranker_type", None),
- strict_filters=kwargs.pop("strict_filters", None),
- answer_span_request=kwargs.pop("answer_span_request", None),
- include_unstructured_sources=kwargs.pop("include_unstructured_sources", None)
- )
+ options = _get_positional_body(*args, **kwargs) or _models.QueryKnowledgeBaseOptions(
+ qna_id=kwargs.pop("qna_id", None),
+ question=kwargs.pop("question", None),
+ top=kwargs.pop("top", None),
+ user_id=kwargs.pop("user_id", None),
+ confidence_score_threshold=kwargs.pop("confidence_score_threshold", None),
+ context=kwargs.pop("context", None),
+ ranker_type=kwargs.pop("ranker_type", None),
+ filters=kwargs.pop("filters", None),
+ answer_span_request=kwargs.pop("answer_span_request", None),
+ include_unstructured_sources=kwargs.pop("include_unstructured_sources", None)
+ )
+ _verify_qna_id_and_question(options)
cls = kwargs.pop("cls", None) # type: ClsType["_models.KnowledgeBaseAnswers"]
error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop("error_map", {}))
content_type = kwargs.pop("content_type", "application/json") # type: Optional[str]
project_name = kwargs.pop("project_name") # type: str
- deployment_name = kwargs.pop("deployment_name", None) # type: Optional[str]
+ deployment_name = kwargs.pop("deployment_name") # type: str
- json = self._serialize.body(knowledge_base_query_options, "KnowledgeBaseQueryOptions")
+ json = self._serialize.body(options, "QueryKnowledgeBaseOptions")
request = build_query_knowledge_base_request(
content_type=content_type,
@@ -186,9 +180,7 @@ async def query_knowledge_base(
}
request.url = self._client.format_url(request.url, **path_format_arguments)
- pipeline_response = await self._client.send_request(
- request, stream=False, _return_pipeline_response=True, **kwargs
- )
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
@@ -206,15 +198,12 @@ async def query_knowledge_base(
query_knowledge_base.metadata = {"url": "/:query-knowledgebases"} # type: ignore
@overload
- async def query_text(
- self, text_query_options: "_models.TextQueryOptions", **kwargs: Any
- ) -> "_models.TextAnswers":
+ async def query_text(self, options: "_models.QueryTextOptions", **kwargs: Any) -> "_models.TextAnswers":
"""Answers the specified question using the provided text in the body.
- :param text_query_options: Post body of the request.
- :type text_query_options: ~azure.ai.language.questionanswering.models.TextQueryOptions
- :keyword callable cls: A custom type or function that will be passed the direct response
- :return: TextAnswers, or the result of cls(response)
+ :param options: Positional-only POST body of the request.
+ :type options: ~azure.ai.language.questionanswering.models.QueryTextOptions
+ :return: TextAnswers
:rtype: ~azure.ai.language.questionanswering.models.TextAnswers
:raises: ~azure.core.exceptions.HttpResponseError
"""
@@ -227,7 +216,6 @@ async def query_text(
question: str,
records: List["_models.TextRecord"],
language: Optional[str] = None,
- string_index_type: Optional[Union[str, "_models.StringIndexType"]] = "TextElements_v8",
**kwargs: Any
) -> "_models.TextAnswers":
"""Answers the specified question using the provided text in the body.
@@ -240,13 +228,7 @@ async def query_text(
example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as
default.
:paramtype language: str
- :keyword string_index_type: Specifies the method used to interpret string offsets. Defaults to
- Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see
- https://aka.ms/text-analytics-offsets. Possible values include: "TextElements_v8",
- "UnicodeCodePoint", "Utf16CodeUnit". Default value: "TextElements_v8".
- :paramtype string_index_type: str or ~azure.ai.language.questionanswering.models.StringIndexType
- :keyword callable cls: A custom type or function that will be passed the direct response
- :return: TextAnswers, or the result of cls(response)
+ :return: TextAnswers
:rtype: ~azure.ai.language.questionanswering.models.TextAnswers
:raises: ~azure.core.exceptions.HttpResponseError
"""
@@ -257,48 +239,38 @@ async def query_text(
) -> "_models.TextAnswers":
"""Answers the specified question using the provided text in the body.
- :param text_query_options: Post body of the request. Provide either `text_query_options`, OR
+ :param options: POST body of the request. Provide either `options`, OR
individual keyword arguments. If both are provided, only the options object will be used.
- :type text_query_options: ~azure.ai.language.questionanswering.models.TextQueryOptions
- :keyword question: User question to query against the given text records. Provide either `text_query_options`, OR
+ :type options: ~azure.ai.language.questionanswering.models.QueryTextOptions
+ :keyword question: User question to query against the given text records. Provide either `options`, OR
individual keyword arguments. If both are provided, only the options object will be used.
:paramtype question: str
- :keyword records: Text records to be searched for given question. Provide either `text_query_options`, OR
+ :keyword records: Text records to be searched for given question. Provide either `options`, OR
individual keyword arguments. If both are provided, only the options object will be used.
:paramtype records: list[~azure.ai.language.questionanswering.models.TextRecord]
:keyword language: Language of the text records. This is BCP-47 representation of a language. For
example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as default.
:paramtype language: str
- :keyword string_index_type: Specifies the method used to interpret string offsets. Defaults to
- Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see
- https://aka.ms/text-analytics-offsets. Possible values include: "TextElements_v8",
- "UnicodeCodePoint", "Utf16CodeUnit". Default value: "TextElements_v8".
- :paramtype string_index_type: str or ~azure.ai.language.questionanswering.models.StringIndexType
- :keyword callable cls: A custom type or function that will be passed the direct response
- :return: TextAnswers, or the result of cls(response)
+ :return: TextAnswers
:rtype: ~azure.ai.language.questionanswering.models.TextAnswers
:raises: ~azure.core.exceptions.HttpResponseError
"""
- if args:
- text_query_options = args[0]
- else:
- text_query_options = _models.TextQueryOptions(
- question=kwargs.pop("question"),
- records=kwargs.pop("records"),
- language=kwargs.pop("language", None),
- string_index_type=kwargs.pop("string_index_type", "TextElements_v8")
- )
+ options = _get_positional_body(*args, **kwargs) or _models.QueryTextOptions(
+ question=kwargs.pop("question"),
+ records=kwargs.pop("records"),
+ language=kwargs.pop("language", self._default_language),
+ )
try:
- text_query_options['records'] = _validate_text_records(text_query_options['records'])
+ options['records'] = _validate_text_records(options['records'])
except TypeError:
- text_query_options.records = _validate_text_records(text_query_options.records)
+ options.records = _validate_text_records(options.records)
cls = kwargs.pop("cls", None) # type: ClsType["_models.TextAnswers"]
error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop("error_map", {}))
content_type = kwargs.pop("content_type", "application/json") # type: Optional[str]
- json = self._serialize.body(text_query_options, "TextQueryOptions")
+ json = self._serialize.body(options, "QueryTextOptions")
request = build_query_text_request(
content_type=content_type,
@@ -310,9 +282,7 @@ async def query_text(
}
request.url = self._client.format_url(request.url, **path_format_arguments)
- pipeline_response = await self._client.send_request(
- request, stream=False, _return_pipeline_response=True, **kwargs
- )
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/__init__.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/__init__.py
index 55d25e6fff0c..e7f241830c2f 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/__init__.py
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/__init__.py
@@ -17,12 +17,12 @@
from ._models_py3 import KnowledgeBaseAnswerPrompt
from ._models_py3 import KnowledgeBaseAnswerRequestContext
from ._models_py3 import KnowledgeBaseAnswers
- from ._models_py3 import KnowledgeBaseQueryOptions
from ._models_py3 import MetadataFilter
- from ._models_py3 import StrictFilters
+ from ._models_py3 import QueryFilters
+ from ._models_py3 import QueryKnowledgeBaseOptions
+ from ._models_py3 import QueryTextOptions
from ._models_py3 import TextAnswer
from ._models_py3 import TextAnswers
- from ._models_py3 import TextQueryOptions
from ._models_py3 import TextRecord
except (SyntaxError, ImportError):
from ._models import AnswerSpan # type: ignore
@@ -35,20 +35,19 @@
from ._models import KnowledgeBaseAnswerPrompt # type: ignore
from ._models import KnowledgeBaseAnswerRequestContext # type: ignore
from ._models import KnowledgeBaseAnswers # type: ignore
- from ._models import KnowledgeBaseQueryOptions # type: ignore
from ._models import MetadataFilter # type: ignore
- from ._models import StrictFilters # type: ignore
+ from ._models import QueryFilters # type: ignore
+ from ._models import QueryKnowledgeBaseOptions # type: ignore
+ from ._models import QueryTextOptions # type: ignore
from ._models import TextAnswer # type: ignore
from ._models import TextAnswers # type: ignore
- from ._models import TextQueryOptions # type: ignore
from ._models import TextRecord # type: ignore
from ._question_answering_client_enums import (
- CompoundOperationKind,
ErrorCode,
InnerErrorCode,
+ LogicalOperationKind,
RankerType,
- StringIndexType,
)
__all__ = [
@@ -62,16 +61,15 @@
"KnowledgeBaseAnswerPrompt",
"KnowledgeBaseAnswerRequestContext",
"KnowledgeBaseAnswers",
- "KnowledgeBaseQueryOptions",
"MetadataFilter",
- "StrictFilters",
+ "QueryFilters",
+ "QueryKnowledgeBaseOptions",
+ "QueryTextOptions",
"TextAnswer",
"TextAnswers",
- "TextQueryOptions",
"TextRecord",
- "CompoundOperationKind",
"ErrorCode",
"InnerErrorCode",
+ "LogicalOperationKind",
"RankerType",
- "StringIndexType",
]
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py
index e16ad163e9fe..0946d3315693 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py
@@ -13,14 +13,14 @@
class AnswerSpan(msrest.serialization.Model):
"""Answer span object of QnA.
- :keyword text: Predicted text of answer span.
- :paramtype text: str
- :keyword confidence_score: Predicted score of answer span, value ranges from 0 to 1.
- :paramtype confidence_score: float
- :keyword offset: The answer span offset from the start of answer.
- :paramtype offset: int
- :keyword length: The length of the answer span.
- :paramtype length: int
+ :ivar text: Predicted text of answer span.
+ :vartype text: str
+ :ivar confidence_score: Predicted score of answer span, value ranges from 0 to 1.
+ :vartype confidence_score: float
+ :ivar offset: The answer span offset from the start of answer.
+ :vartype offset: int
+ :ivar length: The length of the answer span.
+ :vartype length: int
"""
_validation = {
@@ -35,6 +35,16 @@ class AnswerSpan(msrest.serialization.Model):
}
def __init__(self, **kwargs):
+ """
+ :keyword text: Predicted text of answer span.
+ :paramtype text: str
+ :keyword confidence_score: Predicted score of answer span, value ranges from 0 to 1.
+ :paramtype confidence_score: float
+ :keyword offset: The answer span offset from the start of answer.
+ :paramtype offset: int
+ :keyword length: The length of the answer span.
+ :paramtype length: int
+ """
super(AnswerSpan, self).__init__(**kwargs)
self.text = kwargs.get("text", None)
self.confidence_score = kwargs.get("confidence_score", None)
@@ -45,14 +55,14 @@ def __init__(self, **kwargs):
class AnswerSpanRequest(msrest.serialization.Model):
"""To configure Answer span prediction feature.
- :keyword enable: Enable or disable Answer Span prediction.
- :paramtype enable: bool
- :keyword confidence_score_threshold: Minimum threshold score required to include an answer
- span, value ranges from 0 to 1.
- :paramtype confidence_score_threshold: float
- :keyword top_answers_with_span: Number of Top answers to be considered for span prediction from
- 1 to 10.
- :paramtype top_answers_with_span: int
+ :ivar enable: Enable or disable Answer Span prediction.
+ :vartype enable: bool
+ :ivar confidence_score_threshold: Minimum threshold score required to include an answer span,
+ value ranges from 0 to 1.
+ :vartype confidence_score_threshold: float
+ :ivar top_answers_with_span: Number of Top answers to be considered for span prediction from 1
+ to 10.
+ :vartype top_answers_with_span: int
"""
_validation = {
@@ -67,6 +77,16 @@ class AnswerSpanRequest(msrest.serialization.Model):
}
def __init__(self, **kwargs):
+ """
+ :keyword enable: Enable or disable Answer Span prediction.
+ :paramtype enable: bool
+ :keyword confidence_score_threshold: Minimum threshold score required to include an answer
+ span, value ranges from 0 to 1.
+ :paramtype confidence_score_threshold: float
+ :keyword top_answers_with_span: Number of Top answers to be considered for span prediction from
+ 1 to 10.
+ :paramtype top_answers_with_span: int
+ """
super(AnswerSpanRequest, self).__init__(**kwargs)
self.enable = kwargs.get("enable", None)
self.confidence_score_threshold = kwargs.get("confidence_score_threshold", None)
@@ -78,19 +98,19 @@ class Error(msrest.serialization.Model):
All required parameters must be populated in order to send to Azure.
- :keyword code: Required. One of a server-defined set of error codes. Possible values include:
+ :ivar code: Required. One of a server-defined set of error codes. Possible values include:
"InvalidRequest", "InvalidArgument", "Unauthorized", "Forbidden", "NotFound",
"TooManyRequests", "InternalServerError", "ServiceUnavailable".
- :paramtype code: str or ~azure.ai.language.questionanswering.models.ErrorCode
- :keyword message: Required. A human-readable representation of the error.
- :paramtype message: str
- :keyword target: The target of the error.
- :paramtype target: str
- :keyword details: An array of details about specific errors that led to this reported error.
- :paramtype details: list[~azure.ai.language.questionanswering.models.Error]
- :keyword innererror: An object containing more specific information than the current object
- about the error.
- :paramtype innererror: ~azure.ai.language.questionanswering.models.InnerErrorModel
+ :vartype code: str or ~azure.ai.language.questionanswering.models.ErrorCode
+ :ivar message: Required. A human-readable representation of the error.
+ :vartype message: str
+ :ivar target: The target of the error.
+ :vartype target: str
+ :ivar details: An array of details about specific errors that led to this reported error.
+ :vartype details: list[~azure.ai.language.questionanswering.models.Error]
+ :ivar innererror: An object containing more specific information than the current object about
+ the error.
+ :vartype innererror: ~azure.ai.language.questionanswering.models.InnerErrorModel
"""
_validation = {
@@ -107,6 +127,21 @@ class Error(msrest.serialization.Model):
}
def __init__(self, **kwargs):
+ """
+ :keyword code: Required. One of a server-defined set of error codes. Possible values include:
+ "InvalidRequest", "InvalidArgument", "Unauthorized", "Forbidden", "NotFound",
+ "TooManyRequests", "InternalServerError", "ServiceUnavailable".
+ :paramtype code: str or ~azure.ai.language.questionanswering.models.ErrorCode
+ :keyword message: Required. A human-readable representation of the error.
+ :paramtype message: str
+ :keyword target: The target of the error.
+ :paramtype target: str
+ :keyword details: An array of details about specific errors that led to this reported error.
+ :paramtype details: list[~azure.ai.language.questionanswering.models.Error]
+ :keyword innererror: An object containing more specific information than the current object
+ about the error.
+ :paramtype innererror: ~azure.ai.language.questionanswering.models.InnerErrorModel
+ """
super(Error, self).__init__(**kwargs)
self.code = kwargs["code"]
self.message = kwargs["message"]
@@ -118,8 +153,8 @@ def __init__(self, **kwargs):
class ErrorResponse(msrest.serialization.Model):
"""Error response.
- :keyword error: The error object.
- :paramtype error: ~azure.ai.language.questionanswering.models.Error
+ :ivar error: The error object.
+ :vartype error: ~azure.ai.language.questionanswering.models.Error
"""
_attribute_map = {
@@ -127,6 +162,10 @@ class ErrorResponse(msrest.serialization.Model):
}
def __init__(self, **kwargs):
+ """
+ :keyword error: The error object.
+ :paramtype error: ~azure.ai.language.questionanswering.models.Error
+ """
super(ErrorResponse, self).__init__(**kwargs)
self.error = kwargs.get("error", None)
@@ -136,19 +175,19 @@ class InnerErrorModel(msrest.serialization.Model):
All required parameters must be populated in order to send to Azure.
- :keyword code: Required. One of a server-defined set of error codes. Possible values include:
+ :ivar code: Required. One of a server-defined set of error codes. Possible values include:
"InvalidRequest", "InvalidParameterValue", "KnowledgeBaseNotFound",
"AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", "ExtractionFailure".
- :paramtype code: str or ~azure.ai.language.questionanswering.models.InnerErrorCode
- :keyword message: Required. Error message.
- :paramtype message: str
- :keyword details: Error details.
- :paramtype details: dict[str, str]
- :keyword target: Error target.
- :paramtype target: str
- :keyword innererror: An object containing more specific information than the current object
- about the error.
- :paramtype innererror: ~azure.ai.language.questionanswering.models.InnerErrorModel
+ :vartype code: str or ~azure.ai.language.questionanswering.models.InnerErrorCode
+ :ivar message: Required. Error message.
+ :vartype message: str
+ :ivar details: Error details.
+ :vartype details: dict[str, str]
+ :ivar target: Error target.
+ :vartype target: str
+ :ivar innererror: An object containing more specific information than the current object about
+ the error.
+ :vartype innererror: ~azure.ai.language.questionanswering.models.InnerErrorModel
"""
_validation = {
@@ -165,6 +204,21 @@ class InnerErrorModel(msrest.serialization.Model):
}
def __init__(self, **kwargs):
+ """
+ :keyword code: Required. One of a server-defined set of error codes. Possible values include:
+ "InvalidRequest", "InvalidParameterValue", "KnowledgeBaseNotFound",
+ "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", "ExtractionFailure".
+ :paramtype code: str or ~azure.ai.language.questionanswering.models.InnerErrorCode
+ :keyword message: Required. Error message.
+ :paramtype message: str
+ :keyword details: Error details.
+ :paramtype details: dict[str, str]
+ :keyword target: Error target.
+ :paramtype target: str
+ :keyword innererror: An object containing more specific information than the current object
+ about the error.
+ :paramtype innererror: ~azure.ai.language.questionanswering.models.InnerErrorModel
+ """
super(InnerErrorModel, self).__init__(**kwargs)
self.code = kwargs["code"]
self.message = kwargs["message"]
@@ -176,23 +230,23 @@ def __init__(self, **kwargs):
class KnowledgeBaseAnswer(msrest.serialization.Model):
"""Represents knowledge base answer.
- :keyword questions: List of questions.
- :paramtype questions: list[str]
- :keyword answer: The Answer.
- :paramtype answer: str
- :keyword confidence_score: Answer confidence score, value ranges from 0 to 1.
- :paramtype confidence_score: float
- :keyword id: ID of the QnA result.
- :paramtype id: int
- :keyword source: Source of QnA result.
- :paramtype source: str
- :keyword metadata: Metadata associated with the answer, useful to categorize or filter question
+ :ivar questions: List of questions.
+ :vartype questions: list[str]
+ :ivar answer: The Answer.
+ :vartype answer: str
+ :ivar confidence_score: Answer confidence score, value ranges from 0 to 1.
+ :vartype confidence_score: float
+ :ivar id: ID of the QnA result.
+ :vartype id: int
+ :ivar source: Source of QnA result.
+ :vartype source: str
+ :ivar metadata: Metadata associated with the answer, useful to categorize or filter question
answers.
- :paramtype metadata: dict[str, str]
- :keyword dialog: Dialog associated with Answer.
- :paramtype dialog: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerDialog
- :keyword answer_span: Answer span object of QnA with respect to user's question.
- :paramtype answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan
+ :vartype metadata: dict[str, str]
+ :ivar dialog: Dialog associated with Answer.
+ :vartype dialog: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerDialog
+ :ivar answer_span: Answer span object of QnA with respect to user's question.
+ :vartype answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan
"""
_validation = {
@@ -211,6 +265,25 @@ class KnowledgeBaseAnswer(msrest.serialization.Model):
}
def __init__(self, **kwargs):
+ """
+ :keyword questions: List of questions.
+ :paramtype questions: list[str]
+ :keyword answer: The Answer.
+ :paramtype answer: str
+ :keyword confidence_score: Answer confidence score, value ranges from 0 to 1.
+ :paramtype confidence_score: float
+ :keyword id: ID of the QnA result.
+ :paramtype id: int
+ :keyword source: Source of QnA result.
+ :paramtype source: str
+ :keyword metadata: Metadata associated with the answer, useful to categorize or filter question
+ answers.
+ :paramtype metadata: dict[str, str]
+ :keyword dialog: Dialog associated with Answer.
+ :paramtype dialog: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerDialog
+ :keyword answer_span: Answer span object of QnA with respect to user's question.
+ :paramtype answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan
+ """
super(KnowledgeBaseAnswer, self).__init__(**kwargs)
self.questions = kwargs.get("questions", None)
self.answer = kwargs.get("answer", None)
@@ -225,12 +298,12 @@ def __init__(self, **kwargs):
class KnowledgeBaseAnswerDialog(msrest.serialization.Model):
"""Dialog associated with Answer.
- :keyword is_context_only: To mark if a prompt is relevant only with a previous question or not.
- If true, do not include this QnA as search result for queries without context; otherwise, if
+ :ivar is_context_only: To mark if a prompt is relevant only with a previous question or not. If
+ true, do not include this QnA as search result for queries without context; otherwise, if
false, ignores context and includes this QnA in search result.
- :paramtype is_context_only: bool
- :keyword prompts: List of 0 to 20 prompts associated with the answer.
- :paramtype prompts: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerPrompt]
+ :vartype is_context_only: bool
+ :ivar prompts: List of 0 to 20 prompts associated with the answer.
+ :vartype prompts: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerPrompt]
"""
_validation = {
@@ -243,6 +316,14 @@ class KnowledgeBaseAnswerDialog(msrest.serialization.Model):
}
def __init__(self, **kwargs):
+ """
+ :keyword is_context_only: To mark if a prompt is relevant only with a previous question or not.
+ If true, do not include this QnA as search result for queries without context; otherwise, if
+ false, ignores context and includes this QnA in search result.
+ :paramtype is_context_only: bool
+ :keyword prompts: List of 0 to 20 prompts associated with the answer.
+ :paramtype prompts: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerPrompt]
+ """
super(KnowledgeBaseAnswerDialog, self).__init__(**kwargs)
self.is_context_only = kwargs.get("is_context_only", None)
self.prompts = kwargs.get("prompts", None)
@@ -251,12 +332,12 @@ def __init__(self, **kwargs):
class KnowledgeBaseAnswerPrompt(msrest.serialization.Model):
"""Prompt for an answer.
- :keyword display_order: Index of the prompt - used in ordering of the prompts.
- :paramtype display_order: int
- :keyword qna_id: QnA ID corresponding to the prompt.
- :paramtype qna_id: int
- :keyword display_text: Text displayed to represent a follow up question prompt.
- :paramtype display_text: str
+ :ivar display_order: Index of the prompt - used in ordering of the prompts.
+ :vartype display_order: int
+ :ivar qna_id: QnA ID corresponding to the prompt.
+ :vartype qna_id: int
+ :ivar display_text: Text displayed to represent a follow up question prompt.
+ :vartype display_text: str
"""
_validation = {
@@ -270,6 +351,14 @@ class KnowledgeBaseAnswerPrompt(msrest.serialization.Model):
}
def __init__(self, **kwargs):
+ """
+ :keyword display_order: Index of the prompt - used in ordering of the prompts.
+ :paramtype display_order: int
+ :keyword qna_id: QnA ID corresponding to the prompt.
+ :paramtype qna_id: int
+ :keyword display_text: Text displayed to represent a follow up question prompt.
+ :paramtype display_text: str
+ """
super(KnowledgeBaseAnswerPrompt, self).__init__(**kwargs)
self.display_order = kwargs.get("display_order", None)
self.qna_id = kwargs.get("qna_id", None)
@@ -281,10 +370,10 @@ class KnowledgeBaseAnswerRequestContext(msrest.serialization.Model):
All required parameters must be populated in order to send to Azure.
- :keyword previous_qna_id: Required. Previous turn top answer result QnA ID.
- :paramtype previous_qna_id: int
- :keyword previous_user_query: Previous user query.
- :paramtype previous_user_query: str
+ :ivar previous_qna_id: Required. Previous turn top answer result QnA ID.
+ :vartype previous_qna_id: int
+ :ivar previous_user_query: Previous user query.
+ :vartype previous_user_query: str
"""
_validation = {
@@ -297,6 +386,12 @@ class KnowledgeBaseAnswerRequestContext(msrest.serialization.Model):
}
def __init__(self, **kwargs):
+ """
+ :keyword previous_qna_id: Required. Previous turn top answer result QnA ID.
+ :paramtype previous_qna_id: int
+ :keyword previous_user_query: Previous user query.
+ :paramtype previous_user_query: str
+ """
super(KnowledgeBaseAnswerRequestContext, self).__init__(**kwargs)
self.previous_qna_id = kwargs["previous_qna_id"]
self.previous_user_query = kwargs.get("previous_user_query", None)
@@ -305,8 +400,8 @@ def __init__(self, **kwargs):
class KnowledgeBaseAnswers(msrest.serialization.Model):
"""Represents List of Question Answers.
- :keyword answers: Represents Answer Result list.
- :paramtype answers: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswer]
+ :ivar answers: Represents Answer Result list.
+ :vartype answers: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswer]
"""
_attribute_map = {
@@ -314,39 +409,108 @@ class KnowledgeBaseAnswers(msrest.serialization.Model):
}
def __init__(self, **kwargs):
+ """
+ :keyword answers: Represents Answer Result list.
+ :paramtype answers: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswer]
+ """
super(KnowledgeBaseAnswers, self).__init__(**kwargs)
self.answers = kwargs.get("answers", None)
-class KnowledgeBaseQueryOptions(msrest.serialization.Model):
+class MetadataFilter(msrest.serialization.Model):
+ """Find QnAs that are associated with the given list of metadata.
+
+ :ivar metadata:
+ :vartype metadata: list[tuple[str]]
+ :ivar logical_operation: Operation used to join metadata filters. Possible values include:
+ "AND", "OR".
+ :vartype logical_operation: str or
+ ~azure.ai.language.questionanswering.models.LogicalOperationKind
+ """
+
+ _attribute_map = {
+ "metadata": {"key": "metadata", "type": "[[str]]"},
+ "logical_operation": {"key": "logicalOperation", "type": "str"},
+ }
+
+ def __init__(self, **kwargs):
+ """
+ :keyword metadata:
+ :paramtype metadata: list[tuple[str]]
+ :keyword logical_operation: Operation used to join metadata filters. Possible values include:
+ "AND", "OR".
+ :paramtype logical_operation: str or
+ ~azure.ai.language.questionanswering.models.LogicalOperationKind
+ """
+ super(MetadataFilter, self).__init__(**kwargs)
+ self.metadata = kwargs.get("metadata", None)
+ self.logical_operation = kwargs.get("logical_operation", None)
+
+
+class QueryFilters(msrest.serialization.Model):
+ """filters over knowledge base.
+
+ :ivar metadata_filter: Find QnAs that are associated with the given list of metadata.
+ :vartype metadata_filter: ~azure.ai.language.questionanswering.models.MetadataFilter
+ :ivar source_filter: Find QnAs that are associated with the given list of sources in knowledge
+ base.
+ :vartype source_filter: list[str]
+ :ivar logical_operation: Logical operation used to join metadata filters with source filters.
+ Possible values include: "AND", "OR".
+ :vartype logical_operation: str or
+ ~azure.ai.language.questionanswering.models.LogicalOperationKind
+ """
+
+ _attribute_map = {
+ "metadata_filter": {"key": "metadataFilter", "type": "MetadataFilter"},
+ "source_filter": {"key": "sourceFilter", "type": "[str]"},
+ "logical_operation": {"key": "logicalOperation", "type": "str"},
+ }
+
+ def __init__(self, **kwargs):
+ """
+ :keyword metadata_filter: Find QnAs that are associated with the given list of metadata.
+ :paramtype metadata_filter: ~azure.ai.language.questionanswering.models.MetadataFilter
+ :keyword source_filter: Find QnAs that are associated with the given list of sources in
+ knowledge base.
+ :paramtype source_filter: list[str]
+ :keyword logical_operation: Logical operation used to join metadata filters with source
+ filters. Possible values include: "AND", "OR".
+ :paramtype logical_operation: str or
+ ~azure.ai.language.questionanswering.models.LogicalOperationKind
+ """
+ super(QueryFilters, self).__init__(**kwargs)
+ self.metadata_filter = kwargs.get("metadata_filter", None)
+ self.source_filter = kwargs.get("source_filter", None)
+ self.logical_operation = kwargs.get("logical_operation", None)
+
+
+class QueryKnowledgeBaseOptions(msrest.serialization.Model):
"""The question parameters to answer using a knowledge base.
- :keyword qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over
+ :ivar qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over
question.
- :paramtype qna_id: int
- :keyword question: User question to query against the knowledge base.
- :paramtype question: str
- :keyword top: Max number of answers to be returned for the question.
- :paramtype top: int
- :keyword user_id: Unique identifier for the user.
- :paramtype user_id: str
- :keyword confidence_score_threshold: Minimum threshold score for answers, value ranges from 0
- to 1.
- :paramtype confidence_score_threshold: float
- :keyword context: Context object with previous QnA's information.
- :paramtype context:
- ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerRequestContext
- :keyword ranker_type: (Optional) Set to 'QuestionOnly' for using a question only Ranker.
- Possible values include: "Default", "QuestionOnly".
- :paramtype ranker_type: str or ~azure.ai.language.questionanswering.models.RankerType
- :keyword strict_filters: Filter QnAs based on give metadata list and knowledge base source
- names.
- :paramtype strict_filters: ~azure.ai.language.questionanswering.models.StrictFilters
- :keyword answer_span_request: To configure Answer span prediction feature.
- :paramtype answer_span_request: ~azure.ai.language.questionanswering.models.AnswerSpanRequest
- :keyword include_unstructured_sources: (Optional) Flag to enable Query over Unstructured
- Sources.
- :paramtype include_unstructured_sources: bool
+ :vartype qna_id: int
+ :ivar question: User question to query against the knowledge base.
+ :vartype question: str
+ :ivar top: Max number of answers to be returned for the question.
+ :vartype top: int
+ :ivar user_id: Unique identifier for the user.
+ :vartype user_id: str
+ :ivar confidence_score_threshold: Minimum threshold score for answers, value ranges from 0 to
+ 1.
+ :vartype confidence_score_threshold: float
+ :ivar context: Context object with previous QnA's information.
+ :vartype context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerRequestContext
+ :ivar ranker_type: (Optional) Set to 'QuestionOnly' for using a question only Ranker. Possible
+ values include: "Default", "QuestionOnly".
+ :vartype ranker_type: str or ~azure.ai.language.questionanswering.models.RankerType
+ :ivar filters: Filter QnAs based on give metadata list and knowledge base source names.
+ :vartype filters: ~azure.ai.language.questionanswering.models.QueryFilters
+ :ivar answer_span_request: To configure Answer span prediction feature.
+ :vartype answer_span_request: ~azure.ai.language.questionanswering.models.AnswerSpanRequest
+ :ivar include_unstructured_sources: (Optional) Flag to enable Query over Unstructured Sources.
+ :vartype include_unstructured_sources: bool
"""
_validation = {
@@ -361,13 +525,40 @@ class KnowledgeBaseQueryOptions(msrest.serialization.Model):
"confidence_score_threshold": {"key": "confidenceScoreThreshold", "type": "float"},
"context": {"key": "context", "type": "KnowledgeBaseAnswerRequestContext"},
"ranker_type": {"key": "rankerType", "type": "str"},
- "strict_filters": {"key": "strictFilters", "type": "StrictFilters"},
+ "filters": {"key": "filters", "type": "QueryFilters"},
"answer_span_request": {"key": "answerSpanRequest", "type": "AnswerSpanRequest"},
"include_unstructured_sources": {"key": "includeUnstructuredSources", "type": "bool"},
}
def __init__(self, **kwargs):
- super(KnowledgeBaseQueryOptions, self).__init__(**kwargs)
+ """
+ :keyword qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over
+ question.
+ :paramtype qna_id: int
+ :keyword question: User question to query against the knowledge base.
+ :paramtype question: str
+ :keyword top: Max number of answers to be returned for the question.
+ :paramtype top: int
+ :keyword user_id: Unique identifier for the user.
+ :paramtype user_id: str
+ :keyword confidence_score_threshold: Minimum threshold score for answers, value ranges from 0
+ to 1.
+ :paramtype confidence_score_threshold: float
+ :keyword context: Context object with previous QnA's information.
+ :paramtype context:
+ ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerRequestContext
+ :keyword ranker_type: (Optional) Set to 'QuestionOnly' for using a question only Ranker.
+ Possible values include: "Default", "QuestionOnly".
+ :paramtype ranker_type: str or ~azure.ai.language.questionanswering.models.RankerType
+ :keyword filters: Filter QnAs based on give metadata list and knowledge base source names.
+ :paramtype filters: ~azure.ai.language.questionanswering.models.QueryFilters
+ :keyword answer_span_request: To configure Answer span prediction feature.
+ :paramtype answer_span_request: ~azure.ai.language.questionanswering.models.AnswerSpanRequest
+ :keyword include_unstructured_sources: (Optional) Flag to enable Query over Unstructured
+ Sources.
+ :paramtype include_unstructured_sources: bool
+ """
+ super(QueryKnowledgeBaseOptions, self).__init__(**kwargs)
self.qna_id = kwargs.get("qna_id", None)
self.question = kwargs.get("question", None)
self.top = kwargs.get("top", None)
@@ -375,75 +566,71 @@ def __init__(self, **kwargs):
self.confidence_score_threshold = kwargs.get("confidence_score_threshold", None)
self.context = kwargs.get("context", None)
self.ranker_type = kwargs.get("ranker_type", None)
- self.strict_filters = kwargs.get("strict_filters", None)
+ self.filters = kwargs.get("filters", None)
self.answer_span_request = kwargs.get("answer_span_request", None)
self.include_unstructured_sources = kwargs.get("include_unstructured_sources", None)
-class MetadataFilter(msrest.serialization.Model):
- """Find QnAs that are associated with the given list of metadata.
+class QueryTextOptions(msrest.serialization.Model):
+ """The question and text record parameters to answer.
- :keyword metadata: Dictionary of :code:``.
- :paramtype metadata: dict[str, str]
- :keyword compound_operation: (Optional) Set to 'OR' for joining metadata using 'OR' operation.
- Possible values include: "AND", "OR".
- :paramtype compound_operation: str or
- ~azure.ai.language.questionanswering.models.CompoundOperationKind
+ All required parameters must be populated in order to send to Azure.
+
+ :ivar question: Required. User question to query against the given text records.
+ :vartype question: str
+ :ivar records: Required. Text records to be searched for given question.
+ :vartype records: list[~azure.ai.language.questionanswering.models.TextRecord]
+ :ivar language: Language of the text records. This is BCP-47 representation of a language. For
+ example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as
+ default.
+ :vartype language: str
"""
- _attribute_map = {
- "metadata": {"key": "metadata", "type": "{str}"},
- "compound_operation": {"key": "compoundOperation", "type": "str"},
+ _validation = {
+ "question": {"required": True},
+ "records": {"required": True},
}
- def __init__(self, **kwargs):
- super(MetadataFilter, self).__init__(**kwargs)
- self.metadata = kwargs.get("metadata", None)
- self.compound_operation = kwargs.get("compound_operation", None)
-
-
-class StrictFilters(msrest.serialization.Model):
- """filters over knowledge base.
-
- :keyword metadata_filter: Find QnAs that are associated with the given list of metadata.
- :paramtype metadata_filter: ~azure.ai.language.questionanswering.models.MetadataFilter
- :keyword source_filter: Find QnAs that are associated with the given list of sources in
- knowledge base.
- :paramtype source_filter: list[str]
- :keyword compound_operation: (Optional) Set to 'OR' for joining metadata using 'OR' operation.
- Possible values include: "AND", "OR".
- :paramtype compound_operation: str or
- ~azure.ai.language.questionanswering.models.CompoundOperationKind
- """
-
_attribute_map = {
- "metadata_filter": {"key": "metadataFilter", "type": "MetadataFilter"},
- "source_filter": {"key": "sourceFilter", "type": "[str]"},
- "compound_operation": {"key": "compoundOperation", "type": "str"},
+ "question": {"key": "question", "type": "str"},
+ "records": {"key": "records", "type": "[TextRecord]"},
+ "language": {"key": "language", "type": "str"},
+ "string_index_type": {"key": "stringIndexType", "type": "str"},
}
def __init__(self, **kwargs):
- super(StrictFilters, self).__init__(**kwargs)
- self.metadata_filter = kwargs.get("metadata_filter", None)
- self.source_filter = kwargs.get("source_filter", None)
- self.compound_operation = kwargs.get("compound_operation", None)
+ """
+ :keyword question: Required. User question to query against the given text records.
+ :paramtype question: str
+ :keyword records: Required. Text records to be searched for given question.
+ :paramtype records: list[~azure.ai.language.questionanswering.models.TextRecord]
+ :keyword language: Language of the text records. This is BCP-47 representation of a language.
+ For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as
+ default.
+ :paramtype language: str
+ """
+ super(QueryTextOptions, self).__init__(**kwargs)
+ self.question = kwargs["question"]
+ self.records = kwargs["records"]
+ self.language = kwargs.get("language", None)
+ self.string_index_type = "UnicodeCodePoint"
class TextAnswer(msrest.serialization.Model):
"""Represents answer result.
- :keyword answer: Answer.
- :paramtype answer: str
- :keyword confidence_score: answer confidence score, value ranges from 0 to 1.
- :paramtype confidence_score: float
- :keyword id: record ID.
- :paramtype id: str
- :keyword answer_span: Answer span object with respect to user's question.
- :paramtype answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan
- :keyword offset: The sentence offset from the start of the document.
- :paramtype offset: int
- :keyword length: The length of the sentence.
- :paramtype length: int
+ :ivar answer: Answer.
+ :vartype answer: str
+ :ivar confidence_score: answer confidence score, value ranges from 0 to 1.
+ :vartype confidence_score: float
+ :ivar id: record ID.
+ :vartype id: str
+ :ivar answer_span: Answer span object with respect to user's question.
+ :vartype answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan
+ :ivar offset: The sentence offset from the start of the document.
+ :vartype offset: int
+ :ivar length: The length of the sentence.
+ :vartype length: int
"""
_validation = {
@@ -460,6 +647,20 @@ class TextAnswer(msrest.serialization.Model):
}
def __init__(self, **kwargs):
+ """
+ :keyword answer: Answer.
+ :paramtype answer: str
+ :keyword confidence_score: answer confidence score, value ranges from 0 to 1.
+ :paramtype confidence_score: float
+ :keyword id: record ID.
+ :paramtype id: str
+ :keyword answer_span: Answer span object with respect to user's question.
+ :paramtype answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan
+ :keyword offset: The sentence offset from the start of the document.
+ :paramtype offset: int
+ :keyword length: The length of the sentence.
+ :paramtype length: int
+ """
super(TextAnswer, self).__init__(**kwargs)
self.answer = kwargs.get("answer", None)
self.confidence_score = kwargs.get("confidence_score", None)
@@ -472,8 +673,8 @@ def __init__(self, **kwargs):
class TextAnswers(msrest.serialization.Model):
"""Represents the answer results.
- :keyword answers: Represents the answer results.
- :paramtype answers: list[~azure.ai.language.questionanswering.models.TextAnswer]
+ :ivar answers: Represents the answer results.
+ :vartype answers: list[~azure.ai.language.questionanswering.models.TextAnswer]
"""
_attribute_map = {
@@ -481,60 +682,23 @@ class TextAnswers(msrest.serialization.Model):
}
def __init__(self, **kwargs):
+ """
+ :keyword answers: Represents the answer results.
+ :paramtype answers: list[~azure.ai.language.questionanswering.models.TextAnswer]
+ """
super(TextAnswers, self).__init__(**kwargs)
self.answers = kwargs.get("answers", None)
-class TextQueryOptions(msrest.serialization.Model):
- """The question and text record parameters to answer.
-
- All required parameters must be populated in order to send to Azure.
-
- :keyword question: Required. User question to query against the given text records.
- :paramtype question: str
- :keyword records: Required. Text records to be searched for given question.
- :paramtype records: list[~azure.ai.language.questionanswering.models.TextRecord]
- :keyword language: Language of the text records. This is BCP-47 representation of a language.
- For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as
- default.
- :paramtype language: str
- :keyword string_index_type: Specifies the method used to interpret string offsets. Defaults to
- Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see
- https://aka.ms/text-analytics-offsets. Possible values include: "TextElements_v8",
- "UnicodeCodePoint", "Utf16CodeUnit". Default value: "TextElements_v8".
- :paramtype string_index_type: str or
- ~azure.ai.language.questionanswering.models.StringIndexType
- """
-
- _validation = {
- "question": {"required": True},
- "records": {"required": True},
- }
-
- _attribute_map = {
- "question": {"key": "question", "type": "str"},
- "records": {"key": "records", "type": "[TextRecord]"},
- "language": {"key": "language", "type": "str"},
- "string_index_type": {"key": "stringIndexType", "type": "str"},
- }
-
- def __init__(self, **kwargs):
- super(TextQueryOptions, self).__init__(**kwargs)
- self.question = kwargs["question"]
- self.records = kwargs["records"]
- self.language = kwargs.get("language", None)
- self.string_index_type = kwargs.get("string_index_type", "TextElements_v8")
-
-
class TextRecord(msrest.serialization.Model):
"""Represent input text record to be queried.
All required parameters must be populated in order to send to Azure.
- :keyword id: Required. Unique identifier for the text record.
- :paramtype id: str
- :keyword text: Required. Text contents of the record.
- :paramtype text: str
+ :ivar id: Required. Unique identifier for the text record.
+ :vartype id: str
+ :ivar text: Required. Text contents of the record.
+ :vartype text: str
"""
_validation = {
@@ -548,6 +712,12 @@ class TextRecord(msrest.serialization.Model):
}
def __init__(self, **kwargs):
+ """
+ :keyword id: Required. Unique identifier for the text record.
+ :paramtype id: str
+ :keyword text: Required. Text contents of the record.
+ :paramtype text: str
+ """
super(TextRecord, self).__init__(**kwargs)
self.id = kwargs["id"]
self.text = kwargs["text"]
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models_py3.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models_py3.py
index e7b7507de720..83829e675a0d 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models_py3.py
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models_py3.py
@@ -6,7 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Dict, List, Optional, Union
+from typing import Dict, List, Optional, Tuple, Union
from azure.core.exceptions import HttpResponseError
import msrest.serialization
@@ -17,14 +17,14 @@
class AnswerSpan(msrest.serialization.Model):
"""Answer span object of QnA.
- :keyword text: Predicted text of answer span.
- :paramtype text: str
- :keyword confidence_score: Predicted score of answer span, value ranges from 0 to 1.
- :paramtype confidence_score: float
- :keyword offset: The answer span offset from the start of answer.
- :paramtype offset: int
- :keyword length: The length of the answer span.
- :paramtype length: int
+ :ivar text: Predicted text of answer span.
+ :vartype text: str
+ :ivar confidence_score: Predicted score of answer span, value ranges from 0 to 1.
+ :vartype confidence_score: float
+ :ivar offset: The answer span offset from the start of answer.
+ :vartype offset: int
+ :ivar length: The length of the answer span.
+ :vartype length: int
"""
_validation = {
@@ -47,6 +47,16 @@ def __init__(
length: Optional[int] = None,
**kwargs
):
+ """
+ :keyword text: Predicted text of answer span.
+ :paramtype text: str
+ :keyword confidence_score: Predicted score of answer span, value ranges from 0 to 1.
+ :paramtype confidence_score: float
+ :keyword offset: The answer span offset from the start of answer.
+ :paramtype offset: int
+ :keyword length: The length of the answer span.
+ :paramtype length: int
+ """
super(AnswerSpan, self).__init__(**kwargs)
self.text = text
self.confidence_score = confidence_score
@@ -57,14 +67,14 @@ def __init__(
class AnswerSpanRequest(msrest.serialization.Model):
"""To configure Answer span prediction feature.
- :keyword enable: Enable or disable Answer Span prediction.
- :paramtype enable: bool
- :keyword confidence_score_threshold: Minimum threshold score required to include an answer
- span, value ranges from 0 to 1.
- :paramtype confidence_score_threshold: float
- :keyword top_answers_with_span: Number of Top answers to be considered for span prediction from
- 1 to 10.
- :paramtype top_answers_with_span: int
+ :ivar enable: Enable or disable Answer Span prediction.
+ :vartype enable: bool
+ :ivar confidence_score_threshold: Minimum threshold score required to include an answer span,
+ value ranges from 0 to 1.
+ :vartype confidence_score_threshold: float
+ :ivar top_answers_with_span: Number of Top answers to be considered for span prediction from 1
+ to 10.
+ :vartype top_answers_with_span: int
"""
_validation = {
@@ -86,6 +96,16 @@ def __init__(
top_answers_with_span: Optional[int] = None,
**kwargs
):
+ """
+ :keyword enable: Enable or disable Answer Span prediction.
+ :paramtype enable: bool
+ :keyword confidence_score_threshold: Minimum threshold score required to include an answer
+ span, value ranges from 0 to 1.
+ :paramtype confidence_score_threshold: float
+ :keyword top_answers_with_span: Number of Top answers to be considered for span prediction from
+ 1 to 10.
+ :paramtype top_answers_with_span: int
+ """
super(AnswerSpanRequest, self).__init__(**kwargs)
self.enable = enable
self.confidence_score_threshold = confidence_score_threshold
@@ -97,19 +117,19 @@ class Error(msrest.serialization.Model):
All required parameters must be populated in order to send to Azure.
- :keyword code: Required. One of a server-defined set of error codes. Possible values include:
+ :ivar code: Required. One of a server-defined set of error codes. Possible values include:
"InvalidRequest", "InvalidArgument", "Unauthorized", "Forbidden", "NotFound",
"TooManyRequests", "InternalServerError", "ServiceUnavailable".
- :paramtype code: str or ~azure.ai.language.questionanswering.models.ErrorCode
- :keyword message: Required. A human-readable representation of the error.
- :paramtype message: str
- :keyword target: The target of the error.
- :paramtype target: str
- :keyword details: An array of details about specific errors that led to this reported error.
- :paramtype details: list[~azure.ai.language.questionanswering.models.Error]
- :keyword innererror: An object containing more specific information than the current object
- about the error.
- :paramtype innererror: ~azure.ai.language.questionanswering.models.InnerErrorModel
+ :vartype code: str or ~azure.ai.language.questionanswering.models.ErrorCode
+ :ivar message: Required. A human-readable representation of the error.
+ :vartype message: str
+ :ivar target: The target of the error.
+ :vartype target: str
+ :ivar details: An array of details about specific errors that led to this reported error.
+ :vartype details: list[~azure.ai.language.questionanswering.models.Error]
+ :ivar innererror: An object containing more specific information than the current object about
+ the error.
+ :vartype innererror: ~azure.ai.language.questionanswering.models.InnerErrorModel
"""
_validation = {
@@ -135,6 +155,21 @@ def __init__(
innererror: Optional["InnerErrorModel"] = None,
**kwargs
):
+ """
+ :keyword code: Required. One of a server-defined set of error codes. Possible values include:
+ "InvalidRequest", "InvalidArgument", "Unauthorized", "Forbidden", "NotFound",
+ "TooManyRequests", "InternalServerError", "ServiceUnavailable".
+ :paramtype code: str or ~azure.ai.language.questionanswering.models.ErrorCode
+ :keyword message: Required. A human-readable representation of the error.
+ :paramtype message: str
+ :keyword target: The target of the error.
+ :paramtype target: str
+ :keyword details: An array of details about specific errors that led to this reported error.
+ :paramtype details: list[~azure.ai.language.questionanswering.models.Error]
+ :keyword innererror: An object containing more specific information than the current object
+ about the error.
+ :paramtype innererror: ~azure.ai.language.questionanswering.models.InnerErrorModel
+ """
super(Error, self).__init__(**kwargs)
self.code = code
self.message = message
@@ -146,8 +181,8 @@ def __init__(
class ErrorResponse(msrest.serialization.Model):
"""Error response.
- :keyword error: The error object.
- :paramtype error: ~azure.ai.language.questionanswering.models.Error
+ :ivar error: The error object.
+ :vartype error: ~azure.ai.language.questionanswering.models.Error
"""
_attribute_map = {
@@ -155,6 +190,10 @@ class ErrorResponse(msrest.serialization.Model):
}
def __init__(self, *, error: Optional["Error"] = None, **kwargs):
+ """
+ :keyword error: The error object.
+ :paramtype error: ~azure.ai.language.questionanswering.models.Error
+ """
super(ErrorResponse, self).__init__(**kwargs)
self.error = error
@@ -164,19 +203,19 @@ class InnerErrorModel(msrest.serialization.Model):
All required parameters must be populated in order to send to Azure.
- :keyword code: Required. One of a server-defined set of error codes. Possible values include:
+ :ivar code: Required. One of a server-defined set of error codes. Possible values include:
"InvalidRequest", "InvalidParameterValue", "KnowledgeBaseNotFound",
"AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", "ExtractionFailure".
- :paramtype code: str or ~azure.ai.language.questionanswering.models.InnerErrorCode
- :keyword message: Required. Error message.
- :paramtype message: str
- :keyword details: Error details.
- :paramtype details: dict[str, str]
- :keyword target: Error target.
- :paramtype target: str
- :keyword innererror: An object containing more specific information than the current object
- about the error.
- :paramtype innererror: ~azure.ai.language.questionanswering.models.InnerErrorModel
+ :vartype code: str or ~azure.ai.language.questionanswering.models.InnerErrorCode
+ :ivar message: Required. Error message.
+ :vartype message: str
+ :ivar details: Error details.
+ :vartype details: dict[str, str]
+ :ivar target: Error target.
+ :vartype target: str
+ :ivar innererror: An object containing more specific information than the current object about
+ the error.
+ :vartype innererror: ~azure.ai.language.questionanswering.models.InnerErrorModel
"""
_validation = {
@@ -202,6 +241,21 @@ def __init__(
innererror: Optional["InnerErrorModel"] = None,
**kwargs
):
+ """
+ :keyword code: Required. One of a server-defined set of error codes. Possible values include:
+ "InvalidRequest", "InvalidParameterValue", "KnowledgeBaseNotFound",
+ "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", "ExtractionFailure".
+ :paramtype code: str or ~azure.ai.language.questionanswering.models.InnerErrorCode
+ :keyword message: Required. Error message.
+ :paramtype message: str
+ :keyword details: Error details.
+ :paramtype details: dict[str, str]
+ :keyword target: Error target.
+ :paramtype target: str
+ :keyword innererror: An object containing more specific information than the current object
+ about the error.
+ :paramtype innererror: ~azure.ai.language.questionanswering.models.InnerErrorModel
+ """
super(InnerErrorModel, self).__init__(**kwargs)
self.code = code
self.message = message
@@ -213,23 +267,23 @@ def __init__(
class KnowledgeBaseAnswer(msrest.serialization.Model):
"""Represents knowledge base answer.
- :keyword questions: List of questions.
- :paramtype questions: list[str]
- :keyword answer: The Answer.
- :paramtype answer: str
- :keyword confidence_score: Answer confidence score, value ranges from 0 to 1.
- :paramtype confidence_score: float
- :keyword id: ID of the QnA result.
- :paramtype id: int
- :keyword source: Source of QnA result.
- :paramtype source: str
- :keyword metadata: Metadata associated with the answer, useful to categorize or filter question
+ :ivar questions: List of questions.
+ :vartype questions: list[str]
+ :ivar answer: The Answer.
+ :vartype answer: str
+ :ivar confidence_score: Answer confidence score, value ranges from 0 to 1.
+ :vartype confidence_score: float
+ :ivar id: ID of the QnA result.
+ :vartype id: int
+ :ivar source: Source of QnA result.
+ :vartype source: str
+ :ivar metadata: Metadata associated with the answer, useful to categorize or filter question
answers.
- :paramtype metadata: dict[str, str]
- :keyword dialog: Dialog associated with Answer.
- :paramtype dialog: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerDialog
- :keyword answer_span: Answer span object of QnA with respect to user's question.
- :paramtype answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan
+ :vartype metadata: dict[str, str]
+ :ivar dialog: Dialog associated with Answer.
+ :vartype dialog: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerDialog
+ :ivar answer_span: Answer span object of QnA with respect to user's question.
+ :vartype answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan
"""
_validation = {
@@ -260,6 +314,25 @@ def __init__(
answer_span: Optional["AnswerSpan"] = None,
**kwargs
):
+ """
+ :keyword questions: List of questions.
+ :paramtype questions: list[str]
+ :keyword answer: The Answer.
+ :paramtype answer: str
+ :keyword confidence_score: Answer confidence score, value ranges from 0 to 1.
+ :paramtype confidence_score: float
+ :keyword id: ID of the QnA result.
+ :paramtype id: int
+ :keyword source: Source of QnA result.
+ :paramtype source: str
+ :keyword metadata: Metadata associated with the answer, useful to categorize or filter question
+ answers.
+ :paramtype metadata: dict[str, str]
+ :keyword dialog: Dialog associated with Answer.
+ :paramtype dialog: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerDialog
+ :keyword answer_span: Answer span object of QnA with respect to user's question.
+ :paramtype answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan
+ """
super(KnowledgeBaseAnswer, self).__init__(**kwargs)
self.questions = questions
self.answer = answer
@@ -274,12 +347,12 @@ def __init__(
class KnowledgeBaseAnswerDialog(msrest.serialization.Model):
"""Dialog associated with Answer.
- :keyword is_context_only: To mark if a prompt is relevant only with a previous question or not.
- If true, do not include this QnA as search result for queries without context; otherwise, if
+ :ivar is_context_only: To mark if a prompt is relevant only with a previous question or not. If
+ true, do not include this QnA as search result for queries without context; otherwise, if
false, ignores context and includes this QnA in search result.
- :paramtype is_context_only: bool
- :keyword prompts: List of 0 to 20 prompts associated with the answer.
- :paramtype prompts: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerPrompt]
+ :vartype is_context_only: bool
+ :ivar prompts: List of 0 to 20 prompts associated with the answer.
+ :vartype prompts: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerPrompt]
"""
_validation = {
@@ -298,6 +371,14 @@ def __init__(
prompts: Optional[List["KnowledgeBaseAnswerPrompt"]] = None,
**kwargs
):
+ """
+ :keyword is_context_only: To mark if a prompt is relevant only with a previous question or not.
+ If true, do not include this QnA as search result for queries without context; otherwise, if
+ false, ignores context and includes this QnA in search result.
+ :paramtype is_context_only: bool
+ :keyword prompts: List of 0 to 20 prompts associated with the answer.
+ :paramtype prompts: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerPrompt]
+ """
super(KnowledgeBaseAnswerDialog, self).__init__(**kwargs)
self.is_context_only = is_context_only
self.prompts = prompts
@@ -306,12 +387,12 @@ def __init__(
class KnowledgeBaseAnswerPrompt(msrest.serialization.Model):
"""Prompt for an answer.
- :keyword display_order: Index of the prompt - used in ordering of the prompts.
- :paramtype display_order: int
- :keyword qna_id: QnA ID corresponding to the prompt.
- :paramtype qna_id: int
- :keyword display_text: Text displayed to represent a follow up question prompt.
- :paramtype display_text: str
+ :ivar display_order: Index of the prompt - used in ordering of the prompts.
+ :vartype display_order: int
+ :ivar qna_id: QnA ID corresponding to the prompt.
+ :vartype qna_id: int
+ :ivar display_text: Text displayed to represent a follow up question prompt.
+ :vartype display_text: str
"""
_validation = {
@@ -332,6 +413,14 @@ def __init__(
display_text: Optional[str] = None,
**kwargs
):
+ """
+ :keyword display_order: Index of the prompt - used in ordering of the prompts.
+ :paramtype display_order: int
+ :keyword qna_id: QnA ID corresponding to the prompt.
+ :paramtype qna_id: int
+ :keyword display_text: Text displayed to represent a follow up question prompt.
+ :paramtype display_text: str
+ """
super(KnowledgeBaseAnswerPrompt, self).__init__(**kwargs)
self.display_order = display_order
self.qna_id = qna_id
@@ -343,10 +432,10 @@ class KnowledgeBaseAnswerRequestContext(msrest.serialization.Model):
All required parameters must be populated in order to send to Azure.
- :keyword previous_qna_id: Required. Previous turn top answer result QnA ID.
- :paramtype previous_qna_id: int
- :keyword previous_user_query: Previous user query.
- :paramtype previous_user_query: str
+ :ivar previous_qna_id: Required. Previous turn top answer result QnA ID.
+ :vartype previous_qna_id: int
+ :ivar previous_user_query: Previous user query.
+ :vartype previous_user_query: str
"""
_validation = {
@@ -359,6 +448,12 @@ class KnowledgeBaseAnswerRequestContext(msrest.serialization.Model):
}
def __init__(self, *, previous_qna_id: int, previous_user_query: Optional[str] = None, **kwargs):
+ """
+ :keyword previous_qna_id: Required. Previous turn top answer result QnA ID.
+ :paramtype previous_qna_id: int
+ :keyword previous_user_query: Previous user query.
+ :paramtype previous_user_query: str
+ """
super(KnowledgeBaseAnswerRequestContext, self).__init__(**kwargs)
self.previous_qna_id = previous_qna_id
self.previous_user_query = previous_user_query
@@ -367,8 +462,8 @@ def __init__(self, *, previous_qna_id: int, previous_user_query: Optional[str] =
class KnowledgeBaseAnswers(msrest.serialization.Model):
"""Represents List of Question Answers.
- :keyword answers: Represents Answer Result list.
- :paramtype answers: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswer]
+ :ivar answers: Represents Answer Result list.
+ :vartype answers: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswer]
"""
_attribute_map = {
@@ -376,39 +471,121 @@ class KnowledgeBaseAnswers(msrest.serialization.Model):
}
def __init__(self, *, answers: Optional[List["KnowledgeBaseAnswer"]] = None, **kwargs):
+ """
+ :keyword answers: Represents Answer Result list.
+ :paramtype answers: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswer]
+ """
super(KnowledgeBaseAnswers, self).__init__(**kwargs)
self.answers = answers
-class KnowledgeBaseQueryOptions(msrest.serialization.Model):
+class MetadataFilter(msrest.serialization.Model):
+ """Find QnAs that are associated with the given list of metadata.
+
+ :ivar metadata:
+ :vartype metadata: list[tuple[str]]
+ :ivar logical_operation: Operation used to join metadata filters. Possible values include:
+ "AND", "OR".
+ :vartype logical_operation: str or
+ ~azure.ai.language.questionanswering.models.LogicalOperationKind
+ """
+
+ _attribute_map = {
+ "metadata": {"key": "metadata", "type": "[[str]]"},
+ "logical_operation": {"key": "logicalOperation", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ metadata: Optional[List[Tuple[str]]] = None,
+ logical_operation: Optional[Union[str, "LogicalOperationKind"]] = None,
+ **kwargs
+ ):
+ """
+ :keyword metadata:
+ :paramtype metadata: list[tuple[str]]
+ :keyword logical_operation: Operation used to join metadata filters. Possible values include:
+ "AND", "OR".
+ :paramtype logical_operation: str or
+ ~azure.ai.language.questionanswering.models.LogicalOperationKind
+ """
+ super(MetadataFilter, self).__init__(**kwargs)
+ self.metadata = metadata
+ self.logical_operation = logical_operation
+
+
+class QueryFilters(msrest.serialization.Model):
+ """filters over knowledge base.
+
+ :ivar metadata_filter: Find QnAs that are associated with the given list of metadata.
+ :vartype metadata_filter: ~azure.ai.language.questionanswering.models.MetadataFilter
+ :ivar source_filter: Find QnAs that are associated with the given list of sources in knowledge
+ base.
+ :vartype source_filter: list[str]
+ :ivar logical_operation: Logical operation used to join metadata filters with source filters.
+ Possible values include: "AND", "OR".
+ :vartype logical_operation: str or
+ ~azure.ai.language.questionanswering.models.LogicalOperationKind
+ """
+
+ _attribute_map = {
+ "metadata_filter": {"key": "metadataFilter", "type": "MetadataFilter"},
+ "source_filter": {"key": "sourceFilter", "type": "[str]"},
+ "logical_operation": {"key": "logicalOperation", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ metadata_filter: Optional["MetadataFilter"] = None,
+ source_filter: Optional[List[str]] = None,
+ logical_operation: Optional[Union[str, "LogicalOperationKind"]] = None,
+ **kwargs
+ ):
+ """
+ :keyword metadata_filter: Find QnAs that are associated with the given list of metadata.
+ :paramtype metadata_filter: ~azure.ai.language.questionanswering.models.MetadataFilter
+ :keyword source_filter: Find QnAs that are associated with the given list of sources in
+ knowledge base.
+ :paramtype source_filter: list[str]
+ :keyword logical_operation: Logical operation used to join metadata filters with source
+ filters. Possible values include: "AND", "OR".
+ :paramtype logical_operation: str or
+ ~azure.ai.language.questionanswering.models.LogicalOperationKind
+ """
+ super(QueryFilters, self).__init__(**kwargs)
+ self.metadata_filter = metadata_filter
+ self.source_filter = source_filter
+ self.logical_operation = logical_operation
+
+
+class QueryKnowledgeBaseOptions(msrest.serialization.Model):
"""The question parameters to answer using a knowledge base.
- :keyword qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over
+ :ivar qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over
question.
- :paramtype qna_id: int
- :keyword question: User question to query against the knowledge base.
- :paramtype question: str
- :keyword top: Max number of answers to be returned for the question.
- :paramtype top: int
- :keyword user_id: Unique identifier for the user.
- :paramtype user_id: str
- :keyword confidence_score_threshold: Minimum threshold score for answers, value ranges from 0
- to 1.
- :paramtype confidence_score_threshold: float
- :keyword context: Context object with previous QnA's information.
- :paramtype context:
- ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerRequestContext
- :keyword ranker_type: (Optional) Set to 'QuestionOnly' for using a question only Ranker.
- Possible values include: "Default", "QuestionOnly".
- :paramtype ranker_type: str or ~azure.ai.language.questionanswering.models.RankerType
- :keyword strict_filters: Filter QnAs based on give metadata list and knowledge base source
- names.
- :paramtype strict_filters: ~azure.ai.language.questionanswering.models.StrictFilters
- :keyword answer_span_request: To configure Answer span prediction feature.
- :paramtype answer_span_request: ~azure.ai.language.questionanswering.models.AnswerSpanRequest
- :keyword include_unstructured_sources: (Optional) Flag to enable Query over Unstructured
- Sources.
- :paramtype include_unstructured_sources: bool
+ :vartype qna_id: int
+ :ivar question: User question to query against the knowledge base.
+ :vartype question: str
+ :ivar top: Max number of answers to be returned for the question.
+ :vartype top: int
+ :ivar user_id: Unique identifier for the user.
+ :vartype user_id: str
+ :ivar confidence_score_threshold: Minimum threshold score for answers, value ranges from 0 to
+ 1.
+ :vartype confidence_score_threshold: float
+ :ivar context: Context object with previous QnA's information.
+ :vartype context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerRequestContext
+ :ivar ranker_type: (Optional) Set to 'QuestionOnly' for using a question only Ranker. Possible
+ values include: "Default", "QuestionOnly".
+ :vartype ranker_type: str or ~azure.ai.language.questionanswering.models.RankerType
+ :ivar filters: Filter QnAs based on give metadata list and knowledge base source names.
+ :vartype filters: ~azure.ai.language.questionanswering.models.QueryFilters
+ :ivar answer_span_request: To configure Answer span prediction feature.
+ :vartype answer_span_request: ~azure.ai.language.questionanswering.models.AnswerSpanRequest
+ :ivar include_unstructured_sources: (Optional) Flag to enable Query over Unstructured Sources.
+ :vartype include_unstructured_sources: bool
"""
_validation = {
@@ -423,7 +600,7 @@ class KnowledgeBaseQueryOptions(msrest.serialization.Model):
"confidence_score_threshold": {"key": "confidenceScoreThreshold", "type": "float"},
"context": {"key": "context", "type": "KnowledgeBaseAnswerRequestContext"},
"ranker_type": {"key": "rankerType", "type": "str"},
- "strict_filters": {"key": "strictFilters", "type": "StrictFilters"},
+ "filters": {"key": "filters", "type": "QueryFilters"},
"answer_span_request": {"key": "answerSpanRequest", "type": "AnswerSpanRequest"},
"include_unstructured_sources": {"key": "includeUnstructuredSources", "type": "bool"},
}
@@ -438,12 +615,39 @@ def __init__(
confidence_score_threshold: Optional[float] = None,
context: Optional["KnowledgeBaseAnswerRequestContext"] = None,
ranker_type: Optional[Union[str, "RankerType"]] = None,
- strict_filters: Optional["StrictFilters"] = None,
+ filters: Optional["QueryFilters"] = None,
answer_span_request: Optional["AnswerSpanRequest"] = None,
include_unstructured_sources: Optional[bool] = None,
**kwargs
):
- super(KnowledgeBaseQueryOptions, self).__init__(**kwargs)
+ """
+ :keyword qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over
+ question.
+ :paramtype qna_id: int
+ :keyword question: User question to query against the knowledge base.
+ :paramtype question: str
+ :keyword top: Max number of answers to be returned for the question.
+ :paramtype top: int
+ :keyword user_id: Unique identifier for the user.
+ :paramtype user_id: str
+ :keyword confidence_score_threshold: Minimum threshold score for answers, value ranges from 0
+ to 1.
+ :paramtype confidence_score_threshold: float
+ :keyword context: Context object with previous QnA's information.
+ :paramtype context:
+ ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerRequestContext
+ :keyword ranker_type: (Optional) Set to 'QuestionOnly' for using a question only Ranker.
+ Possible values include: "Default", "QuestionOnly".
+ :paramtype ranker_type: str or ~azure.ai.language.questionanswering.models.RankerType
+ :keyword filters: Filter QnAs based on give metadata list and knowledge base source names.
+ :paramtype filters: ~azure.ai.language.questionanswering.models.QueryFilters
+ :keyword answer_span_request: To configure Answer span prediction feature.
+ :paramtype answer_span_request: ~azure.ai.language.questionanswering.models.AnswerSpanRequest
+ :keyword include_unstructured_sources: (Optional) Flag to enable Query over Unstructured
+ Sources.
+ :paramtype include_unstructured_sources: bool
+ """
+ super(QueryKnowledgeBaseOptions, self).__init__(**kwargs)
self.qna_id = qna_id
self.question = question
self.top = top
@@ -451,88 +655,71 @@ def __init__(
self.confidence_score_threshold = confidence_score_threshold
self.context = context
self.ranker_type = ranker_type
- self.strict_filters = strict_filters
+ self.filters = filters
self.answer_span_request = answer_span_request
self.include_unstructured_sources = include_unstructured_sources
-class MetadataFilter(msrest.serialization.Model):
- """Find QnAs that are associated with the given list of metadata.
+class QueryTextOptions(msrest.serialization.Model):
+ """The question and text record parameters to answer.
- :keyword metadata: Dictionary of :code:``.
- :paramtype metadata: dict[str, str]
- :keyword compound_operation: (Optional) Set to 'OR' for joining metadata using 'OR' operation.
- Possible values include: "AND", "OR".
- :paramtype compound_operation: str or
- ~azure.ai.language.questionanswering.models.CompoundOperationKind
+ All required parameters must be populated in order to send to Azure.
+
+ :ivar question: Required. User question to query against the given text records.
+ :vartype question: str
+ :ivar records: Required. Text records to be searched for given question.
+ :vartype records: list[~azure.ai.language.questionanswering.models.TextRecord]
+ :ivar language: Language of the text records. This is BCP-47 representation of a language. For
+ example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as
+ default.
+ :vartype language: str
"""
- _attribute_map = {
- "metadata": {"key": "metadata", "type": "{str}"},
- "compound_operation": {"key": "compoundOperation", "type": "str"},
+ _validation = {
+ "question": {"required": True},
+ "records": {"required": True},
}
- def __init__(
- self,
- *,
- metadata: Optional[Dict[str, str]] = None,
- compound_operation: Optional[Union[str, "CompoundOperationKind"]] = None,
- **kwargs
- ):
- super(MetadataFilter, self).__init__(**kwargs)
- self.metadata = metadata
- self.compound_operation = compound_operation
-
-
-class StrictFilters(msrest.serialization.Model):
- """filters over knowledge base.
-
- :keyword metadata_filter: Find QnAs that are associated with the given list of metadata.
- :paramtype metadata_filter: ~azure.ai.language.questionanswering.models.MetadataFilter
- :keyword source_filter: Find QnAs that are associated with the given list of sources in
- knowledge base.
- :paramtype source_filter: list[str]
- :keyword compound_operation: (Optional) Set to 'OR' for joining metadata using 'OR' operation.
- Possible values include: "AND", "OR".
- :paramtype compound_operation: str or
- ~azure.ai.language.questionanswering.models.CompoundOperationKind
- """
-
_attribute_map = {
- "metadata_filter": {"key": "metadataFilter", "type": "MetadataFilter"},
- "source_filter": {"key": "sourceFilter", "type": "[str]"},
- "compound_operation": {"key": "compoundOperation", "type": "str"},
+ "question": {"key": "question", "type": "str"},
+ "records": {"key": "records", "type": "[TextRecord]"},
+ "language": {"key": "language", "type": "str"},
+ "string_index_type": {"key": "stringIndexType", "type": "str"},
}
- def __init__(
- self,
- *,
- metadata_filter: Optional["MetadataFilter"] = None,
- source_filter: Optional[List[str]] = None,
- compound_operation: Optional[Union[str, "CompoundOperationKind"]] = None,
- **kwargs
- ):
- super(StrictFilters, self).__init__(**kwargs)
- self.metadata_filter = metadata_filter
- self.source_filter = source_filter
- self.compound_operation = compound_operation
+ def __init__(self, *, question: str, records: List["TextRecord"], language: Optional[str] = None, **kwargs):
+ """
+ :keyword question: Required. User question to query against the given text records.
+ :paramtype question: str
+ :keyword records: Required. Text records to be searched for given question.
+ :paramtype records: list[~azure.ai.language.questionanswering.models.TextRecord]
+ :keyword language: Language of the text records. This is BCP-47 representation of a language.
+ For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as
+ default.
+ :paramtype language: str
+ """
+ super(QueryTextOptions, self).__init__(**kwargs)
+ self.question = question
+ self.records = records
+ self.language = language
+ self.string_index_type = "UnicodeCodePoint"
class TextAnswer(msrest.serialization.Model):
"""Represents answer result.
- :keyword answer: Answer.
- :paramtype answer: str
- :keyword confidence_score: answer confidence score, value ranges from 0 to 1.
- :paramtype confidence_score: float
- :keyword id: record ID.
- :paramtype id: str
- :keyword answer_span: Answer span object with respect to user's question.
- :paramtype answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan
- :keyword offset: The sentence offset from the start of the document.
- :paramtype offset: int
- :keyword length: The length of the sentence.
- :paramtype length: int
+ :ivar answer: Answer.
+ :vartype answer: str
+ :ivar confidence_score: answer confidence score, value ranges from 0 to 1.
+ :vartype confidence_score: float
+ :ivar id: record ID.
+ :vartype id: str
+ :ivar answer_span: Answer span object with respect to user's question.
+ :vartype answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan
+ :ivar offset: The sentence offset from the start of the document.
+ :vartype offset: int
+ :ivar length: The length of the sentence.
+ :vartype length: int
"""
_validation = {
@@ -559,6 +746,20 @@ def __init__(
length: Optional[int] = None,
**kwargs
):
+ """
+ :keyword answer: Answer.
+ :paramtype answer: str
+ :keyword confidence_score: answer confidence score, value ranges from 0 to 1.
+ :paramtype confidence_score: float
+ :keyword id: record ID.
+ :paramtype id: str
+ :keyword answer_span: Answer span object with respect to user's question.
+ :paramtype answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan
+ :keyword offset: The sentence offset from the start of the document.
+ :paramtype offset: int
+ :keyword length: The length of the sentence.
+ :paramtype length: int
+ """
super(TextAnswer, self).__init__(**kwargs)
self.answer = answer
self.confidence_score = confidence_score
@@ -571,8 +772,8 @@ def __init__(
class TextAnswers(msrest.serialization.Model):
"""Represents the answer results.
- :keyword answers: Represents the answer results.
- :paramtype answers: list[~azure.ai.language.questionanswering.models.TextAnswer]
+ :ivar answers: Represents the answer results.
+ :vartype answers: list[~azure.ai.language.questionanswering.models.TextAnswer]
"""
_attribute_map = {
@@ -580,68 +781,23 @@ class TextAnswers(msrest.serialization.Model):
}
def __init__(self, *, answers: Optional[List["TextAnswer"]] = None, **kwargs):
+ """
+ :keyword answers: Represents the answer results.
+ :paramtype answers: list[~azure.ai.language.questionanswering.models.TextAnswer]
+ """
super(TextAnswers, self).__init__(**kwargs)
self.answers = answers
-class TextQueryOptions(msrest.serialization.Model):
- """The question and text record parameters to answer.
-
- All required parameters must be populated in order to send to Azure.
-
- :keyword question: Required. User question to query against the given text records.
- :paramtype question: str
- :keyword records: Required. Text records to be searched for given question.
- :paramtype records: list[~azure.ai.language.questionanswering.models.TextRecord]
- :keyword language: Language of the text records. This is BCP-47 representation of a language.
- For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as
- default.
- :paramtype language: str
- :keyword string_index_type: Specifies the method used to interpret string offsets. Defaults to
- Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see
- https://aka.ms/text-analytics-offsets. Possible values include: "TextElements_v8",
- "UnicodeCodePoint", "Utf16CodeUnit". Default value: "TextElements_v8".
- :paramtype string_index_type: str or
- ~azure.ai.language.questionanswering.models.StringIndexType
- """
-
- _validation = {
- "question": {"required": True},
- "records": {"required": True},
- }
-
- _attribute_map = {
- "question": {"key": "question", "type": "str"},
- "records": {"key": "records", "type": "[TextRecord]"},
- "language": {"key": "language", "type": "str"},
- "string_index_type": {"key": "stringIndexType", "type": "str"},
- }
-
- def __init__(
- self,
- *,
- question: str,
- records: List["TextRecord"],
- language: Optional[str] = None,
- string_index_type: Optional[Union[str, "StringIndexType"]] = "TextElements_v8",
- **kwargs
- ):
- super(TextQueryOptions, self).__init__(**kwargs)
- self.question = question
- self.records = records
- self.language = language
- self.string_index_type = string_index_type
-
-
class TextRecord(msrest.serialization.Model):
"""Represent input text record to be queried.
All required parameters must be populated in order to send to Azure.
- :keyword id: Required. Unique identifier for the text record.
- :paramtype id: str
- :keyword text: Required. Text contents of the record.
- :paramtype text: str
+ :ivar id: Required. Unique identifier for the text record.
+ :vartype id: str
+ :ivar text: Required. Text contents of the record.
+ :vartype text: str
"""
_validation = {
@@ -655,6 +811,12 @@ class TextRecord(msrest.serialization.Model):
}
def __init__(self, *, id: str, text: str, **kwargs):
+ """
+ :keyword id: Required. Unique identifier for the text record.
+ :paramtype id: str
+ :keyword text: Required. Text contents of the record.
+ :paramtype text: str
+ """
super(TextRecord, self).__init__(**kwargs)
self.id = id
self.text = text
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_question_answering_client_enums.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_question_answering_client_enums.py
index 869e123dc112..d6c78563d2b6 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_question_answering_client_enums.py
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_question_answering_client_enums.py
@@ -11,13 +11,6 @@
from azure.core import CaseInsensitiveEnumMeta
-class CompoundOperationKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
- """(Optional) Set to 'OR' for joining metadata using 'OR' operation."""
-
- AND_ENUM = "AND"
- OR_ENUM = "OR"
-
-
class ErrorCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""Human-readable error code."""
@@ -42,26 +35,15 @@ class InnerErrorCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
EXTRACTION_FAILURE = "ExtractionFailure"
+class LogicalOperationKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
+ """Set to 'OR' or 'AND' for using corresponding logical operation."""
+
+ AND_ENUM = "AND"
+ OR_ENUM = "OR"
+
+
class RankerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""(Optional) Set to 'QuestionOnly' for using a question only Ranker."""
DEFAULT = "Default"
QUESTION_ONLY = "QuestionOnly"
-
-
-class StringIndexType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
- """Specifies the method used to interpret string offsets. Defaults to Text Elements (Graphemes)
- according to Unicode v8.0.0. For additional information see
- https://aka.ms/text-analytics-offsets.
- """
-
- #: Returned offset and length values will correspond to TextElements (Graphemes and Grapheme
- #: clusters) confirming to the Unicode 8.0.0 standard. Use this option if your application is
- #: written in .Net Framework or .Net Core and you will be using StringInfo.
- TEXT_ELEMENTS_V8 = "TextElements_v8"
- #: Returned offset and length values will correspond to Unicode code points. Use this option if
- #: your application is written in a language that support Unicode, for example Python.
- UNICODE_CODE_POINT = "UnicodeCodePoint"
- #: Returned offset and length values will correspond to UTF-16 code units. Use this option if your
- #: application is written in a language that support Unicode, for example Java, JavaScript.
- UTF16_CODE_UNIT = "Utf16CodeUnit"
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py
index 4f8f585e2a7e..a18c2b15911b 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py
@@ -22,7 +22,7 @@
from msrest import Serializer
from .. import models as _models
-from .._patch import _validate_text_records
+from .._patch import _validate_text_records, _get_positional_body, _verify_qna_id_and_question
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
@@ -40,7 +40,7 @@ def build_query_knowledge_base_request(
# type: (...) -> HttpRequest
content_type = kwargs.pop('content_type', None) # type: Optional[str]
project_name = kwargs.pop('project_name') # type: str
- deployment_name = kwargs.pop('deployment_name', None) # type: Optional[str]
+ deployment_name = kwargs.pop('deployment_name') # type: str
api_version = "2021-07-15-preview"
accept = "application/json"
@@ -50,8 +50,7 @@ def build_query_knowledge_base_request(
# Construct parameters
query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
query_parameters['projectName'] = _SERIALIZER.query("project_name", project_name, 'str')
- if deployment_name is not None:
- query_parameters['deploymentName'] = _SERIALIZER.query("deployment_name", deployment_name, 'str')
+ query_parameters['deploymentName'] = _SERIALIZER.query("deployment_name", deployment_name, 'str')
query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
# Construct headers
@@ -103,21 +102,20 @@ class QuestionAnsweringClientOperationsMixin(object):
@overload
def query_knowledge_base(
self,
- knowledge_base_query_options, # type: "_models.KnowledgeBaseQueryOptions"
+ options, # type: "_models.QueryKnowledgeBaseOptions"
**kwargs # type: Any
):
# type: (...) -> "_models.KnowledgeBaseAnswers"
"""Answers the specified question using your knowledge base.
- :param knowledge_base_query_options: Post body of the request.
- :type knowledge_base_query_options:
- ~azure.ai.language.questionanswering.models.KnowledgeBaseQueryOptions
+ :param options: Positional-only POST body of the request.
+ :type options:
+ ~azure.ai.language.questionanswering.models.QueryKnowledgeBaseOptions
:keyword project_name: The name of the project to use.
:paramtype project_name: str
:keyword deployment_name: The name of the specific deployment of the project to use.
:paramtype deployment_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :return: KnowledgeBaseAnswers, or the result of cls(response)
+ :return: KnowledgeBaseAnswers
:rtype: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswers
:raises: ~azure.core.exceptions.HttpResponseError
"""
@@ -152,14 +150,13 @@ def query_knowledge_base(
:keyword ranker_type: (Optional) Set to 'QuestionOnly' for using a question only Ranker. Possible
values include: "Default", "QuestionOnly".
:paramtype ranker_type: str or ~azure.ai.language.questionanswering.models.RankerType
- :keyword strict_filters: Filter QnAs based on give metadata list and knowledge base source names.
- :paramtype strict_filters: ~azure.ai.language.questionanswering.models.StrictFilters
+ :keyword filters: Filter QnAs based on give metadata list and knowledge base source names.
+ :paramtype filters: ~azure.ai.language.questionanswering.models.QueryFilters
:keyword answer_span_request: To configure Answer span prediction feature.
:paramtype answer_span_request: ~azure.ai.language.questionanswering.models.AnswerSpanRequest
:keyword include_unstructured_sources: (Optional) Flag to enable Query over Unstructured Sources.
:paramtype include_unstructured_sources: bool
- :keyword callable cls: A custom type or function that will be passed the direct response
- :return: KnowledgeBaseAnswers, or the result of cls(response)
+ :return: KnowledgeBaseAnswers
:rtype: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswers
:raises: ~azure.core.exceptions.HttpResponseError
"""
@@ -167,21 +164,21 @@ def query_knowledge_base(
def query_knowledge_base(
self,
- *args, # type: "_models.KnowledgeBaseQueryOptions"
+ *args, # type: "_models.QueryKnowledgeBaseOptions"
**kwargs # type: Any
):
# type: (...) -> "_models.KnowledgeBaseAnswers"
"""Answers the specified question using your knowledge base.
- :param knowledge_base_query_options: Post body of the request. Provide either `knowledge_base_query_options`, OR
+ :param options: POST body of the request. Provide either `options`, OR
individual keyword arguments. If both are provided, only the options object will be used.
- :type knowledge_base_query_options:
- ~azure.ai.language.questionanswering.models.KnowledgeBaseQueryOptions
+ :type options:
+ ~azure.ai.language.questionanswering.models.QueryKnowledgeBaseOptions
:keyword project_name: The name of the project to use.
:paramtype project_name: str
:keyword deployment_name: The name of the specific deployment of the project to use.
:paramtype deployment_name: str
- :keyword question: User question to query against the knowledge base. Provide either `knowledge_base_query_options`, OR
+ :keyword question: User question to query against the knowledge base. Provide either `options`, OR
individual keyword arguments. If both are provided, only the options object will be used.
:paramtype question: str
:keyword qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over question.
@@ -197,40 +194,37 @@ def query_knowledge_base(
:keyword ranker_type: (Optional) Set to 'QuestionOnly' for using a question only Ranker. Possible
values include: "Default", "QuestionOnly".
:paramtype ranker_type: str or ~azure.ai.language.questionanswering.models.RankerType
- :keyword strict_filters: Filter QnAs based on give metadata list and knowledge base source names.
- :paramtype strict_filters: ~azure.ai.language.questionanswering.models.StrictFilters
+ :keyword filters: Filter QnAs based on give metadata list and knowledge base source names.
+ :paramtype filters: ~azure.ai.language.questionanswering.models.QueryFilters
:keyword answer_span_request: To configure Answer span prediction feature.
:paramtype answer_span_request: ~azure.ai.language.questionanswering.models.AnswerSpanRequest
:keyword include_unstructured_sources: (Optional) Flag to enable Query over Unstructured Sources.
:paramtype include_unstructured_sources: bool
- :keyword callable cls: A custom type or function that will be passed the direct response
- :return: KnowledgeBaseAnswers, or the result of cls(response)
+ :return: KnowledgeBaseAnswers
:rtype: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswers
:raises: ~azure.core.exceptions.HttpResponseError
"""
- if args:
- knowledge_base_query_options = args[0]
- else:
- knowledge_base_query_options = _models.KnowledgeBaseQueryOptions(
- qna_id=kwargs.pop("qna_id", None),
- question=kwargs.pop("question", None),
- top=kwargs.pop("top", None),
- user_id=kwargs.pop("user_id", None),
- confidence_score_threshold=kwargs.pop("confidence_score_threshold", None),
- context=kwargs.pop("context", None),
- ranker_type=kwargs.pop("ranker_type", None),
- strict_filters=kwargs.pop("strict_filters", None),
- answer_span_request=kwargs.pop("answer_span_request", None),
- include_unstructured_sources=kwargs.pop("include_unstructured_sources", None)
- )
+ options = _get_positional_body(*args, **kwargs) or _models.QueryKnowledgeBaseOptions(
+ qna_id=kwargs.pop("qna_id", None),
+ question=kwargs.pop("question", None),
+ top=kwargs.pop("top", None),
+ user_id=kwargs.pop("user_id", None),
+ confidence_score_threshold=kwargs.pop("confidence_score_threshold", None),
+ context=kwargs.pop("context", None),
+ ranker_type=kwargs.pop("ranker_type", None),
+ filters=kwargs.pop("filters", None),
+ answer_span_request=kwargs.pop("answer_span_request", None),
+ include_unstructured_sources=kwargs.pop("include_unstructured_sources", None)
+ )
+ _verify_qna_id_and_question(options)
cls = kwargs.pop("cls", None) # type: ClsType["_models.KnowledgeBaseAnswers"]
error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop("error_map", {}))
content_type = kwargs.pop("content_type", "application/json") # type: Optional[str]
project_name = kwargs.pop("project_name") # type: str
- deployment_name = kwargs.pop("deployment_name", None) # type: Optional[str]
+ deployment_name = kwargs.pop("deployment_name") # type: str
- json = self._serialize.body(knowledge_base_query_options, "KnowledgeBaseQueryOptions")
+ json = self._serialize.body(options, "QueryKnowledgeBaseOptions")
request = build_query_knowledge_base_request(
content_type=content_type,
@@ -244,7 +238,7 @@ def query_knowledge_base(
}
request.url = self._client.format_url(request.url, **path_format_arguments)
- pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
+ pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
@@ -264,16 +258,15 @@ def query_knowledge_base(
@overload
def query_text(
self,
- text_query_options, # type: "_models.TextQueryOptions"
+ options, # type: "_models.QueryTextOptions"
**kwargs # type: Any
):
# type: (...) -> "_models.TextAnswers"
"""Answers the specified question using the provided text in the body.
- :param text_query_options: Post body of the request.
- :type text_query_options: ~azure.ai.language.questionanswering.models.TextQueryOptions
- :keyword callable cls: A custom type or function that will be passed the direct response
- :return: TextAnswers, or the result of cls(response)
+ :param options: Positional-only POST body of the request.
+ :type options: ~azure.ai.language.questionanswering.models.QueryTextOptions
+ :return: TextAnswers
:rtype: ~azure.ai.language.questionanswering.models.TextAnswers
:raises: ~azure.core.exceptions.HttpResponseError
"""
@@ -295,13 +288,7 @@ def query_text(
example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as
default.
:paramtype language: str
- :keyword string_index_type: Specifies the method used to interpret string offsets. Defaults to
- Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see
- https://aka.ms/text-analytics-offsets. Possible values include: "TextElements_v8",
- "UnicodeCodePoint", "Utf16CodeUnit". Default value: "TextElements_v8".
- :paramtype string_index_type: str or ~azure.ai.language.questionanswering.models.StringIndexType
- :keyword callable cls: A custom type or function that will be passed the direct response
- :return: TextAnswers, or the result of cls(response)
+ :return: TextAnswers
:rtype: ~azure.ai.language.questionanswering.models.TextAnswers
:raises: ~azure.core.exceptions.HttpResponseError
"""
@@ -309,54 +296,44 @@ def query_text(
def query_text(
self,
- *args, # type: "_models.TextQueryOptions"
+ *args, # type: "_models.QueryTextOptions"
**kwargs # type: Any
):
# type: (...) -> "_models.TextAnswers"
"""Answers the specified question using the provided text in the body.
- :param text_query_options: Post body of the request. Provide either `text_query_options`, OR
+ :param options: POST body of the request. Provide either `options`, OR
individual keyword arguments. If both are provided, only the options object will be used.
- :type text_query_options: ~azure.ai.language.questionanswering.models.TextQueryOptions
- :keyword question: User question to query against the given text records. Provide either `text_query_options`,
+ :type options: ~azure.ai.language.questionanswering.models.QueryTextOptions
+ :keyword question: User question to query against the given text records. Provide either `options`,
OR individual keyword arguments. If both are provided, only the options object will be used.
:paramtype question: str
- :keyword records: Text records to be searched for given question. Provide either `text_query_options`, OR
+ :keyword records: Text records to be searched for given question. Provide either `options`, OR
individual keyword arguments. If both are provided, only the options object will be used.
:paramtype records: list[str or ~azure.ai.language.questionanswering.models.TextRecord]
:keyword language: Language of the text records. This is BCP-47 representation of a language. For
example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as default.
:paramtype language: str
- :keyword string_index_type: Specifies the method used to interpret string offsets. Defaults to
- Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see
- https://aka.ms/text-analytics-offsets. Possible values include: "TextElements_v8",
- "UnicodeCodePoint", "Utf16CodeUnit". Default value: "TextElements_v8".
- :paramtype string_index_type: str or ~azure.ai.language.questionanswering.models.StringIndexType
- :keyword callable cls: A custom type or function that will be passed the direct response
- :return: TextAnswers, or the result of cls(response)
+ :return: TextAnswers
:rtype: ~azure.ai.language.questionanswering.models.TextAnswers
:raises: ~azure.core.exceptions.HttpResponseError
"""
- if args:
- text_query_options = args[0]
- else:
- text_query_options = _models.TextQueryOptions(
- question=kwargs.pop("question"),
- records=kwargs.pop("records"),
- language=kwargs.pop("language", None),
- string_index_type=kwargs.pop("string_index_type", "TextElements_v8")
- )
+ options = _get_positional_body(*args, **kwargs) or _models.QueryTextOptions(
+ question=kwargs.pop("question"),
+ records=kwargs.pop("records"),
+ language=kwargs.pop("language", self._default_language),
+ )
try:
- text_query_options['records'] = _validate_text_records(text_query_options['records'])
+ options['records'] = _validate_text_records(options['records'])
except TypeError:
- text_query_options.records = _validate_text_records(text_query_options.records)
+ options.records = _validate_text_records(options.records)
cls = kwargs.pop("cls", None) # type: ClsType["_models.TextAnswers"]
error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop("error_map", {}))
content_type = kwargs.pop("content_type", "application/json") # type: Optional[str]
- json = self._serialize.body(text_query_options, "TextQueryOptions")
+ json = self._serialize.body(options, "QueryTextOptions")
request = build_query_text_request(
content_type=content_type,
@@ -368,7 +345,7 @@ def query_text(
}
request.url = self._client.format_url(request.url, **path_format_arguments)
- pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
+ pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_chat_async.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_chat_async.py
index 483e68f85705..fa80fc5e0c3c 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_chat_async.py
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_chat_async.py
@@ -35,7 +35,7 @@ async def sample_chit_chat():
client = QuestionAnsweringClient(endpoint, AzureKeyCredential(key))
async with client:
- first_question = qna.KnowledgeBaseQueryOptions(
+ first_question = qna.QueryKnowledgeBaseOptions(
question="How long should my Surface battery last?",
top=3,
confidence_score_threshold=0.2,
@@ -56,7 +56,7 @@ async def sample_chit_chat():
print("Q: {}".format(first_question.question))
print("A: {}".format(best_candidate.answer))
- followup_question = qna.KnowledgeBaseQueryOptions(
+ followup_question = qna.QueryKnowledgeBaseOptions(
question="How long it takes to charge Surface?",
top=3,
confidence_score_threshold=0.2,
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_query_knowledgebase_async.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_query_knowledgebase_async.py
index 2f5b0ef1f2e5..93a4b946f7ef 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_query_knowledgebase_async.py
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_query_knowledgebase_async.py
@@ -35,7 +35,7 @@ async def sample_query_knowledgebase():
client = QuestionAnsweringClient(endpoint, AzureKeyCredential(key))
async with client:
- input = qna.KnowledgeBaseQueryOptions(
+ input = qna.QueryKnowledgeBaseOptions(
question="How long should my Surface battery last?",
top=3,
confidence_score_threshold=0.2,
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_query_text_async.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_query_text_async.py
index a34195f7e320..8b7df0051fd0 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_query_text_async.py
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_query_text_async.py
@@ -32,7 +32,7 @@ async def sample_query_text():
client = QuestionAnsweringClient(endpoint, AzureKeyCredential(key))
async with client:
- input = qna.TextQueryOptions(
+ input = qna.QueryTextOptions(
question="How long it takes to charge surface?",
records=[
qna.TextRecord(
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_chat.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_chat.py
index 68077ff16f05..033c59be5529 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_chat.py
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_chat.py
@@ -33,7 +33,7 @@ def sample_chit_chat():
client = QuestionAnsweringClient(endpoint, AzureKeyCredential(key))
with client:
- first_question = qna.KnowledgeBaseQueryOptions(
+ first_question = qna.QueryKnowledgeBaseOptions(
question="How long should my Surface battery last?",
top=3,
confidence_score_threshold=0.2,
@@ -51,10 +51,10 @@ def sample_chit_chat():
deployment_name="test"
)
best_candidate = [a for a in output.answers if a.confidence_score > 0.9][0]
- print("Q: {}".format(first_question.question))
- print("A: {}".format(best_candidate.answer))
+ print(u"Q: {}".format(first_question.question))
+ print(u"A: {}".format(best_candidate.answer))
- followup_question = qna.KnowledgeBaseQueryOptions(
+ followup_question = qna.QueryKnowledgeBaseOptions(
question="How long it takes to charge Surface?",
top=3,
confidence_score_threshold=0.2,
@@ -75,8 +75,8 @@ def sample_chit_chat():
project_name=knowledge_base_project,
deployment_name="test"
)
- print("Q: {}".format(followup_question.question))
- print("A: {}".format(output.answers[0].answer))
+ print(u"Q: {}".format(followup_question.question))
+ print(u"A: {}".format(output.answers[0].answer))
# [END chit_chat]
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_query_knowledgebase.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_query_knowledgebase.py
index 21599649b602..6bfb59022c0b 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_query_knowledgebase.py
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_query_knowledgebase.py
@@ -33,7 +33,7 @@ def sample_query_knowledgebase():
client = QuestionAnsweringClient(endpoint, AzureKeyCredential(key))
with client:
- input = qna.KnowledgeBaseQueryOptions(
+ input = qna.QueryKnowledgeBaseOptions(
question="How long should my Surface battery last?",
top=3,
confidence_score_threshold=0.2,
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_query_text.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_query_text.py
index 9f784b5a5e4c..c394cf640c91 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_query_text.py
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_query_text.py
@@ -31,7 +31,7 @@ def sample_query_text():
client = QuestionAnsweringClient(endpoint, AzureKeyCredential(key))
with client:
- input = qna.TextQueryOptions(
+ input = qna.QueryTextOptions(
question="How long it takes to charge surface?",
records=[
qna.TextRecord(
@@ -50,8 +50,8 @@ def sample_query_text():
output = client.query_text(input)
best_answer = [a for a in output.answers if a.confidence_score > 0.9][0]
- print("Q: {}".format(input.question))
- print("A: {}".format(best_answer.answer))
+ print(u"Q: {}".format(input.question))
+ print(u"A: {}".format(best_answer.answer))
# [END query_text]
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/setup.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/setup.py
index 976409977724..43de47ef0e69 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/setup.py
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/setup.py
@@ -53,20 +53,21 @@
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
+ 'Programming Language :: Python :: 3.10',
'License :: OSI Approved :: MIT License',
],
packages=find_packages(exclude=[
'tests',
# Exclude packages that will be covered by PEP420 or nspkg
- # This means any folder structure that only consists of a __init__.py.
- # For example, for storage, this would mean adding 'azure.storage'
+ # This means any folder structure that only consists of a __init__.py.
+ # For example, for storage, this would mean adding 'azure.storage'
# in addition to the default 'azure' that is seen here.
'azure',
'azure.ai',
'azure.ai.language',
]),
install_requires=[
- 'azure-core<2.0.0,>=1.16.0',
+ 'azure-core<2.0.0,>=1.19.0',
'msrest>=0.6.21',
],
extras_require={
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/swagger/README.md b/sdk/cognitivelanguage/azure-ai-language-questionanswering/swagger/README.md
index 631ff0b2fbb5..2ba0ad9472a9 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/swagger/README.md
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/swagger/README.md
@@ -20,7 +20,7 @@ autorest
### Settings
```yaml
-input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/feature/cognitiveservices/language/specification/cognitiveservices/data-plane/Language/preview/2021-07-15-preview/questionanswering.json
+input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/68e7988aba481206f08019d3efb585683d5bc577/specification/cognitiveservices/data-plane/Language/preview/2021-07-15-preview/questionanswering.json
output-folder: ../azure/ai/language/questionanswering
namespace: azure.ai.language.questionanswering
package-name: azure-ai-language-questionanswering
@@ -58,3 +58,65 @@ directive:
$["operationId"] = "queryText";
```
+### Rename `KnowledgeBasedQueryOptions` -> `Options`
+
+```yaml
+directive:
+ - from: swagger-document
+ where: $["parameters"]["KnowledgeBaseQueryOptions"]
+ transform: >
+ $["x-ms-client-name"] = "Options";
+```
+
+### Rename `TextQueryOptions` -> `Options`
+
+```yaml
+directive:
+ - from: swagger-document
+ where: $["parameters"]["TextQueryOptions"]
+ transform: >
+ $["x-ms-client-name"] = "Options";
+```
+
+### Rename `KnowledgeBaseQueryOptions` -> `QueryKnowledgeBaseOptions`
+
+```yaml
+directive:
+ - from: swagger-document
+ where: $["definitions"]["KnowledgeBaseQueryOptions"]
+ transform: >
+ $["x-ms-client-name"] = "QueryKnowledgeBaseOptions";
+```
+
+### Rename `TextQueryOptions` -> `QueryTextOptions`
+
+```yaml
+directive:
+ - from: swagger-document
+ where: $["definitions"]["TextQueryOptions"]
+ transform: >
+ $["x-ms-client-name"] = "QueryTextOptions";
+```
+
+### Delete `StringIndexType`
+
+```yaml
+directive:
+ - from: swagger-document
+ where: $["definitions"]["TextQueryOptions"]
+ transform: >
+ delete $.properties["stringIndexType"]
+```
+
+### Make `MetadataFilter`'s `metadata` property a list of string
+
+```yaml
+directive:
+ - from: swagger-document
+ where: $["definitions"]
+ transform: >
+ delete $["MetadataFilter"]["properties"]["metadata"]["items"]["$ref"];
+ $["MetadataFilter"]["properties"]["metadata"]["items"]["type"] = "array";
+ $["MetadataFilter"]["properties"]["metadata"]["items"]["items"] = {"type": "string"};
+ delete $["MetadataRecord"];
+```
\ No newline at end of file
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase.yaml
index afdbe07a2dba..1a5ee269c0f9 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase.yaml
@@ -82,10 +82,10 @@ interactions:
devices directly to your Surface Pro 4 using the USB port, Mini DisplayPort,
or Bluetooth. Or, connect everything to a Surface Dock (sold separately).
With Surface Dock, you can switch between fully connected and fully mobile
- with a single connector.\",\n \"confidenceScore\": 0.46380000000000005,\n
- \ \"id\": 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
- \ \"metadata\": {\n \"explicitlytaggedheading\": \"connect monitors,
- accessories, and other devices\"\n },\n \"dialog\": {\n \"isContextOnly\":
+ with a single connector.\",\n \"confidenceScore\": 0.4067,\n \"id\":
+ 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
+ {\n \"explicitlytaggedheading\": \"connect monitors, accessories, and
+ other devices\"\n },\n \"dialog\": {\n \"isContextOnly\":
false,\n \"prompts\": [\n {\n \"displayOrder\":
0,\n \"qnaId\": 65,\n \"displayText\": \"Set up your
workspace with Surface Dock\"\n },\n {\n \"displayOrder\":
@@ -99,27 +99,27 @@ interactions:
is for video only. Audio will play from your Surface speakers unless you\u2019ve
connected external speakers. For more info about this, see [Surface sound,](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers)
[volume, and audio accessories](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers)
- on Surface.com.\",\n \"confidenceScore\": 0.4307,\n \"id\": 68,\n
+ on Surface.com.\",\n \"confidenceScore\": 0.3392,\n \"id\": 68,\n
\ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
{},\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
[]\n }\n }\n ]\n}"
headers:
apim-request-id:
- - af2f063d-0c1a-4be9-8022-4748b0b968f4
+ - d0dc208c-60f1-4669-bddb-4522e3949ecf
content-length:
- - '7136'
+ - '7123'
content-type:
- application/json; charset=utf-8
csp-billing-usage:
- - CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1
+ - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
date:
- - Tue, 21 Sep 2021 21:06:29 GMT
+ - Thu, 30 Sep 2021 15:52:34 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- - '1908'
+ - '1273'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_filter.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_filter.yaml
new file mode 100644
index 000000000000..29691ffe60eb
--- /dev/null
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_filter.yaml
@@ -0,0 +1,66 @@
+interactions:
+- request:
+ body: '{"question": "Battery life", "top": 3, "filters": {"metadataFilter": {"metadata":
+ [["explicitlytaggedheading", "check the battery level"], ["explicitlytaggedheading",
+ "make your battery last"]]}, "logicalOperation": "OR"}}'
+ headers:
+ Accept:
+ - application/json
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '222'
+ Content-Type:
+ - application/json
+ User-Agent:
+ - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit)
+ method: POST
+ uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview
+ response:
+ body:
+ string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Check
+ the battery level\"\n ],\n \"answer\": \"**Check the battery level**\\n\\nYou
+ can check the battery level from the lock screen or the desktop:\",\n \"confidenceScore\":
+ 0.6905,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
+ \ \"metadata\": {\n \"explicitlytaggedheading\": \"check the battery
+ level\"\n },\n \"dialog\": {\n \"isContextOnly\": false,\n
+ \ \"prompts\": []\n }\n },\n {\n \"questions\": [\n
+ \ \"Make your battery last\"\n ],\n \"answer\": \"**Make your
+ battery last**\\n\\nFor info on how to care for your battery and power supply,
+ conserve power, and make your Surface battery last longer, see [Surface battery
+ and power](http://www.microsoft.com/surface/support/hardware-and-drivers/battery-and-power)
+ on Surface.com.\",\n \"confidenceScore\": 0.5818,\n \"id\": 27,\n
+ \ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
+ {\n \"explicitlytaggedheading\": \"make your battery last\"\n },\n
+ \ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
+ []\n }\n },\n {\n \"questions\": [\n \"Desktop taskbar.\"\n
+ \ ],\n \"answer\": \"**Desktop taskbar.**\\n\\nBattery status appears
+ at the right side of the taskbar. Select the battery icon for info about the
+ charging and battery status, including the percent remaining. \u272A\",\n
+ \ \"confidenceScore\": 0.36340000000000006,\n \"id\": 26,\n \"source\":
+ \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {},\n \"dialog\":
+ {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n }\n
+ \ ]\n}"
+ headers:
+ apim-request-id:
+ - 7884df53-4df8-488a-b78c-692ac7f4f783
+ content-length:
+ - '1622'
+ content-type:
+ - application/json; charset=utf-8
+ csp-billing-usage:
+ - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
+ date:
+ - Thu, 30 Sep 2021 15:52:33 GMT
+ strict-transport-security:
+ - max-age=31536000; includeSubDomains; preload
+ x-content-type-options:
+ - nosniff
+ x-envoy-upstream-service-time:
+ - '700'
+ status:
+ code: 200
+ message: OK
+version: 1
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_llc.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_llc.yaml
index ae90e71dfc59..45d018962798 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_llc.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_llc.yaml
@@ -82,10 +82,10 @@ interactions:
devices directly to your Surface Pro 4 using the USB port, Mini DisplayPort,
or Bluetooth. Or, connect everything to a Surface Dock (sold separately).
With Surface Dock, you can switch between fully connected and fully mobile
- with a single connector.\",\n \"confidenceScore\": 0.46380000000000005,\n
- \ \"id\": 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
- \ \"metadata\": {\n \"explicitlytaggedheading\": \"connect monitors,
- accessories, and other devices\"\n },\n \"dialog\": {\n \"isContextOnly\":
+ with a single connector.\",\n \"confidenceScore\": 0.4067,\n \"id\":
+ 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
+ {\n \"explicitlytaggedheading\": \"connect monitors, accessories, and
+ other devices\"\n },\n \"dialog\": {\n \"isContextOnly\":
false,\n \"prompts\": [\n {\n \"displayOrder\":
0,\n \"qnaId\": 65,\n \"displayText\": \"Set up your
workspace with Surface Dock\"\n },\n {\n \"displayOrder\":
@@ -99,27 +99,27 @@ interactions:
is for video only. Audio will play from your Surface speakers unless you\u2019ve
connected external speakers. For more info about this, see [Surface sound,](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers)
[volume, and audio accessories](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers)
- on Surface.com.\",\n \"confidenceScore\": 0.4307,\n \"id\": 68,\n
+ on Surface.com.\",\n \"confidenceScore\": 0.3392,\n \"id\": 68,\n
\ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
{},\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
[]\n }\n }\n ]\n}"
headers:
apim-request-id:
- - 09599054-e8a3-4df2-a441-897e59381452
+ - 020d4cd9-b1fe-49ce-8ce1-e1f95aefbbf3
content-length:
- - '7136'
+ - '7123'
content-type:
- application/json; charset=utf-8
csp-billing-usage:
- - CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1
+ - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
date:
- - Tue, 21 Sep 2021 21:06:30 GMT
+ - Thu, 30 Sep 2021 15:52:34 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- - '493'
+ - '1590'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_llc_with_answerspan.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_llc_with_answerspan.yaml
index 08f52c0c598e..525c23f2acd1 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_llc_with_answerspan.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_llc_with_answerspan.yaml
@@ -77,18 +77,18 @@ interactions:
\ \"qnaId\": 8,\n \"displayText\": \"Memory and storage\"\n
\ },\n {\n \"displayOrder\": 3,\n \"qnaId\":
9,\n \"displayText\": \"Sensors\"\n }\n ]\n },\n
- \ \"answerSpan\": {\n \"text\": \"**Ports and connectors**\\n\\nSurface
- Pro 4 has the ports you expect in a full-feature laptop.\\n\\nFull-size USB
- 3.0 port Connect a USB accessory like a mouse, printer, Ethernet adapter,
- USB drive, or smartphone.\",\n \"confidenceScore\": 0.0106,\n \"offset\":
- 0,\n \"length\": 206\n }\n },\n {\n \"questions\":
- [\n \"Connect monitors, accessories, and other devices\"\n ],\n
- \ \"answer\": \"**Connect monitors, accessories, and other devices**\\n\\nYou
- can connect monitors, accessories, and other devices directly to your Surface
- Pro 4 using the USB port, Mini DisplayPort, or Bluetooth. Or, connect everything
- to a Surface Dock (sold separately). With Surface Dock, you can switch between
- fully connected and fully mobile with a single connector.\",\n \"confidenceScore\":
- 0.46380000000000005,\n \"id\": 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
+ \ \"answerSpan\": {\n \"text\": \"\\nSurface Pro 4 has the ports
+ you expect in a full-feature laptop.\\n\\nFull-size USB 3.0 port Connect a
+ USB accessory like a mouse, printer, Ethernet adapter, USB drive, or smartphone\",\n
+ \ \"confidenceScore\": 0.5141,\n \"offset\": 25,\n \"length\":
+ 180\n }\n },\n {\n \"questions\": [\n \"Connect monitors,
+ accessories, and other devices\"\n ],\n \"answer\": \"**Connect
+ monitors, accessories, and other devices**\\n\\nYou can connect monitors,
+ accessories, and other devices directly to your Surface Pro 4 using the USB
+ port, Mini DisplayPort, or Bluetooth. Or, connect everything to a Surface
+ Dock (sold separately). With Surface Dock, you can switch between fully connected
+ and fully mobile with a single connector.\",\n \"confidenceScore\": 0.4067,\n
+ \ \"id\": 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
\ \"metadata\": {\n \"explicitlytaggedheading\": \"connect monitors,
accessories, and other devices\"\n },\n \"dialog\": {\n \"isContextOnly\":
false,\n \"prompts\": [\n {\n \"displayOrder\":
@@ -104,27 +104,27 @@ interactions:
is for video only. Audio will play from your Surface speakers unless you\u2019ve
connected external speakers. For more info about this, see [Surface sound,](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers)
[volume, and audio accessories](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers)
- on Surface.com.\",\n \"confidenceScore\": 0.4307,\n \"id\": 68,\n
+ on Surface.com.\",\n \"confidenceScore\": 0.3392,\n \"id\": 68,\n
\ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
{},\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
[]\n }\n }\n ]\n}"
headers:
apim-request-id:
- - 7d3e4c75-318d-47ac-a24f-0e6839903f5d
+ - 8ab8a1da-8fd6-4091-80e3-470885a6b2b7
content-length:
- - '7474'
+ - '7435'
content-type:
- application/json; charset=utf-8
csp-billing-usage:
- - CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1
+ - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
date:
- - Tue, 21 Sep 2021 21:06:32 GMT
+ - Thu, 30 Sep 2021 15:52:35 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- - '902'
+ - '2624'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_only_id.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_only_id.yaml
index b82688010904..e6932c6c456c 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_only_id.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_only_id.yaml
@@ -29,21 +29,21 @@ interactions:
[]\n }\n }\n ]\n}"
headers:
apim-request-id:
- - e03a4af6-be5a-4515-a848-981ca32279a2
+ - 4f01bfd0-6d10-4fbd-a02c-81160bc374d2
content-length:
- '583'
content-type:
- application/json; charset=utf-8
csp-billing-usage:
- - CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1
+ - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
date:
- - Tue, 21 Sep 2021 21:06:33 GMT
+ - Thu, 30 Sep 2021 15:52:34 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- - '337'
+ - '1071'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_overload.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_overload.yaml
index e848833ab31d..e3d3aacec340 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_overload.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_overload.yaml
@@ -25,41 +25,34 @@ interactions:
your battery last\"\n ],\n \"answer\": \"**Make your battery last**\\n\\nFor
info on how to care for your battery and power supply, conserve power, and
make your Surface battery last longer, see [Surface battery and power](http://www.microsoft.com/surface/support/hardware-and-drivers/battery-and-power)
- on Surface.com.\",\n \"confidenceScore\": 0.9290999999999999,\n \"id\":
+ on Surface.com.\",\n \"confidenceScore\": 0.9201999999999999,\n \"id\":
27,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
{\n \"explicitlytaggedheading\": \"make your battery last\"\n },\n
\ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
[]\n }\n },\n {\n \"questions\": [\n \"Check the battery
level\"\n ],\n \"answer\": \"**Check the battery level**\\n\\nYou
can check the battery level from the lock screen or the desktop:\",\n \"confidenceScore\":
- 0.3069,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
+ 0.4412,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
\ \"metadata\": {\n \"explicitlytaggedheading\": \"check the battery
level\"\n },\n \"dialog\": {\n \"isContextOnly\": false,\n
- \ \"prompts\": []\n }\n },\n {\n \"questions\": [\n
- \ \"Desktop taskbar.\"\n ],\n \"answer\": \"**Desktop taskbar.**\\n\\nBattery
- status appears at the right side of the taskbar. Select the battery icon for
- info about the charging and battery status, including the percent remaining.
- \u272A\",\n \"confidenceScore\": 0.2548,\n \"id\": 26,\n \"source\":
- \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {},\n \"dialog\":
- {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n }\n
- \ ]\n}"
+ \ \"prompts\": []\n }\n }\n ]\n}"
headers:
apim-request-id:
- - 8740053b-e4fa-4394-ba6c-28d0b064703c
+ - f02239ca-4edc-4348-b5d6-b3023765bddb
content-length:
- - '1621'
+ - '1140'
content-type:
- application/json; charset=utf-8
csp-billing-usage:
- - CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1
+ - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
date:
- - Tue, 21 Sep 2021 21:06:35 GMT
+ - Thu, 30 Sep 2021 15:52:34 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- - '395'
+ - '916'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_python_dict.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_python_dict.yaml
index 3235745609d1..041d14502a21 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_python_dict.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_python_dict.yaml
@@ -29,21 +29,21 @@ interactions:
[]\n }\n }\n ]\n}"
headers:
apim-request-id:
- - 713fabed-16c6-4c14-858e-099bcfa4cbfc
+ - 845c4b78-915e-484c-af56-56ae05539a6e
content-length:
- '583'
content-type:
- application/json; charset=utf-8
csp-billing-usage:
- - CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1
+ - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
date:
- - Tue, 21 Sep 2021 21:06:36 GMT
+ - Thu, 30 Sep 2021 15:52:34 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- - '153'
+ - '1099'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_answerspan.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_answerspan.yaml
index 7815ea378e3d..f90bbb484e56 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_answerspan.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_answerspan.yaml
@@ -77,18 +77,18 @@ interactions:
\ \"qnaId\": 8,\n \"displayText\": \"Memory and storage\"\n
\ },\n {\n \"displayOrder\": 3,\n \"qnaId\":
9,\n \"displayText\": \"Sensors\"\n }\n ]\n },\n
- \ \"answerSpan\": {\n \"text\": \"**Ports and connectors**\\n\\nSurface
- Pro 4 has the ports you expect in a full-feature laptop.\\n\\nFull-size USB
- 3.0 port Connect a USB accessory like a mouse, printer, Ethernet adapter,
- USB drive, or smartphone.\",\n \"confidenceScore\": 0.0106,\n \"offset\":
- 0,\n \"length\": 206\n }\n },\n {\n \"questions\":
- [\n \"Connect monitors, accessories, and other devices\"\n ],\n
- \ \"answer\": \"**Connect monitors, accessories, and other devices**\\n\\nYou
- can connect monitors, accessories, and other devices directly to your Surface
- Pro 4 using the USB port, Mini DisplayPort, or Bluetooth. Or, connect everything
- to a Surface Dock (sold separately). With Surface Dock, you can switch between
- fully connected and fully mobile with a single connector.\",\n \"confidenceScore\":
- 0.46380000000000005,\n \"id\": 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
+ \ \"answerSpan\": {\n \"text\": \"\\nSurface Pro 4 has the ports
+ you expect in a full-feature laptop.\\n\\nFull-size USB 3.0 port Connect a
+ USB accessory like a mouse, printer, Ethernet adapter, USB drive, or smartphone\",\n
+ \ \"confidenceScore\": 0.5141,\n \"offset\": 25,\n \"length\":
+ 180\n }\n },\n {\n \"questions\": [\n \"Connect monitors,
+ accessories, and other devices\"\n ],\n \"answer\": \"**Connect
+ monitors, accessories, and other devices**\\n\\nYou can connect monitors,
+ accessories, and other devices directly to your Surface Pro 4 using the USB
+ port, Mini DisplayPort, or Bluetooth. Or, connect everything to a Surface
+ Dock (sold separately). With Surface Dock, you can switch between fully connected
+ and fully mobile with a single connector.\",\n \"confidenceScore\": 0.4067,\n
+ \ \"id\": 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
\ \"metadata\": {\n \"explicitlytaggedheading\": \"connect monitors,
accessories, and other devices\"\n },\n \"dialog\": {\n \"isContextOnly\":
false,\n \"prompts\": [\n {\n \"displayOrder\":
@@ -96,6 +96,10 @@ interactions:
workspace with Surface Dock\"\n },\n {\n \"displayOrder\":
1,\n \"qnaId\": 66,\n \"displayText\": \"Connect or
project to a monitor, screen, or other display\"\n }\n ]\n
+ \ },\n \"answerSpan\": {\n \"text\": \"\\nYou can connect
+ monitors, accessories, and other devices directly to your Surface Pro 4 using
+ the USB port, Mini DisplayPort, or Bluetooth\",\n \"confidenceScore\":
+ 0.051399999999999994,\n \"offset\": 53,\n \"length\": 140\n
\ }\n },\n {\n \"questions\": [\n \"Projector or monitor.\"\n
\ ],\n \"answer\": \"If your monitor has a DisplayPort, you can connect
it to your Surface using a DisplayPort to Mini DisplayPort cable (sold separately).
@@ -104,27 +108,27 @@ interactions:
is for video only. Audio will play from your Surface speakers unless you\u2019ve
connected external speakers. For more info about this, see [Surface sound,](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers)
[volume, and audio accessories](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers)
- on Surface.com.\",\n \"confidenceScore\": 0.4307,\n \"id\": 68,\n
+ on Surface.com.\",\n \"confidenceScore\": 0.3392,\n \"id\": 68,\n
\ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
{},\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
[]\n }\n }\n ]\n}"
headers:
apim-request-id:
- - 0eb4c00c-dd83-45be-8d96-aba3077392c2
+ - 33feb3cb-5959-4ca7-97de-8c95847f517e
content-length:
- - '7474'
+ - '7719'
content-type:
- application/json; charset=utf-8
csp-billing-usage:
- - CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1
+ - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
date:
- - Tue, 21 Sep 2021 21:06:37 GMT
+ - Thu, 30 Sep 2021 15:52:34 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- - '342'
+ - '1270'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_dictparams.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_dictparams.yaml
index 9992a6c804fe..459558c35245 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_dictparams.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_dictparams.yaml
@@ -25,41 +25,34 @@ interactions:
your battery last\"\n ],\n \"answer\": \"**Make your battery last**\\n\\nFor
info on how to care for your battery and power supply, conserve power, and
make your Surface battery last longer, see [Surface battery and power](http://www.microsoft.com/surface/support/hardware-and-drivers/battery-and-power)
- on Surface.com.\",\n \"confidenceScore\": 0.9290999999999999,\n \"id\":
+ on Surface.com.\",\n \"confidenceScore\": 0.9201999999999999,\n \"id\":
27,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
{\n \"explicitlytaggedheading\": \"make your battery last\"\n },\n
\ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
[]\n }\n },\n {\n \"questions\": [\n \"Check the battery
level\"\n ],\n \"answer\": \"**Check the battery level**\\n\\nYou
can check the battery level from the lock screen or the desktop:\",\n \"confidenceScore\":
- 0.3069,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
+ 0.4412,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
\ \"metadata\": {\n \"explicitlytaggedheading\": \"check the battery
level\"\n },\n \"dialog\": {\n \"isContextOnly\": false,\n
- \ \"prompts\": []\n }\n },\n {\n \"questions\": [\n
- \ \"Desktop taskbar.\"\n ],\n \"answer\": \"**Desktop taskbar.**\\n\\nBattery
- status appears at the right side of the taskbar. Select the battery icon for
- info about the charging and battery status, including the percent remaining.
- \u272A\",\n \"confidenceScore\": 0.2548,\n \"id\": 26,\n \"source\":
- \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {},\n \"dialog\":
- {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n }\n
- \ ]\n}"
+ \ \"prompts\": []\n }\n }\n ]\n}"
headers:
apim-request-id:
- - 5b72cd45-d5b9-492c-ad05-7172c2ae070d
+ - 1f863859-4839-430b-9e06-3461d04f010e
content-length:
- - '1621'
+ - '1140'
content-type:
- application/json; charset=utf-8
csp-billing-usage:
- - CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1
+ - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
date:
- - Tue, 21 Sep 2021 21:06:38 GMT
+ - Thu, 30 Sep 2021 15:52:35 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- - '365'
+ - '2626'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_followup.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_followup.yaml
index 72af1ce6d157..96d3a557c24b 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_followup.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_followup.yaml
@@ -25,41 +25,34 @@ interactions:
your battery last\"\n ],\n \"answer\": \"**Make your battery last**\\n\\nFor
info on how to care for your battery and power supply, conserve power, and
make your Surface battery last longer, see [Surface battery and power](http://www.microsoft.com/surface/support/hardware-and-drivers/battery-and-power)
- on Surface.com.\",\n \"confidenceScore\": 0.9290999999999999,\n \"id\":
+ on Surface.com.\",\n \"confidenceScore\": 0.9201999999999999,\n \"id\":
27,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
{\n \"explicitlytaggedheading\": \"make your battery last\"\n },\n
\ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
[]\n }\n },\n {\n \"questions\": [\n \"Check the battery
level\"\n ],\n \"answer\": \"**Check the battery level**\\n\\nYou
can check the battery level from the lock screen or the desktop:\",\n \"confidenceScore\":
- 0.3069,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
+ 0.4412,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
\ \"metadata\": {\n \"explicitlytaggedheading\": \"check the battery
level\"\n },\n \"dialog\": {\n \"isContextOnly\": false,\n
- \ \"prompts\": []\n }\n },\n {\n \"questions\": [\n
- \ \"Desktop taskbar.\"\n ],\n \"answer\": \"**Desktop taskbar.**\\n\\nBattery
- status appears at the right side of the taskbar. Select the battery icon for
- info about the charging and battery status, including the percent remaining.
- \u272A\",\n \"confidenceScore\": 0.2548,\n \"id\": 26,\n \"source\":
- \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {},\n \"dialog\":
- {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n }\n
- \ ]\n}"
+ \ \"prompts\": []\n }\n }\n ]\n}"
headers:
apim-request-id:
- - 555d76da-0f60-4c4c-8a93-2f3e263ca9c0
+ - 227983f1-c75e-4ee2-910d-589011a7a251
content-length:
- - '1621'
+ - '1140'
content-type:
- application/json; charset=utf-8
csp-billing-usage:
- - CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1
+ - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
date:
- - Tue, 21 Sep 2021 21:06:39 GMT
+ - Thu, 30 Sep 2021 15:52:35 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- - '322'
+ - '2660'
status:
code: 200
message: OK
@@ -95,7 +88,7 @@ interactions:
like a phone, while your Surface charges. The USB port on the power supply
is only for charging, not for data transfer. If you want to use a USB device,
plug it into the USB port on your Surface.\",\n \"confidenceScore\":
- 0.6517000000000001,\n \"id\": 23,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
+ 0.5296,\n \"id\": 23,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
\ \"metadata\": {\n \"explicitlytaggedheading\": \"power and charging\"\n
\ },\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
[\n {\n \"displayOrder\": 0,\n \"qnaId\": 24,\n
@@ -105,34 +98,34 @@ interactions:
2,\n \"qnaId\": 26,\n \"displayText\": \"Desktop taskbar.\"\n
\ },\n {\n \"displayOrder\": 3,\n \"qnaId\":
27,\n \"displayText\": \"Make your battery last\"\n }\n
- \ ]\n },\n \"answerSpan\": {\n \"text\": \"two to four
- hours\",\n \"confidenceScore\": 0.3086,\n \"offset\": 33,\n
- \ \"length\": 18\n }\n },\n {\n \"questions\": [\n \"Charge
+ \ ]\n },\n \"answerSpan\": {\n \"text\": \" two to
+ four hours\",\n \"confidenceScore\": 0.3795,\n \"offset\": 32,\n
+ \ \"length\": 19\n }\n },\n {\n \"questions\": [\n \"Charge
your Surface Pro 4\"\n ],\n \"answer\": \"**Charge your Surface
Pro 4**\\n\\n1. Connect the two parts of the power cord.\\n\\n2. Connect
the power cord securely to the charging port.\\n\\n3. Plug the power supply
- into an electrical outlet.\",\n \"confidenceScore\": 0.30260000000000004,\n
- \ \"id\": 19,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
- \ \"metadata\": {\n \"explicitlytaggedheading\": \"charge your
- surface pro 4\"\n },\n \"dialog\": {\n \"isContextOnly\":
- false,\n \"prompts\": []\n }\n }\n ]\n}"
+ into an electrical outlet.\",\n \"confidenceScore\": 0.2707,\n \"id\":
+ 19,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
+ {\n \"explicitlytaggedheading\": \"charge your surface pro 4\"\n },\n
+ \ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
+ []\n }\n }\n ]\n}"
headers:
apim-request-id:
- - 9ef0bd69-7736-4ed5-8c21-879df23aaa47
+ - f95352a5-4e6d-4ec1-8809-d164a774dfe6
content-length:
- - '2178'
+ - '2154'
content-type:
- application/json; charset=utf-8
csp-billing-usage:
- - CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1
+ - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
date:
- - Tue, 21 Sep 2021 21:06:41 GMT
+ - Thu, 30 Sep 2021 15:52:35 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- - '1046'
+ - '509'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase.yaml
index bf7d70f91563..e522576f82a0 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase.yaml
@@ -78,10 +78,10 @@ interactions:
devices directly to your Surface Pro 4 using the USB port, Mini DisplayPort,
or Bluetooth. Or, connect everything to a Surface Dock (sold separately).
With Surface Dock, you can switch between fully connected and fully mobile
- with a single connector.\",\n \"confidenceScore\": 0.46380000000000005,\n
- \ \"id\": 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
- \ \"metadata\": {\n \"explicitlytaggedheading\": \"connect monitors,
- accessories, and other devices\"\n },\n \"dialog\": {\n \"isContextOnly\":
+ with a single connector.\",\n \"confidenceScore\": 0.4067,\n \"id\":
+ 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
+ {\n \"explicitlytaggedheading\": \"connect monitors, accessories, and
+ other devices\"\n },\n \"dialog\": {\n \"isContextOnly\":
false,\n \"prompts\": [\n {\n \"displayOrder\":
0,\n \"qnaId\": 65,\n \"displayText\": \"Set up your
workspace with Surface Dock\"\n },\n {\n \"displayOrder\":
@@ -95,19 +95,19 @@ interactions:
is for video only. Audio will play from your Surface speakers unless you\u2019ve
connected external speakers. For more info about this, see [Surface sound,](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers)
[volume, and audio accessories](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers)
- on Surface.com.\",\n \"confidenceScore\": 0.4307,\n \"id\": 68,\n
+ on Surface.com.\",\n \"confidenceScore\": 0.3392,\n \"id\": 68,\n
\ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
{},\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
[]\n }\n }\n ]\n}"
headers:
- apim-request-id: ef43aa6b-709e-4d07-a1ca-c4cf33586fc6
- content-length: '7136'
+ apim-request-id: 5971ea57-2aa9-4179-bda9-aba6b937380f
+ content-length: '7123'
content-type: application/json; charset=utf-8
- csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1
- date: Tue, 21 Sep 2021 21:06:43 GMT
+ csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
+ date: Thu, 30 Sep 2021 15:52:36 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
- x-envoy-upstream-service-time: '284'
+ x-envoy-upstream-service-time: '1153'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_filter.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_filter.yaml
new file mode 100644
index 000000000000..abb85ac4c446
--- /dev/null
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_filter.yaml
@@ -0,0 +1,55 @@
+interactions:
+- request:
+ body: '{"question": "Battery life", "top": 3, "filters": {"metadataFilter": {"metadata":
+ [["explicitlytaggedheading", "check the battery level"], ["explicitlytaggedheading",
+ "make your battery last"]]}, "logicalOperation": "OR"}}'
+ headers:
+ Accept:
+ - application/json
+ Content-Length:
+ - '222'
+ Content-Type:
+ - application/json
+ User-Agent:
+ - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit)
+ method: POST
+ uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview
+ response:
+ body:
+ string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Check
+ the battery level\"\n ],\n \"answer\": \"**Check the battery level**\\n\\nYou
+ can check the battery level from the lock screen or the desktop:\",\n \"confidenceScore\":
+ 0.6905,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
+ \ \"metadata\": {\n \"explicitlytaggedheading\": \"check the battery
+ level\"\n },\n \"dialog\": {\n \"isContextOnly\": false,\n
+ \ \"prompts\": []\n }\n },\n {\n \"questions\": [\n
+ \ \"Make your battery last\"\n ],\n \"answer\": \"**Make your
+ battery last**\\n\\nFor info on how to care for your battery and power supply,
+ conserve power, and make your Surface battery last longer, see [Surface battery
+ and power](http://www.microsoft.com/surface/support/hardware-and-drivers/battery-and-power)
+ on Surface.com.\",\n \"confidenceScore\": 0.5818,\n \"id\": 27,\n
+ \ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
+ {\n \"explicitlytaggedheading\": \"make your battery last\"\n },\n
+ \ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
+ []\n }\n },\n {\n \"questions\": [\n \"Desktop taskbar.\"\n
+ \ ],\n \"answer\": \"**Desktop taskbar.**\\n\\nBattery status appears
+ at the right side of the taskbar. Select the battery icon for info about the
+ charging and battery status, including the percent remaining. \u272A\",\n
+ \ \"confidenceScore\": 0.36340000000000006,\n \"id\": 26,\n \"source\":
+ \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {},\n \"dialog\":
+ {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n }\n
+ \ ]\n}"
+ headers:
+ apim-request-id: e958c124-6d15-41c7-93a5-0a242f6b01b1
+ content-length: '1622'
+ content-type: application/json; charset=utf-8
+ csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
+ date: Thu, 30 Sep 2021 15:52:35 GMT
+ strict-transport-security: max-age=31536000; includeSubDomains; preload
+ x-content-type-options: nosniff
+ x-envoy-upstream-service-time: '1503'
+ status:
+ code: 200
+ message: OK
+ url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview
+version: 1
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_llc.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_llc.yaml
index 0de1a13a3c4b..f5d1f2db923a 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_llc.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_llc.yaml
@@ -78,10 +78,10 @@ interactions:
devices directly to your Surface Pro 4 using the USB port, Mini DisplayPort,
or Bluetooth. Or, connect everything to a Surface Dock (sold separately).
With Surface Dock, you can switch between fully connected and fully mobile
- with a single connector.\",\n \"confidenceScore\": 0.46380000000000005,\n
- \ \"id\": 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
- \ \"metadata\": {\n \"explicitlytaggedheading\": \"connect monitors,
- accessories, and other devices\"\n },\n \"dialog\": {\n \"isContextOnly\":
+ with a single connector.\",\n \"confidenceScore\": 0.4067,\n \"id\":
+ 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
+ {\n \"explicitlytaggedheading\": \"connect monitors, accessories, and
+ other devices\"\n },\n \"dialog\": {\n \"isContextOnly\":
false,\n \"prompts\": [\n {\n \"displayOrder\":
0,\n \"qnaId\": 65,\n \"displayText\": \"Set up your
workspace with Surface Dock\"\n },\n {\n \"displayOrder\":
@@ -95,19 +95,19 @@ interactions:
is for video only. Audio will play from your Surface speakers unless you\u2019ve
connected external speakers. For more info about this, see [Surface sound,](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers)
[volume, and audio accessories](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers)
- on Surface.com.\",\n \"confidenceScore\": 0.4307,\n \"id\": 68,\n
+ on Surface.com.\",\n \"confidenceScore\": 0.3392,\n \"id\": 68,\n
\ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
{},\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
[]\n }\n }\n ]\n}"
headers:
- apim-request-id: 1833a5eb-5934-4f16-abab-46148ceb44a1
- content-length: '7136'
+ apim-request-id: f2cf1974-868f-42c6-b183-ff7f5df0ebe4
+ content-length: '7123'
content-type: application/json; charset=utf-8
- csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1
- date: Tue, 21 Sep 2021 21:06:46 GMT
+ csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
+ date: Thu, 30 Sep 2021 15:52:35 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
- x-envoy-upstream-service-time: '276'
+ x-envoy-upstream-service-time: '519'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_llc_with_answerspan.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_llc_with_answerspan.yaml
index cc075a6d8e6f..862b6d6d3678 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_llc_with_answerspan.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_llc_with_answerspan.yaml
@@ -73,18 +73,18 @@ interactions:
\ \"qnaId\": 8,\n \"displayText\": \"Memory and storage\"\n
\ },\n {\n \"displayOrder\": 3,\n \"qnaId\":
9,\n \"displayText\": \"Sensors\"\n }\n ]\n },\n
- \ \"answerSpan\": {\n \"text\": \"**Ports and connectors**\\n\\nSurface
- Pro 4 has the ports you expect in a full-feature laptop.\\n\\nFull-size USB
- 3.0 port Connect a USB accessory like a mouse, printer, Ethernet adapter,
- USB drive, or smartphone.\",\n \"confidenceScore\": 0.0106,\n \"offset\":
- 0,\n \"length\": 206\n }\n },\n {\n \"questions\":
- [\n \"Connect monitors, accessories, and other devices\"\n ],\n
- \ \"answer\": \"**Connect monitors, accessories, and other devices**\\n\\nYou
- can connect monitors, accessories, and other devices directly to your Surface
- Pro 4 using the USB port, Mini DisplayPort, or Bluetooth. Or, connect everything
- to a Surface Dock (sold separately). With Surface Dock, you can switch between
- fully connected and fully mobile with a single connector.\",\n \"confidenceScore\":
- 0.46380000000000005,\n \"id\": 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
+ \ \"answerSpan\": {\n \"text\": \"\\nSurface Pro 4 has the ports
+ you expect in a full-feature laptop.\\n\\nFull-size USB 3.0 port Connect a
+ USB accessory like a mouse, printer, Ethernet adapter, USB drive, or smartphone\",\n
+ \ \"confidenceScore\": 0.5141,\n \"offset\": 25,\n \"length\":
+ 180\n }\n },\n {\n \"questions\": [\n \"Connect monitors,
+ accessories, and other devices\"\n ],\n \"answer\": \"**Connect
+ monitors, accessories, and other devices**\\n\\nYou can connect monitors,
+ accessories, and other devices directly to your Surface Pro 4 using the USB
+ port, Mini DisplayPort, or Bluetooth. Or, connect everything to a Surface
+ Dock (sold separately). With Surface Dock, you can switch between fully connected
+ and fully mobile with a single connector.\",\n \"confidenceScore\": 0.4067,\n
+ \ \"id\": 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
\ \"metadata\": {\n \"explicitlytaggedheading\": \"connect monitors,
accessories, and other devices\"\n },\n \"dialog\": {\n \"isContextOnly\":
false,\n \"prompts\": [\n {\n \"displayOrder\":
@@ -92,6 +92,10 @@ interactions:
workspace with Surface Dock\"\n },\n {\n \"displayOrder\":
1,\n \"qnaId\": 66,\n \"displayText\": \"Connect or
project to a monitor, screen, or other display\"\n }\n ]\n
+ \ },\n \"answerSpan\": {\n \"text\": \"\\nYou can connect
+ monitors, accessories, and other devices directly to your Surface Pro 4 using
+ the USB port, Mini DisplayPort, or Bluetooth\",\n \"confidenceScore\":
+ 0.051399999999999994,\n \"offset\": 53,\n \"length\": 140\n
\ }\n },\n {\n \"questions\": [\n \"Projector or monitor.\"\n
\ ],\n \"answer\": \"If your monitor has a DisplayPort, you can connect
it to your Surface using a DisplayPort to Mini DisplayPort cable (sold separately).
@@ -100,19 +104,19 @@ interactions:
is for video only. Audio will play from your Surface speakers unless you\u2019ve
connected external speakers. For more info about this, see [Surface sound,](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers)
[volume, and audio accessories](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers)
- on Surface.com.\",\n \"confidenceScore\": 0.4307,\n \"id\": 68,\n
+ on Surface.com.\",\n \"confidenceScore\": 0.3392,\n \"id\": 68,\n
\ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
{},\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
[]\n }\n }\n ]\n}"
headers:
- apim-request-id: 3dbc4527-4e20-44b3-abbe-d380ea18ef2c
- content-length: '7474'
+ apim-request-id: ec633ba0-764f-4865-8e8b-69ffbc1f74f5
+ content-length: '7719'
content-type: application/json; charset=utf-8
- csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1
- date: Tue, 21 Sep 2021 21:06:47 GMT
+ csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
+ date: Thu, 30 Sep 2021 15:52:37 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
- x-envoy-upstream-service-time: '300'
+ x-envoy-upstream-service-time: '663'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_only_id.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_only_id.yaml
index 7f4f92ee521c..c46b8b79716e 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_only_id.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_only_id.yaml
@@ -24,14 +24,14 @@ interactions:
\ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
[]\n }\n }\n ]\n}"
headers:
- apim-request-id: 24be7932-f7a1-4019-8472-32c2551d1d6e
+ apim-request-id: 824a47b2-1f4a-4056-8c26-ddba66a21497
content-length: '583'
content-type: application/json; charset=utf-8
- csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1
- date: Tue, 21 Sep 2021 21:06:49 GMT
+ csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
+ date: Thu, 30 Sep 2021 15:52:35 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
- x-envoy-upstream-service-time: '132'
+ x-envoy-upstream-service-time: '879'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_overload.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_overload.yaml
index a258665e5354..c4cf69673348 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_overload.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_overload.yaml
@@ -21,33 +21,26 @@ interactions:
your battery last\"\n ],\n \"answer\": \"**Make your battery last**\\n\\nFor
info on how to care for your battery and power supply, conserve power, and
make your Surface battery last longer, see [Surface battery and power](http://www.microsoft.com/surface/support/hardware-and-drivers/battery-and-power)
- on Surface.com.\",\n \"confidenceScore\": 0.9290999999999999,\n \"id\":
+ on Surface.com.\",\n \"confidenceScore\": 0.9201999999999999,\n \"id\":
27,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
{\n \"explicitlytaggedheading\": \"make your battery last\"\n },\n
\ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
[]\n }\n },\n {\n \"questions\": [\n \"Check the battery
level\"\n ],\n \"answer\": \"**Check the battery level**\\n\\nYou
can check the battery level from the lock screen or the desktop:\",\n \"confidenceScore\":
- 0.3069,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
+ 0.4412,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
\ \"metadata\": {\n \"explicitlytaggedheading\": \"check the battery
level\"\n },\n \"dialog\": {\n \"isContextOnly\": false,\n
- \ \"prompts\": []\n }\n },\n {\n \"questions\": [\n
- \ \"Desktop taskbar.\"\n ],\n \"answer\": \"**Desktop taskbar.**\\n\\nBattery
- status appears at the right side of the taskbar. Select the battery icon for
- info about the charging and battery status, including the percent remaining.
- \u272A\",\n \"confidenceScore\": 0.2548,\n \"id\": 26,\n \"source\":
- \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {},\n \"dialog\":
- {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n }\n
- \ ]\n}"
+ \ \"prompts\": []\n }\n }\n ]\n}"
headers:
- apim-request-id: 8aa31a73-6acd-4f7a-85c2-dcecc522ae32
- content-length: '1621'
+ apim-request-id: cd3dad50-3644-4273-afc0-442c50d22419
+ content-length: '1140'
content-type: application/json; charset=utf-8
- csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1
- date: Tue, 21 Sep 2021 21:06:50 GMT
+ csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
+ date: Thu, 30 Sep 2021 15:52:35 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
- x-envoy-upstream-service-time: '328'
+ x-envoy-upstream-service-time: '1047'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_python_dict.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_python_dict.yaml
index 84d90331cb91..2b3cc394ee2c 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_python_dict.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_python_dict.yaml
@@ -24,14 +24,14 @@ interactions:
\ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
[]\n }\n }\n ]\n}"
headers:
- apim-request-id: c6c85372-bf1f-4f8c-98ce-8de52137882a
+ apim-request-id: 9980db27-58c1-485e-995a-933a4e41e08c
content-length: '583'
content-type: application/json; charset=utf-8
- csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1
- date: Tue, 21 Sep 2021 21:06:51 GMT
+ csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
+ date: Thu, 30 Sep 2021 15:52:34 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
- x-envoy-upstream-service-time: '139'
+ x-envoy-upstream-service-time: '135'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_answerspan.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_answerspan.yaml
index df113eda18b8..8e6127f52048 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_answerspan.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_answerspan.yaml
@@ -73,18 +73,18 @@ interactions:
\ \"qnaId\": 8,\n \"displayText\": \"Memory and storage\"\n
\ },\n {\n \"displayOrder\": 3,\n \"qnaId\":
9,\n \"displayText\": \"Sensors\"\n }\n ]\n },\n
- \ \"answerSpan\": {\n \"text\": \"**Ports and connectors**\\n\\nSurface
- Pro 4 has the ports you expect in a full-feature laptop.\\n\\nFull-size USB
- 3.0 port Connect a USB accessory like a mouse, printer, Ethernet adapter,
- USB drive, or smartphone.\",\n \"confidenceScore\": 0.0106,\n \"offset\":
- 0,\n \"length\": 206\n }\n },\n {\n \"questions\":
- [\n \"Connect monitors, accessories, and other devices\"\n ],\n
- \ \"answer\": \"**Connect monitors, accessories, and other devices**\\n\\nYou
- can connect monitors, accessories, and other devices directly to your Surface
- Pro 4 using the USB port, Mini DisplayPort, or Bluetooth. Or, connect everything
- to a Surface Dock (sold separately). With Surface Dock, you can switch between
- fully connected and fully mobile with a single connector.\",\n \"confidenceScore\":
- 0.46380000000000005,\n \"id\": 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
+ \ \"answerSpan\": {\n \"text\": \"\\nSurface Pro 4 has the ports
+ you expect in a full-feature laptop.\\n\\nFull-size USB 3.0 port Connect a
+ USB accessory like a mouse, printer, Ethernet adapter, USB drive, or smartphone\",\n
+ \ \"confidenceScore\": 0.5141,\n \"offset\": 25,\n \"length\":
+ 180\n }\n },\n {\n \"questions\": [\n \"Connect monitors,
+ accessories, and other devices\"\n ],\n \"answer\": \"**Connect
+ monitors, accessories, and other devices**\\n\\nYou can connect monitors,
+ accessories, and other devices directly to your Surface Pro 4 using the USB
+ port, Mini DisplayPort, or Bluetooth. Or, connect everything to a Surface
+ Dock (sold separately). With Surface Dock, you can switch between fully connected
+ and fully mobile with a single connector.\",\n \"confidenceScore\": 0.4067,\n
+ \ \"id\": 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
\ \"metadata\": {\n \"explicitlytaggedheading\": \"connect monitors,
accessories, and other devices\"\n },\n \"dialog\": {\n \"isContextOnly\":
false,\n \"prompts\": [\n {\n \"displayOrder\":
@@ -92,6 +92,10 @@ interactions:
workspace with Surface Dock\"\n },\n {\n \"displayOrder\":
1,\n \"qnaId\": 66,\n \"displayText\": \"Connect or
project to a monitor, screen, or other display\"\n }\n ]\n
+ \ },\n \"answerSpan\": {\n \"text\": \"\\nYou can connect
+ monitors, accessories, and other devices directly to your Surface Pro 4 using
+ the USB port, Mini DisplayPort, or Bluetooth\",\n \"confidenceScore\":
+ 0.051399999999999994,\n \"offset\": 53,\n \"length\": 140\n
\ }\n },\n {\n \"questions\": [\n \"Projector or monitor.\"\n
\ ],\n \"answer\": \"If your monitor has a DisplayPort, you can connect
it to your Surface using a DisplayPort to Mini DisplayPort cable (sold separately).
@@ -100,19 +104,19 @@ interactions:
is for video only. Audio will play from your Surface speakers unless you\u2019ve
connected external speakers. For more info about this, see [Surface sound,](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers)
[volume, and audio accessories](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers)
- on Surface.com.\",\n \"confidenceScore\": 0.4307,\n \"id\": 68,\n
+ on Surface.com.\",\n \"confidenceScore\": 0.3392,\n \"id\": 68,\n
\ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
{},\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
[]\n }\n }\n ]\n}"
headers:
- apim-request-id: f107eb5a-8eb0-4d0c-8630-bf8a6e8ed463
- content-length: '7474'
+ apim-request-id: db614ffe-6d30-40e1-96a9-f90e41d9dd0d
+ content-length: '7719'
content-type: application/json; charset=utf-8
- csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1
- date: Tue, 21 Sep 2021 21:06:51 GMT
+ csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
+ date: Thu, 30 Sep 2021 15:52:35 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
- x-envoy-upstream-service-time: '325'
+ x-envoy-upstream-service-time: '633'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_dictparams.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_dictparams.yaml
index 1f36421fa211..513de2a22841 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_dictparams.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_dictparams.yaml
@@ -21,33 +21,26 @@ interactions:
your battery last\"\n ],\n \"answer\": \"**Make your battery last**\\n\\nFor
info on how to care for your battery and power supply, conserve power, and
make your Surface battery last longer, see [Surface battery and power](http://www.microsoft.com/surface/support/hardware-and-drivers/battery-and-power)
- on Surface.com.\",\n \"confidenceScore\": 0.9290999999999999,\n \"id\":
+ on Surface.com.\",\n \"confidenceScore\": 0.9201999999999999,\n \"id\":
27,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
{\n \"explicitlytaggedheading\": \"make your battery last\"\n },\n
\ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
[]\n }\n },\n {\n \"questions\": [\n \"Check the battery
level\"\n ],\n \"answer\": \"**Check the battery level**\\n\\nYou
can check the battery level from the lock screen or the desktop:\",\n \"confidenceScore\":
- 0.3069,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
+ 0.4412,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
\ \"metadata\": {\n \"explicitlytaggedheading\": \"check the battery
level\"\n },\n \"dialog\": {\n \"isContextOnly\": false,\n
- \ \"prompts\": []\n }\n },\n {\n \"questions\": [\n
- \ \"Desktop taskbar.\"\n ],\n \"answer\": \"**Desktop taskbar.**\\n\\nBattery
- status appears at the right side of the taskbar. Select the battery icon for
- info about the charging and battery status, including the percent remaining.
- \u272A\",\n \"confidenceScore\": 0.2548,\n \"id\": 26,\n \"source\":
- \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {},\n \"dialog\":
- {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n }\n
- \ ]\n}"
+ \ \"prompts\": []\n }\n }\n ]\n}"
headers:
- apim-request-id: acaef643-3f2d-4397-aca0-2c4bcc8bb7a2
- content-length: '1621'
+ apim-request-id: e780b038-2930-45fc-99b3-35255fff74ec
+ content-length: '1140'
content-type: application/json; charset=utf-8
- csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1
- date: Tue, 21 Sep 2021 21:06:53 GMT
+ csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
+ date: Thu, 30 Sep 2021 15:52:36 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
- x-envoy-upstream-service-time: '250'
+ x-envoy-upstream-service-time: '578'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_followup.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_followup.yaml
index 69a285e55600..fa6114118971 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_followup.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_followup.yaml
@@ -21,33 +21,26 @@ interactions:
your battery last\"\n ],\n \"answer\": \"**Make your battery last**\\n\\nFor
info on how to care for your battery and power supply, conserve power, and
make your Surface battery last longer, see [Surface battery and power](http://www.microsoft.com/surface/support/hardware-and-drivers/battery-and-power)
- on Surface.com.\",\n \"confidenceScore\": 0.9290999999999999,\n \"id\":
+ on Surface.com.\",\n \"confidenceScore\": 0.9201999999999999,\n \"id\":
27,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
{\n \"explicitlytaggedheading\": \"make your battery last\"\n },\n
\ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
[]\n }\n },\n {\n \"questions\": [\n \"Check the battery
level\"\n ],\n \"answer\": \"**Check the battery level**\\n\\nYou
can check the battery level from the lock screen or the desktop:\",\n \"confidenceScore\":
- 0.3069,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
+ 0.4412,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
\ \"metadata\": {\n \"explicitlytaggedheading\": \"check the battery
level\"\n },\n \"dialog\": {\n \"isContextOnly\": false,\n
- \ \"prompts\": []\n }\n },\n {\n \"questions\": [\n
- \ \"Desktop taskbar.\"\n ],\n \"answer\": \"**Desktop taskbar.**\\n\\nBattery
- status appears at the right side of the taskbar. Select the battery icon for
- info about the charging and battery status, including the percent remaining.
- \u272A\",\n \"confidenceScore\": 0.2548,\n \"id\": 26,\n \"source\":
- \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {},\n \"dialog\":
- {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n }\n
- \ ]\n}"
+ \ \"prompts\": []\n }\n }\n ]\n}"
headers:
- apim-request-id: 5a7bbcf4-75f5-4eeb-a994-b8bcd5d2907f
- content-length: '1621'
+ apim-request-id: 4e07975b-1254-451c-8173-9fc8603cadca
+ content-length: '1140'
content-type: application/json; charset=utf-8
- csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1
- date: Tue, 21 Sep 2021 21:06:53 GMT
+ csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
+ date: Thu, 30 Sep 2021 15:52:36 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
- x-envoy-upstream-service-time: '251'
+ x-envoy-upstream-service-time: '368'
status:
code: 200
message: OK
@@ -80,7 +73,7 @@ interactions:
like a phone, while your Surface charges. The USB port on the power supply
is only for charging, not for data transfer. If you want to use a USB device,
plug it into the USB port on your Surface.\",\n \"confidenceScore\":
- 0.6517000000000001,\n \"id\": 23,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
+ 0.5296,\n \"id\": 23,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
\ \"metadata\": {\n \"explicitlytaggedheading\": \"power and charging\"\n
\ },\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
[\n {\n \"displayOrder\": 0,\n \"qnaId\": 24,\n
@@ -90,26 +83,26 @@ interactions:
2,\n \"qnaId\": 26,\n \"displayText\": \"Desktop taskbar.\"\n
\ },\n {\n \"displayOrder\": 3,\n \"qnaId\":
27,\n \"displayText\": \"Make your battery last\"\n }\n
- \ ]\n },\n \"answerSpan\": {\n \"text\": \"two to four
- hours\",\n \"confidenceScore\": 0.3086,\n \"offset\": 33,\n
- \ \"length\": 18\n }\n },\n {\n \"questions\": [\n \"Charge
+ \ ]\n },\n \"answerSpan\": {\n \"text\": \" two to
+ four hours\",\n \"confidenceScore\": 0.3795,\n \"offset\": 32,\n
+ \ \"length\": 19\n }\n },\n {\n \"questions\": [\n \"Charge
your Surface Pro 4\"\n ],\n \"answer\": \"**Charge your Surface
Pro 4**\\n\\n1. Connect the two parts of the power cord.\\n\\n2. Connect
the power cord securely to the charging port.\\n\\n3. Plug the power supply
- into an electrical outlet.\",\n \"confidenceScore\": 0.30260000000000004,\n
- \ \"id\": 19,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n
- \ \"metadata\": {\n \"explicitlytaggedheading\": \"charge your
- surface pro 4\"\n },\n \"dialog\": {\n \"isContextOnly\":
- false,\n \"prompts\": []\n }\n }\n ]\n}"
+ into an electrical outlet.\",\n \"confidenceScore\": 0.2707,\n \"id\":
+ 19,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\":
+ {\n \"explicitlytaggedheading\": \"charge your surface pro 4\"\n },\n
+ \ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\":
+ []\n }\n }\n ]\n}"
headers:
- apim-request-id: 33ee27bc-abd8-493e-9ffb-ac0259f68ad7
- content-length: '2178'
+ apim-request-id: 7b827f35-7711-46af-8757-f33d0a2ff551
+ content-length: '2154'
content-type: application/json; charset=utf-8
- csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1
- date: Tue, 21 Sep 2021 21:06:53 GMT
+ csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
+ date: Thu, 30 Sep 2021 15:52:38 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
- x-envoy-upstream-service-time: '338'
+ x-envoy-upstream-service-time: '571'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text.yaml
index 31912fc7ddc9..b1a0f0a77e70 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text.yaml
@@ -93,7 +93,7 @@ interactions:
USB 3.1 Always-On, USB 3.1, Headphone/Mic, microSD RAM16GB RAM Upgradable to16GB
Size12.1 x 8.3 x .57 inches Touchpad Size4.3 x 2.2 inches USB Ports3 Video Memory2GB
Warranty/Supportone-year warranty. Weight2.8 pounds Wi-Fi802.11ac Wi-Fi ModelIntel
- Wireless-AC 9560 "}], "language": "en", "stringIndexType": "TextElements_v8"}'
+ Wireless-AC 9560 "}], "language": "en", "stringIndexType": "UnicodeCodePoint"}'
headers:
Accept:
- application/json
@@ -102,7 +102,7 @@ interactions:
Connection:
- keep-alive
Content-Length:
- - '7447'
+ - '7448'
Content-Type:
- application/json
User-Agent:
@@ -119,7 +119,7 @@ interactions:
Battery Life - Longest Lasting Laptop Batteries Competing laptops like the
ZenBook S UX391UA (7:05), Surface Laptop 2 (9:22) and Notebook 9 Pro (8:53)
outstayed the 4K Envy 13 but powered down long before the 1080p version.\",\n
- \ \"confidenceScore\": 0.017458289861679077,\n \"id\": \"doc3\",\n
+ \ \"confidenceScore\": 0.01745828054845333,\n \"id\": \"doc3\",\n
\ \"answerSpan\": {\n \"text\": \"Battery Life\",\n \"confidenceScore\":
0.26247412,\n \"offset\": 0,\n \"length\": 12\n },\n \"offset\":
1779,\n \"length\": 555\n },\n {\n \"answer\": \"Along with
@@ -127,36 +127,36 @@ interactions:
ultraportable chassis, fast performance, and powerful speakers. Best of all,
the Envy 13 starts at a reasonable $799, which is hundreds less than the competition.
In many ways, the Envy 13 is what we wanted the new MacBook Air to be.\",\n
- \ \"confidenceScore\": 0.009401722811162472,\n \"id\": \"doc3\",\n
+ \ \"confidenceScore\": 0.00940172653645277,\n \"id\": \"doc3\",\n
\ \"answerSpan\": {\n \"text\": \"battery life\",\n \"confidenceScore\":
- 0.3530523,\n \"offset\": 27,\n \"length\": 13\n },\n \"offset\":
+ 0.35305238,\n \"offset\": 27,\n \"length\": 13\n },\n \"offset\":
4508,\n \"length\": 319\n },\n {\n \"answer\": \"We also recommend
the Samsung Notebook 9 Pro, which has a similarly premium design but much
better battery life than the 4K Envy. The Microsoft Surface Laptop 2 is another
recommended alternative, though you might want to wait a few months for the
rumored Surface Laptop 3. Overall, the HP Envy 13 is a fantastic laptop
that checks all the right boxes --- as long as you buy the 1080p model.\",\n
- \ \"confidenceScore\": 0.0070572528056800365,\n \"id\": \"doc3\",\n
+ \ \"confidenceScore\": 0.007057250943034887,\n \"id\": \"doc3\",\n
\ \"answerSpan\": {\n \"text\": \"battery life\",\n \"confidenceScore\":
- 0.5914322,\n \"offset\": 98,\n \"length\": 13\n },\n \"offset\":
+ 0.59143245,\n \"offset\": 98,\n \"length\": 13\n },\n \"offset\":
5391,\n \"length\": 393\n }\n ]\n}"
headers:
apim-request-id:
- - 8606d2ff-3166-4f3d-bc8c-b89815b47dfa
+ - abf593a7-19a1-45a9-b94c-e590f8f3bf5a
content-length:
- - '2147'
+ - '2146'
content-type:
- application/json; charset=utf-8
csp-billing-usage:
- - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
+ - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=9
date:
- - Tue, 21 Sep 2021 21:06:55 GMT
+ - Thu, 30 Sep 2021 15:52:33 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- - '733'
+ - '323'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_llc.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_llc.yaml
index 17cc1c469747..3a55e7c933ba 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_llc.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_llc.yaml
@@ -119,7 +119,7 @@ interactions:
Battery Life - Longest Lasting Laptop Batteries Competing laptops like the
ZenBook S UX391UA (7:05), Surface Laptop 2 (9:22) and Notebook 9 Pro (8:53)
outstayed the 4K Envy 13 but powered down long before the 1080p version.\",\n
- \ \"confidenceScore\": 0.017458289861679077,\n \"id\": \"doc3\",\n
+ \ \"confidenceScore\": 0.01745828054845333,\n \"id\": \"doc3\",\n
\ \"answerSpan\": {\n \"text\": \"Battery Life\",\n \"confidenceScore\":
0.26247412,\n \"offset\": 0,\n \"length\": 12\n },\n \"offset\":
1779,\n \"length\": 555\n },\n {\n \"answer\": \"Along with
@@ -127,9 +127,9 @@ interactions:
ultraportable chassis, fast performance, and powerful speakers. Best of all,
the Envy 13 starts at a reasonable $799, which is hundreds less than the competition.
In many ways, the Envy 13 is what we wanted the new MacBook Air to be.\",\n
- \ \"confidenceScore\": 0.00940172653645277,\n \"id\": \"doc3\",\n
+ \ \"confidenceScore\": 0.009401722811162472,\n \"id\": \"doc3\",\n
\ \"answerSpan\": {\n \"text\": \"battery life\",\n \"confidenceScore\":
- 0.35305238,\n \"offset\": 27,\n \"length\": 13\n },\n \"offset\":
+ 0.3530523,\n \"offset\": 27,\n \"length\": 13\n },\n \"offset\":
4508,\n \"length\": 319\n },\n {\n \"answer\": \"We also recommend
the Samsung Notebook 9 Pro, which has a similarly premium design but much
better battery life than the 4K Envy. The Microsoft Surface Laptop 2 is another
@@ -142,21 +142,21 @@ interactions:
5391,\n \"length\": 393\n }\n ]\n}"
headers:
apim-request-id:
- - 77da498d-0205-4cdb-a4ea-034ac73ea176
+ - 63f09596-dbf2-44ac-a8f9-c3de2917c426
content-length:
- - '2146'
+ - '2145'
content-type:
- application/json; charset=utf-8
csp-billing-usage:
- - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
+ - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=9
date:
- - Tue, 21 Sep 2021 21:06:56 GMT
+ - Thu, 30 Sep 2021 15:52:33 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- - '474'
+ - '304'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_overload.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_overload.yaml
index e4628e088f8f..fb3f72c08da0 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_overload.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_overload.yaml
@@ -8,7 +8,7 @@ interactions:
your Surface Pro 4 power supply to charge other devices, like a phone, while
your Surface charges. The USB port on the power supply is only for charging,
not for data transfer. If you want to use a USB device, plug it into the USB
- port on your Surface."}], "stringIndexType": "TextElements_v8"}'
+ port on your Surface."}], "language": "en", "stringIndexType": "UnicodeCodePoint"}'
headers:
Accept:
- application/json
@@ -17,7 +17,7 @@ interactions:
Connection:
- keep-alive
Content-Length:
- - '688'
+ - '707'
Content-Type:
- application/json
User-Agent:
@@ -30,39 +30,39 @@ interactions:
It takes two to four hours to charge the Surface Pro 4 battery fully from
an empty state. It can take longer if you\u2019re using your Surface for power-intensive
activities like gaming or video streaming while you\u2019re charging it.\",\n
- \ \"confidenceScore\": 0.9298818111419678,\n \"id\": \"0\",\n \"answerSpan\":
+ \ \"confidenceScore\": 0.9298818707466125,\n \"id\": \"0\",\n \"answerSpan\":
{\n \"text\": \"two to four hours\",\n \"confidenceScore\":
0.98579097,\n \"offset\": 28,\n \"length\": 18\n },\n \"offset\":
0,\n \"length\": 245\n },\n {\n \"answer\": \"It takes two
to four hours to charge the Surface Pro 4 battery fully from an empty state.
It can take longer if you\u2019re using your Surface for power-intensive activities
like gaming or video streaming while you\u2019re charging it.\",\n \"confidenceScore\":
- 0.9254359602928162,\n \"id\": \"0\",\n \"answerSpan\": {\n \"text\":
+ 0.9254360198974609,\n \"id\": \"0\",\n \"answerSpan\": {\n \"text\":
\"two to four hours\",\n \"confidenceScore\": 0.98562825,\n \"offset\":
8,\n \"length\": 18\n },\n \"offset\": 20,\n \"length\":
225\n },\n {\n \"answer\": \"It can take longer if you\u2019re
using your Surface for power-intensive activities like gaming or video streaming
while you\u2019re charging it.\",\n \"confidenceScore\": 0.05503516271710396,\n
\ \"id\": \"0\",\n \"answerSpan\": {\n \"text\": \"longer\",\n
- \ \"confidenceScore\": 0.624118,\n \"offset\": 11,\n \"length\":
+ \ \"confidenceScore\": 0.62411773,\n \"offset\": 11,\n \"length\":
7\n },\n \"offset\": 110,\n \"length\": 135\n }\n ]\n}"
headers:
apim-request-id:
- - 16114d30-1c1d-48e1-a023-4d4507a0d97a
+ - f0c97e63-de33-41db-bebd-3a34cc810fad
content-length:
- - '1479'
+ - '1481'
content-type:
- application/json; charset=utf-8
csp-billing-usage:
- - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
+ - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=2
date:
- - Tue, 21 Sep 2021 21:06:57 GMT
+ - Thu, 30 Sep 2021 15:52:34 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- - '425'
+ - '255'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_dictparams.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_dictparams.yaml
index 4679ebd184a1..72d83dc51e68 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_dictparams.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_dictparams.yaml
@@ -8,7 +8,7 @@ interactions:
your Surface Pro 4 power supply to charge other devices, like a phone, while
your Surface charges. The USB port on the power supply is only for charging,
not for data transfer. If you want to use a USB device, plug it into the USB
- port on your Surface."}], "language": "en"}'
+ port on your Surface."}], "language": "en", "stringIndexType": "UnicodeCodePoint"}'
headers:
Accept:
- application/json
@@ -17,7 +17,7 @@ interactions:
Connection:
- keep-alive
Content-Length:
- - '668'
+ - '707'
Content-Type:
- application/json
User-Agent:
@@ -30,39 +30,39 @@ interactions:
It takes two to four hours to charge the Surface Pro 4 battery fully from
an empty state. It can take longer if you\u2019re using your Surface for power-intensive
activities like gaming or video streaming while you\u2019re charging it.\",\n
- \ \"confidenceScore\": 0.9298818111419678,\n \"id\": \"1\",\n \"answerSpan\":
+ \ \"confidenceScore\": 0.9298818707466125,\n \"id\": \"1\",\n \"answerSpan\":
{\n \"text\": \"two to four hours\",\n \"confidenceScore\":
0.98579097,\n \"offset\": 28,\n \"length\": 18\n },\n \"offset\":
0,\n \"length\": 245\n },\n {\n \"answer\": \"It takes two
to four hours to charge the Surface Pro 4 battery fully from an empty state.
It can take longer if you\u2019re using your Surface for power-intensive activities
like gaming or video streaming while you\u2019re charging it.\",\n \"confidenceScore\":
- 0.9254360198974609,\n \"id\": \"1\",\n \"answerSpan\": {\n \"text\":
- \"two to four hours\",\n \"confidenceScore\": 0.98562825,\n \"offset\":
+ 0.9254359602928162,\n \"id\": \"1\",\n \"answerSpan\": {\n \"text\":
+ \"two to four hours\",\n \"confidenceScore\": 0.9856282,\n \"offset\":
8,\n \"length\": 18\n },\n \"offset\": 20,\n \"length\":
225\n },\n {\n \"answer\": \"It can take longer if you\u2019re
using your Surface for power-intensive activities like gaming or video streaming
- while you\u2019re charging it.\",\n \"confidenceScore\": 0.05503516271710396,\n
+ while you\u2019re charging it.\",\n \"confidenceScore\": 0.05503518134355545,\n
\ \"id\": \"1\",\n \"answerSpan\": {\n \"text\": \"longer\",\n
\ \"confidenceScore\": 0.624118,\n \"offset\": 11,\n \"length\":
7\n },\n \"offset\": 110,\n \"length\": 135\n }\n ]\n}"
headers:
apim-request-id:
- - 6be5c655-0bad-49d5-ba56-38ba2a890866
+ - 00eefdf8-2d1a-4d4b-9d64-6d28ebc6b0a5
content-length:
- - '1479'
+ - '1478'
content-type:
- application/json; charset=utf-8
csp-billing-usage:
- - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
+ - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=2
date:
- - Tue, 21 Sep 2021 21:06:57 GMT
+ - Thu, 30 Sep 2021 15:52:34 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- - '271'
+ - '203'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_str_records.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_str_records.yaml
index 60c095f1d278..906db8907bfc 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_str_records.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_str_records.yaml
@@ -8,7 +8,7 @@ interactions:
your Surface Pro 4 power supply to charge other devices, like a phone, while
your Surface charges. The USB port on the power supply is only for charging,
not for data transfer. If you want to use a USB device, plug it into the USB
- port on your Surface."}], "language": "en"}'
+ port on your Surface."}], "language": "en", "stringIndexType": "UnicodeCodePoint"}'
headers:
Accept:
- application/json
@@ -17,7 +17,7 @@ interactions:
Connection:
- keep-alive
Content-Length:
- - '668'
+ - '707'
Content-Type:
- application/json
User-Agent:
@@ -38,7 +38,7 @@ interactions:
It can take longer if you\u2019re using your Surface for power-intensive activities
like gaming or video streaming while you\u2019re charging it.\",\n \"confidenceScore\":
0.9254359602928162,\n \"id\": \"0\",\n \"answerSpan\": {\n \"text\":
- \"two to four hours\",\n \"confidenceScore\": 0.98562825,\n \"offset\":
+ \"two to four hours\",\n \"confidenceScore\": 0.9856282,\n \"offset\":
8,\n \"length\": 18\n },\n \"offset\": 20,\n \"length\":
225\n },\n {\n \"answer\": \"It can take longer if you\u2019re
using your Surface for power-intensive activities like gaming or video streaming
@@ -48,21 +48,21 @@ interactions:
7\n },\n \"offset\": 110,\n \"length\": 135\n }\n ]\n}"
headers:
apim-request-id:
- - 49bbe0b7-74a9-416e-9a82-fffdcca416fd
+ - 390cb02b-4245-4719-8556-59acc1863554
content-length:
- - '1479'
+ - '1478'
content-type:
- application/json; charset=utf-8
csp-billing-usage:
- - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
+ - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=2
date:
- - Tue, 21 Sep 2021 21:06:58 GMT
+ - Thu, 30 Sep 2021 15:52:34 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- - '314'
+ - '243'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text.yaml
index 15245c82e840..33d966c39351 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text.yaml
@@ -93,12 +93,12 @@ interactions:
USB 3.1 Always-On, USB 3.1, Headphone/Mic, microSD RAM16GB RAM Upgradable to16GB
Size12.1 x 8.3 x .57 inches Touchpad Size4.3 x 2.2 inches USB Ports3 Video Memory2GB
Warranty/Supportone-year warranty. Weight2.8 pounds Wi-Fi802.11ac Wi-Fi ModelIntel
- Wireless-AC 9560 "}], "language": "en", "stringIndexType": "TextElements_v8"}'
+ Wireless-AC 9560 "}], "language": "en", "stringIndexType": "UnicodeCodePoint"}'
headers:
Accept:
- application/json
Content-Length:
- - '7447'
+ - '7448'
Content-Type:
- application/json
User-Agent:
@@ -115,9 +115,9 @@ interactions:
Battery Life - Longest Lasting Laptop Batteries Competing laptops like the
ZenBook S UX391UA (7:05), Surface Laptop 2 (9:22) and Notebook 9 Pro (8:53)
outstayed the 4K Envy 13 but powered down long before the 1080p version.\",\n
- \ \"confidenceScore\": 0.017458291724324226,\n \"id\": \"doc3\",\n
+ \ \"confidenceScore\": 0.01745828054845333,\n \"id\": \"doc3\",\n
\ \"answerSpan\": {\n \"text\": \"Battery Life\",\n \"confidenceScore\":
- 0.26247388,\n \"offset\": 0,\n \"length\": 12\n },\n \"offset\":
+ 0.26247412,\n \"offset\": 0,\n \"length\": 12\n },\n \"offset\":
1779,\n \"length\": 555\n },\n {\n \"answer\": \"Along with
11-plus hours of battery life (on the FHD model), the Envy 13 has a sleek,
ultraportable chassis, fast performance, and powerful speakers. Best of all,
@@ -132,19 +132,19 @@ interactions:
recommended alternative, though you might want to wait a few months for the
rumored Surface Laptop 3. Overall, the HP Envy 13 is a fantastic laptop
that checks all the right boxes --- as long as you buy the 1080p model.\",\n
- \ \"confidenceScore\": 0.0070572528056800365,\n \"id\": \"doc3\",\n
+ \ \"confidenceScore\": 0.007057250943034887,\n \"id\": \"doc3\",\n
\ \"answerSpan\": {\n \"text\": \"battery life\",\n \"confidenceScore\":
- 0.5914322,\n \"offset\": 98,\n \"length\": 13\n },\n \"offset\":
+ 0.59143245,\n \"offset\": 98,\n \"length\": 13\n },\n \"offset\":
5391,\n \"length\": 393\n }\n ]\n}"
headers:
- apim-request-id: 6509de25-150a-4b5d-852b-deec6ec8cf2c
- content-length: '2147'
+ apim-request-id: 51ce1817-cad9-4c5e-a2b3-4391b42b3211
+ content-length: '2146'
content-type: application/json; charset=utf-8
- csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
- date: Tue, 21 Sep 2021 21:07:00 GMT
+ csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=9
+ date: Thu, 30 Sep 2021 15:52:35 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
- x-envoy-upstream-service-time: '217'
+ x-envoy-upstream-service-time: '292'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_llc.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_llc.yaml
index cd71362f8393..0d9cdddeb235 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_llc.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_llc.yaml
@@ -115,9 +115,9 @@ interactions:
Battery Life - Longest Lasting Laptop Batteries Competing laptops like the
ZenBook S UX391UA (7:05), Surface Laptop 2 (9:22) and Notebook 9 Pro (8:53)
outstayed the 4K Envy 13 but powered down long before the 1080p version.\",\n
- \ \"confidenceScore\": 0.01745828054845333,\n \"id\": \"doc3\",\n
+ \ \"confidenceScore\": 0.01745828241109848,\n \"id\": \"doc3\",\n
\ \"answerSpan\": {\n \"text\": \"Battery Life\",\n \"confidenceScore\":
- 0.26247412,\n \"offset\": 0,\n \"length\": 12\n },\n \"offset\":
+ 0.26247388,\n \"offset\": 0,\n \"length\": 12\n },\n \"offset\":
1779,\n \"length\": 555\n },\n {\n \"answer\": \"Along with
11-plus hours of battery life (on the FHD model), the Envy 13 has a sleek,
ultraportable chassis, fast performance, and powerful speakers. Best of all,
@@ -132,19 +132,19 @@ interactions:
recommended alternative, though you might want to wait a few months for the
rumored Surface Laptop 3. Overall, the HP Envy 13 is a fantastic laptop
that checks all the right boxes --- as long as you buy the 1080p model.\",\n
- \ \"confidenceScore\": 0.0070572528056800365,\n \"id\": \"doc3\",\n
+ \ \"confidenceScore\": 0.007057250943034887,\n \"id\": \"doc3\",\n
\ \"answerSpan\": {\n \"text\": \"battery life\",\n \"confidenceScore\":
0.59143245,\n \"offset\": 98,\n \"length\": 13\n },\n \"offset\":
5391,\n \"length\": 393\n }\n ]\n}"
headers:
- apim-request-id: f3ab3c91-1bfb-4c45-a752-ca79c3e0a987
- content-length: '2147'
+ apim-request-id: bc9b76a5-d8f4-401f-a0d0-1e55341a56d0
+ content-length: '2146'
content-type: application/json; charset=utf-8
- csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
- date: Tue, 21 Sep 2021 21:07:00 GMT
+ csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=9
+ date: Thu, 30 Sep 2021 15:52:36 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
- x-envoy-upstream-service-time: '318'
+ x-envoy-upstream-service-time: '186'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_overload.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_overload.yaml
index 15d4d99520d4..c606f953a9d7 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_overload.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_overload.yaml
@@ -8,12 +8,12 @@ interactions:
your Surface Pro 4 power supply to charge other devices, like a phone, while
your Surface charges. The USB port on the power supply is only for charging,
not for data transfer. If you want to use a USB device, plug it into the USB
- port on your Surface."}], "stringIndexType": "TextElements_v8"}'
+ port on your Surface."}], "language": "en", "stringIndexType": "UnicodeCodePoint"}'
headers:
Accept:
- application/json
Content-Length:
- - '688'
+ - '707'
Content-Type:
- application/json
User-Agent:
@@ -26,7 +26,7 @@ interactions:
It takes two to four hours to charge the Surface Pro 4 battery fully from
an empty state. It can take longer if you\u2019re using your Surface for power-intensive
activities like gaming or video streaming while you\u2019re charging it.\",\n
- \ \"confidenceScore\": 0.9298818111419678,\n \"id\": \"0\",\n \"answerSpan\":
+ \ \"confidenceScore\": 0.9298818707466125,\n \"id\": \"0\",\n \"answerSpan\":
{\n \"text\": \"two to four hours\",\n \"confidenceScore\":
0.98579097,\n \"offset\": 28,\n \"length\": 18\n },\n \"offset\":
0,\n \"length\": 245\n },\n {\n \"answer\": \"It takes two
@@ -43,14 +43,14 @@ interactions:
\ \"confidenceScore\": 0.62411773,\n \"offset\": 11,\n \"length\":
7\n },\n \"offset\": 110,\n \"length\": 135\n }\n ]\n}"
headers:
- apim-request-id: 5f3c0c70-7d76-41fe-84fe-39b61be4f30c
+ apim-request-id: cbb90985-1d4b-4b29-a55e-e2a6bb2ff93b
content-length: '1481'
content-type: application/json; charset=utf-8
- csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
- date: Tue, 21 Sep 2021 21:07:01 GMT
+ csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=2
+ date: Thu, 30 Sep 2021 15:52:35 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
- x-envoy-upstream-service-time: '210'
+ x-envoy-upstream-service-time: '175'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_dictparams.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_dictparams.yaml
index 99885d8fbc99..4a8803314774 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_dictparams.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_dictparams.yaml
@@ -8,12 +8,12 @@ interactions:
your Surface Pro 4 power supply to charge other devices, like a phone, while
your Surface charges. The USB port on the power supply is only for charging,
not for data transfer. If you want to use a USB device, plug it into the USB
- port on your Surface."}], "language": "en"}'
+ port on your Surface."}], "language": "en", "stringIndexType": "UnicodeCodePoint"}'
headers:
Accept:
- application/json
Content-Length:
- - '668'
+ - '707'
Content-Type:
- application/json
User-Agent:
@@ -26,31 +26,31 @@ interactions:
It takes two to four hours to charge the Surface Pro 4 battery fully from
an empty state. It can take longer if you\u2019re using your Surface for power-intensive
activities like gaming or video streaming while you\u2019re charging it.\",\n
- \ \"confidenceScore\": 0.9298818111419678,\n \"id\": \"1\",\n \"answerSpan\":
+ \ \"confidenceScore\": 0.9298818707466125,\n \"id\": \"1\",\n \"answerSpan\":
{\n \"text\": \"two to four hours\",\n \"confidenceScore\":
0.98579097,\n \"offset\": 28,\n \"length\": 18\n },\n \"offset\":
0,\n \"length\": 245\n },\n {\n \"answer\": \"It takes two
to four hours to charge the Surface Pro 4 battery fully from an empty state.
It can take longer if you\u2019re using your Surface for power-intensive activities
like gaming or video streaming while you\u2019re charging it.\",\n \"confidenceScore\":
- 0.9254359006881714,\n \"id\": \"1\",\n \"answerSpan\": {\n \"text\":
+ 0.9254359602928162,\n \"id\": \"1\",\n \"answerSpan\": {\n \"text\":
\"two to four hours\",\n \"confidenceScore\": 0.9856282,\n \"offset\":
8,\n \"length\": 18\n },\n \"offset\": 20,\n \"length\":
225\n },\n {\n \"answer\": \"It can take longer if you\u2019re
using your Surface for power-intensive activities like gaming or video streaming
- while you\u2019re charging it.\",\n \"confidenceScore\": 0.055035144090652466,\n
+ while you\u2019re charging it.\",\n \"confidenceScore\": 0.05503518134355545,\n
\ \"id\": \"1\",\n \"answerSpan\": {\n \"text\": \"longer\",\n
- \ \"confidenceScore\": 0.62411773,\n \"offset\": 11,\n \"length\":
+ \ \"confidenceScore\": 0.624118,\n \"offset\": 11,\n \"length\":
7\n },\n \"offset\": 110,\n \"length\": 135\n }\n ]\n}"
headers:
- apim-request-id: 75d29f93-387d-42b6-92e9-d454c3b09683
- content-length: '1481'
+ apim-request-id: 5bd3db5f-1a20-4d42-8720-772e5f694ccd
+ content-length: '1478'
content-type: application/json; charset=utf-8
- csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
- date: Tue, 21 Sep 2021 21:07:01 GMT
+ csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=2
+ date: Thu, 30 Sep 2021 15:52:36 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
- x-envoy-upstream-service-time: '228'
+ x-envoy-upstream-service-time: '633'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_str_records.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_str_records.yaml
index a80212f864c3..4b1b34ebaadc 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_str_records.yaml
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_str_records.yaml
@@ -8,12 +8,12 @@ interactions:
your Surface Pro 4 power supply to charge other devices, like a phone, while
your Surface charges. The USB port on the power supply is only for charging,
not for data transfer. If you want to use a USB device, plug it into the USB
- port on your Surface."}], "language": "en"}'
+ port on your Surface."}], "language": "en", "stringIndexType": "UnicodeCodePoint"}'
headers:
Accept:
- application/json
Content-Length:
- - '668'
+ - '707'
Content-Type:
- application/json
User-Agent:
@@ -26,31 +26,31 @@ interactions:
It takes two to four hours to charge the Surface Pro 4 battery fully from
an empty state. It can take longer if you\u2019re using your Surface for power-intensive
activities like gaming or video streaming while you\u2019re charging it.\",\n
- \ \"confidenceScore\": 0.9298818111419678,\n \"id\": \"0\",\n \"answerSpan\":
+ \ \"confidenceScore\": 0.9298818707466125,\n \"id\": \"0\",\n \"answerSpan\":
{\n \"text\": \"two to four hours\",\n \"confidenceScore\":
0.98579097,\n \"offset\": 28,\n \"length\": 18\n },\n \"offset\":
0,\n \"length\": 245\n },\n {\n \"answer\": \"It takes two
to four hours to charge the Surface Pro 4 battery fully from an empty state.
It can take longer if you\u2019re using your Surface for power-intensive activities
like gaming or video streaming while you\u2019re charging it.\",\n \"confidenceScore\":
- 0.9254359602928162,\n \"id\": \"0\",\n \"answerSpan\": {\n \"text\":
+ 0.9254360198974609,\n \"id\": \"0\",\n \"answerSpan\": {\n \"text\":
\"two to four hours\",\n \"confidenceScore\": 0.98562825,\n \"offset\":
8,\n \"length\": 18\n },\n \"offset\": 20,\n \"length\":
225\n },\n {\n \"answer\": \"It can take longer if you\u2019re
using your Surface for power-intensive activities like gaming or video streaming
- while you\u2019re charging it.\",\n \"confidenceScore\": 0.055035144090652466,\n
+ while you\u2019re charging it.\",\n \"confidenceScore\": 0.05503518134355545,\n
\ \"id\": \"0\",\n \"answerSpan\": {\n \"text\": \"longer\",\n
- \ \"confidenceScore\": 0.62411773,\n \"offset\": 11,\n \"length\":
+ \ \"confidenceScore\": 0.624118,\n \"offset\": 11,\n \"length\":
7\n },\n \"offset\": 110,\n \"length\": 135\n }\n ]\n}"
headers:
- apim-request-id: 829dce06-09a4-4da9-9118-91a11be1b3e1
- content-length: '1482'
+ apim-request-id: 487b1ad3-a4b7-43d6-86aa-0b04254b2eef
+ content-length: '1479'
content-type: application/json; charset=utf-8
- csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1
- date: Tue, 21 Sep 2021 21:07:02 GMT
+ csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=2
+ date: Thu, 30 Sep 2021 15:52:35 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
- x-envoy-upstream-service-time: '178'
+ x-envoy-upstream-service-time: '199'
status:
code: 200
message: OK
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase.py
index dd279adccf87..86b66635e210 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase.py
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase.py
@@ -4,7 +4,7 @@
# Licensed under the MIT License.
# ------------------------------------
import os
-
+import pytest
from azure.core.exceptions import HttpResponseError, ClientAuthenticationError
from azure.core.credentials import AzureKeyCredential
@@ -16,9 +16,12 @@
from azure.ai.language.questionanswering import QuestionAnsweringClient
from azure.ai.language.questionanswering.operations._operations import build_query_text_request, build_query_knowledge_base_request
from azure.ai.language.questionanswering.models import (
- KnowledgeBaseQueryOptions,
+ QueryKnowledgeBaseOptions,
KnowledgeBaseAnswerRequestContext,
AnswerSpanRequest,
+ MetadataFilter,
+ LogicalOperationKind,
+ QueryFilters,
)
@@ -125,7 +128,7 @@ def test_query_knowledgebase_llc_with_answerspan(self, qna_account, qna_key, qna
@GlobalQuestionAnsweringAccountPreparer()
def test_query_knowledgebase(self, qna_account, qna_key, qna_project):
client = QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key))
- query_params = KnowledgeBaseQueryOptions(
+ query_params = QueryKnowledgeBaseOptions(
question="Ports and connectors",
top=3,
context=KnowledgeBaseAnswerRequestContext(
@@ -166,7 +169,7 @@ def test_query_knowledgebase(self, qna_account, qna_key, qna_project):
@GlobalQuestionAnsweringAccountPreparer()
def test_query_knowledgebase_with_answerspan(self, qna_account, qna_key, qna_project):
client = QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key))
- query_params = KnowledgeBaseQueryOptions(
+ query_params = QueryKnowledgeBaseOptions(
question="Ports and connectors",
top=3,
context=KnowledgeBaseAnswerRequestContext(
@@ -238,7 +241,7 @@ def test_query_knowledgebase_with_dictparams(self, qna_account, qna_key, qna_pro
deployment_name='test'
)
- assert len(output.answers) == 3
+ assert len(output.answers) == 2
confident_answers = [a for a in output.answers if a.confidence_score > 0.9]
assert len(confident_answers) == 1
assert confident_answers[0].source == "surface-pro-4-user-guide-EN.pdf"
@@ -262,7 +265,7 @@ def test_query_knowledgebase_overload(self, qna_account, qna_key, qna_project):
include_unstructured_sources=True
)
- assert len(output.answers) == 3
+ assert len(output.answers) == 2
confident_answers = [a for a in output.answers if a.confidence_score > 0.9]
assert len(confident_answers) == 1
assert confident_answers[0].source == "surface-pro-4-user-guide-EN.pdf"
@@ -271,7 +274,7 @@ def test_query_knowledgebase_overload(self, qna_account, qna_key, qna_project):
def test_query_knowledgebase_with_followup(self, qna_account, qna_key, qna_project):
client = QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key))
with client:
- query_params = KnowledgeBaseQueryOptions(
+ query_params = QueryKnowledgeBaseOptions(
question="How long should my Surface battery last?",
top=3,
user_id="sd53lsY=",
@@ -293,7 +296,7 @@ def test_query_knowledgebase_with_followup(self, qna_account, qna_key, qna_proje
assert len(confident_answers) == 1
assert confident_answers[0].source == "surface-pro-4-user-guide-EN.pdf"
- query_params = KnowledgeBaseQueryOptions(
+ query_params = QueryKnowledgeBaseOptions(
question="How long it takes to charge Surface?",
top=3,
user_id="sd53lsY=",
@@ -316,16 +319,16 @@ def test_query_knowledgebase_with_followup(self, qna_account, qna_key, qna_proje
)
assert len(output.answers) == 2
- confident_answers = [a for a in output.answers if a.confidence_score > 0.6]
+ confident_answers = [a for a in output.answers if a.confidence_score > 0.5]
assert len(confident_answers) == 1
- assert confident_answers[0].answer_span.text == "two to four hours"
+ assert confident_answers[0].answer_span.text == " two to four hours"
@GlobalQuestionAnsweringAccountPreparer()
def test_query_knowledgebase_only_id(self, qna_account, qna_key, qna_project):
client = QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key))
with client:
- query_params = KnowledgeBaseQueryOptions(
+ query_params = QueryKnowledgeBaseOptions(
qna_id=19
)
@@ -349,4 +352,56 @@ def test_query_knowledgebase_python_dict(self, qna_account, qna_key, qna_project
deployment_name='test'
)
- assert len(output.answers) == 1
\ No newline at end of file
+ assert len(output.answers) == 1
+
+ def test_query_knowledgebase_overload_positional_and_kwarg(self):
+ with QuestionAnsweringClient("http://fake.com", AzureKeyCredential("123")) as client:
+ with pytest.raises(TypeError):
+ client.query_knowledge_base("positional_one", "positional_two")
+ with pytest.raises(TypeError):
+ client.query_knowledge_base("positional_options_bag", options="options bag by name")
+
+ def test_query_knowledgebase_question_or_qna_id(self):
+ with QuestionAnsweringClient("http://fake.com", AzureKeyCredential("123")) as client:
+
+ options = QueryKnowledgeBaseOptions()
+ with pytest.raises(TypeError):
+ client.query_knowledge_base(
+ options,
+ project_name="hello",
+ deployment_name='test'
+ )
+
+ with pytest.raises(TypeError):
+ client.query_knowledge_base(
+ project_name="hello",
+ deployment_name='test'
+ )
+
+ @GlobalQuestionAnsweringAccountPreparer()
+ def test_query_knowledgebase_filter(self, qna_account, qna_key, qna_project):
+ """Thanks to @heaths for this test!"""
+ filters = QueryFilters(
+ metadata_filter=MetadataFilter(
+ metadata=[
+ ("explicitlytaggedheading", "check the battery level"),
+ ("explicitlytaggedheading", "make your battery last")
+ ],
+ ),
+ logical_operation=LogicalOperationKind.OR_ENUM
+ )
+ with QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key)) as client:
+ response = client.query_knowledge_base(
+ project_name=qna_project,
+ deployment_name='test',
+ question="Battery life",
+ filters=filters,
+ top=3,
+ )
+ assert len(response.answers) == 3
+ assert any(
+ [a for a in response.answers if a.metadata.get('explicitlytaggedheading') == "check the battery level"]
+ )
+ assert any(
+ [a for a in response.answers if a.metadata.get('explicitlytaggedheading') == "make your battery last"]
+ )
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase_async.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase_async.py
index fda1d6cb265d..e90f684f1be3 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase_async.py
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase_async.py
@@ -16,9 +16,12 @@
from asynctestcase import AsyncQuestionAnsweringTest
from azure.ai.language.questionanswering.models import (
- KnowledgeBaseQueryOptions,
+ QueryKnowledgeBaseOptions,
KnowledgeBaseAnswerRequestContext,
AnswerSpanRequest,
+ QueryFilters,
+ MetadataFilter,
+ LogicalOperationKind,
)
from azure.ai.language.questionanswering.aio import QuestionAnsweringClient
from azure.ai.language.questionanswering.operations._operations import build_query_knowledge_base_request, build_query_text_request
@@ -127,7 +130,7 @@ async def test_query_knowledgebase_llc_with_answerspan(self, qna_account, qna_ke
@GlobalQuestionAnsweringAccountPreparer()
async def test_query_knowledgebase(self, qna_account, qna_key, qna_project):
client = QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key))
- query_params = KnowledgeBaseQueryOptions(
+ query_params = QueryKnowledgeBaseOptions(
question="Ports and connectors",
top=3,
context=KnowledgeBaseAnswerRequestContext(
@@ -168,7 +171,7 @@ async def test_query_knowledgebase(self, qna_account, qna_key, qna_project):
@GlobalQuestionAnsweringAccountPreparer()
async def test_query_knowledgebase_with_answerspan(self, qna_account, qna_key, qna_project):
client = QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key))
- query_params = KnowledgeBaseQueryOptions(
+ query_params = QueryKnowledgeBaseOptions(
question="Ports and connectors",
top=3,
context=KnowledgeBaseAnswerRequestContext(
@@ -239,7 +242,7 @@ async def test_query_knowledgebase_with_dictparams(self, qna_account, qna_key, q
deployment_name='test'
)
- assert len(output.answers) == 3
+ assert len(output.answers) == 2
confident_answers = [a for a in output.answers if a.confidence_score > 0.9]
assert len(confident_answers) == 1
assert confident_answers[0].source == "surface-pro-4-user-guide-EN.pdf"
@@ -263,7 +266,7 @@ async def test_query_knowledgebase_overload(self, qna_account, qna_key, qna_proj
include_unstructured_sources=True
)
- assert len(output.answers) == 3
+ assert len(output.answers) == 2
confident_answers = [a for a in output.answers if a.confidence_score > 0.9]
assert len(confident_answers) == 1
assert confident_answers[0].source == "surface-pro-4-user-guide-EN.pdf"
@@ -272,7 +275,7 @@ async def test_query_knowledgebase_overload(self, qna_account, qna_key, qna_proj
async def test_query_knowledgebase_with_followup(self, qna_account, qna_key, qna_project):
client = QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key))
async with client:
- query_params = KnowledgeBaseQueryOptions(
+ query_params = QueryKnowledgeBaseOptions(
question="How long should my Surface battery last?",
top=3,
user_id="sd53lsY=",
@@ -294,7 +297,7 @@ async def test_query_knowledgebase_with_followup(self, qna_account, qna_key, qna
assert len(confident_answers) == 1
assert confident_answers[0].source == "surface-pro-4-user-guide-EN.pdf"
- query_params = KnowledgeBaseQueryOptions(
+ query_params = QueryKnowledgeBaseOptions(
question="How long it takes to charge Surface?",
top=3,
user_id="sd53lsY=",
@@ -317,9 +320,9 @@ async def test_query_knowledgebase_with_followup(self, qna_account, qna_key, qna
)
assert len(output.answers) == 2
- confident_answers = [a for a in output.answers if a.confidence_score > 0.6]
+ confident_answers = [a for a in output.answers if a.confidence_score > 0.5]
assert len(confident_answers) == 1
- assert confident_answers[0].answer_span.text == "two to four hours"
+ assert confident_answers[0].answer_span.text == " two to four hours"
@GlobalQuestionAnsweringAccountPreparer()
async def test_query_knowledgebase_only_id(self, qna_account, qna_key, qna_project):
@@ -348,3 +351,55 @@ async def test_query_knowledgebase_python_dict(self, qna_account, qna_key, qna_p
)
assert len(output.answers) == 1
+
+ async def test_query_knowledgebase_overload_positional_and_kwarg(self):
+ async with QuestionAnsweringClient("http://fake.com", AzureKeyCredential("123")) as client:
+ with pytest.raises(TypeError):
+ await client.query_knowledge_base("positional_one", "positional_two")
+ with pytest.raises(TypeError):
+ await client.query_knowledge_base("positional_options_bag", options="options bag by name")
+
+ async def test_query_knowledgebase_question_or_qna_id(self):
+ async with QuestionAnsweringClient("http://fake.com", AzureKeyCredential("123")) as client:
+
+ options = QueryKnowledgeBaseOptions()
+ with pytest.raises(TypeError):
+ await client.query_knowledge_base(
+ options,
+ project_name="hello",
+ deployment_name='test'
+ )
+
+ with pytest.raises(TypeError):
+ await client.query_knowledge_base(
+ project_name="hello",
+ deployment_name='test'
+ )
+
+ @GlobalQuestionAnsweringAccountPreparer()
+ async def test_query_knowledgebase_filter(self, qna_account, qna_key, qna_project):
+ """Thanks to @heaths for this test!"""
+ filters = QueryFilters(
+ metadata_filter=MetadataFilter(
+ metadata=[
+ ("explicitlytaggedheading", "check the battery level"),
+ ("explicitlytaggedheading", "make your battery last")
+ ],
+ ),
+ logical_operation=LogicalOperationKind.OR_ENUM
+ )
+ async with QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key)) as client:
+ response = await client.query_knowledge_base(
+ project_name=qna_project,
+ deployment_name='test',
+ question="Battery life",
+ filters=filters,
+ top=3,
+ )
+ assert len(response.answers) == 3
+ assert any(
+ [a for a in response.answers if a.metadata.get('explicitlytaggedheading') == "check the battery level"]
+ )
+ assert any(
+ [a for a in response.answers if a.metadata.get('explicitlytaggedheading') == "make your battery last"]
+ )
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_text.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_text.py
index db55ce2867c1..434141a88a2d 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_text.py
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_text.py
@@ -17,7 +17,7 @@
from azure.ai.language.questionanswering import QuestionAnsweringClient
from azure.ai.language.questionanswering.operations._operations import build_query_text_request, build_query_knowledge_base_request
from azure.ai.language.questionanswering.models import (
- TextQueryOptions,
+ QueryTextOptions,
TextRecord
)
@@ -67,7 +67,7 @@ def test_query_text_llc(self, qna_account, qna_key):
@GlobalQuestionAnsweringAccountPreparer()
def test_query_text(self, qna_account, qna_key):
client = QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key))
- params = TextQueryOptions(
+ params = QueryTextOptions(
question="What is the meaning of life?",
records=[
TextRecord(
@@ -180,3 +180,10 @@ def test_query_text_overload(self, qna_account, qna_key):
confident_answers = [a for a in output.answers if a.confidence_score > 0.9]
assert len(confident_answers) == 2
assert confident_answers[0].answer_span.text == "two to four hours"
+
+ def test_query_text_overload_positional_and_kwarg(self):
+ with QuestionAnsweringClient("http://fake.com", AzureKeyCredential("123")) as client:
+ with pytest.raises(TypeError):
+ client.query_text("positional_one", "positional_two")
+ with pytest.raises(TypeError):
+ client.query_text("positional_options_bag", options="options bag by name")
diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_text_async.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_text_async.py
index a4fb8d110dfc..b5d6323a64db 100644
--- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_text_async.py
+++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_text_async.py
@@ -17,7 +17,7 @@
from azure.ai.language.questionanswering.aio import QuestionAnsweringClient
from azure.ai.language.questionanswering.operations._operations import build_query_text_request, build_query_knowledge_base_request
from azure.ai.language.questionanswering.models import (
- TextQueryOptions,
+ QueryTextOptions,
TextRecord
)
@@ -69,7 +69,7 @@ async def test_query_text_llc(self, qna_account, qna_key):
@GlobalQuestionAnsweringAccountPreparer()
async def test_query_text(self, qna_account, qna_key):
client = QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key))
- params = TextQueryOptions(
+ params = QueryTextOptions(
question="What is the meaning of life?",
records=[
TextRecord(
@@ -181,3 +181,10 @@ async def test_query_text_overload(self, qna_account, qna_key):
confident_answers = [a for a in output.answers if a.confidence_score > 0.9]
assert len(confident_answers) == 2
assert confident_answers[0].answer_span.text == "two to four hours"
+
+ async def test_query_text_overload_positional_and_kwarg(self):
+ async with QuestionAnsweringClient("http://fake.com", AzureKeyCredential("123")) as client:
+ with pytest.raises(TypeError):
+ await client.query_text("positional_one", "positional_two")
+ with pytest.raises(TypeError):
+ await client.query_text("positional_options_bag", options="options bag by name")
diff --git a/sdk/cognitivelanguage/tests.yml b/sdk/cognitivelanguage/tests.yml
index 77ea573acbbc..cbe99bfbe34a 100644
--- a/sdk/cognitivelanguage/tests.yml
+++ b/sdk/cognitivelanguage/tests.yml
@@ -1,33 +1,10 @@
-trigger:
- branches:
- include:
- - master
- - main
- - hotfix/*
- - release/*
- - restapi*
- paths:
- include:
- - sdk/cognitivelanguage/
- - scripts/
-
-pr:
- branches:
- include:
- - master
- - main
- - feature/*
- - hotfix/*
- - release/*
- - restapi*
- paths:
- include:
- - sdk/cognitivelanguage/
+trigger: none
stages:
- template: ../../eng/pipelines/templates/stages/archetype-sdk-tests.yml
parameters:
AllocateResourceGroup: false
+ BuildTargetingString: azure*
ServiceDirectory: cognitivelanguage
MatrixReplace:
- TestSamples=.*/true
@@ -35,9 +12,13 @@ stages:
AZURE_QUESTIONANSWERING_KEY: $(qna-key)
AZURE_QUESTIONANSWERING_PROJECT: 190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c
AZURE_QUESTIONANSWERING_ENDPOINT: $(qna-uri)
+ AZURE_CONVERSATIONS_ENDPOINT: $(conversations-endpoint)
+ AZURE_CONVERSATIONS_KEY: $(conversations-key)
+ AZURE_CONVERSATIONS_PROJECT: $(conversations-project)
+ AZURE_CONVERSATIONS_WORKFLOW_PROJECT: $(conversations-workflow-project)
AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id)
AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret)
AZURE_SUBSCRIPTION_ID: $(azure-subscription-id)
AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id)
- TEST_MODE: 'RunLiveNoRecord' # use when allowing preparers to create the rgs for you
- AZURE_TEST_RUN_LIVE: 'true' # use when utilizing the New-TestResources Script
+ TEST_MODE: "RunLiveNoRecord" # use when allowing preparers to create the rgs for you
+ AZURE_TEST_RUN_LIVE: "true" # use when utilizing the New-TestResources Script
diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/text_moderation_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/text_moderation_operations.py
index baf744da1366..9254927d46cc 100644
--- a/sdk/cognitiveservices/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/text_moderation_operations.py
+++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/text_moderation_operations.py
@@ -35,10 +35,10 @@ def __init__(self, client, config, serializer, deserializer):
def screen_text(
self, text_content_type, text_content, language=None, autocorrect=False, pii=False, list_id=None, classify=False, custom_headers=None, raw=False, callback=None, **operation_config):
- """Detect profanity and match against custom and shared blacklists.
+ """Detect profanity and match against custom and shared blocklists.
Detects profanity in more than 100 languages and match against custom
- and shared blacklists.
+ and shared blocklists.
:param text_content_type: The content type. Possible values include:
'text/plain', 'text/html', 'text/xml', 'text/markdown'
diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md
index a657078c52ff..c9111ed9eaa4 100644
--- a/sdk/core/azure-core/CHANGELOG.md
+++ b/sdk/core/azure-core/CHANGELOG.md
@@ -1,5 +1,15 @@
# Release History
+## 1.19.1 (Unreleased)
+
+### Features Added
+
+### Breaking Changes
+
+### Bugs Fixed
+
+### Other Changes
+
## 1.19.0 (2021-09-30)
### Breaking Changes in the Provisional `azure.core.rest` package
diff --git a/sdk/core/azure-core/azure/core/_version.py b/sdk/core/azure-core/azure/core/_version.py
index 7b0e621101b8..91bcd81c2857 100644
--- a/sdk/core/azure-core/azure/core/_version.py
+++ b/sdk/core/azure-core/azure/core/_version.py
@@ -9,4 +9,4 @@
# regenerated.
# --------------------------------------------------------------------------
-VERSION = "1.19.0"
+VERSION = "1.19.1"
diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/_retry.py b/sdk/core/azure-core/azure/core/pipeline/policies/_retry.py
index b683e7e08ab2..5fe7223041e4 100644
--- a/sdk/core/azure-core/azure/core/pipeline/policies/_retry.py
+++ b/sdk/core/azure-core/azure/core/pipeline/policies/_retry.py
@@ -152,14 +152,14 @@ def _is_read_error(self, err):
def _is_method_retryable(self, settings, request, response=None):
"""Checks if a given HTTP method should be retried upon, depending if
- it is included on the method whitelist.
+ it is included on the method allowlist.
:param dict settings: The retry settings.
:param request: The PipelineRequest object.
:type request: ~azure.core.pipeline.PipelineRequest
:param response: The PipelineResponse object.
:type response: ~azure.core.pipeline.PipelineResponse
- :return: True if method should be retried upon. False if not in method whitelist.
+ :return: True if method should be retried upon. False if not in method allowlist.
:rtype: bool
"""
if response and request.method.upper() in ['POST', 'PATCH'] and \
@@ -173,7 +173,7 @@ def _is_method_retryable(self, settings, request, response=None):
def is_retry(self, settings, response):
"""Checks if method/status code is retryable.
- Based on whitelists and control variables such as the number of
+ Based on allowlists and control variables such as the number of
total retries to allow, whether to respect the Retry-After header,
whether this header is present, and whether the returned status
code is on the list of status codes to be retried upon on the
@@ -244,7 +244,7 @@ def increment(self, settings, response=None, error=None):
else:
# Incrementing because of a server error like a 500 in
- # status_forcelist and a the given method is in the whitelist
+ # status_forcelist and a the given method is in the allowlist
if response:
settings['status'] -= 1
if hasattr(response, 'http_request') and hasattr(response, 'http_response'):
diff --git a/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/azure/eventhub/extensions/checkpointstoreblobaio/_vendor/storage/blob/_shared/policies.py b/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/azure/eventhub/extensions/checkpointstoreblobaio/_vendor/storage/blob/_shared/policies.py
index c9bc798d671a..2db5048b67ef 100644
--- a/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/azure/eventhub/extensions/checkpointstoreblobaio/_vendor/storage/blob/_shared/policies.py
+++ b/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/azure/eventhub/extensions/checkpointstoreblobaio/_vendor/storage/blob/_shared/policies.py
@@ -75,7 +75,7 @@ def retry_hook(settings, **kwargs):
def is_retry(response, mode):
- """Is this method/status code retryable? (Based on whitelists and control
+ """Is this method/status code retryable? (Based on allowlists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the returned status code is on the list of status codes to
@@ -456,7 +456,7 @@ def increment(self, settings, request, response=None, error=None):
else:
# Incrementing because of a server error like a 500 in
- # status_forcelist and a the given method is in the whitelist
+ # status_forcelist and a the given method is in the allowlist
if response:
settings['status'] -= 1
settings['history'].append(RequestHistory(request, http_response=response))
diff --git a/sdk/eventhub/azure-eventhub-checkpointstoreblob/azure/eventhub/extensions/checkpointstoreblob/_vendor/storage/blob/_shared/policies.py b/sdk/eventhub/azure-eventhub-checkpointstoreblob/azure/eventhub/extensions/checkpointstoreblob/_vendor/storage/blob/_shared/policies.py
index c9bc798d671a..2db5048b67ef 100644
--- a/sdk/eventhub/azure-eventhub-checkpointstoreblob/azure/eventhub/extensions/checkpointstoreblob/_vendor/storage/blob/_shared/policies.py
+++ b/sdk/eventhub/azure-eventhub-checkpointstoreblob/azure/eventhub/extensions/checkpointstoreblob/_vendor/storage/blob/_shared/policies.py
@@ -75,7 +75,7 @@ def retry_hook(settings, **kwargs):
def is_retry(response, mode):
- """Is this method/status code retryable? (Based on whitelists and control
+ """Is this method/status code retryable? (Based on allowlists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the returned status code is on the list of status codes to
@@ -456,7 +456,7 @@ def increment(self, settings, request, response=None, error=None):
else:
# Incrementing because of a server error like a 500 in
- # status_forcelist and a the given method is in the whitelist
+ # status_forcelist and a the given method is in the allowlist
if response:
settings['status'] -= 1
settings['history'].append(RequestHistory(request, http_response=response))
diff --git a/sdk/eventhub/azure-eventhub-checkpointstoretable/azure/eventhub/extensions/checkpointstoretable/_vendor/data/tables/_policies.py b/sdk/eventhub/azure-eventhub-checkpointstoretable/azure/eventhub/extensions/checkpointstoretable/_vendor/data/tables/_policies.py
index ad5045703369..1cb05388280d 100644
--- a/sdk/eventhub/azure-eventhub-checkpointstoretable/azure/eventhub/extensions/checkpointstoretable/_vendor/data/tables/_policies.py
+++ b/sdk/eventhub/azure-eventhub-checkpointstoretable/azure/eventhub/extensions/checkpointstoretable/_vendor/data/tables/_policies.py
@@ -133,7 +133,7 @@ def __init__(self, **kwargs):
self.retry_to_secondary = kwargs.get('retry_to_secondary', False)
def is_retry(self, settings, response):
- """Is this method/status code retryable? (Based on whitelists and control
+ """Is this method/status code retryable? (Based on allowlists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the returned status code is on the list of status codes to
diff --git a/sdk/eventhub/azure-eventhub-checkpointstoretable/azure/eventhub/extensions/checkpointstoretable/_vendor/data/tables/aio/_policies_async.py b/sdk/eventhub/azure-eventhub-checkpointstoretable/azure/eventhub/extensions/checkpointstoretable/_vendor/data/tables/aio/_policies_async.py
index 96139f7c5b4e..5f23dece3524 100644
--- a/sdk/eventhub/azure-eventhub-checkpointstoretable/azure/eventhub/extensions/checkpointstoretable/_vendor/data/tables/aio/_policies_async.py
+++ b/sdk/eventhub/azure-eventhub-checkpointstoretable/azure/eventhub/extensions/checkpointstoretable/_vendor/data/tables/aio/_policies_async.py
@@ -56,7 +56,7 @@ def __init__(self, **kwargs):
self.retry_to_secondary = kwargs.get('retry_to_secondary', False)
def is_retry(self, settings, response):
- """Is this method/status code retryable? (Based on whitelists and control
+ """Is this method/status code retryable? (Based on allowlists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the returned status code is on the list of status codes to
diff --git a/sdk/eventhub/test-resources.json b/sdk/eventhub/test-resources.json
index f66ea2ac3756..7ad0213a48b6 100644
--- a/sdk/eventhub/test-resources.json
+++ b/sdk/eventhub/test-resources.json
@@ -59,7 +59,7 @@
"type": "string",
"defaultValue": "10",
"metadata": {
- "description": "The maximum duration, in minutes, that a single test is permitted to run before it is considered at-risk for being hung."
+ "description": "The maximum duration, in minutes, that a single test is permitted to run before it is considered at-risk of not responding"
}
}
},
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/README.md b/sdk/formrecognizer/azure-ai-formrecognizer/README.md
index 6a3ceba3b737..84d8dc5b62eb 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/README.md
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/README.md
@@ -518,10 +518,10 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con
[custom_subdomain]: https://docs.microsoft.com/azure/cognitive-services/authentication#create-a-resource-with-a-custom-subdomain
[azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity
[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
-[service_recognize_receipt]: https://aka.ms/formrecognizer/receiptfields
-[service_recognize_business_cards]: https://aka.ms/formrecognizer/businesscardfields
-[service_recognize_invoice]: https://aka.ms/formrecognizer/invoicefields
-[service_recognize_identity_documents]: https://aka.ms/formrecognizer/iddocumentfields
+[service_recognize_receipt]: https://aka.ms/azsdk/formrecognizer/receiptfieldschema
+[service_recognize_business_cards]: https://aka.ms/azsdk/formrecognizer/businesscardfieldschema
+[service_recognize_invoice]: https://aka.ms/azsdk/formrecognizer/invoicefieldschema
+[service_recognize_identity_documents]: https://aka.ms/azsdk/formrecognizer/iddocumentfieldschema
[sdk_logging_docs]: https://docs.microsoft.com/azure/developer/python/azure-sdk-logging
[sample_readme]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples
[changelog]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_base_client.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_base_client.py
index 037e8e8c6c98..ce37f74b2a34 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_base_client.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_base_client.py
@@ -56,6 +56,8 @@ def __init__(self, endpoint, credential, **kwargs):
"op",
"pages",
"readingOrder",
+ "stringIndexType",
+ "api-version"
}
)
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_base_client_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_base_client_async.py
index 1e3b22effa3e..6468e6bb5665 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_base_client_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_base_client_async.py
@@ -67,6 +67,8 @@ def __init__(
"op",
"pages",
"readingOrder",
+ "stringIndexType",
+ "api-version"
}
)
self._client = FormRecognizer(
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/README.md b/sdk/formrecognizer/azure-ai-formrecognizer/samples/README.md
index 3dbf77803ad1..7a678a3a9b8a 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/README.md
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/README.md
@@ -11,6 +11,10 @@ urlFragment: formrecognizer-samples
# Samples for Azure Form Recognizer client library for Python
+> Note: Starting with version 2021-09-30-preview, a new set of clients were introduced to leverage the newest features
+> of the Form Recognizer service. Please see the Migration Guide for detailed instructions on how to update application
+> code from client library version 3.1.X or lower to the latest version. Additionally, see the [Changelog][changelog] for more detailed information.
+
These code samples show common scenario operations with the Azure Form Recognizer client library.
The async versions of the samples require Python 3.6 or later.
@@ -18,6 +22,26 @@ These sample programs show common scenarios for the Form Recognizer client's off
All of these samples need the endpoint to your Form Recognizer resource ([instructions on how to get endpoint][get-endpoint-instructions]), and your Form Recognizer API key ([instructions on how to get key][get-key-instructions]).
+## Samples for client library versions 3.2.0b1 and later
+
+|**File Name**|**Description**|
+|----------------|-------------|
+|[sample_authentication.py][sample_auth] and [sample_authentication_async.py][sample_auth_async]|Authenticate the client|
+|[sample_analyze_layout.py][sample_analyze_layout] and [sample_analyze_layout_async.py][sample_analyze_layout_async]|Extract text, selection marks, and table structures in a document|
+|[sample_analyze_prebuilt_document.py][sample_analyze_prebuilt_document] and [sample_analyze_prebuilt_document_async.py][sample_analyze_prebuilt_document_async]|Analyze document key-value pairs, entities, tables, and selection marks using a prebuilt model|
+|[sample_analyze_invoices.py][sample_analyze_invoices] and [sample_analyze_invoices_async.py][sample_analyze_invoices_async]|Analyze document text, selection marks, tables, and pre-trained fields and values pertaining to English invoices using a prebuilt model|
+|[sample_analyze_business_cards.py][sample_analyze_business_cards] and [sample_analyze_business_cards_async.py][sample_analyze_business_cards_async]|Analyze document text and pre-trained fields and values pertaining to English business cards using a prebuilt model|
+|[sample_analyze_identity_documents.py][sample_analyze_identity_documents] and [sample_analyze_identity_documents_async.py][sample_analyze_identity_documents_async]|Analyze document text and pre-trained fields and values pertaining to US driver licenses and international passports using a prebuilt model|
+|[sample_analyze_receipts.py][sample_analyze_receipts] and [sample_analyze_receipts_async.py][sample_analyze_receipts_async]|Analyze document text and pre-trained fields and values pertaining to English sales receipts using a prebuilt model|
+|[sample_analyze_custom_documents.py][sample_analyze_custom_documents] and [sample_analyze_custom_documents_async.py][sample_analyze_custom_documents_async]|Analyze custom documents with your custom model to extract text, field values, selection marks, and table data from documents|
+|[sample_build_model.py][sample_build_model] and [sample_build_model_async.py][sample_build_model_async]|Build a custom model|
+|[sample_create_composed_model.py][sample_composed_model] and [sample_create_composed_model_async.py][sample_composed_model_async]|Create a composed model from a collection of existing models to be called with a single model ID|
+|[sample_manage_models.py][sample_manage_models] and [sample_manage_models_async.py][sample_manage_models_async]|Manage the models in your account|
+|[sample_get_operations.py][sample_get_operations] and [sample_get_operations_async.py][sample_get_operations_async]|Get and list the document model operations created within the past 24 hours|
+|[sample_copy_model.py][sample_copy] and [sample_copy_model_async.py][sample_copy_async]|Copy a custom model from one Form Recognizer resource to another|
+
+## Samples for client library versions 3.1.X
+
|**File Name**|**Description**|
|----------------|-------------|
|[sample_authentication.py][sample_authentication] and [sample_authentication_async.py][sample_authentication_async]|Authenticate the client|
@@ -33,6 +57,14 @@ All of these samples need the endpoint to your Form Recognizer resource ([instru
|[sample_manage_custom_models.py][sample_manage_custom_models] and [sample_manage_custom_models_async.py][sample_manage_custom_models_async]|Manage the custom models in your account|
|[sample_copy_model.py][sample_copy_model] and [sample_copy_model_async.py][sample_copy_model_async]|Copy a custom model from one Form Recognizer resource to another|
|[sample_create_composed_model.py][sample_create_composed_model] and [sample_create_composed_model_async.py][sample_create_composed_model_async]|Create a composed model from a collection of existing models trained with labels|
+|[sample_strongly_typing_recognized_form.py][sample_strongly_typing_recognized_form] and [sample_strongly_typing_recognized_form_async.py][sample_strongly_typing_recognized_form_async]|Use the fields in your recognized forms to create an object with strongly-typed fields|
+|[sample_get_bounding_boxes.py][sample_get_bounding_boxes] and [sample_get_bounding_boxes_async.py][sample_get_bounding_boxes_async]|Get info to visualize the outlines of form content and fields, which can be used for manual validation|
+|[sample_differentiate_output_models_trained_with_and_without_labels.py][sample_differentiate_output_models_trained_with_and_without_labels] and [sample_differentiate_output_models_trained_with_and_without_labels_async.py][sample_differentiate_output_models_trained_with_and_without_labels_async]|See the differences in output when using a custom model trained with labeled data and one trained with unlabeled data|
+|[sample_differentiate_output_labeled_tables.py][sample_differentiate_output_labeled_tables] and [sample_differentiate_output_labeled_tables_async.py][sample_differentiate_output_labeled_tables_async]|See the differences in output when using a custom model trained with fixed vs. dynamic table tags|
+
+## Samples for client library versions 3.0.0 and below
+
+Please see the samples [here][v3.0.0-samples-tag].
## Prerequisites
* Python 2.7, or 3.6 or later is required to use this package (3.6 or later if using asyncio)
@@ -44,7 +76,7 @@ All of these samples need the endpoint to your Form Recognizer resource ([instru
1. Install the Azure Form Recognizer client library for Python with [pip][pip]:
```bash
-pip install azure-ai-formrecognizer
+pip install azure-ai-formrecognizer --pre
```
2. Clone or download this sample repository
@@ -54,19 +86,13 @@ pip install azure-ai-formrecognizer
1. Open a terminal window and `cd` to the directory that the samples are saved in.
2. Set the environment variables specified in the sample file you wish to run.
-3. Follow the usage described in the file, e.g. `python sample_recognize_receipts.py`
+3. Follow the usage described in the file, e.g. `python sample_analyze_receipts.py`
## Next steps
Check out the [API reference documentation][python-fr-ref-docs] to learn more about
what you can do with the Azure Form Recognizer client library.
-|**Advanced Sample File Name**|**Description**|
-|----------------|-------------|
-|[sample_strongly_typing_recognized_form.py][sample_strongly_typing_recognized_form] and [sample_strongly_typing_recognized_form_async.py][sample_strongly_typing_recognized_form_async]|Use the fields in your recognized forms to create an object with strongly-typed fields|
-|[sample_get_bounding_boxes.py][sample_get_bounding_boxes] and [sample_get_bounding_boxes_async.py][sample_get_bounding_boxes_async]|Get info to visualize the outlines of form content and fields, which can be used for manual validation|
-|[sample_differentiate_output_models_trained_with_and_without_labels.py][sample_differentiate_output_models_trained_with_and_without_labels] and [sample_differentiate_output_models_trained_with_and_without_labels_async.py][sample_differentiate_output_models_trained_with_and_without_labels_async]|See the differences in output when using a custom model trained with labeled data and one trained with unlabeled data|
-|[sample_differentiate_output_labeled_tables.py][sample_differentiate_output_labeled_tables] and [sample_differentiate_output_labeled_tables_async.py][sample_differentiate_output_labeled_tables_async]|See the differences in output when using a custom model trained with fixed vs. dynamic table tags|
[azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity
@@ -77,42 +103,70 @@ what you can do with the Azure Form Recognizer client library.
[python-fr-ref-docs]: https://aka.ms/azsdk/python/formrecognizer/docs
[get-endpoint-instructions]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/README.md#looking-up-the-endpoint
[get-key-instructions]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/README.md#get-the-api-key
-
-
\ No newline at end of file
+[changelog]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md
+[v3.0.0-samples-tag]: https://github.com/Azure/azure-sdk-for-python/tree/azure-ai-formrecognizer_3.0.0/sdk/formrecognizer/azure-ai-formrecognizer/samples
+
+
+
+[sample_auth]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_authentication.py
+[sample_auth_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_authentication_async.py
+[sample_analyze_layout]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_layout.py
+[sample_analyze_layout_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_layout_async.py
+[sample_analyze_prebuilt_document]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_prebuilt_document.py
+[sample_analyze_prebuilt_document_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_prebuilt_document_async.py
+[sample_analyze_invoices]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_invoices.py
+[sample_analyze_invoices_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_invoices_async.py
+[sample_analyze_business_cards]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_business_cards.py
+[sample_analyze_business_cards_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_business_cards_async.py
+[sample_analyze_identity_documents]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_identity_documents.py
+[sample_analyze_identity_documents_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_identity_documents_async.py
+[sample_analyze_receipts]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_receipts.py
+[sample_analyze_receipts_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_receipts_async.py
+[sample_analyze_custom_documents]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_custom_documents.py
+[sample_analyze_custom_documents_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_custom_documents_async.py
+[sample_build_model]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_build_model.py
+[sample_build_model_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_build_model_async.py
+[sample_composed_model]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_create_composed_model.py
+[sample_composed_model_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_create_composed_model_async.py
+[sample_manage_models]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_manage_models.py
+[sample_manage_models_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_manage_models_async.py
+[sample_get_operations]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_get_operations.py
+[sample_get_operations_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_get_operations_async.py
+[sample_copy]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_copy_model.py
+[sample_copy_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_copy_model_async.py
+
+
+[sample_authentication]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_authentication.py
+[sample_authentication_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_authentication_async.py
+[sample_differentiate_output_models_trained_with_and_without_labels]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_differentiate_output_models_trained_with_and_without_labels.py
+[sample_differentiate_output_models_trained_with_and_without_labels_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_differentiate_output_models_trained_with_and_without_labels_async.py
+[sample_get_bounding_boxes]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_get_bounding_boxes.py
+[sample_get_bounding_boxes_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_get_bounding_boxes_async.py
+[sample_manage_custom_models]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_manage_custom_models.py
+[sample_manage_custom_models_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_manage_custom_models_async.py
+[sample_recognize_content]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_content.py
+[sample_recognize_content_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_content_async.py
+[sample_recognize_custom_forms]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_custom_forms.py
+[sample_recognize_custom_forms_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_custom_forms_async.py
+[sample_recognize_receipts_from_url]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_receipts_from_url.py
+[sample_recognize_receipts_from_url_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_receipts_from_url_async.py
+[sample_recognize_receipts]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_receipts.py
+[sample_recognize_receipts_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_receipts_async.py
+[sample_recognize_business_cards]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_business_cards.py
+[sample_recognize_business_cards_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_business_cards_async.py
+[sample_recognize_identity_documents]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_identity_documents.py
+[sample_recognize_identity_documents_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_identity_documents_async.py
+[sample_recognize_invoices]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_invoices.py
+[sample_recognize_invoices_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_invoices_async.py
+[sample_train_model_with_labels]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_train_model_with_labels.py
+[sample_train_model_with_labels_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_train_model_with_labels_async.py
+[sample_train_model_without_labels]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_train_model_without_labels.py
+[sample_train_model_without_labels_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_train_model_without_labels_async.py
+[sample_copy_model]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_copy_model.py
+[sample_copy_model_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_copy_model_async.py
+[sample_strongly_typing_recognized_form]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_strongly_typing_recognized_form.py
+[sample_strongly_typing_recognized_form_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_strongly_typing_recognized_form_async.py
+[sample_create_composed_model]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_create_composed_model.py
+[sample_create_composed_model_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_create_composed_model_async.py
+[sample_differentiate_output_labeled_tables]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_differentiate_output_labeled_tables.py
+[sample_differentiate_output_labeled_tables_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_differentiate_output_labeled_tables_async.py
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_authentication_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_authentication_async.py
index e6df75d36622..edb62df41a7d 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_authentication_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_authentication_async.py
@@ -45,7 +45,7 @@ async def authentication_with_api_key_credential_form_recognizer_client_async(se
endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
- form_recognizer_client = FormRecognizerClient(endpoint, AzureKeyCredential(key), api_version="2.1")
+ form_recognizer_client = FormRecognizerClient(endpoint, AzureKeyCredential(key))
# [END create_fr_client_with_key_async]
async with form_recognizer_client:
poller = await form_recognizer_client.begin_recognize_content_from_url(self.url)
@@ -62,7 +62,7 @@ async def authentication_with_azure_active_directory_form_recognizer_client_asyn
endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
credential = DefaultAzureCredential()
- form_recognizer_client = FormRecognizerClient(endpoint, credential, api_version="2.1")
+ form_recognizer_client = FormRecognizerClient(endpoint, credential)
# [END create_fr_client_with_aad_async]
async with form_recognizer_client:
poller = await form_recognizer_client.begin_recognize_content_from_url(self.url)
@@ -75,7 +75,7 @@ async def authentication_with_api_key_credential_form_training_client_async(self
endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
- form_training_client = FormTrainingClient(endpoint, AzureKeyCredential(key), api_version="2.1")
+ form_training_client = FormTrainingClient(endpoint, AzureKeyCredential(key))
# [END create_ft_client_with_key_async]
async with form_training_client:
properties = await form_training_client.get_account_properties()
@@ -91,7 +91,7 @@ async def authentication_with_azure_active_directory_form_training_client_async(
endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
credential = DefaultAzureCredential()
- form_training_client = FormTrainingClient(endpoint, credential, api_version="2.1")
+ form_training_client = FormTrainingClient(endpoint, credential)
# [END create_ft_client_with_aad_async]
async with form_training_client:
properties = await form_training_client.get_account_properties()
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_copy_model_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_copy_model_async.py
index 00d91a4d1c29..ec6eb26aee43 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_copy_model_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_copy_model_async.py
@@ -52,7 +52,7 @@ async def copy_model_async(self, custom_model_id):
target_resource_id = os.environ["AZURE_FORM_RECOGNIZER_TARGET_RESOURCE_ID"]
# [START get_copy_authorization_async]
- target_client = FormTrainingClient(endpoint=target_endpoint, credential=AzureKeyCredential(target_key), api_version="2.1")
+ target_client = FormTrainingClient(endpoint=target_endpoint, credential=AzureKeyCredential(target_key))
async with target_client:
target = await target_client.get_copy_authorization(
@@ -64,7 +64,7 @@ async def copy_model_async(self, custom_model_id):
# [END get_copy_authorization_async]
# [START copy_model_async]
- source_client = FormTrainingClient(endpoint=source_endpoint, credential=AzureKeyCredential(source_key), api_version="2.1")
+ source_client = FormTrainingClient(endpoint=source_endpoint, credential=AzureKeyCredential(source_key))
async with source_client:
poller = await source_client.begin_copy_model(
@@ -93,7 +93,7 @@ async def main():
raise ValueError("Please provide endpoint and API key to run the samples.")
form_training_client = FormTrainingClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
async with form_training_client:
model = await (await form_training_client.begin_training(
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_create_composed_model_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_create_composed_model_async.py
index 37eb03e0d687..c6282e36d74f 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_create_composed_model_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_create_composed_model_async.py
@@ -53,7 +53,7 @@ async def create_composed_model_async(self):
po_furniture = os.environ['PURCHASE_ORDER_OFFICE_FURNITURE_SAS_URL_V2']
po_cleaning_supplies = os.environ['PURCHASE_ORDER_OFFICE_CLEANING_SUPPLIES_SAS_URL_V2']
- form_training_client = FormTrainingClient(endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1")
+ form_training_client = FormTrainingClient(endpoint=endpoint, credential=AzureKeyCredential(key))
async with form_training_client:
supplies_poller = await form_training_client.begin_training(
po_supplies, use_training_labels=True, model_name="Purchase order - Office supplies"
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_differentiate_output_labeled_tables_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_differentiate_output_labeled_tables_async.py
index 051e4c7730f8..18b6d214bb15 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_differentiate_output_labeled_tables_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_differentiate_output_labeled_tables_async.py
@@ -53,7 +53,7 @@ async def test_recognize_tables_fixed_rows_async(self, custom_model_id):
model_id_fixed_rows_table = os.getenv("MODEL_ID_FIXED_ROW_TABLES", custom_model_id)
form_recognizer_client = FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
path_to_sample_forms = os.path.abspath(os.path.join(os.path.abspath(__file__),
@@ -96,7 +96,7 @@ async def test_recognize_tables_dynamic_rows_async(self, custom_model_id):
model_id_dynamic_rows_table = os.getenv("MODEL_ID_DYNAMIC_ROW_TABLES", custom_model_id)
form_recognizer_client = FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
path_to_sample_forms = os.path.abspath(os.path.join(os.path.abspath(__file__),
@@ -149,7 +149,7 @@ async def main():
raise ValueError("Please provide endpoint and API key to run the samples.")
form_training_client = FormTrainingClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
async with form_training_client:
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_differentiate_output_models_trained_with_and_without_labels_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_differentiate_output_models_trained_with_and_without_labels_async.py
index 228a1d25bf84..4d951bbc6359 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_differentiate_output_models_trained_with_and_without_labels_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_differentiate_output_models_trained_with_and_without_labels_async.py
@@ -59,7 +59,7 @@ async def recognize_custom_forms(self, labeled_model_id, unlabeled_model_id):
path_to_sample_forms = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", "..", "./sample_forms/forms/Form_1.jpg"))
async with FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
) as form_recognizer_client:
with open(path_to_sample_forms, "rb") as f:
@@ -143,7 +143,7 @@ async def main():
raise ValueError("Please provide endpoint and API key to run the samples.")
form_training_client = FormTrainingClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
async with form_training_client:
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_get_bounding_boxes_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_get_bounding_boxes_async.py
index c71f4cc9c7af..7ab408f9bb70 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_get_bounding_boxes_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_get_bounding_boxes_async.py
@@ -51,7 +51,7 @@ async def get_bounding_boxes(self, custom_model_id):
model_id = os.getenv("CUSTOM_TRAINED_MODEL_ID", custom_model_id)
form_recognizer_client = FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
path_to_sample_forms = os.path.abspath(os.path.join(os.path.abspath(__file__),
@@ -135,7 +135,7 @@ async def main():
raise ValueError("Please provide endpoint and API key to run the samples.")
form_training_client = FormTrainingClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
async with form_training_client:
model = await (await form_training_client.begin_training(
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_manage_custom_models_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_manage_custom_models_async.py
index 3b3690980185..cb93556c966c 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_manage_custom_models_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_manage_custom_models_async.py
@@ -39,7 +39,7 @@ async def manage_custom_models(self):
# [START get_account_properties_async]
async with FormTrainingClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
) as form_training_client:
# First, we see how many custom models we have, and what our limit is
account_properties = await form_training_client.get_account_properties()
@@ -52,9 +52,9 @@ async def manage_custom_models(self):
# [START list_custom_models_async]
custom_models = form_training_client.list_custom_models()
- # print("We have models with the following IDs:") TODO list models is returning null for some models
- # async for model in custom_models:
- # print(model.model_id)
+ print("We have models with the following IDs:")
+ async for model in custom_models:
+ print(model.model_id)
# [END list_custom_models_async]
# let's train a model to use for this sample
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_business_cards_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_business_cards_async.py
index 2342eb8ad5b5..dd55efaf271a 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_business_cards_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_business_cards_async.py
@@ -41,7 +41,7 @@ async def recognize_business_card_async(self):
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
form_recognizer_client = FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
async with form_recognizer_client:
with open(path_to_sample_forms, "rb") as f:
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_content_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_content_async.py
index 7d994ce256b6..c9d849cb592d 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_content_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_content_async.py
@@ -48,7 +48,7 @@ async def recognize_content(self):
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
async with FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
) as form_recognizer_client:
with open(path_to_sample_forms, "rb") as f:
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_custom_forms_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_custom_forms_async.py
index 4bdec624340c..56054a5f9428 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_custom_forms_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_custom_forms_async.py
@@ -48,7 +48,7 @@ async def recognize_custom_forms(self, custom_model_id):
model_id = os.getenv("CUSTOM_TRAINED_MODEL_ID", custom_model_id)
async with FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
) as form_recognizer_client:
# Make sure your form's type is included in the list of form types the custom model can recognize
@@ -121,7 +121,7 @@ async def main():
raise ValueError("Please provide endpoint and API key to run the samples.")
form_training_client = FormTrainingClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
async with form_training_client:
model = await (await form_training_client.begin_training(
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_identity_documents_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_identity_documents_async.py
index 0ddcbdde3081..45c645dcf70b 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_identity_documents_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_identity_documents_async.py
@@ -41,7 +41,7 @@ async def recognize_identity_documents(self):
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
async with FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
) as form_recognizer_client:
with open(path_to_sample_forms, "rb") as f:
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_invoices_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_invoices_async.py
index 36eebfb2286d..948a3ccbb6ca 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_invoices_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_invoices_async.py
@@ -41,7 +41,7 @@ async def recognize_invoice(self):
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
async with FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
) as form_recognizer_client:
with open(path_to_sample_forms, "rb") as f:
poller = await form_recognizer_client.begin_recognize_invoices(invoice=f, locale="en-US")
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_receipts_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_receipts_async.py
index 00695047350a..87122dffb7fd 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_receipts_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_receipts_async.py
@@ -42,7 +42,7 @@ async def recognize_receipts(self):
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
async with FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
) as form_recognizer_client:
with open(path_to_sample_forms, "rb") as f:
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_receipts_from_url_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_receipts_from_url_async.py
index 985c7084fd58..50bb1afac659 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_receipts_from_url_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_receipts_from_url_async.py
@@ -40,7 +40,7 @@ async def recognize_receipts_from_url(self):
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
async with FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
) as form_recognizer_client:
url = "https://raw.githubusercontent.com/Azure/azure-sdk-for-python/main/sdk/formrecognizer/azure-ai-formrecognizer/tests/sample_forms/receipt/contoso-receipt.png"
poller = await form_recognizer_client.begin_recognize_receipts_from_url(receipt_url=url)
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_strongly_typing_recognized_form_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_strongly_typing_recognized_form_async.py
index df2cd8ec4ac8..a99faab58315 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_strongly_typing_recognized_form_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_strongly_typing_recognized_form_async.py
@@ -83,7 +83,7 @@ async def strongly_typed_receipt_async(self):
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
async with FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
) as form_recognizer_client:
with open(path_to_sample_forms, "rb") as f:
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_train_model_with_labels_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_train_model_with_labels_async.py
index d521fa68e8f8..535e8b3b6370 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_train_model_with_labels_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_train_model_with_labels_async.py
@@ -45,7 +45,7 @@ async def train_model_with_labels(self):
container_sas_url = os.environ["CONTAINER_SAS_URL_V2"]
form_training_client = FormTrainingClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
async with form_training_client:
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_train_model_without_labels_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_train_model_without_labels_async.py
index 98881b1a7823..3941012df1ca 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_train_model_without_labels_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_train_model_without_labels_async.py
@@ -43,7 +43,7 @@ async def train_model_without_labels(self):
container_sas_url = os.environ["CONTAINER_SAS_URL_V2"]
async with FormTrainingClient(
- endpoint, AzureKeyCredential(key), api_version="2.1"
+ endpoint, AzureKeyCredential(key)
) as form_training_client:
poller = await form_training_client.begin_training(container_sas_url, use_training_labels=False)
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_authentication.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_authentication.py
index 51eb8ea52a97..9b1279b5ebd4 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_authentication.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_authentication.py
@@ -44,7 +44,7 @@ def authentication_with_api_key_credential_form_recognizer_client(self):
endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
- form_recognizer_client = FormRecognizerClient(endpoint, AzureKeyCredential(key), api_version="2.1")
+ form_recognizer_client = FormRecognizerClient(endpoint, AzureKeyCredential(key))
# [END create_fr_client_with_key]
poller = form_recognizer_client.begin_recognize_content_from_url(self.url)
result = poller.result()
@@ -60,7 +60,7 @@ def authentication_with_azure_active_directory_form_recognizer_client(self):
endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
credential = DefaultAzureCredential()
- form_recognizer_client = FormRecognizerClient(endpoint, credential, api_version="2.1")
+ form_recognizer_client = FormRecognizerClient(endpoint, credential)
# [END create_fr_client_with_aad]
poller = form_recognizer_client.begin_recognize_content_from_url(self.url)
result = poller.result()
@@ -72,7 +72,7 @@ def authentication_with_api_key_credential_form_training_client(self):
endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
- form_training_client = FormTrainingClient(endpoint, AzureKeyCredential(key), api_version="2.1")
+ form_training_client = FormTrainingClient(endpoint, AzureKeyCredential(key))
# [END create_ft_client_with_key]
properties = form_training_client.get_account_properties()
@@ -87,7 +87,7 @@ def authentication_with_azure_active_directory_form_training_client(self):
endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
credential = DefaultAzureCredential()
- form_training_client = FormTrainingClient(endpoint, credential, api_version="2.1")
+ form_training_client = FormTrainingClient(endpoint, credential)
# [END create_ft_client_with_aad]
properties = form_training_client.get_account_properties()
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_copy_model.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_copy_model.py
index 42510ef6af04..fe2cefd29af8 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_copy_model.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_copy_model.py
@@ -51,7 +51,7 @@ def copy_model(self, custom_model_id):
target_resource_id = os.environ["AZURE_FORM_RECOGNIZER_TARGET_RESOURCE_ID"]
# [START get_copy_authorization]
- target_client = FormTrainingClient(endpoint=target_endpoint, credential=AzureKeyCredential(target_key), api_version="2.1")
+ target_client = FormTrainingClient(endpoint=target_endpoint, credential=AzureKeyCredential(target_key))
target = target_client.get_copy_authorization(
resource_region=target_region,
@@ -62,7 +62,7 @@ def copy_model(self, custom_model_id):
# [END get_copy_authorization]
# [START begin_copy_model]
- source_client = FormTrainingClient(endpoint=source_endpoint, credential=AzureKeyCredential(source_key), api_version="2.1")
+ source_client = FormTrainingClient(endpoint=source_endpoint, credential=AzureKeyCredential(source_key))
poller = source_client.begin_copy_model(
model_id=source_model_id,
@@ -90,7 +90,7 @@ def copy_model(self, custom_model_id):
raise ValueError("Please provide endpoint and API key to run the samples.")
form_training_client = FormTrainingClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
model = form_training_client.begin_training(os.getenv("CONTAINER_SAS_URL_V2"), use_training_labels=True).result()
model_id = model.model_id
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_create_composed_model.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_create_composed_model.py
index 552841d967f8..fc54f9fa3cb4 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_create_composed_model.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_create_composed_model.py
@@ -52,7 +52,7 @@ def create_composed_model(self):
po_furniture = os.environ['PURCHASE_ORDER_OFFICE_FURNITURE_SAS_URL_V2']
po_cleaning_supplies = os.environ['PURCHASE_ORDER_OFFICE_CLEANING_SUPPLIES_SAS_URL_V2']
- form_training_client = FormTrainingClient(endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1")
+ form_training_client = FormTrainingClient(endpoint=endpoint, credential=AzureKeyCredential(key))
supplies_poller = form_training_client.begin_training(
po_supplies, use_training_labels=True, model_name="Purchase order - Office supplies"
)
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_differentiate_output_labeled_tables.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_differentiate_output_labeled_tables.py
index b0dd8f96f043..dff016c22a24 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_differentiate_output_labeled_tables.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_differentiate_output_labeled_tables.py
@@ -52,7 +52,7 @@ def test_recognize_tables_fixed_rows(self, custom_model_id):
model_id_fixed_rows_table = os.getenv("MODEL_ID_FIXED_ROW_TABLES", custom_model_id)
form_recognizer_client = FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
path_to_sample_forms = os.path.abspath(os.path.join(os.path.abspath(__file__),
@@ -94,7 +94,7 @@ def test_recognize_tables_dynamic_rows(self, custom_model_id):
model_id_dynamic_rows_table = os.getenv("MODEL_ID_DYNAMIC_ROW_TABLES", custom_model_id)
form_recognizer_client = FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
path_to_sample_forms = os.path.abspath(os.path.join(os.path.abspath(__file__),
@@ -146,7 +146,7 @@ def test_recognize_tables_dynamic_rows(self, custom_model_id):
raise ValueError("Please provide endpoint and API key to run the samples.")
form_training_client = FormTrainingClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
if fixed:
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_differentiate_output_models_trained_with_and_without_labels.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_differentiate_output_models_trained_with_and_without_labels.py
index 7ff61356bd5e..0fa15996107f 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_differentiate_output_models_trained_with_and_without_labels.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_differentiate_output_models_trained_with_and_without_labels.py
@@ -56,7 +56,7 @@ def recognize_custom_forms(self, labeled_model_id, unlabeled_model_id):
model_trained_without_labels_id = os.getenv("ID_OF_MODEL_TRAINED_WITHOUT_LABELS", unlabeled_model_id)
form_recognizer_client = FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
path_to_sample_forms = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", "./sample_forms/forms/Form_1.jpg"))
@@ -143,7 +143,7 @@ def recognize_custom_forms(self, labeled_model_id, unlabeled_model_id):
raise ValueError("Please provide endpoint and API key to run the samples.")
form_training_client = FormTrainingClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
if labeled:
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_get_bounding_boxes.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_get_bounding_boxes.py
index 9aaa2ae10272..48651b9f2da8 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_get_bounding_boxes.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_get_bounding_boxes.py
@@ -50,7 +50,7 @@ def get_bounding_boxes(self, custom_model_id):
model_id = os.getenv("CUSTOM_TRAINED_MODEL_ID", custom_model_id)
form_recognizer_client = FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
path_to_sample_forms = os.path.abspath(os.path.join(os.path.abspath(__file__),
@@ -131,7 +131,7 @@ def get_bounding_boxes(self, custom_model_id):
raise ValueError("Please provide endpoint and API key to run the samples.")
form_training_client = FormTrainingClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
model = form_training_client.begin_training(os.getenv("CONTAINER_SAS_URL_V2"), use_training_labels=False).result()
model_id = model.model_id
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_manage_custom_models.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_manage_custom_models.py
index cdff4576b85d..7fad685f6071 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_manage_custom_models.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_manage_custom_models.py
@@ -37,7 +37,7 @@ def manage_custom_models(self):
container_sas_url = os.environ["CONTAINER_SAS_URL_V2"]
# [START get_account_properties]
- form_training_client = FormTrainingClient(endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1")
+ form_training_client = FormTrainingClient(endpoint=endpoint, credential=AzureKeyCredential(key))
# First, we see how many custom models we have, and what our limit is
account_properties = form_training_client.get_account_properties()
print("Our account has {} custom models, and we can have at most {} custom models\n".format(
@@ -49,9 +49,9 @@ def manage_custom_models(self):
# [START list_custom_models]
custom_models = form_training_client.list_custom_models()
- # print("We have models with the following IDs:") TODO list models is returning null for some models
- # for model in custom_models:
- # print(model.model_id)
+ print("We have models with the following IDs:")
+ for model in custom_models:
+ print(model.model_id)
# [END list_custom_models]
# let's train a model to use for this sample
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_business_cards.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_business_cards.py
index 416772a53435..53b800c5eea1 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_business_cards.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_business_cards.py
@@ -39,7 +39,7 @@ def recognize_business_card(self):
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
form_recognizer_client = FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
with open(path_to_sample_forms, "rb") as f:
poller = form_recognizer_client.begin_recognize_business_cards(business_card=f, locale="en-US")
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_content.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_content.py
index 26ad101c2d5a..b76b17f48de0 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_content.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_content.py
@@ -46,7 +46,7 @@ def recognize_content(self):
endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
- form_recognizer_client = FormRecognizerClient(endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1")
+ form_recognizer_client = FormRecognizerClient(endpoint=endpoint, credential=AzureKeyCredential(key))
with open(path_to_sample_forms, "rb") as f:
poller = form_recognizer_client.begin_recognize_content(form=f)
form_pages = poller.result()
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_custom_forms.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_custom_forms.py
index 68a7663b3952..35b2e20cd6af 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_custom_forms.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_custom_forms.py
@@ -47,7 +47,7 @@ def recognize_custom_forms(self, custom_model_id):
model_id = os.getenv("CUSTOM_TRAINED_MODEL_ID", custom_model_id)
form_recognizer_client = FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
# Make sure your form's type is included in the list of form types the custom model can recognize
@@ -120,7 +120,7 @@ def recognize_custom_forms(self, custom_model_id):
raise ValueError("Please provide endpoint and API key to run the samples.")
form_training_client = FormTrainingClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
model = form_training_client.begin_training(os.getenv("CONTAINER_SAS_URL_V2"), use_training_labels=True).result()
model_id = model.model_id
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_identity_documents.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_identity_documents.py
index 218bb16a5d5c..63e4572e6793 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_identity_documents.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_identity_documents.py
@@ -40,7 +40,7 @@ def recognize_identity_documents(self):
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
form_recognizer_client = FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
with open(path_to_sample_forms, "rb") as f:
poller = form_recognizer_client.begin_recognize_identity_documents(identity_document=f)
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_invoices.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_invoices.py
index fbe64b0a95a2..48a529dc21a6 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_invoices.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_invoices.py
@@ -40,7 +40,7 @@ def recognize_invoice(self):
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
form_recognizer_client = FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
with open(path_to_sample_forms, "rb") as f:
poller = form_recognizer_client.begin_recognize_invoices(invoice=f, locale="en-US")
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_receipts.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_receipts.py
index 968b47b79c25..e20945584d26 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_receipts.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_receipts.py
@@ -41,7 +41,7 @@ def recognize_receipts(self):
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
form_recognizer_client = FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
with open(path_to_sample_forms, "rb") as f:
poller = form_recognizer_client.begin_recognize_receipts(receipt=f, locale="en-US")
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_receipts_from_url.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_receipts_from_url.py
index ece40f5ba83c..b3b4a3cc97f5 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_receipts_from_url.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_receipts_from_url.py
@@ -39,7 +39,7 @@ def recognize_receipts_from_url(self):
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
form_recognizer_client = FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
url = "https://raw.githubusercontent.com/Azure/azure-sdk-for-python/main/sdk/formrecognizer/azure-ai-formrecognizer/tests/sample_forms/receipt/contoso-receipt.png"
poller = form_recognizer_client.begin_recognize_receipts_from_url(receipt_url=url)
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_strongly_typing_recognized_form.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_strongly_typing_recognized_form.py
index e74a53105aca..3545d9a4dd02 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_strongly_typing_recognized_form.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_strongly_typing_recognized_form.py
@@ -82,7 +82,7 @@ def strongly_typed_receipt(self):
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
form_recognizer_client = FormRecognizerClient(
- endpoint=endpoint, credential=AzureKeyCredential(key), api_version="2.1"
+ endpoint=endpoint, credential=AzureKeyCredential(key)
)
with open(path_to_sample_forms, "rb") as f:
poller = form_recognizer_client.begin_recognize_receipts(receipt=f)
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_train_model_with_labels.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_train_model_with_labels.py
index 7e553439ffb6..723487f777b9 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_train_model_with_labels.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_train_model_with_labels.py
@@ -43,7 +43,7 @@ def train_model_with_labels(self):
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
container_sas_url = os.environ["CONTAINER_SAS_URL_V2"]
- form_training_client = FormTrainingClient(endpoint, AzureKeyCredential(key), api_version="2.1")
+ form_training_client = FormTrainingClient(endpoint, AzureKeyCredential(key))
poller = form_training_client.begin_training(
container_sas_url, use_training_labels=True, model_name="mymodel"
)
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_train_model_without_labels.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_train_model_without_labels.py
index d90a6107dd59..422e1d5a790b 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_train_model_without_labels.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_train_model_without_labels.py
@@ -41,7 +41,7 @@ def train_model_without_labels(self):
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
container_sas_url = os.environ["CONTAINER_SAS_URL_V2"]
- form_training_client = FormTrainingClient(endpoint, AzureKeyCredential(key), api_version="2.1")
+ form_training_client = FormTrainingClient(endpoint, AzureKeyCredential(key))
poller = form_training_client.begin_training(container_sas_url, use_training_labels=False)
model = poller.result()
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_business_cards_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_business_cards_async.py
index d0bd07ca84fe..ac2f2231f77f 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_business_cards_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_business_cards_async.py
@@ -13,7 +13,7 @@
This sample demonstrates how to analyze business cards.
See fields found on a business card here:
- https://aka.ms/formrecognizer/businesscardfields
+ https://aka.ms/azsdk/formrecognizer/businesscardfieldschema
USAGE:
python sample_analyze_business_cards_async.py
@@ -64,7 +64,7 @@ async def analyze_business_card_async():
contact_name.value["FirstName"].value,
contact_name.value[
"FirstName"
- ].confidence, # TODO confidence is None
+ ].confidence,
)
)
print(
@@ -72,7 +72,7 @@ async def analyze_business_card_async():
contact_name.value["LastName"].value,
contact_name.value[
"LastName"
- ].confidence, # TODO confidence is None
+ ].confidence,
)
)
company_names = business_card.fields.get("CompanyNames")
@@ -128,7 +128,7 @@ async def analyze_business_card_async():
"Mobile phone number: {} has confidence: {}".format(
phone.content, phone.confidence
)
- ) # TODO value not getting populated
+ )
faxes = business_card.fields.get("Faxes")
if faxes:
for fax in faxes.value:
@@ -136,7 +136,7 @@ async def analyze_business_card_async():
"Fax number: {} has confidence: {}".format(
fax.content, fax.confidence
)
- ) # TODO value not getting populated
+ )
work_phones = business_card.fields.get("WorkPhones")
if work_phones:
for work_phone in work_phones.value:
@@ -144,7 +144,7 @@ async def analyze_business_card_async():
"Work phone number: {} has confidence: {}".format(
work_phone.content, work_phone.confidence
)
- ) # TODO value not getting populated
+ )
other_phones = business_card.fields.get("OtherPhones")
if other_phones:
for other_phone in other_phones.value:
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_identity_documents_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_identity_documents_async.py
index 1d4c66a2a5c2..2f650f2f3807 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_identity_documents_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_identity_documents_async.py
@@ -13,7 +13,7 @@
This sample demonstrates how to analyze an identity document.
See fields found on identity documents here:
- https://aka.ms/formrecognizer/iddocumentfields
+ https://aka.ms/azsdk/formrecognizer/iddocumentfieldschema
USAGE:
python sample_analyze_identity_documents_async.py
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_invoices_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_invoices_async.py
index 8448a628660b..16cb50d4dbad 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_invoices_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_invoices_async.py
@@ -13,7 +13,7 @@
This sample demonstrates how to analyze invoices.
See fields found on a invoice here:
- https://aka.ms/formrecognizer/invoicefields
+ https://aka.ms/azsdk/formrecognizer/invoicefieldschema
USAGE:
python sample_analyze_invoices_async.py
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_receipts_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_receipts_async.py
index dec4fc0a277b..b5c8419631f1 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_receipts_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_receipts_async.py
@@ -14,7 +14,7 @@
using a pre-trained receipt model.
See fields found on a receipt here:
- https://aka.ms/formrecognizer/receiptfields
+ https://aka.ms/azsdk/formrecognizer/receiptfieldschema
USAGE:
python sample_analyze_receipts_async.py
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_receipts_from_url_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_receipts_from_url_async.py
index 839481373d3e..ec54660885e0 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_receipts_from_url_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_receipts_from_url_async.py
@@ -14,7 +14,7 @@
using a pre-trained receipt model.
See fields found on a receipt here:
- https://aka.ms/formanalyzer/receiptfields
+ https://aka.ms/azsdk/formrecognizer/receiptfieldschema
USAGE:
python sample_analyze_receipts_from_url_async.py
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_business_cards.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_business_cards.py
index c5b0f3f49903..811fa10858f0 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_business_cards.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_business_cards.py
@@ -13,7 +13,7 @@
This sample demonstrates how to analyze business cards.
See fields found on a business card here:
- https://aka.ms/formrecognizer/businesscardfields
+ https://aka.ms/azsdk/formrecognizer/businesscardfieldschema
USAGE:
python sample_analyze_business_cards.py
@@ -61,7 +61,7 @@ def analyze_business_card():
contact_name.value["FirstName"].value,
contact_name.value[
"FirstName"
- ].confidence, # TODO confidence is None
+ ].confidence,
)
)
print(
@@ -69,7 +69,7 @@ def analyze_business_card():
contact_name.value["LastName"].value,
contact_name.value[
"LastName"
- ].confidence, # TODO confidence is None
+ ].confidence,
)
)
company_names = business_card.fields.get("CompanyNames")
@@ -125,7 +125,7 @@ def analyze_business_card():
"Mobile phone number: {} has confidence: {}".format(
phone.content, phone.confidence
)
- ) # TODO value not getting populated
+ )
faxes = business_card.fields.get("Faxes")
if faxes:
for fax in faxes.value:
@@ -133,7 +133,7 @@ def analyze_business_card():
"Fax number: {} has confidence: {}".format(
fax.content, fax.confidence
)
- ) # TODO value not getting populated
+ )
work_phones = business_card.fields.get("WorkPhones")
if work_phones:
for work_phone in work_phones.value:
@@ -141,7 +141,7 @@ def analyze_business_card():
"Work phone number: {} has confidence: {}".format(
work_phone.content, work_phone.confidence
)
- ) # TODO value not getting populated
+ )
other_phones = business_card.fields.get("OtherPhones")
if other_phones:
for other_phone in other_phones.value:
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_identity_documents.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_identity_documents.py
index b645bfcb2c27..794f8d915c1a 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_identity_documents.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_identity_documents.py
@@ -13,7 +13,7 @@
This sample demonstrates how to analyze an identity document.
See fields found on identity documents here:
- https://aka.ms/formrecognizer/iddocumentfields
+ https://aka.ms/azsdk/formrecognizer/iddocumentfieldschema
USAGE:
python sample_analyze_identity_documents.py
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_invoices.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_invoices.py
index 514e12bb7d7a..40a3eefef5bc 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_invoices.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_invoices.py
@@ -13,7 +13,7 @@
This sample demonstrates how to analyze invoices.
See fields found on a invoice here:
- https://aka.ms/formrecognizer/invoicefields
+ https://aka.ms/azsdk/formrecognizer/invoicefieldschema
USAGE:
python sample_analyze_invoices.py
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_receipts.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_receipts.py
index 57aec6734763..bd9f45559ede 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_receipts.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_receipts.py
@@ -14,7 +14,7 @@
using a pre-trained receipt model.
See fields found on a receipt here:
- https://aka.ms/formrecognizer/receiptfields
+ https://aka.ms/azsdk/formrecognizer/receiptfieldschema
USAGE:
python sample_analyze_receipts.py
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_receipts_from_url.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_receipts_from_url.py
index c56da0efb187..b4c300a5dc37 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_receipts_from_url.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_receipts_from_url.py
@@ -14,7 +14,7 @@
using a pre-trained receipt model.
See fields found on a receipt here:
- https://aka.ms/formanalyzer/receiptfields
+ https://aka.ms/azsdk/formrecognizer/receiptfieldschema
USAGE:
python sample_analyze_receipts_from_url.py
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_receipt.test_receipt_locale_error.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_receipt.test_receipt_locale_error.yaml
index 27d57ee0e053..dc3ad49cd758 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_receipt.test_receipt_locale_error.yaml
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_receipt.test_receipt_locale_error.yaml
@@ -12,31 +12,31 @@ interactions:
Content-Length:
- '154512'
Content-Type:
- - image/jpeg
+ - application/octet-stream
User-Agent:
- - azsdk-python-ai-formrecognizer/3.2.0b1 Python/3.9.1 (Windows-10-10.0.19041-SP0)
+ - azsdk-python-ai-formrecognizer/3.2.0b1 Python/3.9.0 (Windows-10-10.0.19041-SP0)
method: POST
- uri: https://region.api.cognitive.microsoft.com/formrecognizer/v2.1/prebuilt/receipt/analyze?includeTextDetails=false&locale=not%20a%20locale
+ uri: https://region.api.cognitive.microsoft.com/formrecognizer/documentModels/prebuilt-receipt:analyze?locale=not%20a%20locale&stringIndexType=unicodeCodePoint&api-version=2021-09-30-preview
response:
body:
- string: '{"error": {"code": "UnsupportedLocale", "innerError": {"requestId":
- "c6836b61-db64-4355-8b25-e1948f564d44"}, "message": "Locale unsupported. Supported
- locales include en-AU, en-CA, en-GB, en-IN and en-US."}}'
+ string: '{"error": {"code": "InvalidArgument", "message": "Invalid argument.",
+ "innererror": {"code": "InvalidParameter", "message": "The parameter Locale
+ is invalid: The language code is invalid or not supported."}}}'
headers:
apim-request-id:
- - c6836b61-db64-4355-8b25-e1948f564d44
- content-length:
- - '200'
+ - edf133b9-e46e-458e-a38e-3a148a6ed1f2
content-type:
- application/json; charset=utf-8
date:
- - Mon, 30 Aug 2021 23:48:59 GMT
+ - Thu, 30 Sep 2021 17:06:02 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
+ transfer-encoding:
+ - chunked
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- - '113'
+ - '135'
status:
code: 400
message: Bad Request
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_receipt_async.test_receipt_locale_error.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_receipt_async.test_receipt_locale_error.yaml
index 64cdcdc65abf..93331c0b1c52 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_receipt_async.test_receipt_locale_error.yaml
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_receipt_async.test_receipt_locale_error.yaml
@@ -6,26 +6,26 @@ interactions:
Accept:
- application/json
Content-Type:
- - image/jpeg
+ - application/octet-stream
User-Agent:
- - azsdk-python-ai-formrecognizer/3.1.0 Python/3.9.0 (Windows-10-10.0.19041-SP0)
+ - azsdk-python-ai-formrecognizer/3.2.0b1 Python/3.9.0 (Windows-10-10.0.19041-SP0)
method: POST
- uri: https://region.api.cognitive.microsoft.com/formrecognizer/v2.1/prebuilt/receipt/analyze?includeTextDetails=false&locale=not%20a%20locale
+ uri: https://region.api.cognitive.microsoft.com/formrecognizer/documentModels/prebuilt-receipt:analyze?locale=not%20a%20locale&stringIndexType=unicodeCodePoint&api-version=2021-09-30-preview
response:
body:
- string: '{"error": {"code": "UnsupportedLocale", "innerError": {"requestId":
- "4c27b38d-d0e4-4b41-b76a-0422a7b924b9"}, "message": "Locale unsupported. Supported
- locales include en-AU, en-CA, en-GB, en-IN and en-US."}}'
+ string: '{"error": {"code": "InvalidArgument", "message": "Invalid argument.",
+ "innererror": {"code": "InvalidParameter", "message": "The parameter Locale
+ is invalid: The language code is invalid or not supported."}}}'
headers:
- apim-request-id: 4c27b38d-d0e4-4b41-b76a-0422a7b924b9
- content-length: '200'
+ apim-request-id: 8f6bc0ec-dfbe-4d03-895f-b0cf4bec6192
content-type: application/json; charset=utf-8
- date: Tue, 11 May 2021 03:08:08 GMT
+ date: Thu, 30 Sep 2021 17:06:19 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
+ transfer-encoding: chunked
x-content-type-options: nosniff
- x-envoy-upstream-service-time: '134'
+ x-envoy-upstream-service-time: '69'
status:
code: 400
message: Bad Request
- url: https://region.api.cognitive.microsoft.com/formrecognizer/v2.1/prebuilt/receipt/analyze?includeTextDetails=false&locale=not%20a%20locale
+ url: https://region.api.cognitive.microsoft.com/formrecognizer/documentModels/prebuilt-receipt:analyze?locale=not%20a%20locale&stringIndexType=unicodeCodePoint&api-version=2021-09-30-preview
version: 1
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_receipt_from_url.test_receipt_locale_error.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_receipt_from_url.test_receipt_locale_error.yaml
index 8ed6afb3dcc7..36a7cee92635 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_receipt_from_url.test_receipt_locale_error.yaml
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_receipt_from_url.test_receipt_locale_error.yaml
@@ -1,6 +1,6 @@
interactions:
- request:
- body: 'b''{"source": "blob_sas_url"}'''
+ body: 'b''{"urlSource": "blob_sas_url"}'''
headers:
Accept:
- application/json
@@ -9,33 +9,33 @@ interactions:
Connection:
- keep-alive
Content-Length:
- - '221'
+ - '224'
Content-Type:
- application/json
User-Agent:
- - azsdk-python-ai-formrecognizer/3.1.0 Python/3.9.0 (Windows-10-10.0.19041-SP0)
+ - azsdk-python-ai-formrecognizer/3.2.0b1 Python/3.9.0 (Windows-10-10.0.19041-SP0)
method: POST
- uri: https://region.api.cognitive.microsoft.com/formrecognizer/v2.1/prebuilt/receipt/analyze?includeTextDetails=false&locale=not%20a%20locale
+ uri: https://region.api.cognitive.microsoft.com/formrecognizer/documentModels/prebuilt-receipt:analyze?locale=not%20a%20locale&stringIndexType=unicodeCodePoint&api-version=2021-09-30-preview
response:
body:
- string: '{"error": {"code": "UnsupportedLocale", "innerError": {"requestId":
- "04a5530c-7246-4327-9661-6579f4ac252b"}, "message": "Locale unsupported. Supported
- locales include en-AU, en-CA, en-GB, en-IN and en-US."}}'
+ string: '{"error": {"code": "InvalidArgument", "message": "Invalid argument.",
+ "innererror": {"code": "InvalidParameter", "message": "The parameter Locale
+ is invalid: The language code is invalid or not supported."}}}'
headers:
apim-request-id:
- - 04a5530c-7246-4327-9661-6579f4ac252b
- content-length:
- - '200'
+ - 37eba60a-f330-4c8f-94cf-8747ba3c2fc5
content-type:
- application/json; charset=utf-8
date:
- - Tue, 11 May 2021 03:09:31 GMT
+ - Thu, 30 Sep 2021 17:05:04 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
+ transfer-encoding:
+ - chunked
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- - '289'
+ - '564'
status:
code: 400
message: Bad Request
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_receipt_from_url_async.test_receipt_locale_error.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_receipt_from_url_async.test_receipt_locale_error.yaml
index 1fbd527eb3f5..7da46986f3da 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_receipt_from_url_async.test_receipt_locale_error.yaml
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_receipt_from_url_async.test_receipt_locale_error.yaml
@@ -1,32 +1,32 @@
interactions:
- request:
- body: 'b''{"source": "blob_sas_url"}'''
+ body: 'b''{"urlSource": "blob_sas_url"}'''
headers:
Accept:
- application/json
Content-Length:
- - '221'
+ - '224'
Content-Type:
- application/json
User-Agent:
- - azsdk-python-ai-formrecognizer/3.1.0 Python/3.9.0 (Windows-10-10.0.19041-SP0)
+ - azsdk-python-ai-formrecognizer/3.2.0b1 Python/3.9.0 (Windows-10-10.0.19041-SP0)
method: POST
- uri: https://region.api.cognitive.microsoft.com/formrecognizer/v2.1/prebuilt/receipt/analyze?includeTextDetails=false&locale=not%20a%20locale
+ uri: https://region.api.cognitive.microsoft.com/formrecognizer/documentModels/prebuilt-receipt:analyze?locale=not%20a%20locale&stringIndexType=unicodeCodePoint&api-version=2021-09-30-preview
response:
body:
- string: '{"error": {"code": "UnsupportedLocale", "innerError": {"requestId":
- "c72b100e-f260-4bd3-874f-3354e1b08e83"}, "message": "Locale unsupported. Supported
- locales include en-AU, en-CA, en-GB, en-IN and en-US."}}'
+ string: '{"error": {"code": "InvalidArgument", "message": "Invalid argument.",
+ "innererror": {"code": "InvalidParameter", "message": "The parameter Locale
+ is invalid: The language code is invalid or not supported."}}}'
headers:
- apim-request-id: c72b100e-f260-4bd3-874f-3354e1b08e83
- content-length: '200'
+ apim-request-id: e6c4d122-9c19-4bfb-9d69-f5914cfc29b4
content-type: application/json; charset=utf-8
- date: Tue, 11 May 2021 03:12:51 GMT
+ date: Thu, 30 Sep 2021 17:06:34 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
+ transfer-encoding: chunked
x-content-type-options: nosniff
- x-envoy-upstream-service-time: '897'
+ x-envoy-upstream-service-time: '581'
status:
code: 400
message: Bad Request
- url: https://region.api.cognitive.microsoft.com/formrecognizer/v2.1/prebuilt/receipt/analyze?includeTextDetails=false&locale=not%20a%20locale
+ url: https://region.api.cognitive.microsoft.com/formrecognizer/documentModels/prebuilt-receipt:analyze?locale=not%20a%20locale&stringIndexType=unicodeCodePoint&api-version=2021-09-30-preview
version: 1
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_logging.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_logging.py
index 0f298dd2a1a5..081b719554c8 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_logging.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_logging.py
@@ -13,7 +13,7 @@
except ImportError: # python < 3.3
import mock # type: ignore
-from azure.ai.formrecognizer import FormRecognizerClient, FormTrainingClient
+from azure.ai.formrecognizer import DocumentAnalysisClient, DocumentModelAdministrationClient
from azure.core.credentials import AzureKeyCredential
from azure.core.exceptions import HttpResponseError
from testcase import FormRecognizerTest
@@ -27,20 +27,20 @@ def __init__(self):
def emit(self, record):
self.messages.append(record)
-@pytest.mark.skip
+
class TestLogging(FormRecognizerTest):
@FormRecognizerPreparer()
@pytest.mark.live_test_only
- def test_logging_info_fr_client(self, formrecognizer_test_endpoint, formrecognizer_test_api_key):
- client = FormRecognizerClient(formrecognizer_test_endpoint, AzureKeyCredential(formrecognizer_test_api_key))
+ def test_logging_info_dac_client(self, formrecognizer_test_endpoint, formrecognizer_test_api_key):
+ client = DocumentAnalysisClient(formrecognizer_test_endpoint, AzureKeyCredential(formrecognizer_test_api_key))
mock_handler = MockHandler()
logger = logging.getLogger("azure")
logger.addHandler(mock_handler)
logger.setLevel(logging.INFO)
- poller = client.begin_recognize_invoices_from_url(self.receipt_url_jpg)
+ poller = client.begin_analyze_document_from_url("prebuilt-receipt", self.receipt_url_jpg)
result = poller.result()
for message in mock_handler.messages:
@@ -53,15 +53,15 @@ def test_logging_info_fr_client(self, formrecognizer_test_endpoint, formrecogniz
@FormRecognizerPreparer()
@pytest.mark.live_test_only
- def test_logging_info_ft_client(self, formrecognizer_test_endpoint, formrecognizer_test_api_key):
- client = FormTrainingClient(formrecognizer_test_endpoint, AzureKeyCredential(formrecognizer_test_api_key))
+ def test_logging_info_dmac_client(self, formrecognizer_test_endpoint, formrecognizer_test_api_key):
+ client = DocumentModelAdministrationClient(formrecognizer_test_endpoint, AzureKeyCredential(formrecognizer_test_api_key))
mock_handler = MockHandler()
logger = logging.getLogger("azure")
logger.addHandler(mock_handler)
logger.setLevel(logging.INFO)
- result = client.get_account_properties()
+ result = client.get_account_info()
for message in mock_handler.messages:
if message.levelname == "INFO":
@@ -86,10 +86,10 @@ def test_mock_quota_exceeded_403(self, formrecognizer_test_endpoint, formrecogni
response.content_type = "application/json"
transport = mock.Mock(send=lambda request, **kwargs: response)
- client = FormRecognizerClient(formrecognizer_test_endpoint, AzureKeyCredential(formrecognizer_test_api_key), transport=transport)
+ client = DocumentAnalysisClient(formrecognizer_test_endpoint, AzureKeyCredential(formrecognizer_test_api_key), transport=transport)
with pytest.raises(HttpResponseError) as e:
- poller = client.begin_recognize_receipts_from_url(self.receipt_url_jpg)
+ poller = client.begin_analyze_document_from_url("prebuilt-receipt", self.receipt_url_jpg)
assert e.value.status_code == 403
assert e.value.error.message == 'Out of call volume quota for FormRecognizer F0 pricing tier. Please retry after 1 day. To increase your call volume switch to a paid tier.'
@@ -108,9 +108,9 @@ def test_mock_quota_exceeded_429(self, formrecognizer_test_endpoint, formrecogni
response.content_type = "application/json"
transport = mock.Mock(send=lambda request, **kwargs: response)
- client = FormRecognizerClient(formrecognizer_test_endpoint, AzureKeyCredential(formrecognizer_test_api_key), transport=transport)
+ client = DocumentAnalysisClient(formrecognizer_test_endpoint, AzureKeyCredential(formrecognizer_test_api_key), transport=transport)
with pytest.raises(HttpResponseError) as e:
- poller = client.begin_recognize_receipts_from_url(self.receipt_url_jpg)
+ poller = client.begin_analyze_document_from_url("prebuilt-receipt", self.receipt_url_jpg)
assert e.value.status_code == 429
assert e.value.error.message == 'Out of call volume quota for FormRecognizer F0 pricing tier. Please retry after 1 day. To increase your call volume switch to a paid tier.'
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_logging_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_logging_async.py
index 5d0a0474bbe1..774e53b255f5 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_logging_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_logging_async.py
@@ -15,7 +15,7 @@
from unittest import mock
except ImportError: # python < 3.3
import mock # type: ignore
-from azure.ai.formrecognizer.aio import FormRecognizerClient, FormTrainingClient
+from azure.ai.formrecognizer.aio import DocumentAnalysisClient, DocumentModelAdministrationClient
from azure.core.credentials import AzureKeyCredential
from azure.core.exceptions import HttpResponseError
from preparers import FormRecognizerPreparer
@@ -62,20 +62,20 @@ def __init__(self, *args, **kwargs):
self.__aenter__ = mock.Mock(return_value=get_completed_future())
self.__aexit__ = mock.Mock(return_value=get_completed_future())
-@pytest.mark.skip
+
class TestLogging(AsyncFormRecognizerTest):
@FormRecognizerPreparer()
@pytest.mark.live_test_only
- async def test_logging_info_fr_client(self, formrecognizer_test_endpoint, formrecognizer_test_api_key):
- client = FormRecognizerClient(formrecognizer_test_endpoint, AzureKeyCredential(formrecognizer_test_api_key))
+ async def test_logging_info_dac_client(self, formrecognizer_test_endpoint, formrecognizer_test_api_key):
+ client = DocumentAnalysisClient(formrecognizer_test_endpoint, AzureKeyCredential(formrecognizer_test_api_key))
mock_handler = MockHandler()
logger = logging.getLogger("azure")
logger.addHandler(mock_handler)
logger.setLevel(logging.INFO)
async with client:
- poller = await client.begin_recognize_invoices_from_url(self.receipt_url_jpg)
+ poller = await client.begin_analyze_document_from_url("prebuilt-receipt", self.receipt_url_jpg)
result = await poller.result()
for message in mock_handler.messages:
@@ -88,15 +88,15 @@ async def test_logging_info_fr_client(self, formrecognizer_test_endpoint, formre
@FormRecognizerPreparer()
@pytest.mark.live_test_only
- async def test_logging_info_ft_client(self, formrecognizer_test_endpoint, formrecognizer_test_api_key):
- client = FormTrainingClient(formrecognizer_test_endpoint, AzureKeyCredential(formrecognizer_test_api_key))
+ async def test_logging_info_dmac_client(self, formrecognizer_test_endpoint, formrecognizer_test_api_key):
+ client = DocumentModelAdministrationClient(formrecognizer_test_endpoint, AzureKeyCredential(formrecognizer_test_api_key))
mock_handler = MockHandler()
logger = logging.getLogger("azure")
logger.addHandler(mock_handler)
logger.setLevel(logging.INFO)
async with client:
- result = await client.get_account_properties()
+ result = await client.get_account_info()
for message in mock_handler.messages:
if message.levelname == "INFO":
@@ -121,10 +121,10 @@ async def test_mock_quota_exceeded_403(self, formrecognizer_test_endpoint, formr
response.content_type = "application/json"
transport = AsyncMockTransport(send=wrap_in_future(lambda request, **kwargs: response))
- client = FormRecognizerClient(formrecognizer_test_endpoint, AzureKeyCredential(formrecognizer_test_api_key), transport=transport)
+ client = DocumentAnalysisClient(formrecognizer_test_endpoint, AzureKeyCredential(formrecognizer_test_api_key), transport=transport)
with pytest.raises(HttpResponseError) as e:
- poller = await client.begin_recognize_receipts_from_url(self.receipt_url_jpg)
+ poller = await client.begin_analyze_document_from_url("prebuilt-receipt", self.receipt_url_jpg)
assert e.value.status_code == 403
assert e.value.error.message == 'Out of call volume quota for FormRecognizer F0 pricing tier. Please retry after 1 day. To increase your call volume switch to a paid tier.'
@@ -142,8 +142,8 @@ async def test_mock_quota_exceeded_429(self, formrecognizer_test_endpoint, formr
response.content_type = "application/json"
transport = AsyncMockTransport(send=wrap_in_future(lambda request, **kwargs: response))
- client = FormRecognizerClient(formrecognizer_test_endpoint, AzureKeyCredential(formrecognizer_test_api_key), transport=transport)
+ client = DocumentAnalysisClient(formrecognizer_test_endpoint, AzureKeyCredential(formrecognizer_test_api_key), transport=transport)
with pytest.raises(HttpResponseError) as e:
- poller = await client.begin_recognize_receipts_from_url(self.receipt_url_jpg)
+ poller = await client.begin_analyze_document_from_url("prebuilt-receipt", self.receipt_url_jpg)
assert e.value.status_code == 429
- assert e.value.error.message == 'Out of call volume quota for FormRecognizer F0 pricing tier. Please retry after 1 day. To increase your call volume switch to a paid tier.'
\ No newline at end of file
+ assert e.value.error.message == 'Out of call volume quota for FormRecognizer F0 pricing tier. Please retry after 1 day. To increase your call volume switch to a paid tier.'
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_mgmt.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_mgmt.py
index dbd32752e8f6..cbb417410f23 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_mgmt.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_mgmt.py
@@ -27,7 +27,6 @@
class TestManagement(FormRecognizerTest):
- @pytest.mark.skip("aad not working in canary")
@FormRecognizerPreparer()
@pytest.mark.live_test_only
def test_active_directory_auth(self):
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_mgmt_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_mgmt_async.py
index c56f1d12c1a9..e4c6301567de 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_mgmt_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_mgmt_async.py
@@ -29,7 +29,6 @@
class TestManagementAsync(AsyncFormRecognizerTest):
- @pytest.mark.skip("no aad yet in private preview")
@FormRecognizerPreparer()
@pytest.mark.live_test_only
async def test_active_directory_auth_async(self):
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_receipt.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_receipt.py
index 68e399005f9b..16888d669c22 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_receipt.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_receipt.py
@@ -388,13 +388,12 @@ def test_receipt_locale_specified(self, client):
@FormRecognizerPreparer()
@GlobalClientPreparer()
- @pytest.mark.skip("the service is returning a different error code")
def test_receipt_locale_error(self, client):
with open(self.receipt_jpg, "rb") as fd:
receipt = fd.read()
with pytest.raises(HttpResponseError) as e:
client.begin_analyze_document("prebuilt-receipt", receipt, locale="not a locale")
- assert "UnsupportedLocale" == e.value.error.code
+ assert "InvalidArgument" == e.value.error.code
@FormRecognizerPreparer()
@GlobalClientPreparerV2(client_kwargs={"api_version": FormRecognizerApiVersion.V2_0})
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_receipt_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_receipt_async.py
index 538432c44bcf..e097572866c2 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_receipt_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_receipt_async.py
@@ -400,14 +400,13 @@ async def test_receipt_locale_specified(self, client):
@FormRecognizerPreparer()
@GlobalClientPreparer()
- @pytest.mark.skip("the service is returning a different error code")
async def test_receipt_locale_error(self, client):
with open(self.receipt_jpg, "rb") as fd:
receipt = fd.read()
with pytest.raises(HttpResponseError) as e:
async with client:
await client.begin_analyze_document("prebuilt-receipt", receipt, locale="not a locale")
- assert "UnsupportedLocale" == e.value.error.code
+ assert "InvalidArgument" == e.value.error.code
@FormRecognizerPreparer()
@GlobalClientPreparerV2(client_kwargs={"api_version": FormRecognizerApiVersion.V2_0})
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_receipt_from_url.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_receipt_from_url.py
index da50faad515b..072f11882508 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_receipt_from_url.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_receipt_from_url.py
@@ -35,7 +35,6 @@ def test_polling_interval(self, formrecognizer_test_endpoint, formrecognizer_tes
self.assertEqual(poller2._polling_method._timeout, 7) # goes back to client default
@pytest.mark.live_test_only
- @pytest.mark.skip("aad not enabled yet in v2021-07-30")
def test_active_directory_auth(self):
token = self.generate_oauth_token()
endpoint = self.get_oauth_endpoint()
@@ -300,11 +299,10 @@ def test_receipt_locale_specified(self, client):
@FormRecognizerPreparer()
@GlobalClientPreparer()
- @pytest.mark.skip("different error code being returned")
def test_receipt_locale_error(self, client):
with pytest.raises(HttpResponseError) as e:
client.begin_analyze_document_from_url("prebuilt-receipt", self.receipt_url_jpg, locale="not a locale")
- assert "UnsupportedLocale" == e.value.error.code
+ assert "InvalidArgument" == e.value.error.code
@FormRecognizerPreparer()
@GlobalClientPreparerV2(client_kwargs={"api_version": FormRecognizerApiVersion.V2_0})
diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_receipt_from_url_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_receipt_from_url_async.py
index 14737014a0f0..c26ec7acb7cc 100644
--- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_receipt_from_url_async.py
+++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_receipt_from_url_async.py
@@ -39,7 +39,6 @@ async def test_polling_interval(self, formrecognizer_test_endpoint, formrecogniz
@pytest.mark.live_test_only
@FormRecognizerPreparer()
- @pytest.mark.skip("aad not enabled yet in v2021-07-30")
async def test_active_directory_auth_async(self):
token = self.generate_oauth_token()
endpoint = self.get_oauth_endpoint()
@@ -333,12 +332,11 @@ async def test_receipt_locale_specified(self, client):
@FormRecognizerPreparer()
@GlobalClientPreparer()
- @pytest.mark.skip("different error code being returned")
async def test_receipt_locale_error(self, client):
with pytest.raises(HttpResponseError) as e:
async with client:
await client.begin_analyze_document_from_url("prebuilt-receipt", self.receipt_url_jpg, locale="not a locale")
- assert "UnsupportedLocale" == e.value.error.code
+ assert "InvalidArgument" == e.value.error.code
@FormRecognizerPreparer()
@GlobalClientPreparerV2(client_kwargs={"api_version": FormRecognizerApiVersion.V2_0})
diff --git a/sdk/identity/azure-identity/README.md b/sdk/identity/azure-identity/README.md
index 0f3c12139e16..6306917ccd5b 100644
--- a/sdk/identity/azure-identity/README.md
+++ b/sdk/identity/azure-identity/README.md
@@ -9,6 +9,10 @@ This library does not support Azure Active Directory B2C.
| [API reference documentation][ref_docs]
| [Azure Active Directory documentation](https://docs.microsoft.com/azure/active-directory/)
+## _Disclaimer_
+
+_Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
+
## Getting started
### Install the package
diff --git a/sdk/identity/azure-identity/setup.py b/sdk/identity/azure-identity/setup.py
index 9dcd57da02a4..6ffc1683458d 100644
--- a/sdk/identity/azure-identity/setup.py
+++ b/sdk/identity/azure-identity/setup.py
@@ -61,6 +61,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
+ "Programming Language :: Python :: 3.10",
"License :: OSI Approved :: MIT License",
],
zip_safe=False,
diff --git a/sdk/keyvault/azure-keyvault-administration/README.md b/sdk/keyvault/azure-keyvault-administration/README.md
index 6d280c29554c..4f1089e1fdb4 100644
--- a/sdk/keyvault/azure-keyvault-administration/README.md
+++ b/sdk/keyvault/azure-keyvault-administration/README.md
@@ -16,6 +16,10 @@ create, manage, and deploy public and private SSL/TLS certificates
[Package (PyPI)][pypi_package_administration] | [API reference documentation][reference_docs] | [Product documentation][keyvault_docs]
+## _Disclaimer_
+
+_Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
+
## Getting started
### Install packages
Install [azure-keyvault-administration][pypi_package_administration] and
diff --git a/sdk/keyvault/azure-keyvault-administration/setup.py b/sdk/keyvault/azure-keyvault-administration/setup.py
index 15a86bfbbeaf..0231b074702c 100644
--- a/sdk/keyvault/azure-keyvault-administration/setup.py
+++ b/sdk/keyvault/azure-keyvault-administration/setup.py
@@ -68,6 +68,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
+ "Programming Language :: Python :: 3.10",
"License :: OSI Approved :: MIT License",
],
zip_safe=False,
diff --git a/sdk/keyvault/azure-keyvault-certificates/README.md b/sdk/keyvault/azure-keyvault-certificates/README.md
index 1d06d3e37c9a..ed21c6c5cf4a 100644
--- a/sdk/keyvault/azure-keyvault-certificates/README.md
+++ b/sdk/keyvault/azure-keyvault-certificates/README.md
@@ -11,6 +11,10 @@ and other secrets
[Source code][certificates_client_src] | [Package (PyPI)][pypi_package_certificates] | [API reference documentation][reference_docs] | [Product documentation][keyvault_docs] | [Samples][certificates_samples]
+## _Disclaimer_
+
+_Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
+
## Getting started
### Install the package
Install [azure-keyvault-certificates][pypi_package_certificates] and
diff --git a/sdk/keyvault/azure-keyvault-certificates/setup.py b/sdk/keyvault/azure-keyvault-certificates/setup.py
index 3dfd40f5726a..e9d54c896c34 100644
--- a/sdk/keyvault/azure-keyvault-certificates/setup.py
+++ b/sdk/keyvault/azure-keyvault-certificates/setup.py
@@ -69,6 +69,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
+ "Programming Language :: Python :: 3.10",
"License :: OSI Approved :: MIT License",
],
zip_safe=False,
diff --git a/sdk/keyvault/azure-keyvault-keys/README.md b/sdk/keyvault/azure-keyvault-keys/README.md
index bbe3597447b8..ae86032483d9 100644
--- a/sdk/keyvault/azure-keyvault-keys/README.md
+++ b/sdk/keyvault/azure-keyvault-keys/README.md
@@ -13,6 +13,10 @@ create, manage, and deploy public and private SSL/TLS certificates
[Source code][key_client_src] | [Package (PyPI)][pypi_package_keys] | [API reference documentation][reference_docs] | [Product documentation][keyvault_docs] | [Samples][key_samples]
+## _Disclaimer_
+
+_Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
+
## Getting started
### Install packages
Install [azure-keyvault-keys][pypi_package_keys] and
diff --git a/sdk/keyvault/azure-keyvault-keys/setup.py b/sdk/keyvault/azure-keyvault-keys/setup.py
index 5eb6f5522963..3a12c3d53b5d 100644
--- a/sdk/keyvault/azure-keyvault-keys/setup.py
+++ b/sdk/keyvault/azure-keyvault-keys/setup.py
@@ -68,6 +68,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
+ "Programming Language :: Python :: 3.10",
"License :: OSI Approved :: MIT License",
],
zip_safe=False,
diff --git a/sdk/keyvault/azure-keyvault-secrets/README.md b/sdk/keyvault/azure-keyvault-secrets/README.md
index 0ec1bcc3e8d6..13142a68ab23 100644
--- a/sdk/keyvault/azure-keyvault-secrets/README.md
+++ b/sdk/keyvault/azure-keyvault-secrets/README.md
@@ -14,6 +14,10 @@ create, manage, and deploy public and private SSL/TLS certificates
[Source code][secret_client_src] | [Package (PyPI)][pypi_package_secrets] | [API reference documentation][reference_docs] | [Product documentation][keyvault_docs] | [Samples][secret_samples]
+## _Disclaimer_
+
+_Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
+
## Getting started
### Install packages
Install [azure-keyvault-secrets][pypi_package_secrets] and
diff --git a/sdk/keyvault/azure-keyvault-secrets/setup.py b/sdk/keyvault/azure-keyvault-secrets/setup.py
index bdcb5e2c6f04..b8e377b75496 100644
--- a/sdk/keyvault/azure-keyvault-secrets/setup.py
+++ b/sdk/keyvault/azure-keyvault-secrets/setup.py
@@ -69,6 +69,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
+ "Programming Language :: Python :: 3.10",
"License :: OSI Approved :: MIT License",
],
zip_safe=False,
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/README.md b/sdk/metricsadvisor/azure-ai-metricsadvisor/README.md
index b60a6eb58487..65030e7efb4d 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/README.md
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/README.md
@@ -8,6 +8,10 @@ Metrics Advisor is a scalable real-time time series monitoring, alerting, and ro
[Source code][src_code] | [Package (Pypi)][package] | [API reference documentation][reference_documentation] | [Product documentation][ma_docs] | [Samples][samples_readme]
+## _Disclaimer_
+
+_Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
+
## Getting started
### Install the package
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/setup.py b/sdk/metricsadvisor/azure-ai-metricsadvisor/setup.py
index 76912bfddf36..117821428f55 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/setup.py
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/setup.py
@@ -69,6 +69,7 @@
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
+ 'Programming Language :: Python :: 3.10',
'License :: OSI Approved :: MIT License',
],
zip_safe=False,
diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md b/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md
index 556d3532b5aa..eff8b60cc8d3 100644
--- a/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md
+++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md
@@ -1,12 +1,14 @@
# Release History
- **Features**
- - Support stamp specific redirect in exporters
- ([#20489](https://github.com/Azure/azure-sdk-for-python/pull/20489))
+## 1.0.0b5 (2021-10-05)
- **Breaking Changes**
- - Change exporter OT to AI mapping fields following common schema
- ([#20445](https://github.com/Azure/azure-sdk-for-python/pull/20445))
+### Features Added
+- Support stamp specific redirect in exporters
+ ([#20489](https://github.com/Azure/azure-sdk-for-python/pull/20489))
+
+### Breaking Changes
+- Change exporter OT to AI mapping fields following common schema
+ ([#20445](https://github.com/Azure/azure-sdk-for-python/pull/20445))
## 1.0.0b4 (2021-04-06)
diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/README.md b/sdk/monitor/azure-monitor-opentelemetry-exporter/README.md
index 7f3e594ccd44..38b856901f16 100644
--- a/sdk/monitor/azure-monitor-opentelemetry-exporter/README.md
+++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/README.md
@@ -21,7 +21,7 @@ To use this package, you must have:
* Azure subscription - [Create a free account][azure_sub]
* Azure Monitor - [How to use application insights][application_insights_namespace]
* Opentelemetry SDK - [Opentelemtry SDK for Python][ot_sdk_python]
-* Python 3.5 or later - [Install Python][python]
+* Python 3.6 or later - [Install Python][python]
### Instantiate the client
diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_version.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_version.py
index 3938d6c3e835..9ed953daa8fe 100644
--- a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_version.py
+++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_version.py
@@ -5,4 +5,4 @@
# license information.
# --------------------------------------------------------------------------
-VERSION = "1.0.0b4"
+VERSION = "1.0.0b5"
diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/trace/_exporter.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/trace/_exporter.py
index 732fe0caa160..73b1e714d5ae 100644
--- a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/trace/_exporter.py
+++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/trace/_exporter.py
@@ -6,6 +6,8 @@
from typing import Sequence, Any
from urllib.parse import urlparse
+from opentelemetry.semconv.resource import ResourceAttributes
+from opentelemetry.semconv.trace import DbSystemValues, SpanAttributes
from opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult
from opentelemetry.sdk.util import ns_to_iso_str
from opentelemetry.trace import Span, SpanKind
@@ -91,9 +93,9 @@ def _convert_span_to_envelope(span: Span) -> TelemetryItem:
time=ns_to_iso_str(span.start_time),
)
if span.resource and span.resource.attributes:
- service_name = span.resource.attributes.get("service.name")
- service_namespace = span.resource.attributes.get("service.namespace")
- service_instance_id = span.resource.attributes.get("service.instance.id")
+ service_name = span.resource.attributes.get(ResourceAttributes.SERVICE_NAME)
+ service_namespace = span.resource.attributes.get(ResourceAttributes.SERVICE_NAMESPACE)
+ service_instance_id = span.resource.attributes.get(ResourceAttributes.SERVICE_INSTANCE_ID)
if service_name:
if service_namespace:
envelope.tags["ai.cloud.role"] = service_namespace + \
@@ -106,8 +108,8 @@ def _convert_span_to_envelope(span: Span) -> TelemetryItem:
envelope.tags["ai.cloud.roleInstance"] = platform.node() # hostname default
envelope.tags["ai.internal.nodeName"] = envelope.tags["ai.cloud.roleInstance"]
envelope.tags["ai.operation.id"] = "{:032x}".format(span.context.trace_id)
- if "enduser.id" in span.attributes:
- envelope.tags["ai.user.id"] = span.attributes["enduser.id"]
+ if SpanAttributes.ENDUSER_ID in span.attributes:
+ envelope.tags["ai.user.id"] = span.attributes[SpanAttributes.ENDUSER_ID]
if span.parent and span.parent.span_id:
envelope.tags["ai.operation.parentId"] = "{:016x}".format(
span.parent.span_id
@@ -116,7 +118,7 @@ def _convert_span_to_envelope(span: Span) -> TelemetryItem:
if span.kind in (SpanKind.CONSUMER, SpanKind.SERVER):
envelope.name = "Microsoft.ApplicationInsights.Request"
data = RequestData(
- name=span.name[:1024], # Breeze max length
+ name=span.name,
id="{:016x}".format(span.context.span_id),
duration=_utils.ns_to_duration(span.end_time - span.start_time),
response_code="0",
@@ -124,86 +126,105 @@ def _convert_span_to_envelope(span: Span) -> TelemetryItem:
properties={},
)
envelope.data = MonitorBase(base_data=data, base_type="RequestData")
- if "http.method" in span.attributes: # HTTP
- envelope.tags["ai.operation.name"] = "{} {}".format(
- span.attributes["http.method"],
- span.name,
- )
- data.properties["request.name"] = data.name
+ if SpanAttributes.HTTP_METHOD in span.attributes: # HTTP
url = ""
- if "http.user_agent" in span.attributes:
+ path = ""
+ if SpanAttributes.HTTP_USER_AGENT in span.attributes:
# TODO: Not exposed in Swagger, need to update def
- envelope.tags["ai.user.userAgent"] = span.attributes["http.user_agent"]
- if "http.client_ip" in span.attributes:
- envelope.tags["ai.location.ip"] = span.attributes["http.client_ip"]
- elif "net.peer.ip" in span.attributes:
- envelope.tags["ai.location.ip"] = span.attributes["net.peer.ip"]
+ envelope.tags["ai.user.userAgent"] = span.attributes[SpanAttributes.HTTP_USER_AGENT]
+ if SpanAttributes.HTTP_CLIENT_IP in span.attributes:
+ envelope.tags["ai.location.ip"] = span.attributes[SpanAttributes.HTTP_CLIENT_IP]
+ elif SpanAttributes.NET_PEER_IP in span.attributes:
+ envelope.tags["ai.location.ip"] = span.attributes[SpanAttributes.NET_PEER_IP]
# url
- if "http.url" in span.attributes:
- url = span.attributes["http.url"]
- elif "http.scheme" in span.attributes and "http.target" in span.attributes:
- scheme = span.attributes["http.scheme"]
- http_target = span.attributes["http.target"]
- if "http.host" in span.attributes:
+ if SpanAttributes.HTTP_URL in span.attributes:
+ url = span.attributes[SpanAttributes.HTTP_URL]
+ elif SpanAttributes.HTTP_SCHEME in span.attributes and SpanAttributes.HTTP_TARGET in span.attributes:
+ scheme = span.attributes[SpanAttributes.HTTP_SCHEME]
+ http_target = span.attributes[SpanAttributes.HTTP_TARGET]
+ if SpanAttributes.HTTP_HOST in span.attributes:
url = "{}://{}{}".format(
scheme,
- span.attributes["http.host"],
+ span.attributes[SpanAttributes.HTTP_HOST],
http_target,
)
- elif "net.host.port" in span.attributes:
- host_port = span.attributes["net.host.port"]
- if "http.server_name" in span.attributes:
- server_name = span.attributes["http.server_name"]
+ elif SpanAttributes.NET_HOST_PORT in span.attributes:
+ host_port = span.attributes[SpanAttributes.NET_HOST_PORT]
+ if SpanAttributes.HTTP_SERVER_NAME in span.attributes:
+ server_name = span.attributes[SpanAttributes.HTTP_SERVER_NAME]
url = "{}://{}:{}{}".format(
scheme,
server_name,
host_port,
http_target,
)
- elif "net.host.name" in span.attributes:
- host_name = span.attributes["net.host.name"]
+ elif SpanAttributes.NET_HOST_NAME in span.attributes:
+ host_name = span.attributes[SpanAttributes.NET_HOST_NAME]
url = "{}://{}:{}{}".format(
scheme,
host_name,
host_port,
http_target,
)
- if url:
- url = url[:2048] # Breeze max length
data.url = url
- data.properties["request.url"] = url
- if "http.status_code" in span.attributes:
- status_code = span.attributes["http.status_code"]
+ # Http specific logic for ai.operation.name
+ if SpanAttributes.HTTP_ROUTE in span.attributes:
+ envelope.tags["ai.operation.name"] = "{} {}".format(
+ span.attributes[SpanAttributes.HTTP_METHOD],
+ span.attributes[SpanAttributes.HTTP_ROUTE],
+ )
+ elif url:
+ try:
+ parse_url = urlparse(url)
+ path = parse_url.path
+ if not path:
+ path = "/"
+ envelope.tags["ai.operation.name"] = "{} {}".format(
+ span.attributes[SpanAttributes.HTTP_METHOD],
+ path,
+ )
+ except Exception: # pylint: disable=broad-except
+ pass
+ else:
+ envelope.tags["ai.operation.name"] = span.name
+ if SpanAttributes.HTTP_STATUS_CODE in span.attributes:
+ status_code = span.attributes[SpanAttributes.HTTP_STATUS_CODE]
data.response_code = str(status_code)
- elif "messaging.system" in span.attributes: # Messaging
+ elif SpanAttributes.MESSAGING_SYSTEM in span.attributes: # Messaging
envelope.tags["ai.operation.name"] = span.name
- if "net.peer.ip" in span.attributes:
- envelope.tags["ai.location.ip"] = span.attributes["net.peer.ip"]
- if "messaging.destination" in span.attributes:
- if "net.peer.name" in span.attributes:
+ if SpanAttributes.NET_PEER_IP in span.attributes:
+ envelope.tags["ai.location.ip"] = span.attributes[SpanAttributes.NET_PEER_IP]
+ if SpanAttributes.MESSAGING_DESTINATION in span.attributes:
+ if SpanAttributes.NET_PEER_NAME in span.attributes:
data.properties["source"] = "{}/{}".format(
- span.attributes["net.peer.name"],
- span.attributes["messaging.destination"],
+ span.attributes[SpanAttributes.NET_PEER_NAME],
+ span.attributes[SpanAttributes.MESSAGING_DESTINATION],
)
- elif "net.peer.ip" in span.attributes:
+ elif SpanAttributes.NET_PEER_IP in span.attributes:
data.properties["source"] = "{}/{}".format(
- span.attributes["net.peer.ip"],
- span.attributes["messaging.destination"],
+ span.attributes[SpanAttributes.NET_PEER_IP],
+ span.attributes[SpanAttributes.MESSAGING_DESTINATION],
)
else:
- data.properties["source"] = span.attributes["messaging.destination"]
+ data.properties["source"] = span.attributes[SpanAttributes.MESSAGING_DESTINATION]
else: # Other
envelope.tags["ai.operation.name"] = span.name
- if "net.peer.ip" in span.attributes:
- envelope.tags["ai.location.ip"] = span.attributes["net.peer.ip"]
- data.response_code = data.response_code[:1024] # Breeze max length
+ if SpanAttributes.NET_PEER_IP in span.attributes:
+ envelope.tags["ai.location.ip"] = span.attributes[SpanAttributes.NET_PEER_IP]
+ # Apply truncation
+ if data.url:
+ data.url = data.url[:2048] # Breeze max length
+ if data.response_code:
+ data.response_code = data.response_code[:1024] # Breeze max length
+ if envelope.tags["ai.operation.name"]:
+ data.name = envelope.tags["ai.operation.name"][:1024] # Breeze max length
else: # INTERNAL, CLIENT, PRODUCER
envelope.name = "Microsoft.ApplicationInsights.RemoteDependency"
# TODO: ai.operation.name for non-server spans
data = RemoteDependencyData(
- name=span.name[:1024], # Breeze max length
+ name=span.name,
id="{:016x}".format(span.context.span_id),
- result_code=str(span.status.status_code.value),
+ result_code="0",
duration=_utils.ns_to_duration(span.end_time - span.start_time),
success=span.status.is_ok,
properties={},
@@ -212,110 +233,123 @@ def _convert_span_to_envelope(span: Span) -> TelemetryItem:
base_data=data, base_type="RemoteDependencyData"
)
target = None
- if "peer.service" in span.attributes:
- target = span.attributes["peer.service"]
+ if SpanAttributes.PEER_SERVICE in span.attributes:
+ target = span.attributes[SpanAttributes.PEER_SERVICE]
else:
- if "net.peer.name" in span.attributes:
- target = span.attributes["net.peer.name"]
- elif "net.peer.ip" in span.attributes:
- target = span.attributes["net.peer.ip"]
- if "net.peer.port" in span.attributes:
- port = span.attributes["net.peer.port"]
+ if SpanAttributes.NET_PEER_NAME in span.attributes:
+ target = span.attributes[SpanAttributes.NET_PEER_NAME]
+ elif SpanAttributes.NET_PEER_IP in span.attributes:
+ target = span.attributes[SpanAttributes.NET_PEER_IP]
+ if SpanAttributes.NET_PEER_PORT in span.attributes:
+ port = span.attributes[SpanAttributes.NET_PEER_PORT]
# TODO: check default port for rpc
# This logic assumes default ports never conflict across dependency types
- if port != _get_default_port_http(span.attributes.get("http.scheme")) and \
- port != _get_default_port_db(span.attributes.get("db.system")):
+ if port != _get_default_port_http(span.attributes.get(SpanAttributes.HTTP_SCHEME)) and \
+ port != _get_default_port_db(span.attributes.get(SpanAttributes.DB_SYSTEM)):
target = "{}:{}".format(target, port)
if span.kind is SpanKind.CLIENT:
- if "http.method" in span.attributes: # HTTP
+ if SpanAttributes.HTTP_METHOD in span.attributes: # HTTP
data.type = "HTTP"
- if "http.user_agent" in span.attributes:
+ if SpanAttributes.HTTP_USER_AGENT in span.attributes:
# TODO: Not exposed in Swagger, need to update def
- envelope.tags["ai.user.userAgent"] = span.attributes["http.user_agent"]
- scheme = span.attributes.get("http.scheme")
- url = ""
- # Target
- if "http.url" in span.attributes:
- url = span.attributes["http.url"]
- # http specific logic for target
- if "peer.service" not in span.attributes:
- try:
- parse_url = urlparse(url)
- if parse_url.port == _get_default_port_http(scheme):
- target = parse_url.hostname
- else:
- target = parse_url.netloc
- except Exception: # pylint: disable=broad-except
- logger.warning("Error while parsing url.")
- # http specific logic for target
- if "peer.service" not in span.attributes and "http.host" in span.attributes:
- host = span.attributes["http.host"]
- try:
- # urlparse insists on absolute URLs starting with "//"
- # This logic assumes host does not include a "//"
- host_name = urlparse("//" + host)
- if host_name.port == _get_default_port_http(scheme):
- target = host_name.hostname
- else:
- target = host
- except Exception: # pylint: disable=broad-except
- logger.warning("Error while parsing hostname.")
+ envelope.tags["ai.user.userAgent"] = span.attributes[SpanAttributes.HTTP_USER_AGENT]
+ scheme = span.attributes.get(SpanAttributes.HTTP_SCHEME)
# url
- if not url:
- if scheme and "http.target" in span.attributes:
- http_target = span.attributes["http.target"]
- if "http.host" in span.attributes:
- url = "{}://{}{}".format(
+ url = ""
+ if SpanAttributes.HTTP_URL in span.attributes:
+ url = span.attributes[SpanAttributes.HTTP_URL]
+ elif scheme and SpanAttributes.HTTP_TARGET in span.attributes:
+ http_target = span.attributes[SpanAttributes.HTTP_TARGET]
+ if SpanAttributes.HTTP_HOST in span.attributes:
+ url = "{}://{}{}".format(
+ scheme,
+ span.attributes[SpanAttributes.HTTP_HOST],
+ http_target,
+ )
+ elif SpanAttributes.NET_PEER_PORT in span.attributes:
+ peer_port = span.attributes[SpanAttributes.NET_PEER_PORT]
+ if SpanAttributes.NET_PEER_NAME in span.attributes:
+ peer_name = span.attributes[SpanAttributes.NET_PEER_NAME]
+ url = "{}://{}:{}{}".format(
scheme,
- span.attributes["http.host"],
+ peer_name,
+ peer_port,
http_target,
)
- elif "net.peer.port" in span.attributes:
- peer_port = span.attributes["net.peer.port"]
- if "net.peer.name" in span.attributes:
- peer_name = span.attributes["net.peer.name"]
- url = "{}://{}:{}{}".format(
- scheme,
- peer_name,
- peer_port,
- http_target,
- )
- elif "net.peer.ip" in span.attributes:
- peer_ip = span.attributes["net.peer.ip"]
- url = "{}://{}:{}{}".format(
- scheme,
- peer_ip,
- peer_port,
- http_target,
- )
+ elif SpanAttributes.NET_PEER_IP in span.attributes:
+ peer_ip = span.attributes[SpanAttributes.NET_PEER_IP]
+ url = "{}://{}:{}{}".format(
+ scheme,
+ peer_ip,
+ peer_port,
+ http_target,
+ )
+ target_from_url = ""
+ path = ""
+ if url:
+ try:
+ parse_url = urlparse(url)
+ path = parse_url.path
+ if not path:
+ path = "/"
+ if parse_url.port == _get_default_port_http(scheme):
+ target_from_url = parse_url.hostname
+ else:
+ target_from_url = parse_url.netloc
+ except Exception: # pylint: disable=broad-except
+ pass
+ # http specific logic for name
+ if path:
+ data.name = "{} {}".format(
+ span.attributes[SpanAttributes.HTTP_METHOD],
+ path,
+ )
+ # http specific logic for target
+ if SpanAttributes.PEER_SERVICE not in span.attributes:
+ if SpanAttributes.HTTP_HOST in span.attributes:
+ host = span.attributes[SpanAttributes.HTTP_HOST]
+ try:
+ # urlparse insists on absolute URLs starting with "//"
+ # This logic assumes host does not include a "//"
+ host_name = urlparse("//" + host)
+ if host_name.port == _get_default_port_http(scheme):
+ target = host_name.hostname
+ else:
+ target = host
+ except Exception: # pylint: disable=broad-except
+ logger.warning("Error while parsing hostname.")
+ elif target_from_url:
+ target = target_from_url
# data is url
data.data = url
- if "http.status_code" in span.attributes:
- status_code = span.attributes["http.status_code"]
+ if SpanAttributes.HTTP_STATUS_CODE in span.attributes:
+ status_code = span.attributes[SpanAttributes.HTTP_STATUS_CODE]
data.result_code = str(status_code)
- elif "db.system" in span.attributes: # Database
- db_system = span.attributes["db.system"]
- if _is_relational_db(db_system):
- data.type = "SQL"
- else:
+ elif SpanAttributes.DB_SYSTEM in span.attributes: # Database
+ db_system = span.attributes[SpanAttributes.DB_SYSTEM]
+ if not _is_sql_db(db_system):
data.type = db_system
- # data is the full statement
- if "db.statement" in span.attributes:
- data.data = span.attributes["db.statement"]
+ else:
+ data.type = "SQL"
+ # data is the full statement or operation
+ if SpanAttributes.DB_STATEMENT in span.attributes:
+ data.data = span.attributes[SpanAttributes.DB_STATEMENT]
+ elif SpanAttributes.DB_OPERATION in span.attributes:
+ data.data = span.attributes[SpanAttributes.DB_OPERATION]
# db specific logic for target
- if "db.name" in span.attributes:
- db_name = span.attributes["db.name"]
+ if SpanAttributes.DB_NAME in span.attributes:
+ db_name = span.attributes[SpanAttributes.DB_NAME]
if target is None:
target = db_name
else:
- target = "{}/{}".format(target, db_name)
+ target = "{}|{}".format(target, db_name)
if target is None:
target = db_system
- elif "rpc.system" in span.attributes: # Rpc
- data.type = "rpc.system"
+ elif SpanAttributes.RPC_SYSTEM in span.attributes: # Rpc
+ data.type = SpanAttributes.RPC_SYSTEM
# TODO: data.data for rpc
if target is None:
- target = span.attributes["rpc.system"]
+ target = span.attributes[SpanAttributes.RPC_SYSTEM]
else:
# TODO: Azure specific types
data.type = "N/A"
@@ -334,6 +368,8 @@ def _convert_span_to_envelope(span: Span) -> TelemetryItem:
data.data = data.data[:8192]
if target:
data.target = target[:1024]
+ if data.name:
+ data.name = data.name[:1024]
for key, val in span.attributes.items():
# Remove Opentelemetry related span attributes from custom dimensions
if key.startswith("http.") or \
@@ -361,16 +397,28 @@ def _convert_span_to_envelope(span: Span) -> TelemetryItem:
return envelope
+# pylint:disable=too-many-return-statements
def _get_default_port_db(dbsystem):
- if dbsystem == "postgresql":
+ if dbsystem == DbSystemValues.POSTGRESQL.value:
return 5432
- if dbsystem == "mysql":
+ if dbsystem == DbSystemValues.CASSANDRA.value:
+ return 9042
+ if dbsystem in (DbSystemValues.MARIADB.value, DbSystemValues.MYSQL.value):
return 3306
+ if dbsystem == DbSystemValues.MSSQL.value:
+ return 1433
+ # TODO: Add in memcached
if dbsystem == "memcached":
return 11211
- if dbsystem == "mongodb":
- return 27017
- if dbsystem == "redis":
+ if dbsystem == DbSystemValues.DB2.value:
+ return 50000
+ if dbsystem == DbSystemValues.ORACLE.value:
+ return 1521
+ if dbsystem == DbSystemValues.H2.value:
+ return 8082
+ if dbsystem == DbSystemValues.DERBY.value:
+ return 1527
+ if dbsystem == DbSystemValues.REDIS.value:
return 6379
return 0
@@ -383,5 +431,15 @@ def _get_default_port_http(scheme):
return 0
-def _is_relational_db(dbsystem):
- return dbsystem in ["postgresql", "mysql"]
+def _is_sql_db(dbsystem):
+ return dbsystem in (
+ DbSystemValues.DB2.value,
+ DbSystemValues.DERBY.value,
+ DbSystemValues.MARIADB.value,
+ DbSystemValues.MSSQL.value,
+ DbSystemValues.ORACLE.value,
+ DbSystemValues.SQLITE.value,
+ DbSystemValues.OTHER_SQL.value,
+ DbSystemValues.HSQLDB.value,
+ DbSystemValues.H2.value,
+ )
diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/trace/test_trace.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/trace/test_trace.py
index cf58f037345b..3bc7ffc523a6 100644
--- a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/trace/test_trace.py
+++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/trace/test_trace.py
@@ -243,7 +243,7 @@ def test_span_to_envelope_client_http(self):
envelope.name, "Microsoft.ApplicationInsights.RemoteDependency"
)
self.assertEqual(envelope.time, "2019-12-04T21:18:36.027613Z")
- self.assertEqual(envelope.data.base_data.name, "test")
+ self.assertEqual(envelope.data.base_data.name, "GET /wiki/Rabbit")
self.assertEqual(envelope.data.base_data.id, "a6f5d48acb4d31d9")
self.assertEqual(envelope.data.base_data.duration, "0.00:00:01.001")
self.assertTrue(envelope.data.base_data.success)
@@ -258,6 +258,15 @@ def test_span_to_envelope_client_http(self):
self.assertEqual(envelope.data.base_data.result_code, "200")
self.assertEqual(envelope.tags["ai.user.userAgent"], "agent")
+ # Name empty
+ span._attributes = {
+ "http.method": "GET",
+ "http.scheme": "https",
+ "http.url": "https://www.example.com",
+ }
+ envelope = exporter._span_to_envelope(span)
+ self.assertEqual(envelope.data.base_data.name, "GET /")
+
# Target
span._attributes = {
"http.method": "GET",
@@ -339,7 +348,7 @@ def test_span_to_envelope_client_db(self):
attributes={
"db.system": "postgresql",
"peer.service": "service",
- "db.statement": "SELECT",
+ "db.statement": "SELECT * from test",
},
kind=SpanKind.CLIENT,
)
@@ -358,10 +367,19 @@ def test_span_to_envelope_client_db(self):
self.assertTrue(envelope.data.base_data.success)
self.assertEqual(envelope.data.base_type, "RemoteDependencyData")
- self.assertEqual(envelope.data.base_data.type, "SQL")
+ self.assertEqual(envelope.data.base_data.type, "postgresql")
self.assertEqual(envelope.data.base_data.target, "service")
+ self.assertEqual(envelope.data.base_data.data, "SELECT * from test")
+ self.assertEqual(envelope.data.base_data.result_code, "0")
+
+ # data
+ span._attributes = {
+ "db.system": "postgresql",
+ "peer.service": "service",
+ "db.operation": "SELECT",
+ }
+ envelope = exporter._span_to_envelope(span)
self.assertEqual(envelope.data.base_data.data, "SELECT")
- self.assertEqual(envelope.data.base_data.result_code, "1")
# Target
span._attributes = {
@@ -371,7 +389,7 @@ def test_span_to_envelope_client_db(self):
"peer.service": "service",
}
envelope = exporter._span_to_envelope(span)
- self.assertEqual(envelope.data.base_data.target, "service/testDb")
+ self.assertEqual(envelope.data.base_data.target, "service|testDb")
span._attributes = {
"db.system": "postgresql",
@@ -387,6 +405,16 @@ def test_span_to_envelope_client_db(self):
envelope = exporter._span_to_envelope(span)
self.assertEqual(envelope.data.base_data.target, "postgresql")
+ # Type
+ span._attributes = {
+ "db.system": "mssql",
+ "db.statement": "SELECT",
+ "db.name": "testDb",
+ "peer.service": "service",
+ }
+ envelope = exporter._span_to_envelope(span)
+ self.assertEqual(envelope.data.base_data.type, "SQL")
+
def test_span_to_envelope_client_rpc(self):
exporter = self._exporter
start_time = 1575494316027613500
@@ -435,7 +463,7 @@ def test_span_to_envelope_client_rpc(self):
# TODO: data.data
# self.assertEqual(envelope.data.base_data.data, "SELECT")
- self.assertEqual(envelope.data.base_data.result_code, "1")
+ self.assertEqual(envelope.data.base_data.result_code, "0")
def test_span_to_envelope_producer_messaging(self):
exporter = self._exporter
@@ -477,7 +505,7 @@ def test_span_to_envelope_producer_messaging(self):
# self.assertEqual(envelope.data.base_data.target, "rpc")
# TODO: data.data
# self.assertEqual(envelope.data.base_data.data, "SELECT")
- self.assertEqual(envelope.data.base_data.result_code, "1")
+ self.assertEqual(envelope.data.base_data.result_code, "0")
def test_span_to_envelope_internal(self):
exporter = self._exporter
@@ -513,7 +541,7 @@ def test_span_to_envelope_internal(self):
self.assertEqual(envelope.data.base_type, "RemoteDependencyData")
self.assertEqual(envelope.data.base_data.type, "InProc")
- self.assertEqual(envelope.data.base_data.result_code, "1")
+ self.assertEqual(envelope.data.base_data.result_code, "0")
# type
span._parent = None
@@ -552,18 +580,16 @@ def test_span_envelope_server_http(self):
envelope.name, "Microsoft.ApplicationInsights.Request"
)
self.assertEqual(envelope.data.base_type, "RequestData")
- self.assertEqual(envelope.data.base_data.name, "test")
+ self.assertEqual(envelope.data.base_data.name, "GET /wiki/Rabbit")
self.assertEqual(envelope.data.base_data.id, "a6f5d48acb4d31d9")
self.assertEqual(envelope.data.base_data.duration, "0.00:00:01.001")
self.assertEqual(envelope.data.base_data.response_code, "200")
self.assertTrue(envelope.data.base_data.success)
- self.assertEqual(envelope.tags["ai.operation.name"], "GET test")
+ self.assertEqual(envelope.tags["ai.operation.name"], "GET /wiki/Rabbit")
self.assertEqual(envelope.tags["ai.user.userAgent"], "agent")
self.assertEqual(envelope.tags["ai.location.ip"], "client_ip")
self.assertEqual(envelope.data.base_data.url, "https://www.wikipedia.org/wiki/Rabbit")
- self.assertEqual(envelope.data.base_data.properties["request.name"], "test")
- self.assertEqual(envelope.data.base_data.properties["request.url"], "https://www.wikipedia.org/wiki/Rabbit")
# location
span._attributes = {
@@ -603,6 +629,22 @@ def test_span_envelope_server_http(self):
envelope = exporter._span_to_envelope(span)
self.assertEqual(envelope.data.base_data.url, "https://localhost:35555/path")
+ # ai.operation.name
+ span._attributes = {
+ "http.method": "GET",
+ "http.url": "https://www.wikipedia.org/wiki/Rabbit/test",
+ }
+ envelope = exporter._span_to_envelope(span)
+ self.assertEqual(envelope.tags["ai.operation.name"], "GET /wiki/Rabbit/test")
+ self.assertEqual(envelope.data.base_data.name, "GET /wiki/Rabbit/test")
+
+ span._attributes = {
+ "http.method": "GET",
+ }
+ envelope = exporter._span_to_envelope(span)
+ self.assertEqual(envelope.tags["ai.operation.name"], "test")
+ self.assertEqual(envelope.data.base_data.name, "test")
+
def test_span_envelope_server_messaging(self):
exporter = self._exporter
start_time = 1575494316027613500
diff --git a/sdk/monitor/azure-monitor-query/CHANGELOG.md b/sdk/monitor/azure-monitor-query/CHANGELOG.md
index 0969530e1cbe..9079858da9fe 100644
--- a/sdk/monitor/azure-monitor-query/CHANGELOG.md
+++ b/sdk/monitor/azure-monitor-query/CHANGELOG.md
@@ -1,6 +1,6 @@
# Release History
-## 1.0.0b5 (Unreleased)
+## 1.0.0b5 (2021-10-05)
### Features Added
@@ -9,6 +9,7 @@
- Added `LogsQueryStatus` Enum to describe the status of a result.
- Added a new `LogsTableRow` type that represents a single row in a table.
- Items in `metrics` list in `MetricsResult` can now be accessed by metric names.
+- Added `audience` keyword to support providing credential scope when creating clients.
### Breaking Changes
@@ -19,10 +20,6 @@
- `query_batch` API now returns a union of `LogsQueryPartialResult`, `LogsQueryError` and `LogsQueryResult`.
- `metric_namespace` is renamed to `namespace` and is a keyword-only argument in `list_metric_definitions` API.
-### Bugs Fixed
-
-### Other Changes
-
## 1.0.0b4 (2021-09-09)
### Features Added
diff --git a/sdk/monitor/azure-monitor-query/README.md b/sdk/monitor/azure-monitor-query/README.md
index 4f1677bd6807..2dbac055aee6 100644
--- a/sdk/monitor/azure-monitor-query/README.md
+++ b/sdk/monitor/azure-monitor-query/README.md
@@ -14,6 +14,10 @@ The Azure Monitor Query client library is used to execute read-only queries agai
- [Samples][samples]
- [Change log][changelog]
+## _Disclaimer_
+
+_Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
+
## Getting started
### Prerequisites
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_helpers.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_helpers.py
index 4fb0563fd3da..b23fcd8ec0c8 100644
--- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_helpers.py
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_helpers.py
@@ -15,16 +15,19 @@
def get_authentication_policy(
- credential, # type: TokenCredential
+ credential, # type: "TokenCredential"
+ audience=None # type: str
):
# type: (...) -> BearerTokenCredentialPolicy
"""Returns the correct authentication policy"""
-
+ if not audience:
+ audience = "https://api.loganalytics.io/"
+ scope = audience.rstrip('/') + "/.default"
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if hasattr(credential, "get_token"):
return BearerTokenCredentialPolicy(
- credential, "https://api.loganalytics.io/.default"
+ credential, scope
)
raise TypeError("Unsupported credential")
@@ -32,15 +35,18 @@ def get_authentication_policy(
def get_metrics_authentication_policy(
credential, # type: TokenCredential
+ audience=None # type: str
):
# type: (...) -> BearerTokenCredentialPolicy
"""Returns the correct authentication policy"""
-
+ if not audience:
+ audience = "https://management.azure.com/"
+ scope = audience.rstrip('/') + "/.default"
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if hasattr(credential, "get_token"):
return BearerTokenCredentialPolicy(
- credential, "https://management.azure.com/.default"
+ credential, scope
)
raise TypeError("Unsupported credential")
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_logs_query_client.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_logs_query_client.py
index 1bc32db07d39..24db36531e8b 100644
--- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_logs_query_client.py
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_logs_query_client.py
@@ -49,15 +49,20 @@ class LogsQueryClient(object):
:type credential: ~azure.core.credentials.TokenCredential
:keyword endpoint: The endpoint to connect to. Defaults to 'https://api.loganalytics.io'.
:paramtype endpoint: str
+ :keyword audience: URL to use for credential authentication with AAD.
+ :paramtype audience: str
"""
def __init__(self, credential, **kwargs):
# type: (TokenCredential, Any) -> None
-
- self._endpoint = kwargs.pop("endpoint", "https://api.loganalytics.io/v1")
+ audience = kwargs.pop("audience", None)
+ endpoint = kwargs.pop("endpoint", "https://api.loganalytics.io/v1")
+ if not endpoint.startswith("https://") and not endpoint.startswith("http://"):
+ endpoint = "https://" + endpoint
+ self._endpoint = endpoint
self._client = MonitorQueryClient(
credential=credential,
- authentication_policy=get_authentication_policy(credential),
+ authentication_policy=get_authentication_policy(credential, audience),
base_url=self._endpoint,
**kwargs
)
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_metrics_query_client.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_metrics_query_client.py
index 171d0b495a3c..e730db1c7f26 100644
--- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_metrics_query_client.py
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_metrics_query_client.py
@@ -44,15 +44,21 @@ class MetricsQueryClient(object):
:type credential: ~azure.core.credentials.TokenCredential
:keyword endpoint: The endpoint to connect to. Defaults to 'https://management.azure.com'.
:paramtype endpoint: str
+ :keyword audience: URL to use for credential authentication with AAD.
+ :paramtype audience: str
"""
def __init__(self, credential, **kwargs):
# type: (TokenCredential, Any) -> None
+ audience = kwargs.pop("audience", None)
endpoint = kwargs.pop("endpoint", "https://management.azure.com")
+ if not endpoint.startswith("https://") and not endpoint.startswith("http://"):
+ endpoint = "https://" + endpoint
+ self._endpoint = endpoint
self._client = MonitorQueryClient(
credential=credential,
- base_url=endpoint,
- authentication_policy=get_metrics_authentication_policy(credential),
+ base_url=self._endpoint,
+ authentication_policy=get_metrics_authentication_policy(credential, audience),
**kwargs
)
self._metrics_op = self._client.metrics
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_helpers_asyc.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_helpers_asyc.py
index ffecbec48927..033b1c3fc585 100644
--- a/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_helpers_asyc.py
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_helpers_asyc.py
@@ -13,14 +13,17 @@
def get_authentication_policy(
credential: "AsyncTokenCredential",
+ audience: str = None
) -> AsyncBearerTokenCredentialPolicy:
"""Returns the correct authentication policy"""
-
+ if not audience:
+ audience = "https://api.loganalytics.io/"
+ scope = audience.rstrip('/') + "/.default"
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if hasattr(credential, "get_token"):
return AsyncBearerTokenCredentialPolicy(
- credential, "https://api.loganalytics.io/.default"
+ credential, scope
)
raise TypeError("Unsupported credential")
@@ -28,14 +31,17 @@ def get_authentication_policy(
def get_metrics_authentication_policy(
credential: "AsyncTokenCredential",
+ audience: str = None
) -> AsyncBearerTokenCredentialPolicy:
"""Returns the correct authentication policy"""
-
+ if not audience:
+ audience = "https://management.azure.com/"
+ scope = audience.rstrip('/') + "/.default"
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if hasattr(credential, "get_token"):
return AsyncBearerTokenCredentialPolicy(
- credential, "https://management.azure.com/.default"
+ credential, scope
)
raise TypeError("Unsupported credential")
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_logs_query_client_async.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_logs_query_client_async.py
index 92379c5d6442..4e4df78df924 100644
--- a/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_logs_query_client_async.py
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_logs_query_client_async.py
@@ -35,13 +35,19 @@ class LogsQueryClient(object):
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:keyword endpoint: The endpoint to connect to. Defaults to 'https://api.loganalytics.io/v1'.
:paramtype endpoint: str
+ :keyword audience: URL to use for credential authentication with AAD.
+ :paramtype audience: str
"""
def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None:
- self._endpoint = kwargs.pop("endpoint", "https://api.loganalytics.io/v1")
+ audience = kwargs.pop("audience", None)
+ endpoint = kwargs.pop("endpoint", "https://api.loganalytics.io/v1")
+ if not endpoint.startswith("https://") and not endpoint.startswith("http://"):
+ endpoint = "https://" + endpoint
+ self._endpoint = endpoint
self._client = MonitorQueryClient(
credential=credential,
- authentication_policy=get_authentication_policy(credential),
+ authentication_policy=get_authentication_policy(credential, audience),
base_url=self._endpoint,
**kwargs
)
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_metrics_query_client_async.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_metrics_query_client_async.py
index e9345743d686..707272d39ac4 100644
--- a/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_metrics_query_client_async.py
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_metrics_query_client_async.py
@@ -32,14 +32,20 @@ class MetricsQueryClient(object):
:type credential: ~azure.core.credentials.TokenCredential
:keyword endpoint: The endpoint to connect to. Defaults to 'https://management.azure.com'.
:paramtype endpoint: str
+ :keyword audience: URL to use for credential authentication with AAD.
+ :paramtype audience: str
"""
def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None:
+ audience = kwargs.pop("audience", None)
endpoint = kwargs.pop("endpoint", "https://management.azure.com")
+ if not endpoint.startswith("https://") and not endpoint.startswith("http://"):
+ endpoint = "https://" + endpoint
+ self._endpoint = endpoint
self._client = MonitorQueryClient(
credential=credential,
- base_url=endpoint,
- authentication_policy=get_metrics_authentication_policy(credential),
+ base_url=self._endpoint,
+ authentication_policy=get_metrics_authentication_policy(credential, audience),
**kwargs
)
self._metrics_op = self._client.metrics
diff --git a/sdk/search/azure-search-documents/azure/search/documents/_search_client.py b/sdk/search/azure-search-documents/azure/search/documents/_search_client.py
index 68a1e180bb42..bb5da1902f3c 100644
--- a/sdk/search/azure-search-documents/azure/search/documents/_search_client.py
+++ b/sdk/search/azure-search-documents/azure/search/documents/_search_client.py
@@ -132,7 +132,7 @@ def get_document(self, key, selected_fields=None, **kwargs):
:param key: The primary key value for the document to retrieve
:type key: str
- :param selected_fields: a whitelist of fields to include in the results
+ :param selected_fields: a allowlist of fields to include in the results
:type selected_fields: List[str]
:rtype: dict
diff --git a/sdk/search/azure-search-documents/azure/search/documents/aio/_search_client_async.py b/sdk/search/azure-search-documents/azure/search/documents/aio/_search_client_async.py
index e7f66ca59ae0..7ed9fe24dbf2 100644
--- a/sdk/search/azure-search-documents/azure/search/documents/aio/_search_client_async.py
+++ b/sdk/search/azure-search-documents/azure/search/documents/aio/_search_client_async.py
@@ -109,7 +109,7 @@ async def get_document(self, key, selected_fields=None, **kwargs):
:param key: The primary key value for the document to retrieve
:type key: str
- :param selected_fields: a whitelist of fields to include in the results
+ :param selected_fields: a allowlist of fields to include in the results
:type selected_fields: List[str]
:rtype: dict
diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies.py
index 11fc9849998a..00068a7ba112 100644
--- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies.py
+++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies.py
@@ -75,7 +75,7 @@ def retry_hook(settings, **kwargs):
def is_retry(response, mode):
- """Is this method/status code retryable? (Based on whitelists and control
+ """Is this method/status code retryable? (Based on allowlists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the returned status code is on the list of status codes to
@@ -456,7 +456,7 @@ def increment(self, settings, request, response=None, error=None):
else:
# Incrementing because of a server error like a 500 in
- # status_forcelist and a the given method is in the whitelist
+ # status_forcelist and a the given method is in the allowlist
if response:
settings['status'] -= 1
settings['history'].append(RequestHistory(request, http_response=response))
diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/policies.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/policies.py
index 11fc9849998a..00068a7ba112 100644
--- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/policies.py
+++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/policies.py
@@ -75,7 +75,7 @@ def retry_hook(settings, **kwargs):
def is_retry(response, mode):
- """Is this method/status code retryable? (Based on whitelists and control
+ """Is this method/status code retryable? (Based on allowlists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the returned status code is on the list of status codes to
@@ -456,7 +456,7 @@ def increment(self, settings, request, response=None, error=None):
else:
# Incrementing because of a server error like a 500 in
- # status_forcelist and a the given method is in the whitelist
+ # status_forcelist and a the given method is in the allowlist
if response:
settings['status'] -= 1
settings['history'].append(RequestHistory(request, http_response=response))
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/policies.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/policies.py
index 11fc9849998a..00068a7ba112 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/policies.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/policies.py
@@ -75,7 +75,7 @@ def retry_hook(settings, **kwargs):
def is_retry(response, mode):
- """Is this method/status code retryable? (Based on whitelists and control
+ """Is this method/status code retryable? (Based on allowlists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the returned status code is on the list of status codes to
@@ -456,7 +456,7 @@ def increment(self, settings, request, response=None, error=None):
else:
# Incrementing because of a server error like a 500 in
- # status_forcelist and a the given method is in the whitelist
+ # status_forcelist and a the given method is in the allowlist
if response:
settings['status'] -= 1
settings['history'].append(RequestHistory(request, http_response=response))
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies.py
index 11fc9849998a..00068a7ba112 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies.py
@@ -75,7 +75,7 @@ def retry_hook(settings, **kwargs):
def is_retry(response, mode):
- """Is this method/status code retryable? (Based on whitelists and control
+ """Is this method/status code retryable? (Based on allowlists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the returned status code is on the list of status codes to
@@ -456,7 +456,7 @@ def increment(self, settings, request, response=None, error=None):
else:
# Incrementing because of a server error like a 500 in
- # status_forcelist and a the given method is in the whitelist
+ # status_forcelist and a the given method is in the allowlist
if response:
settings['status'] -= 1
settings['history'].append(RequestHistory(request, http_response=response))
diff --git a/sdk/synapse/azure-synapse-accesscontrol/README.md b/sdk/synapse/azure-synapse-accesscontrol/README.md
index 5238d56b16d7..def1c2847aad 100644
--- a/sdk/synapse/azure-synapse-accesscontrol/README.md
+++ b/sdk/synapse/azure-synapse-accesscontrol/README.md
@@ -4,15 +4,14 @@ This is the Microsoft Azure Synapse AccessControl Client Library.
This package has been tested with Python 2.7, 3.6, 3.7, 3.8 and 3.9.
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
+## _Disclaimer_
-# Usage
-
-
+_Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
+# Usage
For code examples, see [Synapse AccessControl](https://docs.microsoft.com/python/api/overview/azure/) on docs.microsoft.com.
-
# Provide Feedback
If you encounter any bugs or have suggestions, please file an issue in the
diff --git a/sdk/synapse/azure-synapse-accesscontrol/setup.py b/sdk/synapse/azure-synapse-accesscontrol/setup.py
index 771f5c1e4103..374016253dc9 100644
--- a/sdk/synapse/azure-synapse-accesscontrol/setup.py
+++ b/sdk/synapse/azure-synapse-accesscontrol/setup.py
@@ -71,6 +71,7 @@
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
+ 'Programming Language :: Python :: 3.10',
'License :: OSI Approved :: MIT License',
],
zip_safe=False,
diff --git a/sdk/synapse/azure-synapse-artifacts/README.md b/sdk/synapse/azure-synapse-artifacts/README.md
index 66c14aaf08be..218a58cb00ac 100644
--- a/sdk/synapse/azure-synapse-artifacts/README.md
+++ b/sdk/synapse/azure-synapse-artifacts/README.md
@@ -4,20 +4,18 @@ This is the Microsoft Azure Synapse Artifacts Client Library.
This package has been tested with Python 2.7, 3.6, 3.7, 3.8 and 3.9.
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
+## _Disclaimer_
-# Usage
-
-
+_Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
+# Usage
For code examples, see [Synapse Artifacts](https://docs.microsoft.com/python/api/overview/azure/) on docs.microsoft.com.
-
# Provide Feedback
If you encounter any bugs or have suggestions, please file an issue in the
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
section of the project.
-
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-synapse-artifacts%2FREADME.png)
diff --git a/sdk/synapse/azure-synapse-artifacts/setup.py b/sdk/synapse/azure-synapse-artifacts/setup.py
index df7989bdbbab..5b77e11d2441 100644
--- a/sdk/synapse/azure-synapse-artifacts/setup.py
+++ b/sdk/synapse/azure-synapse-artifacts/setup.py
@@ -71,6 +71,7 @@
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
+ 'Programming Language :: Python :: 3.10',
'License :: OSI Approved :: MIT License',
],
zip_safe=False,
diff --git a/sdk/synapse/azure-synapse-monitoring/README.md b/sdk/synapse/azure-synapse-monitoring/README.md
index f5f8f081b36b..7fa99cef1a75 100644
--- a/sdk/synapse/azure-synapse-monitoring/README.md
+++ b/sdk/synapse/azure-synapse-monitoring/README.md
@@ -4,20 +4,18 @@ This is the Microsoft Azure Synapse Monitoring Client Library.
This package has been tested with Python 2.7, 3.6, 3.7, 3.8 and 3.9.
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
+## _Disclaimer_
-# Usage
-
-
+_Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
+# Usage
For code examples, see [Synapse Monitoring](https://docs.microsoft.com/python/api/overview/azure/) on docs.microsoft.com.
-
# Provide Feedback
If you encounter any bugs or have suggestions, please file an issue in the
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
section of the project.
-
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-synapse-monitoring%2FREADME.png)
diff --git a/sdk/synapse/azure-synapse-monitoring/setup.py b/sdk/synapse/azure-synapse-monitoring/setup.py
index fe6cbfd07e18..69b9ea42975a 100644
--- a/sdk/synapse/azure-synapse-monitoring/setup.py
+++ b/sdk/synapse/azure-synapse-monitoring/setup.py
@@ -71,6 +71,7 @@
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
+ 'Programming Language :: Python :: 3.10',
'License :: OSI Approved :: MIT License',
],
zip_safe=False,
diff --git a/sdk/synapse/azure-synapse-spark/README.md b/sdk/synapse/azure-synapse-spark/README.md
index 0efdc1b23548..38027e4956ea 100644
--- a/sdk/synapse/azure-synapse-spark/README.md
+++ b/sdk/synapse/azure-synapse-spark/README.md
@@ -4,20 +4,18 @@ This is the Microsoft Azure Synapse Spark Client Library.
This package has been tested with Python 2.7, 3.6, 3.7, 3.8 and 3.9.
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
+## _Disclaimer_
-# Usage
-
-
+_Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
+# Usage
For code examples, see [Synapse Spark](https://docs.microsoft.com/python/api/overview/azure/) on docs.microsoft.com.
-
# Provide Feedback
If you encounter any bugs or have suggestions, please file an issue in the
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
section of the project.
-
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-synapse-spark%2FREADME.png)
diff --git a/sdk/synapse/azure-synapse-spark/setup.py b/sdk/synapse/azure-synapse-spark/setup.py
index ab3c8302fbc0..7953222cddce 100644
--- a/sdk/synapse/azure-synapse-spark/setup.py
+++ b/sdk/synapse/azure-synapse-spark/setup.py
@@ -71,6 +71,7 @@
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
+ 'Programming Language :: Python :: 3.10',
'License :: OSI Approved :: MIT License',
],
zip_safe=False,
diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_policies.py b/sdk/tables/azure-data-tables/azure/data/tables/_policies.py
index ad5045703369..1cb05388280d 100644
--- a/sdk/tables/azure-data-tables/azure/data/tables/_policies.py
+++ b/sdk/tables/azure-data-tables/azure/data/tables/_policies.py
@@ -133,7 +133,7 @@ def __init__(self, **kwargs):
self.retry_to_secondary = kwargs.get('retry_to_secondary', False)
def is_retry(self, settings, response):
- """Is this method/status code retryable? (Based on whitelists and control
+ """Is this method/status code retryable? (Based on allowlists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the returned status code is on the list of status codes to
diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_policies_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_policies_async.py
index 96139f7c5b4e..5f23dece3524 100644
--- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_policies_async.py
+++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_policies_async.py
@@ -56,7 +56,7 @@ def __init__(self, **kwargs):
self.retry_to_secondary = kwargs.get('retry_to_secondary', False)
def is_retry(self, settings, response):
- """Is this method/status code retryable? (Based on whitelists and control
+ """Is this method/status code retryable? (Based on allowlists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the returned status code is on the list of status codes to
diff --git a/shared_requirements.txt b/shared_requirements.txt
index 11035e2303e0..66d9e014b64e 100644
--- a/shared_requirements.txt
+++ b/shared_requirements.txt
@@ -151,7 +151,7 @@ backports.functools-lru-cache>=1.6.4
#override azure-keyvault-secrets azure-core<2.0.0,>=1.7.0
#override azure-ai-textanalytics msrest>=0.6.21
#override azure-ai-textanalytics azure-core<2.0.0,>=1.14.0
-#override azure-ai-language-questionanswering azure-core<2.0.0,>=1.16.0
+#override azure-ai-language-questionanswering azure-core<2.0.0,>=1.19.0
#override azure-ai-language-questionanswering msrest>=0.6.21
#override azure-search-documents azure-core<2.0.0,>=1.18.0
#override azure-ai-formrecognizer msrest>=0.6.21
diff --git a/tools/vcrpy/vcr/stubs/__init__.py b/tools/vcrpy/vcr/stubs/__init__.py
index 37ab137ce477..264cfaf461ea 100644
--- a/tools/vcrpy/vcr/stubs/__init__.py
+++ b/tools/vcrpy/vcr/stubs/__init__.py
@@ -26,7 +26,7 @@ def settimeout(self, *args, **kwargs):
def fileno(self):
"""
- This is kinda crappy. requests will watch
+ This is not very good. requests will watch
this descriptor and make sure it's not closed.
Return file descriptor 0 since that's stdin.
"""