Creating an Oracle Cloud Infrastructure AI Chatbot with OpenAI
Rohit Rahi
Vice President, Global Oracle Cloud Infrastructure Delivery, Oracle University | ex-AWS | ex-Azure
Oracle Cloud Infrastructure (OCI) is a cloud computing platform
?In this blog post, I will show you how to create a simple AI chatbot
Requirements:
To get started, you will need Python installed
?Additionally, you will need an API key
Building the Chatbot:
2. Set the OpenAI API key:
3. Initialize the messages list with a system message: this initializes the messages list with a system message that instructs the chatbot to only answer questions related to Oracle Cloud Infrastructure.
4. Define the chatbot function: this function takes user input as an argument and appends it to the messages list. The function then calls the OpenAI ChatCompletion API with the messages list, retrieves the OpenAI's response, appends it to the messages list, and returns the response.
领英推荐
5. Set up the Gradio user interface: the interface is launched locally, and I can ask questions related to OCI.
6. Create and launch the Gradio interface:
Now I can chat with the chatbot in my browser, asking questions about OCI. The chatbot will provide answers in the output textbox as shown below.
As expected, when asked about AWS, the chatbot lets me know that it can only answer queries related to OCI. :)
It gives a pretty good overview of the key storage services in OCI. Next, I ask a more complex question about using a network load balancer over a load balancer and the response is really good.
Finally, I ask it a complex multiple-choice question from one of our OCI practice exams, and not only does it provide the correct answer but also gives a very detailed explanation
That's pretty much it - the capabilities of OpenAI are just mind-boggling. Using just a few lines of code, I was able to create a simple chatbot for answering Oracle Cloud Infrastructure-related questions using OpenAI's GPT-3.5 Turbo model. With a simple chatbot like this, you can quickly find answers to your OCI questions. You can read more about the ChatCompletion API here, https://platform.openai.com/docs/guides/chat
Security Account Manager - Oracle Cloud Advisory
1 年I executed all the steps successfully, however I get this error when I submit the query. "openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details." Should I pay something for this?
Master Principal Solution Architect, Oracle ???? |Cloud | MultiCloud | Data | AI
1 年yes, it runs well... but we need to pay API token fee if we don't go chatgpt UI ??
Pricing Strategy | Business Planning | Analytics | Process Optimization | P&L Management | Team Building | Cross-functional Collaboration | Customer Advocacy | SQL | Python | Power BI
1 年this is amazing!
Senior Consultant | Oracle HCM Cloud | Technology Consulting | Digital HR Transformation
1 年Amazing Utility. Thanks for sharing!
PMP | Cloud, Data Analytics, AI | 3x Azure | 1x AWS
1 年Pretty cool.. Thanks for sharing.