Hi !
On my application developed with bubble , there is a feature to enter raw information and get a text (done in API)
The prompt written clearly stipulates an output of a text of 350 characters.
It does not work with tokens either.
I never have the right number…
Does anyone have the solution? I can pay for the service!
Thank you very much!
Welcome to the community!
That’s a super tough problem. First of all, because the models suck at counting, but second of all (and most importantly) because it’s a computationally difficult problem.
Can you, as a human, come up with a 100 character poem without backtracking? I’m guessing that you would take an iterative approach → come up with “close enough” solution, count, and then refine.
The models can’t backtrack (on its own) and correct any errors, so it’s incredibly difficult. That said, the models seem to be exceptionally good at getting the heuristics required to approximate these tasks if possible.
One thing you can do, is to augment the model’s generation with a character count, so the model knows how many more characters it can spit out. This will get expensive with OpenAI’s primitive API monetization scheme.
A cheaper method is to ask the model to count words, by putting each word in a new line and prepending the line number, e.g.:
1: The
2: white
3: rabbit
etc..
you’d need to figure out statistically how long the average word is. If we assume 4.7 chars per word, you’d need to ask for ~74 words to get very close to your target 350.
If you need to absolutely get exactly 350, you can then compute how many chars were generated, and ask the llm for some replacement words/synonyms and then insert them programmatically to get to where you want to be.
It’s not super easy but it’s definitely doable! I believe in you!
Thanks for your feedback !
I will take time to try what you explained
I think o3 will be better for this i hope.
Merry christmas to you and yout close.
I will give news soon