Skip to content

fixed error code for bad model version error #11497

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

Merged
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 @@ -17,26 +17,26 @@ interactions:
- azsdk-python-ai-textanalytics/1.0.0b5 Python/3.7.7 (Darwin-17.7.0-x86_64-i386-64bit)
Python/3.7.7 (Darwin-17.7.0-x86_64-i386-64bit)
method: POST
uri: https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0/sentiment?model-version=bad&showStats=false
uri: https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0/keyPhrases?model-version=bad&showStats=false
response:
body:
string: '{"error":{"code":"InvalidRequest","message":"Invalid model version.
Possible values are: latest,2019-10-01,2020-04-01"}}'
string: '{"error":{"code":"InvalidRequest","message":"Invalid Request.","innererror":{"code":"ModelVersionIncorrect","message":"Invalid
model version. Possible values are: latest,2019-10-01"}}}'
headers:
apim-request-id:
- 49cc0a41-f980-48e3-93b3-851a35c931e3
- 42b6899a-6664-4cad-9e09-f9a481c991b5
content-type:
- application/json; charset=utf-8
date:
- Mon, 18 May 2020 15:13:11 GMT
- Mon, 18 May 2020 15:20:43 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
transfer-encoding:
- chunked
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- '6'
- '4'
status:
code: 400
message: Bad Request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ interactions:
- azsdk-python-ai-textanalytics/1.0.0b5 Python/3.7.7 (Darwin-17.7.0-x86_64-i386-64bit)
Python/3.7.7 (Darwin-17.7.0-x86_64-i386-64bit)
method: POST
uri: https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0/sentiment?model-version=bad&showStats=false
uri: https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0/keyPhrases?model-version=bad&showStats=false
response:
body:
string: '{"error":{"code":"InvalidRequest","message":"Invalid model version.
Possible values are: latest,2019-10-01,2020-04-01"}}'
string: '{"error":{"code":"InvalidRequest","message":"Invalid Request.","innererror":{"code":"ModelVersionIncorrect","message":"Invalid
model version. Possible values are: latest,2019-10-01"}}}'
headers:
apim-request-id: 5bbc9218-98d0-4ad7-b921-503639690fcc
apim-request-id: e64bf548-d879-44d7-b62f-77c8e3f69a86
content-type: application/json; charset=utf-8
date: Mon, 18 May 2020 15:13:12 GMT
date: Mon, 18 May 2020 15:20:44 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
transfer-encoding: chunked
x-content-type-options: nosniff
x-envoy-upstream-service-time: '5'
x-envoy-upstream-service-time: '3'
status:
code: 400
message: Bad Request
url: https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0/sentiment?model-version=bad&showStats=false
url: https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0/keyPhrases?model-version=bad&showStats=false
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
interactions:
- request:
body: '{"documents": [{"id": "1", "text": "I did not like the hotel we stayed
at.", "language": "english"}]}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '101'
Content-Type:
- application/json
User-Agent:
- azsdk-python-ai-textanalytics/1.0.0b5 Python/3.7.7 (Darwin-17.7.0-x86_64-i386-64bit)
Python/3.7.7 (Darwin-17.7.0-x86_64-i386-64bit)
method: POST
uri: https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0/entities/recognition/general?model-version=bad&showStats=false
response:
body:
string: '{"error":{"code":"InvalidRequest","message":"Invalid Request.","innererror":{"code":"ModelVersionIncorrect","message":"Invalid
model version. Possible values are: latest,2020-04-01,2019-10-01,2020-02-01"}}}'
headers:
apim-request-id:
- 3622af79-4965-4fd9-9c6c-f98d2d5b1947
content-type:
- application/json; charset=utf-8
date:
- Mon, 18 May 2020 15:20:42 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
transfer-encoding:
- chunked
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- '5'
status:
code: 400
message: Bad Request
version: 1
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
interactions:
- request:
body: '{"documents": [{"id": "1", "text": "I did not like the hotel we stayed
at.", "countryHint": "US"}]}'
at.", "language": "english"}]}'
headers:
Accept:
- application/json
Content-Length:
- '99'
- '101'
Content-Type:
- application/json
User-Agent:
- azsdk-python-ai-textanalytics/1.0.0b5 Python/3.7.7 (Darwin-17.7.0-x86_64-i386-64bit)
Python/3.7.7 (Darwin-17.7.0-x86_64-i386-64bit)
method: POST
uri: https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0/languages?model-version=bad&showStats=false
uri: https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0/entities/recognition/general?model-version=bad&showStats=false
response:
body:
string: '{"error":{"code":"InvalidRequest","message":"Invalid model version.
Possible values are: latest,2019-10-01"}}'
string: '{"error":{"code":"InvalidRequest","message":"Invalid Request.","innererror":{"code":"ModelVersionIncorrect","message":"Invalid
model version. Possible values are: latest,2020-04-01,2019-10-01,2020-02-01"}}}'
headers:
apim-request-id: 4c03585b-b971-4565-825f-c84de2b98a30
apim-request-id: 9d334131-db3c-490e-a7d8-36f2a25dc2ac
content-type: application/json; charset=utf-8
date: Mon, 18 May 2020 15:13:14 GMT
date: Mon, 18 May 2020 15:20:43 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
transfer-encoding: chunked
x-content-type-options: nosniff
x-envoy-upstream-service-time: '4'
status:
code: 400
message: Bad Request
url: https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0/languages?model-version=bad&showStats=false
url: https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0/entities/recognition/general?model-version=bad&showStats=false
version: 1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
body: '{"documents": [{"id": "1", "text": "I did not like the hotel we stayed
at.", "countryHint": "US"}]}'
at.", "language": "english"}]}'
headers:
Accept:
- application/json
Expand All @@ -10,33 +10,33 @@ interactions:
Connection:
- keep-alive
Content-Length:
- '99'
- '101'
Content-Type:
- application/json
User-Agent:
- azsdk-python-ai-textanalytics/1.0.0b5 Python/3.7.7 (Darwin-17.7.0-x86_64-i386-64bit)
Python/3.7.7 (Darwin-17.7.0-x86_64-i386-64bit)
method: POST
uri: https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0/languages?model-version=bad&showStats=false
uri: https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0/entities/linking?model-version=bad&showStats=false
response:
body:
string: '{"error":{"code":"InvalidRequest","message":"Invalid model version.
Possible values are: latest,2019-10-01"}}'
string: '{"error":{"code":"InvalidRequest","message":"Invalid Request.","innererror":{"code":"ModelVersionIncorrect","message":"Invalid
model version. Possible values are: latest,2020-02-01"}}}'
headers:
apim-request-id:
- 4d28642b-cb75-4b15-8063-19dbb1057b18
- d3284888-5143-4c31-8563-9432c9e5ec24
content-type:
- application/json; charset=utf-8
date:
- Mon, 18 May 2020 15:13:14 GMT
- Mon, 18 May 2020 15:20:43 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
transfer-encoding:
- chunked
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- '5'
- '4'
status:
code: 400
message: Bad Request
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
interactions:
- request:
body: '{"documents": [{"id": "1", "text": "I did not like the hotel we stayed
at.", "language": "english"}]}'
headers:
Accept:
- application/json
Content-Length:
- '101'
Content-Type:
- application/json
User-Agent:
- azsdk-python-ai-textanalytics/1.0.0b5 Python/3.7.7 (Darwin-17.7.0-x86_64-i386-64bit)
Python/3.7.7 (Darwin-17.7.0-x86_64-i386-64bit)
method: POST
uri: https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0/entities/linking?model-version=bad&showStats=false
response:
body:
string: '{"error":{"code":"InvalidRequest","message":"Invalid Request.","innererror":{"code":"ModelVersionIncorrect","message":"Invalid
model version. Possible values are: latest,2020-02-01"}}}'
headers:
apim-request-id: d6df87ea-2ae6-4044-bd24-16ca43118a92
content-type: application/json; charset=utf-8
date: Mon, 18 May 2020 15:20:43 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
transfer-encoding: chunked
x-content-type-options: nosniff
x-envoy-upstream-service-time: '6'
status:
code: 400
message: Bad Request
url: https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0/entities/linking?model-version=bad&showStats=false
version: 1
Original file line number Diff line number Diff line change
Expand Up @@ -472,13 +472,15 @@ def test_document_attribute_error_nonexistent_attribute(self, client):

