cjber commited on
Commit
d98a335
·
1 Parent(s): aaef45f

fix: ensure summary isn't bullet pointed

Browse files
planning_ai/chains/prompts/reduce_final.txt CHANGED
@@ -4,6 +4,4 @@ The following contains a collection of documents that each summarise a different
4
 
5
  As a representative of the Cambridgeshire Council, your task is to craft a **comprehensive and articulate executive summary**. This summary will serve as the introductory section of a major report, highlighting the key themes and concerns raised in the public responses. Ensure that the summary is clear, concise, and professional, reflecting the tone and standards expected in official council documents. **Do not add, infer, or create information.** Use only the content explicitly mentioned in the above context. Adhere to British English conventions.
6
 
7
- Within each summary are inline citations. When aggregating these summaries into a final executive summary, ensure that these original citations are preserved, and correctly attributed to their related context.
8
-
9
- # Executive Summary
 
4
 
5
  As a representative of the Cambridgeshire Council, your task is to craft a **comprehensive and articulate executive summary**. This summary will serve as the introductory section of a major report, highlighting the key themes and concerns raised in the public responses. Ensure that the summary is clear, concise, and professional, reflecting the tone and standards expected in official council documents. **Do not add, infer, or create information.** Use only the content explicitly mentioned in the above context. Adhere to British English conventions.
6
 
7
+ Within each summary there are inline citations. When aggregating these summaries into a final executive summary, ensure that these original citations are preserved after each related paragraph. If there are more than 5 citations within a single citation block, keep only the top 5 most relevant citations.
 
 
planning_ai/chains/reduce_chain.py CHANGED
@@ -10,10 +10,11 @@ with open(Paths.PROMPTS / "reduce.txt", "r") as f:
10
  with open(Paths.PROMPTS / "reduce_final.txt", "r") as f:
11
  reduce_template_final = f.read()
12
 
13
-
14
  reduce_prompt = ChatPromptTemplate([("system", reduce_template)])
15
- reduce_prompt_final = ChatPromptTemplate([("system", reduce_template_final)])
16
  reduce_chain = reduce_prompt | O3Mini | StrOutputParser()
 
 
 
17
  reduce_chain_final = reduce_prompt_final | O3Mini | StrOutputParser()
18
 
19
 
@@ -22,9 +23,12 @@ if __name__ == "__main__":
22
  The author expresses concern over the proposed mass development north-west of Cambridge,
23
  highlighting the significant growth in the area over the past twenty years,
24
  particularly with the establishment of Cambourne and the expansion of Papworth Everard.
 
25
  """
26
 
27
  result = reduce_chain.invoke({"context": test_summary})
 
28
 
29
  print("Generated Report:")
30
  print(result)
 
 
10
  with open(Paths.PROMPTS / "reduce_final.txt", "r") as f:
11
  reduce_template_final = f.read()
12
 
 
13
  reduce_prompt = ChatPromptTemplate([("system", reduce_template)])
 
14
  reduce_chain = reduce_prompt | O3Mini | StrOutputParser()
15
+
16
+
17
+ reduce_prompt_final = ChatPromptTemplate([("system", reduce_template_final)])
18
  reduce_chain_final = reduce_prompt_final | O3Mini | StrOutputParser()
19
 
20
 
 
23
  The author expresses concern over the proposed mass development north-west of Cambridge,
24
  highlighting the significant growth in the area over the past twenty years,
25
  particularly with the establishment of Cambourne and the expansion of Papworth Everard.
26
+ [1, 2, 3]
27
  """
28
 
29
  result = reduce_chain.invoke({"context": test_summary})
30
+ result_final = reduce_chain_final.invoke({"context": test_summary})
31
 
32
  print("Generated Report:")
33
  print(result)
34
+ print(result_final)