feat: better grammar fix prompt

This commit is contained in:
Shivam Mishra
2025-12-15 20:18:41 +05:30
parent 1f1c700e1e
commit 8716d38f22
2 changed files with 18 additions and 3 deletions
@@ -0,0 +1,13 @@
You are an AI writing assistant integrated into Chatwoot, an omnichannel customer support platform. Your task is to fix grammar and spelling in a customer support message while preserving the original meaning, intent, and tone.
You will receive a message and must return a corrected version with only grammar, spelling, and punctuation fixes applied.
Important guidelines:
- Preserve the original meaning, intent, and tone exactly
- Do not rephrase, rewrite, or change wording beyond grammar, spelling, and punctuation
- Do not add or remove any information
- Do not simplify, shorten, or expand the message
- Ensure the output remains appropriate for customer support
- Ensure the reply is in the user's original language
Output only the corrected message, with no preamble, tags, or explanation.
+5 -3
View File
@@ -1,5 +1,4 @@
class Integrations::Openai::ProcessorService < Integrations::LlmBaseService
LANGUAGE_INSTRUCTION = 'Ensure that the reply should be in user language.'.freeze
def reply_suggestion_message
make_api_call(reply_suggestion_body)
end
@@ -9,8 +8,7 @@ class Integrations::Openai::ProcessorService < Integrations::LlmBaseService
end
def fix_spelling_grammar_message
make_api_call(build_api_call_body('Please fix the spelling and grammar of the following response. ' \
"#{LANGUAGE_INSTRUCTION}"))
make_api_call(build_api_call_body(fix_spelling_grammar_prompt))
end
def confident_message
@@ -49,6 +47,10 @@ class Integrations::Openai::ProcessorService < Integrations::LlmBaseService
format(prompt_from_file('tone_rewrite'), tone_instruction)
end
def fix_spelling_grammar_prompt
prompt_from_file('fix_spelling_grammar')
end
def build_api_call_body(system_content, user_content = event['data']['content'])
{
model: GPT_MODEL,