#Struggling with Consistent Prompting: GPT Keeps Generating Values Outside My List

1 messages · Page 1 of 1 (latest)

proud spear
#

Hey everyone,

I've been experimenting with GPT to generate content based on a specific list of elements. The goal was to ensure that the model picks values only from this predefined list, but I’m running into an issue. While GPT does sometimes choose elements from the list, it also generates values that aren’t part of it.

For example, I’ll give my prompt:

Please select the least relevant categories to the user's needs (minimum 45) among the following 336 categories:
car_dealer
[List of 300+ element]
car_repair

YOUR RESPONSE FORMAT IS THE FOLOWING: ONLY a comma-separated list with no explanations, introductions, or additional text.
You are not allowed to add any other text or explanations.
User prompt input: You are a flower merchant
Is it may way of prompting that creates this inconsistency ?
Has anyone else had this problem?
I’ve tried rephrasing the prompt, being more explicit, and even giving it more context, but it doesn’t always seem to help.

Any help would be greatly appreciated!

uncut plinth
#

You're doing this over the API, right? If so you might want to look into the "structured outputs" feature. This is basically what it was made for, outputting content in a strictly defined format.

proud spear
#

Double thanks for fast answer

uncut plinth
proud spear
uncut plinth
#

depending on how many classes you have for your outputs I would suggest either making one model which contains every class encoded as a boolean, or making it output a list of strings and then informing it in the prompt about which strings it is/isn't allowed to put in the list

proud spear
thorny ore
#

give this a spin

https://zenodo.org/records/15186676

(look into the coordinates listed in the silver network)