I’m using ChatGPT API in my Python project.
I’m using the text-davinci-003 model. I have passed a prompt to the ChatGPT API.
However, it returns empty results to me.
Yes, but the code generated by ChatGPT is wrong. So you should go to the GitHub page and follow the code examples there, first (and please stop using ChatGPT to write code for you if you are not going to verify it):
ChatGPT writes very bad OpenAI API code based on long (close to two years) deprecated libs.
As a “novice” software developer, it’s best, I assure you, to code from the current docs of the libs you are using.
Yes, but you should add a stop for good measure, something like "####".
Also, you should print your completion response as follows, per the Python docs:
# print the completion
print(response.choices[0].text)
HTH
Note: If you still get a blank response, please post your prompt you are using so I can test it for you. My code works fine so it’s easy to test and I’m happy to test if for you.
OR
You can first try this to see if there is an error message (also wisely suggested by @dhiaeddine.khalfalla earlier, BTW):
Extract the location, category, and keywords from the following sentence:
I'm looking for a good italian restaurant in New York City.
Location: [input location]
Categories: Abruzzo Restaurant|Accessories|Accountant|Acupuncturist|Aerospace Company|Afghan Restaurant|African Restaurant|Agricultural Service|Agriculture|Airline Company|…
Keywords: [input keywords]