How to use ChatGPT.(Power Automate Cloud flow)
Introduction to using ChatGPT from Power Automate (Cloud flow).

Contents
Stems
Get the ChatGPT API key (secret key) in beforehand.
Then set up the Initialize variable Action.


Specify APY_KEY for Name, String for Type, and API key for Value.

One more Initialize variable Action is set up, with prompt in the Name, string in the Type, and the contents of the query to ChatGPT in the Value.

Set up an HTTP Action.


Set up as follows.
Parameter | Value |
---|---|
Method | POST |
URI | https://api.openai.com/v1/completions |
Header, line 1, left | Content-Type |
Header, line 1, right | application/json |
Header, line 2, left | Authorization |
Header, line 2, right | Bearer @{variables('APY_KEY')} |
Body | { "model": "text-davinci-003", "prompt": @{variables('prompt')}, "max_tokens": 2024, "temperature": 0, "top_p": 1 } |

When the flow is saved, the @{variables('APY_KEY')} and @{variables('prompt')} parts change.

The result from ChatGPT is obtained by the following Expression.
trim(body('HTTP')?['choices'][0]?['text'])

The flow is complete.

Discussion
New Comments
No comments yet. Be the first one!