Spaces:
Sleeping
Sleeping
Update services/qa_service/qna.py
Browse files
services/qa_service/qna.py
CHANGED
@@ -26,7 +26,7 @@ class QAService:
|
|
26 |
|
27 |
level_1 = i['matches']
|
28 |
level_2 = level_1['metadata']['_node_content']
|
29 |
-
collect = json.loads(level_2)
|
30 |
parsed.append(collect)
|
31 |
|
32 |
return collect
|
@@ -42,13 +42,13 @@ class QAService:
|
|
42 |
include_metadata=True
|
43 |
)
|
44 |
|
45 |
-
output = self.parse_results(result)
|
46 |
|
47 |
return output
|
48 |
|
49 |
def run(self):
|
50 |
"""Query pinecone outputs and infer results"""
|
51 |
-
context = self.retrieve_context()
|
52 |
prompt = format_prompt(self.question, context)
|
53 |
output = self.model_pipeline.infer(prompt)
|
54 |
|
|
|
26 |
|
27 |
level_1 = i['matches']
|
28 |
level_2 = level_1['metadata']['_node_content']
|
29 |
+
collect = json.loads(level_2)["text"]
|
30 |
parsed.append(collect)
|
31 |
|
32 |
return collect
|
|
|
42 |
include_metadata=True
|
43 |
)
|
44 |
|
45 |
+
output = self.parse_results(result)
|
46 |
|
47 |
return output
|
48 |
|
49 |
def run(self):
|
50 |
"""Query pinecone outputs and infer results"""
|
51 |
+
context = '\n'.join(self.retrieve_context())
|
52 |
prompt = format_prompt(self.question, context)
|
53 |
output = self.model_pipeline.infer(prompt)
|
54 |
|