At first, I’m sorry that I cannot share the prompt messages I used for the input.
For some prompts, the contents of response only consists of lot’s of spaces and new lines. It doesn’t happens everytime, but sometimes without control.
Q1. Why is this happens
Q2. How to prevent from this situation?
I’m trying to build a Python script to feed information to chatGPT using the following script
from openai import OpenAI
Blockquote
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model=“gpt-3.5-turbo-0125”,
response_format={ “type”: “json_object” },
messages=[{“role”: “system”, “content”: “You are a young and intelligent software engineer assigned to the task to identify ambiguities in the system requirements JSON”},
{“role”: “user”, “content”: “Identify ambiguities in the following software requirement”},
{“role”: “user”, “content”: “Once borrower clicks on the Payment Request link sent to their email address we need to retrieve the Payment Request Information and return it to the borrower.”}],
temperature=1,
top_p=1
)
print(response)
We are experiencing the same problem - 5-10 times a day this one specific prompt (running on gpt-4-turbo-preview) will return a table header, then 20-70kB of whitespace. Already deployed code to check for that scenario and rerun (most of the time it is fine on rerun)
Sometimes at the end will be some repeating mandarin characters too!
Try adding the assistant’s response in between your user messages.
This gives me a sane output:
usemodel="gpt-3.5-turbo-0125"
client = OpenAI()
response = client.chat.completions.create(
model=usemodel,
response_format={ "type": "json_object" },
messages=[{"role": "system", "content": "You are a young and intelligent software engineer assigned to the task to identify ambiguities in the system requirements and output it in JSON"},
{"role": "user", "content": "Identify ambiguities in the following software requirement"},
{"role": "assistant", "content": "To help you identify ambiguities, I'll need to see the specific software requirement you're referring to. Could you please provide the requirement text?"},
{"role": "user", "content": "Once borrower clicks on the Payment Request link sent to their email address we need to retrieve the Payment Request Information and return it to the borrower."}],
temperature=1,
top_p=1
)
print(response)