Hi,
I’m writing a simple script to augment my data with relevant keywords. The data is a simple collection of Emojis, and I want to add keywords to each one of them.
I’m using the API and gpt-3.5-turbo.
The issue is that, more often than not, GPT is returning various repeated keywords at the end of their response.
Here’s my code and prompt:
const completion = await openai.createChatCompletion({
model: "gpt-3.5-turbo",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{
role: "user",
content: `
You are a helpful and creative assistant.
Write a comprehensive list of keywords for an emoji.
Include keywords that represent places, verbs and actions.
Emoji:
- Emoji: ${emoji.symbol}, // the emoji itself
- Name: ${emoji.name}, // the name of the emoji
- Existing keywords: ${emoji.keywords}. // some existing keywords
- Requirement:
All keywords must be single words only; avoid using sentences or expressions.
Never repeat keywords to ensure variety in the list.
- Output:
Generate an extensive list without repeating words or compromising relevance.
Return only a comma separated list of keywords.`,
},
],
temperature: 0.4,
max_tokens: 250,
});
And here’s an example response for the emoji
love, affection, passion, emotion, romance, adoration, care, devotion, fondness, attachment, desire, warmth, tenderness, infatuation, sentiment, feeling, heartbeat, pulse, beloved, sweetheart, crush, admiration, enchantment, enchanting, captivating, endearing, charming, delightful, attractive, beautiful, lovely, pretty, stunning, gorgeous, striking, captivating, alluring, mesmerizing, bewitching, spellbinding, irresistible, attractive, attractive, desirable, desirable, attractive, attractive, desirable, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive, attractive, desirable, attractive
It’s worth noting that sometimes the prompt works great and I get a list of unique keywords. But often, I get results like the above.
I’ve tried many variations of the same prompt without much success.
Is there anything I can try to avoid the repeated keywords?