How to integrate ChatGPT into UiPath using HTTP request
Hello Folks,
It is probable that you've heard about ChatGPT and have experienced its capabilities. ChatGPT represents a groundbreaking AI technology that facilitates natural communication with an intelligent chatbot
What tasks can ChatGPT perform?
ChatGPT is a large language model that can perform a wide range of natural language processing tasks, such as:
A fun fact is that I used ChatGPT to generate its own capabilities.??
Steps to integrate ChatGPT into UiPath:
2. Copy the secret key from the website and store it in a strAPIKey variable.
3. Add an input dialog activity and store the question in the strQuestion variable.
4. Take HTTP Request activity (If the HTTP Request activity is not present in the activities panel, install the WEBAPI package from the manage packages.) and set the motioned values below.
End Point: https://api.openai.com/v1/engines/davinci/completions
Request Method: POST
Accept response as: JSON
Increase the timeout.
set this two parameters to it
Authorization: string.Format("Bearer {0}", strAPIkey)
Content-type: "application/json"
领英推荐
5. To build a body for our request just take a invoke code activity do the following steps:
out_JsonBody= @"
" + "\n" +
? ? ? @"""model"": """",
" + "\n" +
? ? ? @"""prompt"": ""Q: "? + in_strQuestion + @"?\nA:"",
" + "\n" +
? ? ? @"""temperature"": 0,
" + "\n" +
? ? ? @"""max_tokens"": 1000,
" + "\n" +
? ? ? @"""top_p"": 1,
" + "\n" +
? ? ? @"""frequency_penalty"": 0.0,
" + "\n" +
? ? ? @"""presence_penalty"": 0.0,
" + "\n" +
? ? ? @"""stop"" :""\n""
" + "\n" +
? ? ? @"}";
3. Set the arguments for invoke code.
4. Assign JsonBody variable to Body of the HTTP Request.
5. Assign a strResponce variable to Response Content.
6. Desacralize the JSON using Desacralize JSON activity and store the output in strOutputJson variable.
7. Create a string variable strAnswer to store your answer and assign value to it mentioned below:
8. Take a message box activity and format your output like mentioned below:
9. Debug your process.
10. Just ask your question to ChatGPT and it will provide you an answer.
11. This is how we get the exact answer from ChatGPT using above automation workflow.
This is how it is done, so using this approach RPA Developers can leverage #ChatGPT into their automation workflows.
I hope this this article helped you and readers can input their feedbacks as their is always a scope of improvisation.
Thank You.
Actively looking for oppurtunities || UiPath SDC'22 || SIH finalist 2022 || Vice-president Rotaract || Open Source || Greed to learn mode is on || JAVA is cool || learning
2 年It was some nice explanation, would definately try this out ??
UiPath Technical Architect | Experienced in RPA large scale implementations | AI/ML Engineer | AWS Solution Architect | Power Automate Developer |
2 年Great Pradeep Wani
★ Strategic-Minded MBA ★ Certified Sales Operations Specialist ★ Business Intelligence Professional ★ Problem-Solving Expert ★ Proven Track Record of Success
2 年Great Job UniPath! ??
Software Engineer- Microsoft Power Platform, Oracle Apex, Robotics Process Automation, AWS, ML
2 年A great tutorial on calling APIs with UiPath. But what is the application of calling ChatGPT with RPA in real world? I can as well type my question on the web User interface of ChatGPT.