4
4
5
5
class QnAMaker :
6
6
7
- __qnaMakerServiceEndpoint = 'https://westus.api.cognitive.microsoft.com/qnamaker/v3.0/knowledgebases/'
8
- __json_mime_type = 'application/json'
9
- __api_management_header = 'Ocp-Apim-Subscription-Key'
10
-
11
7
def __init__ (self , options , http_client ):
8
+ self .__qnaMakerServiceEndpoint = 'https://westus.api.cognitive.microsoft.com/qnamaker/v3.0/knowledgebases/'
9
+ self .__json_mime_type = 'application/json'
10
+ self .__api_management_header = 'Ocp-Apim-Subscription-Key'
12
11
13
- self .__http_client = _http_client or False
12
+ self .__http_client = http_client or False
14
13
if not self .__http_client :
15
14
raise TypeError ('HTTP Client failed' )
16
15
self .__options = options or False
17
16
if not self .__options :
18
17
raise TypeError ('Options config error' )
19
18
20
- self .__answerUrl = "%s%s/generateanswer" % (__qnaMakerServiceEndpoint ,options .knowledge_base_id )
19
+ self .__answerUrl = "%s%s/generateanswer" % (self . __qnaMakerServiceEndpoint ,options .kno
9B62
wledge_base_id )
21
20
22
21
if self .__options .ScoreThreshold == 0 :
23
22
self .__options .ScoreThreshold = 0.3 #Note - SHOULD BE 0.3F 'FLOAT'
@@ -33,7 +32,7 @@ def __init__(self, options, http_client):
33
32
34
33
async def get_answers (question ): # HTTP call
35
34
headers = {
36
- __api_management_header : self .__options .subscription_key ,
35
+ self . __api_management_header : self .__options .subscription_key ,
37
36
"Content-Type" : __json_mime_type
38
37
}
39
38
@@ -69,4 +68,4 @@ def __init__(self, questions, answer, score, metadata, source, qna_id):
69
68
70
69
class QueryResults :
71
70
def __init__ (self , answers ):
72
- self .__answers = answers
71
+ self .__answers = answers
0 commit comments