Creating an Oracle Cloud Infrastructure AI Chatbot with OpenAI

Creating an Oracle Cloud Infrastructure AI Chatbot with OpenAI

Oracle Cloud Infrastructure (OCI) is a cloud computing platform that provides 100+ services, including compute, storage, networking, databases, application development, security, observability, and many other services. For developers and IT professionals who are new to OCI or need help with specific tasks, it can be challenging to find the right information quickly.

?In this blog post, I will show you how to create a simple AI chatbot using OpenAI's GPT-3.5 Turbo model and the Gradio library. This chatbot is specifically designed to answer questions related to Oracle Cloud Infrastructure using the OpenAI ChatCompletion API. Even though the ChatCompletion API supports both gpt-3.5-turbo and gpt-4, I could not get gpt-4 to work for this chatbot, so I am using gpt-3.5-turbo here.

Requirements:

To get started, you will need Python installed on your machine, along with the openai and gradio libraries. You can install these libraries using pip:

No alt text provided for this image

?Additionally, you will need an API key for OpenAI. You can obtain one by signing up for an account on the OpenAI website.

Building the Chatbot:

  1. Import the necessary libraries:

No alt text provided for this image

2. Set the OpenAI API key:

No alt text provided for this image

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.

No alt text provided for this image

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.

No alt text provided for this image

5. Set up the Gradio user interface: the interface is launched locally, and I can ask questions related to OCI.

No alt text provided for this image

6. Create and launch the Gradio interface:

No alt text provided for this image

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.

No alt text provided for this image

As expected, when asked about AWS, the chatbot lets me know that it can only answer queries related to OCI. :)

No alt text provided for this image

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.

No alt text provided for this image

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.

No alt text provided for this image

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

Abhilash Patnaik (CISSP)

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?

回复
Vivian Liu

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 ??

回复
Ajay Sharma

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!

回复
Vinit Dave

Senior Consultant | Oracle HCM Cloud | Technology Consulting | Digital HR Transformation

1 年

Amazing Utility. Thanks for sharing!

回复
Shirali Shah

PMP | Cloud, Data Analytics, AI | 3x Azure | 1x AWS

1 年

Pretty cool.. Thanks for sharing.

回复

要查看或添加评论,请登录

Rohit Rahi的更多文章

  • No Code Retrieval-Augmented Generation (RAG) with OCI Generative AI Agents

    No Code Retrieval-Augmented Generation (RAG) with OCI Generative AI Agents

    For enterprise AI models to be truly useful, they often need access to background knowledge that they wouldn't have on…

    21 条评论
  • 100,000 OCI Certifications

    100,000 OCI Certifications

    Last week, we hit a major milestone: we crossed 100,000 OCI certifications! And the scale is truly global – we have OCI…

    134 条评论

社区洞察

其他会员也浏览了