@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
@pytest.mark.xfail
def test_bad_model_version_error(self, client):
# marking as xfail since the bad model version change hasn't appeared for sentiment endpoint yet
docs = [{"id": "1", "language": "english", "text": "I did not like the hotel we stayed at."}]

try:
result = client.analyze_sentiment(docs, model_version="bad")
except HttpResponseError as err:
self.assertEqual(err.error.code, "InvalidRequest")
self.assertEqual(err.error.code, "ModelVersionIncorrect")
self.assertIsNotNone(err.error.message)

@GlobalTextAnalyticsAccountPreparer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,15 @@ async def test_document_attribute_error_nonexistent_attribute(self, client):

@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
@pytest.mark.xfail
async def test_bad_model_version_error(self, client):
# marking as xfail since the bad model version change hasn't appeared for sentiment endpoint yet
docs = [{"id": "1", "language": "english", "text": "I did not like the hotel we stayed at."}]

try:
result = await client.analyze_sentiment(docs, model_version="bad")
except HttpResponseError as err:
self.assertEqual(err.error.code, "InvalidRequest")
self.assertEqual(err.error.code, "ModelVersionIncorrect")
self.assertIsNotNone(err.error.message)

@GlobalTextAnalyticsAccountPreparer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,13 +448,15 @@ def test_document_attribute_error_nonexistent_attribute(self, client):

