From 04c3578d61197ced5e164d3f3b13bcc7fbf88211 Mon Sep 17 00:00:00 2001 From: Max Richter Date: Fri, 8 Sep 2023 15:24:07 +0200 Subject: [PATCH] feat: optimize keyword creation query --- lib/openai.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/openai.ts b/lib/openai.ts index 0c233ad..fd0bdcf 100644 --- a/lib/openai.ts +++ b/lib/openai.ts @@ -85,11 +85,15 @@ export async function createKeywords( { "role": "system", "content": - `you create some keywords that can be used in a recommendation system. The keywords are based on a ${type} description. Create a range of keywords from very specific ones that describe the general vibe. Also include some that describe the genre. ${ + `you create some keywords that can be used in a recommendation system. The keywords are based on a ${type} description or title. If you do not know the title, take into account the description aswell. Create a range of keywords from very specific ones that describe the general vibe. Also include some that describe the genre. ${ title ? `The name of the ${type} is ${title}` : "" }`, }, - { "role": "user", "content": description.slice(0, 2000) }, + { + "role": "user", + "content": `description: + ${description.slice(0, 2000)}`, + }, { "role": "user", "content": "return a list of around 20 keywords seperated by commas", @@ -122,3 +126,4 @@ export async function createTags(content: string) { return extractListFromResponse(res).map((v) => v.replaceAll(" ", "-")); } +