Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[textanalytics] check for model version/stats in response hook policy #11797

Merged
merged 1 commit into from
Jun 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ def on_response(self, request, response):
statistics = data.get("statistics", None)
model_version = data.get("modelVersion", None)

batch_statistics = TextDocumentBatchStatistics._from_generated(statistics) # pylint: disable=protected-access
response.statistics = batch_statistics
response.model_version = model_version
response.raw_response = data
self._response_callback(response)
if statistics or model_version:
batch_statistics = TextDocumentBatchStatistics._from_generated(statistics) # pylint: disable=protected-access
response.statistics = batch_statistics
response.model_version = model_version
response.raw_response = data
self._response_callback(response)
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ async def on_response(self, request, response):
statistics = data.get("statistics", None)
model_version = data.get("modelVersion", None)

batch_statistics = TextDocumentBatchStatistics._from_generated(statistics) # pylint: disable=protected-access
response.statistics = batch_statistics
response.model_version = model_version
response.raw_response = data
if asyncio.iscoroutine(self._response_callback):
await self._response_callback(response)
else:
self._response_callback(response)
if statistics or model_version:
batch_statistics = TextDocumentBatchStatistics._from_generated(statistics) # pylint: disable=protected-access
response.statistics = batch_statistics
response.model_version = model_version
response.raw_response = data
if asyncio.iscoroutine(self._response_callback):
await self._response_callback(response)
else:
self._response_callback(response)