Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Make model uses same language as the prompt #13

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/formalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class FormalizeChain(Chain):
"
{text}
"
Write the above text again, rephrase it to use only formal language and be very polite.
Write the above text again, rephrase it to use only formal words and be very polite. Also, Detect the language of the above text. When rephrasing the text make sure to use the same language as the original text in your rewritten text. Output only the new text, nothing else, no introductory sentence. Also do not output the name of the language you detected.
"""
)
)# Does not work with llama 3 8B :(


"""Prompt object to use."""
Expand Down
4 changes: 2 additions & 2 deletions lib/headline.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class HeadlineChain(Chain):
user_prompt: BasePromptTemplate = PromptTemplate(
input_variables=["text"],
template="""
Find a headline for the following text
Give me the headline of the following text in its original language. Output only the headline.
"
{text}
"
Write a single headline for the above text in one sentence
Give me the headline of the above text in its original language. Do not output the language. Output only the headline without any quotes or additional punctuation.
"""
)

Expand Down
2 changes: 1 addition & 1 deletion lib/simplify.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class SimplifyChain(Chain):
"
{text}
"
Rewrite and rephrase the above text to make it easier to understand, so that a 5-year-old child can understand it. Describe difficult concepts in the text instead of using jargon terms directly. Do not make up anything new that is not in the original text. Only return the new, rewritten text.
Rewrite and rephrase the above text to make it easier to understand, so that a 5-year-old child can understand it. Describe difficult concepts in the text instead of using jargon terms directly. Do not make up anything new that is not in the original text. Make sure to use the same language as the above text. Output only the new, rewritten text in the original language of the original text, nothing else.
"""
)

Expand Down
4 changes: 2 additions & 2 deletions lib/summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ class SummarizeChain(Chain):
user_prompt: BasePromptTemplate = PromptTemplate(
input_variables=["text"],
template="""
Please write a summary of the following text to make it shorter without losing key information and also don't add anything new:
Summarize the following text. Detect the language of the text. Use the same language as the text. Here is the text:
"
{text}
"
Please write a summary of the above text to make it shorter without losing key information and also don't add anything new:
Output only the summary. Here is your summary in the same language as the text:
"""
)

Expand Down
2 changes: 1 addition & 1 deletion lib/topics.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TopicsChain(Chain):
"
{text}
"
List 5 topics of the above text as keywords separated by commas:
List 5 topics of the above text as keywords separated by commas. Output only the topics, nothing else. Use the same language for the topics as the text.
"""
)

Expand Down