API and Playground Differences!

Why from the following prompt is there a different answer from Playground to API on all models? All setting being the same!

“show a list of UK population growth over 10 years”

Playground apologises then gives data. API apologises with no data.

Can you share your API code (without API Key)?

1 Like

If you are using a deprecated completion model such as davinci-003, then one must set a max_token value yourself as part of the API call, or you will only get a default answer length of 16 tokens, about 10 words. That could give the appearance of “apology, but no data”.

Otherwise, just compare every other parameter and setting that you see with a slider or value in the sidebar of the playground, and ensure it has an equivalent in your API calling code. Also, if using a chat model through the chat API, that you have created separate role messages with the system role message the same as you have created in the system role message box seen in the “chat” version of the playground.

2 Likes