Integrating ChatGPT into Your Power Automate Flow. Use pre-build “Chat completion” action or “HTTP” connector.
Alona Soroka
Project manager / Team lead / SCM Functional Analyst Microsoft Dynamics 365 F&O
Leverage ChatGPT in your Power Automate workflows using a pre-built action or an HTTP connector. Following the trial introduction of Co-pilot and its subsequent popularity, many have explored incorporating ChatGPT into their automation tasks. Initially, setting up ChatGPT for free versions was straightforward. However, with the deprecation of all free versions (Ada, Babbage, Curie, and Davinci) on April 4, 2024, including the "GPT3 completes your prompt" action in Power Automate, alternative methods were necessary.
Prerequisites:
1.????? API Key for ChatGPT Connection: Obtain an API key and save it securely as it cannot be retrieved once issued; you will need to regenerate if lost. Learn more about OpenAI Authentication.
2.????? Ensure Adequate Funding: Your OpenAI account should have a minimum of USD 5 credits that must be active. You can check it here.
3.????? Access to Power Platform Subscription: Ensure you have an active subscription to test your scenarios.
?
I will demonstrate the simplest scenario in which I pose a question to ChatGPT and expect a response. You may adapt this approach to suit your specific needs, where ChatGPT can analyze images, interpret data from Excel, or integrate information from various external sources.
?
Chat completion action for ChatGPT Response Generation in Power Automate Flow
1.????? Create a New Flow: Launch Power Automate, initiate a new flow, click 'Skip', and rename the newly created empty flow if preferred.
2.????? Add a Trigger: For testing purposes, I will use a Manual trigger as it is the simplest form of activation. You may replace it with your preferred trigger once testing is complete.
3.????? Configure Text Input: Add a Text Input for your manual trigger and rename this input to 'Question'.
4.????? Insert Chat Completion Action: Following the 'Manually trigger a flow', incorporate a 'Chat Completion' action.
5.????? Data Entry:
a.????? Body/Model: Select "gpt-3.5-turbo" as the model, ensuring it is within your OpenAI credit limits.
b.????? Body/Message:
????????????????? i.????? Role – 1: "user".
???????????????? ii.????? Content-1: Enter your 'Question', select the 'lightning'?icon, and choose 'Question' from the 'Manually trigger a flow' menu.
c.????? Body/N: "1".
d.???? Temperature: "1".
e.????? Max Tokens: "1000".
f.?????? Frequency Penalty: "0".
g. Presence Penalty: "0".
6.????? Connection Setup:
a)????? Scroll down and select 'Change connection'.
b)???? Click 'Add new' to establish a new ChatGPT connection.
c)????? Input the Connection name as "Authorization".
d)???? Enter your API Key: "Bearer YOUR CHATGPT KEY" (note the space between 'Bearer' and your key).
e)???? Click on the 'Create new' button.
7.????? Save and Test the Flow: Save your configurations and initiate a test run.
8.????? Manual Execution: Manually input your question and activate the flow by clicking the 'Run flow' button.
9.????? Review the Output: Inspect the results in the Output > Body section.
10. Final Adjustments: Update the trigger as needed and publish your flow to make it live.
This procedure will guide you through setting up a ChatGPT-powered flow in Power Automate, ensuring you can efficiently generate responses as needed.
领英推荐
?
HTTP Connection to ChatGPT in Power Automate Flow
1.????? Initialize a New Flow: Launch Power Automate, start a new flow, click 'Skip', and rename the newly created empty flow if desired.
2.????? Set Up a Trigger: For initial testing, I will use a Manual trigger as it simplifies the process. After testing is complete, you may switch to the trigger of your choice.
3.????? Configure Text Input: Add a Text Input for your manual trigger and rename it to 'Question'.
4.????? Implement HTTP Action: Insert an HTTP action following the 'Manually trigger a flow'.
5.????? Configure HTTP Parameters:
a.????? URL: Enter "https://api.openai.com/v1/completions" as outlined on the OpenAI Authentication page.
b.????? Method: Set to "POST".
c.?????? Headers: Configure as follows:
????????????????????????? i.????? Enter key: "Authorization”.
???????????????????????? ii.????? Enter value: "Bearer YOUR CHATGPT KEY" (ensure there is a space between 'Bearer' and your key).
d.????? Body: Adapt the body to fit your model requirements from the provided examples or include additional details regarding penalties and other GPT input parameters. Replace "YOUR QUESTION" with your 'Question' input from the Manual trigger step.
{
??? "model": "gpt-3.5-turbo-instruct",
??? "prompt": "YOUR QUESTION",
???? "max_tokens": 1000,
??? "temperature": 0,
??? "stop": null.
}
{
??? "model": "gpt-3.5-turbo",
??? "messages": [
??????? {
??????????? "role": "user",
??????????? "content": "YOUR QUESTION"
??????? }
??? ],
??? "max_tokens": 1000,
??? "temperature": 0,
??? "stop": null
}
6.????? Save and Test the Flow: Save your settings and conduct a test run.
7.????? Manual Execution: Manually input your question and activate the flow by clicking the 'Run flow' button..
8.????? Review the Output: Examine the results in the Output > Body section.
9.????? Final Adjustments: Update the trigger as needed and publish your flow to finalize it.
?
This setup enables you to efficiently integrate ChatGPT into your Power Automate flows using HTTP actions, ensuring flexibility and customization according to your automation needs.
Founder @ Bridge2IT +32 471 26 11 22 | Business Analyst @ Carrefour Finance
4 个月Thanks for shedding light on the capabilities of ChatGPT! ????
PLANIFICACIóN DE SISTEMAS ELECTRICOS | CONEXIóN Y DESARROLLO DE PROYECTOS | CIENCIA DE DATOS
4 个月Alona, muchas gracias por compartir la conexión entre ambas herramientas.
Senior Managing Director
5 个月Alona Soroka Very Informative. Thank you for sharing.