ABAO77 commited on
Commit
dca0c37
·
1 Parent(s): da10e03

[update][abaoxomtieu]: update route grammar

Browse files
apis/V1/prompts/prompt.py CHANGED
@@ -117,13 +117,13 @@ def grammar_check_prompt(sentence):
117
  3. Return the corrected text.
118
  Examples:
119
 
120
- 1.
121
  Sentence: "She don't know nothing about the new project, and there is many details that needs to be explained."
122
  Incorrect: [don't know nothing, is, needs]
123
  Correct: [doesn't know anything, are, need]
124
  Corrected sentence: "She doesn't know anything about the new project, and there are many details that need to be explained."
125
 
126
- 2.
127
  Sentence: "He go to the store every day, but he never buy nothing."
128
  Incorrect: [go, buy nothing]
129
  Correct: [goes, buys anything]
@@ -134,7 +134,6 @@ def grammar_check_prompt(sentence):
134
 
135
  You must return in JSON format, field is mandatory:
136
  {{
137
- "sentence": my origin sentence,
138
  "incorrect": [list of incorrect words or phrases, it can be repeated],
139
  "correct": [list of correct words or phrases, it can be repeated],
140
  "corrected_sentence": corrected sentence
 
117
  3. Return the corrected text.
118
  Examples:
119
 
120
+ Example 1:
121
  Sentence: "She don't know nothing about the new project, and there is many details that needs to be explained."
122
  Incorrect: [don't know nothing, is, needs]
123
  Correct: [doesn't know anything, are, need]
124
  Corrected sentence: "She doesn't know anything about the new project, and there are many details that need to be explained."
125
 
126
+ Example 2:
127
  Sentence: "He go to the store every day, but he never buy nothing."
128
  Incorrect: [go, buy nothing]
129
  Correct: [goes, buys anything]
 
134
 
135
  You must return in JSON format, field is mandatory:
136
  {{
 
137
  "incorrect": [list of incorrect words or phrases, it can be repeated],
138
  "correct": [list of correct words or phrases, it can be repeated],
139
  "corrected_sentence": corrected sentence
apis/V1/routes/chat.py CHANGED
@@ -79,7 +79,7 @@ class GrammarCheck(BaseModel):
79
  sentence: str = Field(description="Sentence to check", min_length=1)
80
 
81
 
82
- @router.post("grammar_check", status_code=status.HTTP_200_OK)
83
  async def grammar_check(body: GrammarCheck):
84
  result = await run_in_thread(llm.invoke, grammar_check_prompt(body.sentence))
85
  result = JsonOutputParser().parse(result)
 
79
  sentence: str = Field(description="Sentence to check", min_length=1)
80
 
81
 
82
+ @router.post("/grammar_check", status_code=status.HTTP_200_OK)
83
  async def grammar_check(body: GrammarCheck):
84
  result = await run_in_thread(llm.invoke, grammar_check_prompt(body.sentence))
85
  result = JsonOutputParser().parse(result)