I am providing a prompt to openAI API from my flutterflow app. Sometimes its returning the garbage characters. For example, output starts with a period and have carriage returns in the output and then the actual output starts. Sometimes it returns the sentence perfectly.
Here is an example: When I selected the area Environment and then AI generated perfect sentence for Step 1 i.e. “I am not good enough to be a professional actor.” but look at the output of Step 2 in 2nd text field. It starts with a period and has carriage returns in it and then the actual output
".
Can you suggest what possibly is wrong with the following prompt? I am not good enough to be a professional actor. Write cause for this belief statement in one line
The problem is more likely what we don’t see: what model are you using, and what is the “prompt” or “messages” format being passed to it.
I can tell from the symptom of the period being written you are likely using a completion model instead of a chat model (see API reference on side of forum). Asking an AI to code for you will only get you obsolete info about the OpenAI API.
A completion model (as ChatGPT might suggest from its own knowledge) needs much more containerization to return to you what is solely an AI response – and not adding the period you missed.
A prompt for a “completion” model like davinci (as a chatbot may have suggested) would have all this text to get the output you want:
Here is a conversation between an AI assistant and a human. The human is consulting the AI and looking for information and advice.
AI: Hello, how can I offer my assistance today?
Human: (I am not good enough…) ← insertion
AI:
You can see that we supplied a place for the AI to write its answer - that shows the AI that the human’s input is done.
This will also need a stop sequence of “\nHuman:” in the API call parameters, or the completion model may continue to simulate more conversation.