gavinzli commited on
Commit
23b7557
·
1 Parent(s): 2512706

Refactor prompt template formatting in summarizer and update script documentation for clarity

Browse files
Files changed (2) hide show
  1. controllers/summarizer.py +4 -2
  2. main.py +8 -6
controllers/summarizer.py CHANGED
@@ -32,7 +32,8 @@ def summarize(text):
32
  azure_deployment="gpt-35-turbo",
33
  )
34
 
35
- prompt_template = """ You're task is to create a concise summary of the following text, meant as a preview of the article when you hover over it,
 
36
  keep it less than 70 words, do not insert information not found in the text,
37
  audience is potential reader who wants to know what is the article generally about:
38
  "{text}"
@@ -47,7 +48,8 @@ def summarize(text):
47
  "------------\n"
48
  "{text}\n"
49
  "------------\n"
50
- "Given the new context, refine the original summary, keep it less than 70 words, do not insert information not found in the text,"
 
51
  "Audience is potential reader who wants to know what is the article generally about"
52
  "If the context isn't useful, return the original summary.")
53
  refine_prompt = PromptTemplate.from_template(refine_template)
 
32
  azure_deployment="gpt-35-turbo",
33
  )
34
 
35
+ prompt_template = """ You're task is to create a concise summary of the following text,
36
+ meant as a preview of the article when you hover over it,
37
  keep it less than 70 words, do not insert information not found in the text,
38
  audience is potential reader who wants to know what is the article generally about:
39
  "{text}"
 
48
  "------------\n"
49
  "{text}\n"
50
  "------------\n"
51
+ "Given the new context, refine the original summary, keep it less than 70 words, \
52
+ do not insert information not found in the text,"
53
  "Audience is potential reader who wants to know what is the article generally about"
54
  "If the context isn't useful, return the original summary.")
55
  refine_prompt = PromptTemplate.from_template(refine_template)
main.py CHANGED
@@ -1,16 +1,18 @@
1
  """
2
- This script is responsible for collecting data from various websites related to financial and policy information in China.
3
- It fetches data from different sources, extracts relevant information, translates it, and updates the content accordingly.
4
- The collected data includes policy interpretations, financial news, macroeconomic research, and more.
 
5
  """
6
  import logging
7
  import os
8
 
9
  from dotenv import load_dotenv
 
10
 
11
  from source import cbirc, csrc, eastmoney, gov, mofcom, ndrc, safe, stats, mof
12
- from glue import glue_job_run
13
- from prefect import flow
14
 
15
  load_dotenv()
16
 
@@ -38,6 +40,6 @@ def main():
38
  ndrc.crawl(delta)
39
  mof.crawl(delta)
40
  # glue_job_run()
41
-
42
  if __name__ == '__main__':
43
  main()
 
1
  """
2
+ This script is responsible for collecting data from various websites \
3
+ related to financial and policy information in China. It fetches data from various sources,\
4
+ extracts relevant information, translates it, and updates the content accordingly.
5
+ Collected data includes policy interpretations, financial news, macroeconomic research.
6
  """
7
  import logging
8
  import os
9
 
10
  from dotenv import load_dotenv
11
+ from prefect import flow
12
 
13
  from source import cbirc, csrc, eastmoney, gov, mofcom, ndrc, safe, stats, mof
14
+ # from glue import glue_job_run
15
+
16
 
17
  load_dotenv()
18
 
 
40
  ndrc.crawl(delta)
41
  mof.crawl(delta)
42
  # glue_job_run()
43
+
44
  if __name__ == '__main__':
45
  main()