Saif Rehman Nasir commited on
Commit
e1fa991
·
1 Parent(s): bdf0a45

Change reduce prompt, limit communities to 3

Browse files
Files changed (1) hide show
  1. rag.py +3 -31
rag.py CHANGED
@@ -227,37 +227,9 @@ def global_retriever(query: str, level: int, response_type: str):
227
 
228
  {report_data}
229
 
230
-
231
- ---Goal---
232
-
233
- Generate a response of the target length and format that responds to the user's question, summarize all the reports from multiple analysts who focused on different parts of the dataset.
234
-
235
- Note that the analysts' reports provided below are ranked in the **descending order of importance**.
236
-
237
- If you don't know the answer or if the provided reports do not contain sufficient information to provide an answer, just say so. Do not make anything up.
238
-
239
- The final response should remove all irrelevant information from the analysts' reports and merge the cleaned information into a comprehensive answer that provides explanations of all the key points and implications appropriate for the response length and format.
240
-
241
- The response shall preserve the original meaning and use of modal verbs such as "shall", "may" or "will".
242
-
243
- The response should also preserve all the data references previously included in the analysts' reports, but do not mention the roles of multiple analysts in the analysis process.
244
-
245
- **Do not list more than 5 record ids in a single reference**. Instead, list the top 5 most relevant record ids and add "+more" to indicate that there are more.
246
-
247
- For example:
248
-
249
- "Person X is the owner of Company Y and subject to many allegations of wrongdoing [Data: Reports (2, 7, 34, 46, 64, +more)]. He is also CEO of company X [Data: Reports (1, 3)]"
250
-
251
- where 1, 2, 3, 7, 34, 46, and 64 represent the id (not the index) of the relevant data record.
252
-
253
- Do not include information where the supporting evidence for it is not provided.
254
-
255
-
256
- ---Target response length and format---
257
-
258
- {response_type}
259
-
260
  Add sections and commentary to the response as appropriate for the length and format. Style the response in markdown.
 
 
261
  """
262
 
263
  reduce_prompt = ChatPromptTemplate.from_messages(
@@ -293,7 +265,7 @@ def global_retriever(query: str, level: int, response_type: str):
293
  # print(community_data)
294
  intermediate_results = []
295
  i = 0
296
- for community in tqdm(community_data[:10], desc="Processing communities"):
297
  intermediate_response = map_chain.invoke(
298
  {"question": query, "context_data": community["output"]}
299
  )
 
227
 
228
  {report_data}
229
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  Add sections and commentary to the response as appropriate for the length and format. Style the response in markdown.
231
+
232
+ ---Real Data---
233
  """
234
 
235
  reduce_prompt = ChatPromptTemplate.from_messages(
 
265
  # print(community_data)
266
  intermediate_results = []
267
  i = 0
268
+ for community in tqdm(community_data[:3], desc="Processing communities"):
269
  intermediate_response = map_chain.invoke(
270
  {"question": query, "context_data": community["output"]}
271
  )