Update project/bot/openai_backend.py
Browse files
project/bot/openai_backend.py
CHANGED
|
@@ -82,11 +82,8 @@ class SearchBot:
|
|
| 82 |
analyzed_assistant_message = assistant_message
|
| 83 |
for entity in ner_result:
|
| 84 |
if entity['entity_group'] in ("LOC", "ORG", "MISC") and entity['word'] != "Javea":
|
| 85 |
-
start = entity['start']
|
| 86 |
-
end = entity['end']
|
| 87 |
enriched_information = await self.enrich_information_from_google(entity['word'])
|
| 88 |
-
analyzed_assistant_message = analyzed_assistant_message[
|
| 89 |
-
:start] + f"{enriched_information}" + analyzed_assistant_message[end:]
|
| 90 |
return "ENRICHED:" + analyzed_assistant_message
|
| 91 |
|
| 92 |
async def _convert_to_embeddings(self, text_list):
|
|
|
|
| 82 |
analyzed_assistant_message = assistant_message
|
| 83 |
for entity in ner_result:
|
| 84 |
if entity['entity_group'] in ("LOC", "ORG", "MISC") and entity['word'] != "Javea":
|
|
|
|
|
|
|
| 85 |
enriched_information = await self.enrich_information_from_google(entity['word'])
|
| 86 |
+
analyzed_assistant_message = analyzed_assistant_message.replace(entity['word'], enriched_information)
|
|
|
|
| 87 |
return "ENRICHED:" + analyzed_assistant_message
|
| 88 |
|
| 89 |
async def _convert_to_embeddings(self, text_list):
|