You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: app/summarizer.py
+10-21Lines changed: 10 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ def setup_argparse():
15
15
"-u", "--url", required=True, help="URL of the document to summarize"
16
16
)
17
17
parser.add_argument(
18
-
"-l", "--language",
18
+
"-t", "--translate",
19
19
help="Target language for translation (if specified, translation is enabled)"
20
20
)
21
21
returnparser.parse_args()
@@ -30,22 +30,11 @@ def load_document(url):
30
30
defsetup_summarization_chain():
31
31
"""Setup the summarization chain with a prompt template and ChatOllama."""
32
32
prompt_template=PromptTemplate(
33
-
template="""As a professional summarizer, create a detailed and comprehensive summary of the provided text, be it an article, post, conversation, or passage, while adhering to these guidelines:
34
-
1. Craft a summary that is detailed, thorough, in-depth, and complex, while maintaining clarity.
33
+
template="""Create a detailed and comprehensive summary of the following text. Provide only the summary without any headers, quotes, or additional text:
35
34
36
-
2. Incorporate main ideas and essential information, eliminating extraneous language and focusing on critical aspects.
35
+
{text}
37
36
38
-
3. Rely strictly on the provided text, without including external information.
39
-
40
-
4. Format the summary in paragraph form for easy understanding.
41
-
42
-
5.Conclude your notes with [End of Notes, Message #X] to indicate completion, where "X" represents the total number of messages that I have sent. In other words, include a message counter where you start with #1 and add 1 to the message counter every time I send a message.
43
-
44
-
By following this optimized prompt, you will generate an effective summary that encapsulates the essence of the given text in a clear, detailed, and reader-friendly manner. Optimize output as markdown file.
"""Setup the translation chain with a prompt template and ChatOllama."""
59
48
prompt_template=PromptTemplate(
60
-
template="""As a professional translator, provide a detailed and comprehensive translation of the provided text into {target_language}, ensuring that the translation is accurate, coherent, and faithful to the original text.
49
+
template="""Translate the following text into {target_language}. Provide only the translation without any quotes, headers, or additional text. The output should be clean and direct:
0 commit comments