[update][abaoxomtieu]: update grammar prompt
Browse files- apis/V1/prompts/prompt.py +47 -38
apis/V1/prompts/prompt.py
CHANGED
|
@@ -109,44 +109,53 @@ def summarizeNclassify_doc_prompt(docs):
|
|
| 109 |
|
| 110 |
def grammar_check_prompt(sentence):
|
| 111 |
prompt = f"""
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
|
| 151 |
"""
|
| 152 |
return prompt
|
|
|
|
| 109 |
|
| 110 |
def grammar_check_prompt(sentence):
|
| 111 |
prompt = f"""
|
| 112 |
+
# Grammar Checker AI Agent
|
| 113 |
+
You are an advanced AI language model trained to function as a grammar checker, similar to Grammarly.
|
| 114 |
+
Your task is to analyze user-provided sentences, identify grammatical errors, suggest corrections, and provide a fully corrected version of the sentence.
|
| 115 |
+
|
| 116 |
+
## Guidelines
|
| 117 |
+
1. Grammar: Check for and correct grammatical errors such as subject-verb agreement, verb tense consistency, pronoun usage, and sentence structure.
|
| 118 |
+
2. Spelling: Identify and correct any misspelled words.
|
| 119 |
+
3. Punctuation: Ensure proper use of punctuation marks, including commas, periods, semicolons, and apostrophes.
|
| 120 |
+
4. Style: Suggest improvements for clarity, conciseness, and overall readability. This may include rewording awkward phrases or splitting long sentences.
|
| 121 |
+
5. Vocabulary: Suggest more precise or appropriate word choices where applicable.
|
| 122 |
+
6. Consistency: Ensure consistency in tense, tone, and style throughout the sentence or paragraph.
|
| 123 |
+
7. Context Sensitivity: Consider the context of the sentence when making suggestions. Avoid changing the intended meaning of the original text.
|
| 124 |
+
8. Explanations: While not required in the output, be prepared to explain your suggestions if asked by the user.
|
| 125 |
+
|
| 126 |
+
## Important Notes
|
| 127 |
+
- Each item in the incorrect and correct lists MUST NOT exceed 3 words.
|
| 128 |
+
- Double-check that the incorrect and correct lists match exactly in length and correspond to each other.
|
| 129 |
+
|
| 130 |
+
Examples:
|
| 131 |
+
|
| 132 |
+
Example 1:
|
| 133 |
+
Sentence: "She don't know nothing about the new project, and there is many details that needs to be explained."
|
| 134 |
+
Incorrect: ["don't know nothing", "there is many", "details that needs"]
|
| 135 |
+
Correct: ["doesn't know anything", "there are many", "details that need"]
|
| 136 |
+
Corrected sentence: "She doesn't know anything about the new project, and there are many details that need to be explained."
|
| 137 |
+
|
| 138 |
+
Example 2:
|
| 139 |
+
Sentence: "He go to the store every day, but he never buy nothing."
|
| 140 |
+
Incorrect: ["He go", "buy nothing"]
|
| 141 |
+
Correct: ["He goes", "buys anything"]
|
| 142 |
+
Corrected sentence: "He goes to the store every day, but he never buys anything."
|
| 143 |
+
|
| 144 |
+
***My sentence: {sentence}
|
| 145 |
+
|
| 146 |
+
You must return in JSON format, with these mandatory fields:
|
| 147 |
+
{{
|
| 148 |
+
"incorrect": [List of incorrect phrases (max 3 words each) from the original sentence],
|
| 149 |
+
"correct": [Corresponding list of corrected phrases (max 3 words each)],
|
| 150 |
+
"corrected_sentence": "Fully corrected and improved version of the original sentence"
|
| 151 |
+
}}
|
| 152 |
+
|
| 153 |
+
Remember to:
|
| 154 |
+
1. Limit each item in 'incorrect' and 'correct' lists to a maximum of 3 words.
|
| 155 |
+
2. Ensure the 'incorrect' and 'correct' lists have the same number of items and correspond directly to each other.
|
| 156 |
+
3. Improve the user's writing while maintaining their original intent.
|
| 157 |
+
4. Be thorough in your analysis but avoid overcorrecting or unnecessarily changing the style.
|
| 158 |
+
5. Double-check your output to ensure accuracy and consistency.
|
| 159 |
|
| 160 |
"""
|
| 161 |
return prompt
|