ofermend commited on
Commit
6541511
1 Parent(s): 3b56cfd

Update query.py

Browse files
Files changed (1) hide show
  1. query.py +11 -5
query.py CHANGED
@@ -36,7 +36,7 @@ class VectaraQuery():
36
  {
37
  'query': query_str,
38
  'start': 0,
39
- 'numResults': 10,
40
  'corpusKey': corpora_key_list,
41
  'context_config': {
42
  'sentences_before': 2,
@@ -44,6 +44,13 @@ class VectaraQuery():
44
  'start_tag': start_tag,
45
  'end_tag': end_tag,
46
  },
 
 
 
 
 
 
 
47
  'summary': [
48
  {
49
  'responseLang': 'eng',
@@ -68,13 +75,12 @@ class VectaraQuery():
68
  res = response.json()
69
  print(f"DEBUG request body = {body}")
70
  print(f"DEBUG response summary = {res['responseSet'][0]['summary']}")
71
-
 
72
  summary = res['responseSet'][0]['summary'][0]['text']
73
- responses = res['responseSet'][0]['response']
74
  docs = res['responseSet'][0]['document']
75
  self.conv_id = res['responseSet'][0]['summary'][0]['chat']['conversationId']
76
-
77
-
78
 
79
  pattern = r'\[\d{1,2}\]'
80
  matches = [match.span() for match in re.finditer(pattern, summary)]
 
36
  {
37
  'query': query_str,
38
  'start': 0,
39
+ 'numResults': 50,
40
  'corpusKey': corpora_key_list,
41
  'context_config': {
42
  'sentences_before': 2,
 
44
  'start_tag': start_tag,
45
  'end_tag': end_tag,
46
  },
47
+ 'rerankingConfig':
48
+ {
49
+ 'rerankerId': '272725718',
50
+ 'mmrConfig': {
51
+ 'diversityBias': 0.2
52
+ }
53
+ }
54
  'summary': [
55
  {
56
  'responseLang': 'eng',
 
75
  res = response.json()
76
  print(f"DEBUG request body = {body}")
77
  print(f"DEBUG response summary = {res['responseSet'][0]['summary']}")
78
+
79
+ top_k = 10
80
  summary = res['responseSet'][0]['summary'][0]['text']
81
+ responses = res['responseSet'][0]['response'][:top_k]
82
  docs = res['responseSet'][0]['document']
83
  self.conv_id = res['responseSet'][0]['summary'][0]['chat']['conversationId']
 
 
84
 
85
  pattern = r'\[\d{1,2}\]'
86
  matches = [match.span() for match in re.finditer(pattern, summary)]