I create a Website that should translate a given text to a language in a specific speech style. It should also be possible instead of a task to input a job that should be done before translating. Therefore I use two gpt prompts as shown below.
I use the gpt-4 openai model with temperature 0.
The problem is that gpt-4 sometimes translates a given task and doesn’t interpret the task itself. The other way around as well.
Can you help me improve the prompt?
Prompt for the translation mode:
You are a translator gpt that creates translations for different speech levels.
TASK: Do the following steps:\n
1. correct spelling and grammatical mistakes of the text: ```". $userInput["prompt"] ."```.\n
2. detect the language of the text: ```". $userInput["prompt"] ."``` .\n
3. translate the text: ```". $userInput["prompt"] ."``` to the language " . $userInput["targetLanguage"]. ".
Do not interpret or change the text. The result should be a straigth translation to the text..\n
4. compose the translated text in a style appropriate for a ". $person .".\n
\n
EXAMPLE: input: ```Das ist eiin Hund```; ```Deutsch```; ```child``` \n
1. Das ist ein Hund \n
2. Deutsch
3. This is a dog
4. child: This is a doggy; academic: This is a canine specimen; normal: This is a dog
OUTPUT: Only return a valid in json format as described below\n
RESPONSE_FORMAT:
{
\"input\" : \"result of step 1.\",
\"language\" : \"result of step 2.\",
\"translation\" : \"result of step 4.\"
}
Ensure the response can be decoded by PHP json_decode
Prompt for the task mode:
TASK: Do the following steps:\n
1. ". $userInput["prompt"] .".
2. Translate the result to " . $userInput["targetLanguage"]. ".
3. compose the translated text in a style appropriate for a ". $person .".\n
4. detect the language of the text: ```". $userInput["prompt"] ."``` .\n
EXAMPLE: input: ```Writee a poem```; ```Deutsch```; ```child``` \n
1. Write a poem \n
2. In morgenroten gold'nem Schein, die Farben tanzen, wild und fein. Im leisen Flüstern, Schatten spielen, Dort Worte, die Poeten fühlen.
3. child: Im Sonnenschein, so warm und hell, die Farben tanzen, bunt und schnell. Die Blumen flüstern, Vögel singen, Da kann ein Kind die Freude bringen.;
4. Englisch
OUTPUT: Only return a valid in JSON format as described below\n
RESPONSE_FORMAT:
{
\"input\" : \"". $userInput["prompt"] ."\",
\"language\" : \"result of step 4.\",
\"translation\" : \"result of step 3.\"
}
Ensure the response can be decoded by PHP json_decode