openAI API returning garbage characters in output

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
".

I will never be a professional actor."

I have set the temperature to .2 and also tried .1. maxTokens are set to 256 integer value. Can somebody help me whats wrong here?

prompt:

You are probably prompting the model used incorrectly

generation:

.

When a model “completes” text, it will continue producing the expected text, even if it has to finish what you gave as input.

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.

I guess you are right. It is a completion model based on the API call (api.openai.c o m/v1/engines/text-davinci-002/completions)

Can you provide me the chat model link which I can simply go and replace in the code. or the link where I can find the URL. Thanks!

https://platform.openai.com/docs/api-reference/chat/create