-
Go to OpenAI's Platform website at https://platform.openai.com/ and sign in with an OpenAI account.
-
Click your profile icon at the top-right corner of the page and select "View API Keys."
- Click "Create New Secret Key" to generate a new API key.
Follow below steps to setup ChatGPT(gpt-3.5-turbo based) custom connector
-
Go to Custom connectors section under Makers Portal - https://make.powerapps.com/.
-
Click on + New custom connector, select Create from blank and provide a name, e.g. "ChatGPT Connector" and click continue.
- Under General section, specify the Host as api.openai.com, optional, provide an icon for the custom connector.
- Under Security section, specify the API key as Authentication type. Under API key sub-section, Add API Key as Parameter label and Authorization as Parameter name.
-
Under Definition, click on New Action
- Under General section, provide Summary as ChatGPT API and Operation ID as ChatAPI.
- Click on + Import from sample under Request section
Add the following in the below order and click on Import once done.
Verb - POST
URL - https://api.openai.com/v1/chat/completions
Headers - Content-Type application/json
Body -
{ "model":"gpt-3.5-turbo", "messages":[{"role":"","content":""}] }
-
After import, click on Content-Type dropdown under Request section and select Edit.
-
Set the Default value as application/json, Is required as Yes and Visibility as internal. Go back.
-
Similarly, select body dropdown under Request section and select Edit.
-
Set Is required as Yes and Visibility as important.
- Repeat the step for content, role and model dropdowns located under body parameter, by setting Is required as Yes and Visibility as important.
-
Click on Create Connector.
-
Under Test section click on + New connection and enter key with a prefix **Bearer ** (Bearer with a space)
- Once setup successfully, the connector will show up under connections section
- Complete the Test Connector steps. See - next section.
To test the connector follow the below step
-
Go to Custom connectors section under Makers Portal (https://make.powerapps.com/) and select the connector(ChatGPT Connect) created in previous section.
-
Go to Test section. By default, Connection should populate under selected connection.
-
Under Operations section, enter gpt-3.5-turbo as model, role as user and content as What does CDS mean in Power Platform? to Test operation. Click Test operation and copy the response value under Body section once complete.
-
Go to Definition and select default under Response section.
-
Click Import from sample and paste the response value copied in step 3. Click Import.
-
Update the connector again.