Update (ai): improve description generation, increase timeout

This commit is contained in:
2023-09-25 20:21:53 +08:00
parent e3fe8bf877
commit 8fc46dc80c

View File

@@ -55,7 +55,7 @@ public static function createNewArticleTitle($current_title, $supporting_data)
No punctuation in titles especially colons :\n
90-130 characters\n\n
return in following json format {\"main_keyword\":\"(Main Keyword)\",\"title\":\"(Title in 90-130 letters)\",\"short_title\":\"(Short Title in 30-40 letters)\",\"article_type\":\"(How-tos|Guides|Interview|Review|Commentary|Feature|News|Editorial|Report|Research|Case-study|Overview|Tutorial|Update|Spotlight|Insights)\",\"description\":\"(SEO description based on main keyword)\",\"photo_keywords\":[\"photo keyword 1\",\"photo keyword 2\"]}";
return in following json format {\"main_keyword\":\"(Main Keyword)\",\"title\":\"(Title in 90-130 letters)\",\"short_title\":\"(Short Title in 30-40 letters)\",\"article_type\":\"(How-tos|Guides|Interview|Review|Commentary|Feature|News|Editorial|Report|Research|Case-study|Overview|Tutorial|Update|Spotlight|Insights)\",\"description\":\"(Cliffhanger SEO description based on main keyword, do not start with action verb)\",\"photo_keywords\":[\"photo keyword 1\",\"photo keyword 2\"]}";
$user_prompt = "Article Title: {$current_title}\n Article Description: {$supporting_data}\n";
@@ -94,7 +94,7 @@ public static function suggestArticleTitles($current_title, $supporting_data, $s
public static function chatCompletion($system_prompt, $user_prompt, $model)
{
$response = Http::timeout(500)->withToken(config('platform.ai.openai.api_key'))
$response = Http::timeout(800)->withToken(config('platform.ai.openai.api_key'))
->post('https://api.openai.com/v1/chat/completions', [
'model' => $model,
'max_tokens' => 2500,