Next.js Discord

Discord Forum

Need some OpenAI help with my api route!

Unanswered
Scottish Terrier posted this in #help-forum
Open in Discord
Scottish TerrierOP
Hey!

I'm trying to craft a prompt that always responds within a given length, let's say 200 words.
The problem is that the max_tokens parameter seems to include the input prompt as well, which not always cuts my sentences in the reponse.

How can I change my code so that the input is not counted into the total token count in the api call?

Here's the code:
const response = await openAIInstance.chat.completions.create({ model: "gpt-3.5-turbo", messages: [ { role: "user", content:Return a professional CV using the following data: '${myParsed.data}'., }, ], temperature: 1, max_tokens: 200, top_p: 1, frequency_penalty: 0, presence_penalty: 0, });
Many thanks! I've tried everything but without success sadly :/

0 Replies