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

[QnA] Initial SDK #19544

Merged
merged 31 commits into from
Jul 8, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
b3f19aa
Template + first code gen
annatisch Jun 14, 2021
acc2108
Basic client
annatisch Jun 16, 2021
792610e
First tests
annatisch Jun 16, 2021
21848b5
Added async client + tests
annatisch Jun 16, 2021
a445347
Added answerspan test
annatisch Jun 17, 2021
cf4d00d
Added authoring APIs
annatisch Jun 22, 2021
459481e
Some updates
annatisch Jun 23, 2021
d0e4a6a
Pure generated clients
annatisch Jun 24, 2021
5cee5e6
Test updates
annatisch Jun 25, 2021
b9ed3bb
Update test imports
annatisch Jun 25, 2021
455bd3f
Clean working recordings
annatisch Jun 25, 2021
dae79b7
Renamed directory
annatisch Jun 25, 2021
df656d9
Removed authoring for now
annatisch Jun 28, 2021
52a306f
Use unreleased core
annatisch Jun 28, 2021
f91a856
Remove conversation + ci yaml
annatisch Jun 28, 2021
94cf599
Merge remote-tracking branch 'upstream/main' into feature/cognitivese…
annatisch Jun 28, 2021
19c99c7
Some CI updates
annatisch Jun 28, 2021
6eafbf6
update language __init__.py to not have a space in the name
scbedd Jun 28, 2021
d3d0322
Setup.py
annatisch Jun 29, 2021
78f3631
Updated core dependency
annatisch Jun 29, 2021
8e70771
CI fixes
annatisch Jun 29, 2021
8b22e87
Added language nspkg
annatisch Jun 29, 2021
55d270f
Merge remote-tracking branch 'upstream/main' into feature/cognitivese…
annatisch Jun 30, 2021
a510171
Fix Python 2.7
annatisch Jun 30, 2021
485ab2f
Added some more tests
annatisch Jun 30, 2021
2651fd5
Test fixes
annatisch Jun 30, 2021
c14a5e7
Added live configuration
annatisch Jun 30, 2021
9dc5346
Bumped msrest
annatisch Jun 30, 2021
f335cf3
readme + samples
annatisch Jul 1, 2021
c27d1d3
No pypi or refdocs yet
annatisch Jul 6, 2021
da8e057
Review feedback
annatisch Jul 6, 2021
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
Prev Previous commit
Next Next commit
Added answerspan test
  • Loading branch information
annatisch committed Jun 17, 2021
commit a445347728ed695d584cf38f540589bc06438115
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,61 @@ def test_query_knowledgebase_llc(self, client, question_answering_project):
assert answer.get('id')
assert answer.get('source')
assert answer.get('metadata') is not None

assert not answer.get('answerSpan')
# assert answer['answerSpan'].get('text')
# assert answer['answerSpan'].get('confidenceScore')
# assert answer['answerSpan'].get('offset') is not None
# assert answer['answerSpan'].get('length')

assert answer.get('questions')
for question in answer['questions']:
assert question

assert answer.get('dialog')
assert answer['dialog'].get('isContextOnly') is not None
assert answer['dialog'].get('prompts') is not None
if answer['dialog'].get('prompts'):
for prompt in answer['dialog']['prompts']:
assert prompt.get('displayOrder') is not None
assert prompt.get('qnaId')
assert prompt.get('displayText')

@GlobalQuestionAnsweringAccountPreparer()
@QuestionAnsweringClientPreparer(QuestionAnsweringClient)
def test_query_knowledgebase_llc_with_answerspan(self, client, question_answering_project):
json_content = {
"question": "Ports and connectors",
"top": 3,
"context": {
"previousUserQuery": "Meet Surface Pro 4",
"previousQnAId": 4
},
"answerSpanRequest": {
"enable": True,
"confidenceScoreThreshold": 0.1,
"topAnswersWithSpan": 1
}
}
request = question_answering_knowledgebase.build_query_request(
json=json_content,
project_name=question_answering_project,
deployment_name='test'
)
with client:
response = client.send_request(request)
assert response.status_code == 200

output = response.json()
assert output
assert output.get('answers')
for answer in output['answers']:
assert answer.get('answer')
assert answer.get('confidenceScore')
assert answer.get('id')
assert answer.get('source')
assert answer.get('metadata') is not None

if answer.get('answerSpan'):
assert answer['answerSpan'].get('text')
assert answer['answerSpan'].get('confidenceScore')
assert answer['answerSpan'].get('offset') is not None
assert answer['answerSpan'].get('length')

assert answer.get('questions')
for question in answer['questions']:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,57 @@ async def test_query_knowledgebase_llc(self, client, question_answering_project)
assert prompt.get('displayOrder') is not None
assert prompt.get('qnaId')
assert prompt.get('displayText')

@GlobalQuestionAnsweringAccountPreparer()
@QuestionAnsweringClientPreparer(QuestionAnsweringClient)
async def test_query_knowledgebase_llc_with_answerspan(self, client, question_answering_project):
json_content = {
"question": "Ports and connectors",
"top": 3,
"context": {
"previousUserQuery": "Meet Surface Pro 4",
"previousQnAId": 4
},
"answerSpanRequest": {
"enable": True,
"confidenceScoreThreshold": 0.1,
"topAnswersWithSpan": 2
}
}
request = question_answering_knowledgebase.build_query_request(
json=json_content,
project_name=question_answering_project,
deployment_name='test'
)
async with client:
response = await client.send_request(request)
assert response.status_code == 200

output = response.json()
assert output
assert output.get('answers')
for answer in output['answers']:
assert answer.get('answer')
assert answer.get('confidenceScore')
assert answer.get('id')
assert answer.get('source')
assert answer.get('metadata') is not None

if answer.get('answerSpan'):
assert answer['answerSpan'].get('text')
assert answer['answerSpan'].get('confidenceScore')
assert answer['answerSpan'].get('offset') is not None
assert answer['answerSpan'].get('length')

assert answer.get('questions')
for question in answer['questions']:
assert question

assert answer.get('dialog')
assert answer['dialog'].get('isContextOnly') is not None
assert answer['dialog'].get('prompts') is not None
if answer['dialog'].get('prompts'):
for prompt in answer['dialog']['prompts']:
assert prompt.get('displayOrder') is not None
assert prompt.get('qnaId')
assert prompt.get('displayText')