Spaces:
Sleeping
Sleeping
fix connect mongodb
Browse files- NLP_model/chatbot.py +5 -4
NLP_model/chatbot.py
CHANGED
|
@@ -105,16 +105,17 @@ CACHE_TTL = 1800 # 30 phút tính bằng giây
|
|
| 105 |
prompt = PromptTemplate(
|
| 106 |
template = """Goal:
|
| 107 |
You are a professional tour guide assistant that assists users in finding information about places in Da Nang, Vietnam.
|
| 108 |
-
You can provide details on restaurants, cafes, hotels, attractions, and other local venues.
|
|
|
|
| 109 |
|
| 110 |
Return Format:
|
| 111 |
-
Respond in friendly, natural, and
|
| 112 |
|
| 113 |
Warning:
|
| 114 |
Let's support users like a real tour guide, not a bot. The information in core knowledge is your own knowledge.
|
| 115 |
Your knowledge is provided in the Core Knowledge. All of information in Core Knowledge is about Da Nang, Vietnam.
|
| 116 |
You just care about current time that user mention when user ask about Solana event.
|
| 117 |
-
If you do not have enough information to answer user's question, reply with "I don't know. I don't have information about that".
|
| 118 |
|
| 119 |
Core knowledge:
|
| 120 |
{context}
|
|
@@ -150,7 +151,7 @@ def get_chain():
|
|
| 150 |
text_key="text"
|
| 151 |
)
|
| 152 |
|
| 153 |
-
_retriever_instance = vectorstore.as_retriever(search_kwargs={"k":
|
| 154 |
logger.info(f"Pinecone retriever initialized in {time.time() - start_time:.2f} seconds")
|
| 155 |
return _retriever_instance
|
| 156 |
except Exception as e:
|
|
|
|
| 105 |
prompt = PromptTemplate(
|
| 106 |
template = """Goal:
|
| 107 |
You are a professional tour guide assistant that assists users in finding information about places in Da Nang, Vietnam.
|
| 108 |
+
You can provide details on restaurants, cafes, hotels, attractions, and other local venues.
|
| 109 |
+
You have to use core knowledge and conversation history to chat with users, who are Da Nang's tourists.
|
| 110 |
|
| 111 |
Return Format:
|
| 112 |
+
Respond in friendly, natural, concise and use only English like a real tour guide.
|
| 113 |
|
| 114 |
Warning:
|
| 115 |
Let's support users like a real tour guide, not a bot. The information in core knowledge is your own knowledge.
|
| 116 |
Your knowledge is provided in the Core Knowledge. All of information in Core Knowledge is about Da Nang, Vietnam.
|
| 117 |
You just care about current time that user mention when user ask about Solana event.
|
| 118 |
+
If you do not have enough information to answer user's question, please reply with "I don't know. I don't have information about that".
|
| 119 |
|
| 120 |
Core knowledge:
|
| 121 |
{context}
|
|
|
|
| 151 |
text_key="text"
|
| 152 |
)
|
| 153 |
|
| 154 |
+
_retriever_instance = vectorstore.as_retriever(search_kwargs={"k": 5})
|
| 155 |
logger.info(f"Pinecone retriever initialized in {time.time() - start_time:.2f} seconds")
|
| 156 |
return _retriever_instance
|
| 157 |
except Exception as e:
|