#Accessing Davinci-003 Via Python 'requests' Library / Module (API)

10 messages ยท Page 1 of 1 (latest)

ember onyx
#

Hi guys ๐Ÿ™‚ I am trying to access text-davinci-003 via Python. I have a Python script which dynamically loads request settings and prompts via info stored in a spreadsheet.

My aim is to generate prompts (in a spreadsheet) and fire them to Davinci-003 and then collect the responses. The application is to generate some product descriptions.

I would post a sample of the actual Python script, but I don't think it's really relevant or worth anyone's time to read. All you need to know is the request being made by the Python script. It is separated into "headers" and "data", as per the imported "requests" library / module. Instead I will focus on the output which is being sent to Open AI via Python / requests.

Here are the header and data outputs which are being fired to the Open AI API (examples).

Headers:

{'Authorization': 'sk-VALID-GENERATED-KEY', 'Content-Type': 'application/json'}

Above: note that the key is generated from Open-AI back-end. It is valid and not deleted. I am just not sharing the exact key (hope that's okay).

Data:
{'model': 'text-davinci-003', 'prompt': 'Write an 800 character product description for the product known as the Arlo Pro 3 Floodlight 2K Camera - Black. Use a technical and promotional writing style.', 'temperature': 0.5, 'max_tokens': 60.0, 'top_p': 0.3, 'frequency_penalty': 0.5, 'presence_penalty': 0.0}

The request URL is set to: https://api.openai.com/v1/completions

When I run the script, everything works but I get 401 response (instead of actual prompt responses). What have I done wrong? I have Asperger's sorry if I put this in the wrong place. I am also not a developer or programmer by trade, but I pick things like this up pretty quick with some minor assistance ๐Ÿ™‚

ember onyx
#

I have just noticed that davinci-003 isn't available on the free plan and that my test credits have expired, but I never used them! This is a blow as I was hoping to get my company to pay, but they won't unless they can see what Open AI can do first

fair estuary
#

@ember onyx That is a shame. You can always just use ChatGPT. It's similar to GPT and if you are looking to write reviews you'll eventually need to train it to speak truthfully

ember onyx
#

@fair estuary thanks for the info! I'd rather use ChatGPT but as far as I know, no current API access and I need to make bulk requests (no human interaction / web UI). The plan is to get this davinci-003 one working, and then recode it for ChatGPT model once that is released into the Open AI API, where it doesn't currently exist (to my knowledge, correct me if I am wrong)

fair estuary
#

@ember onyx For sure, but given your situation I'm just thinking it may be better to have an efficient prompt to demonstrate, and then get funding for the API

#

Also i think you're thinking a bit backwards. ChatGPT is simply a trained version of GPT, and as of now , doesn't grant any access to its settings.

You would ideally want to train your own. The other way around would be very limiting

nocturne laurel
#

Hello @fair estuary

What if we wanted to use the "chat" preset of the text davinci 003 as an API

#

We have the API hooked up to our platform, but she's sounding way off compared to how she did on the OpenAI playground

fair estuary
#

@nocturne laurel Compared to ChatGPT? Unless you wait for ChatGPT to become available with an API you'd need to train and configure it yourself

nocturne laurel
#

Hmmmm! That sounds like a long wait