Spaces:
Sleeping
Sleeping
Update modules.py
Browse files- modules.py +12 -17
modules.py
CHANGED
|
@@ -87,24 +87,19 @@ def select_llm(model:str, api_key:str=None, temperature: float=0.5)->Union[Ollam
|
|
| 87 |
|
| 88 |
|
| 89 |
def get_prompt(context:str, query:str)->str:
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
# return prompt
|
| 104 |
-
|
| 105 |
-
prompt = f"""As Mira, an expert e-commerce chatbot, your role is to provide users with precise and informative responses to their queries about products. You are required to answer questions based solely on the provided context, ensuring that your responses are both concise and relevant. It's essential to communicate clearly, avoiding any incomplete or repetitive sentences. Your goal is to deliver a seamless and insightful user experience by offering well-structured answers that directly address the user's needs.
|
| 106 |
-
Context: `{context}`
|
| 107 |
-
Question: `{query}`"""
|
| 108 |
return prompt
|
| 109 |
|
| 110 |
def retrieve_query(query:str, df:str, column:str, api_key:str, model:str, temperature:float=0.5, chunk_size:int=100)->str:
|
|
|
|
| 87 |
|
| 88 |
|
| 89 |
def get_prompt(context:str, query:str)->str:
|
| 90 |
+
prompt = f"""You are a chatbot named Mira. You answer user's query about ecommerce products.
|
| 91 |
+
Here are some rules you will follow:
|
| 92 |
+
1. Your response will be concise and informative.
|
| 93 |
+
2. You must answer the user's query from the given context.
|
| 94 |
+
3. Do not generate any incomplete sentences or duplicate sentences.
|
| 95 |
+
4. If you give a list of product do not list more than 5 product at once.
|
| 96 |
|
| 97 |
+
-----------------------------------------------
|
| 98 |
+
Context: '''{context}'''
|
| 99 |
+
-----------------------------------------------
|
| 100 |
+
Question: '''{query}'''
|
| 101 |
+
-----------------------------------------------
|
| 102 |
+
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
return prompt
|
| 104 |
|
| 105 |
def retrieve_query(query:str, df:str, column:str, api_key:str, model:str, temperature:float=0.5, chunk_size:int=100)->str:
|