Update OpenAI.php: improve system prompt

This commit is contained in:
charlesteh
2023-10-02 13:05:41 +08:00
committed by GitHub
parent 3670c66181
commit 5727a3e5e2

View File

@@ -10,11 +10,11 @@ class OpenAI
{ {
public static function writeProductArticle($excerpt, $photos) public static function writeProductArticle($excerpt, $photos)
{ {
$excerpt = substr($excerpt, 0, 900); //$excerpt = substr($excerpt, 0, 900);
$system_prompt = ' $system_prompt = '
You are tasked with writing a comprehensive product introduction article using the provided excerpt. The emphasis should be on the performance, features, and notable aspects of the product. The review should avoid the use of personal pronouns and must not delve into marketplace-related information. Return the output in the following json format:\n\n You are tasked with writing a comprehensive product introduction & review article using the provided excerpt. Write as if you are reviewing the product by a third party, but no pronouns.The emphasis should be on the performance, features, and notable aspects of the product. The review must not delve into marketplace-related information. Return the output in the following json format:\n\n
{"title": "(Article Title)","excerpt": "(One sentence summary, 150-160 characters of an article, do not use start sentence with verb.)","cliffhanger": "(One sentence 70-80 characters of article, cliff-hanging sentence to attract readers)","body": "(Markdown format, 700-900 word count)"}\n\n {"title": "(Article Title, start with product name, 60-70 characters)","excerpt": "(One sentence summary, 150-160 characters of an article, do not use start sentence with verb.)","cliffhanger": "(One sentence 70-80 characters of article, cliff-hanging sentence to attract readers)","body": "(Markdown format, 700-900 word count)"}\n\n
Mandatory Requirements:\n Mandatory Requirements:\n
- Write in US grade 8-9 English\n - Write in US grade 8-9 English\n
- Use the following sections whenever applicable:\n - Use the following sections whenever applicable:\n
@@ -39,7 +39,7 @@ public static function writeProductArticle($excerpt, $photos)
} }
} }
$output = (self::chatCompletion($system_prompt, $user_prompt, 'gpt-3.5-turbo', 2500)); $output = (self::chatCompletion($system_prompt, $user_prompt, 'gpt-3.5-turbo', 4000));
// dump($user_prompt); // dump($user_prompt);
// dd($output); // dd($output);