Spaces:
GIZ
/
Running on CPU Upgrade

Romulan12 commited on
Commit
b52ae58
·
1 Parent(s): 78c9684

improve prompt

Browse files
model_params.cfg CHANGED
@@ -1,9 +1,9 @@
1
  [generator]
2
  PROVIDER = huggingface
3
- MODEL = meta-llama/Meta-Llama-3-8B-Instruct
4
- MAX_TOKENS = 512
5
  TEMPERATURE = 0.2
6
- INFERENCE_PROVIDER = novita
7
  ORGANIZATION = GIZ
8
 
9
  [reader]
 
1
  [generator]
2
  PROVIDER = huggingface
3
+ MODEL = meta-llama/Llama-3.1-8B-Instruct
4
+ MAX_TOKENS = 1024
5
  TEMPERATURE = 0.2
6
+ INFERENCE_PROVIDER = nebius
7
  ORGANIZATION = GIZ
8
 
9
  [reader]
utils/__pycache__/generator.cpython-310.pyc CHANGED
Binary files a/utils/__pycache__/generator.cpython-310.pyc and b/utils/__pycache__/generator.cpython-310.pyc differ
 
utils/__pycache__/retriever.cpython-310.pyc CHANGED
Binary files a/utils/__pycache__/retriever.cpython-310.pyc and b/utils/__pycache__/retriever.cpython-310.pyc differ
 
utils/__pycache__/whisp_api.cpython-310.pyc CHANGED
Binary files a/utils/__pycache__/whisp_api.cpython-310.pyc and b/utils/__pycache__/whisp_api.cpython-310.pyc differ
 
utils/generator.py CHANGED
@@ -208,8 +208,29 @@ def build_messages(question: str, context: str) -> list:
208
  List of LangChain message objects
209
  """
210
  system_content = (
211
- "You are an expert assistant. Answer the USER question using only the "
212
- "CONTEXT provided. If the context is insufficient say 'I don't know.'"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  )
214
 
215
  user_content = f"### CONTEXT\n{context}\n\n### USER QUESTION\n{question}"
 
208
  List of LangChain message objects
209
  """
210
  system_content = (
211
+ """
212
+ You are an expert assistant. Your task is to generate accurate, helpful responses using only the
213
+ information contained in the "CONTEXT" provided.
214
+
215
+ Instructions:
216
+ - Answer based only on provided context: Use only the information present in the retrieved_paragraphs below. Do not use any external knowledge or make assumptions beyond what is explicitly stated.
217
+ - Language matching: Respond in the same language as the user's query.
218
+ - Handle missing information: If the retrieved paragraphs do not contain sufficient information to answer the query, respond with "I don't know" or equivalent in the query language. If information is incomplete, state what you know and acknowledge limitations.
219
+ - Be accurate and specific: When information is available, provide clear, specific answers. Include relevant details, useful facts, and numbers from the context.
220
+ - Stay focused: Answer only what is asked. Do not provide additional information not requested.
221
+ - Structure your response effectively:
222
+ * Do not just summarize each passage one by one. Group your summaries to highlight the key parts in the explanation.
223
+ * Use bullet points and lists when it makes sense to improve readability.
224
+ * You do not need to use every passage. Only use the ones that help answer the question.
225
+ - Format your response properly: Ensure proper formatting with appropriate line breaks, spacing, and structure. Use markdown formatting when applicable (bullet points, numbered lists, headers) to make your response clear and easy to read.
226
+
227
+ Input Format:
228
+ - Query: {query}
229
+ - Retrieved Paragraphs: {retrieved_paragraphs}
230
+
231
+ Generate your response based on these guidelines.
232
+
233
+ """
234
  )
235
 
236
  user_content = f"### CONTEXT\n{context}\n\n### USER QUESTION\n{question}"
utils/retriever.py CHANGED
@@ -13,6 +13,7 @@ def retrieve_paragraphs(query, country):
13
  filter_metadata = {'country':country},
14
  api_name="/retrieve"
15
  )
 
16
 
17
  except Exception as e:
18
  error_msg = f"Error retrieving paragraphs: {str(e)}"
 
13
  filter_metadata = {'country':country},
14
  api_name="/retrieve"
15
  )
16
+ return result
17
 
18
  except Exception as e:
19
  error_msg = f"Error retrieving paragraphs: {str(e)}"