@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
@pytest.mark.xfail
def test_bad_model_version_error(self, client):
# marking as xfail since the bad model version change hasn't appeared for LD endpoint yet
docs = [{"id": "1", "language": "english", "text": "I did not like the hotel we stayed at."}]

try:
result = client.detect_language(docs, model_version="bad")
except HttpResponseError as err:
self.assertEqual(err.error.code, "InvalidRequest")
self.assertEqual(err.error.code, "ModelVersionIncorrect")
self.assertIsNotNone(err.error.message)

@GlobalTextAnalyticsAccountPreparer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,13 +461,15 @@ async def test_document_attribute_error_nonexistent_attribute(self, client):

@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
@pytest.mark.xfail
async def test_bad_model_version_error(self, client):
# marking as xfail since the bad model version change hasn't appeared for LD endpoint yet
docs = [{"id": "1", "language": "english", "text": "I did not like the hotel we stayed at."}]

try:
result = await client.detect_language(docs, model_version="bad")
except HttpResponseError as err:
self.assertEqual(err.error.code, "InvalidRequest")
self.assertEqual(err.error.code, "ModelVersionIncorrect")
self.assertIsNotNone(err.error.message)

@GlobalTextAnalyticsAccountPreparer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def test_bad_model_version_error(self, client):
try:
result = client.extract_key_phrases(docs, model_version="bad")
except HttpResponseError as err:
self.assertEqual(err.error.code, "InvalidRequest")
self.assertEqual(err.error.code, "ModelVersionIncorrect")
self.assertIsNotNone(err.error.message)

@GlobalTextAnalyticsAccountPreparer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ async def test_bad_model_version_error(self, client):
try:
result = await client.extract_key_phrases(docs, model_version="bad")
except HttpResponseError as err:
self.assertEqual(err.error.code, "InvalidRequest")
self.assertEqual(err.error.code, "ModelVersionIncorrect")
self.assertIsNotNone(err.error.message)

@GlobalTextAnalyticsAccountPreparer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def test_bad_model_version_error(self, client):
try:
result = client.recognize_entities(docs, model_version="bad")
except HttpResponseError as err:
self.assertEqual(err.error.code, "InvalidRequest")
self.assertEqual(err.error.code, "ModelVersionIncorrect")
self.assertIsNotNone(err.error.message)

@GlobalTextAnalyticsAccountPreparer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ async def test_bad_model_version_error(self, client):
try:
result = await client.recognize_entities(docs, model_version="bad")
except HttpResponseError as err:
self.assertEqual(err.error.code, "InvalidRequest")
self.assertEqual(err.error.code, "ModelVersionIncorrect")
self.assertIsNotNone(err.error.message)

@GlobalTextAnalyticsAccountPreparer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def test_bad_model_version_error(self, client):
try:
result = client.recognize_linked_entities(docs, model_version="bad")
except HttpResponseError as err:
self.assertEqual(err.error.code, "InvalidRequest")
self.assertEqual(err.error.code, "ModelVersionIncorrect")
self.assertIsNotNone(err.error.message)

@GlobalTextAnalyticsAccountPreparer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ async def test_bad_model_version_error(self, client):
try:
result = await client.recognize_linked_entities(docs, model_version="bad")
except HttpResponseError as err:
self.assertEqual(err.error.code, "InvalidRequest")
self.assertEqual(err.error.code, "ModelVersionIncorrect")
self.assertIsNotNone(err.error.message)

@GlobalTextAnalyticsAccountPreparer()
Expand Down