This repository demonstrates a practical chatbot deployment on Oracle Cloud Infrastructure (OCI) as part of the Oracle Cloud Infrastructure Generative AI Professional course. The course is designed for Software Developers, Machine Learning/AI Engineers, and Generative AI Professionals, covering topics such as pretrained foundational models, summarization, embeddings, Dedicated AI Clusters, and the OCI Generative AI security architecture.
In this course, I learned how to enhance the chatbot's conversational abilities by integrating memory and implementing Retrieval-Augmented Generation (RAG) with LangChain. Additionally, I gained experience in deploying the chatbot on an OCI compute instance.
-
Fundamentals of Large Language Models (LLMs):
- LLM Basics
- LLM Architectures
- Prompt Engineering
- Fine-tuning Techniques
- Fundamentals of Code Models
- Multi-modal LLMs and Language Agents
-
OCI Generative AI Deep Dive:
- Pretrained Foundational Models (Generation, Summarization, Embedding)
- Flexible Fine-tuning (including T-Few technique)
- Model Inference
- Dedicated AI Clusters
- Generative AI Security Architecture
-
Building a Conversational Chatbot with OCI Generative AI:
- Understanding Retrieval-Augmented Generation (RAG)
- Vector Databases and Semantic Search
- Building a Chatbot using the LangChain Framework (Prompts, Models, Memory, Chains)
- Tracing and Evaluating the Chatbot
- Deploying the Chatbot on OCI
This repository demonstrates a practical chatbot deployment on Oracle Cloud Infrastructure (OCI) as part of the Oracle Cloud Infrastructure Generative AI Professional course. The course is designed for Software Developers, Machine Learning/AI Engineers, and Generative AI Professionals. It covers key topics such as pretrained foundational models, summarization, embeddings, Dedicated AI Clusters, and the OCI Generative AI security architecture.
In this course, I learned how to enhance a chatbot’s conversational abilities by integrating memory and implementing Retrieval-Augmented Generation (RAG) with LangChain. Additionally, the course covered deploying the chatbot on an OCI compute instance.
-
Fundamentals of Large Language Models (LLMs):
- LLM basics
- LLM architectures
- Prompt engineering
- Fine-tuning techniques
- Fundamentals of code models
- Multi-modal LLMs and Language Agents
-
OCI Generative AI Deep Dive:
- Pretrained foundational models (generation, summarization, embedding)
- Flexible fine-tuning (including T-Few technique)
- Model inference
- Dedicated AI Clusters
- Generative AI security architecture
-
Building a Conversational Chatbot with OCI Generative AI:
- Understanding RAG
- Vector databases and semantic search
- Building a chatbot using the LangChain framework (prompts, models, memory, chains)
- Tracing and evaluating the chatbot
- Deploying the chatbot on OCI
This repository contains various files for learning and certification purposes. However, the primary files needed for deploying the conversational chatbot are:
-
demo-ou-chatbot-chroma-final-v1.py:
This script creates a vector store using the Chroma library, suitable for document retrieval tasks in natural language processing.Key Features:
- Importing Libraries: Includes
OCIGenAIEmbeddings,RecursiveCharacterTextSplitter, andChromafor essential tasks. - Loading and Splitting Documents: Loads PDF documents from the
./pdf-docsdirectory and splits them into manageable text chunks. - Setting Up OCI Generative AI Embeddings: Uses a
LoadPropertiesclass to retrieve configuration settings and set upOCIGenAIEmbeddings. - Processing and Storing Documents in Batches: Handles batch processing due to the embedding model's limit of 96 documents at a time.
- Persisting the Vector Store: Automatically saves data in Chroma 0.4.x and later.
- Importing Libraries: Includes
-
demo-chroma-create-v1.py:
A demonstration for creating a Chroma vector store using LangChain and OCI Generative AI embeddings.Key Features:
- Importing Modules: Includes libraries for PDF loading, text splitting, embedding generation, and vector storage.
- Loading and Splitting Documents: Loads and splits documents into 2,500-character chunks with a 100-character overlap.
- Setting Up OCI Generative AI Embeddings: Configures embeddings using model settings retrieved by
LoadProperties. - Batch Processing: Efficiently processes large datasets by splitting them into smaller batches.
- Persisting the Vector Store: Automatically saves the vector store for future retrieval and analysis.
-
LoadProperties.py:
A utility class that loads configuration settings from aconfig.txtfile (in JSON format) and provides access to these settings throughout the application.
In this guide, I will walk through the process of building and deploying an OCI Generative AI chatbot.

- Create a VM instance with the following configuration:
- Image: Canonical Ubuntu 22.04
- Shape:
VM.Standard.E4.Flex - Virtual Machine Specs: 1 OCPU, 64 GB memory, 2 Gbps network bandwidth
- Download the SSH key and save it as
ubuntu-vm-priv.key.
- Open Windows PowerShell and connect via SSH:
ssh -i ubuntu-vm-priv.key ubuntu@<VM_IP_Address>

- Upgrade Ubuntu packages:
sudo apt update && sudo apt upgrade - Install Python and Virtual Environment:
sudo apt update && sudo apt upgrade
- Create a virtual environment and activate it:
virtualenv ouenv source ouenv/bin/activate - Install dependencies from requirements.txt (copy the files from your local machine to the VM first):
pip install -r requirements.txt
- Set up the firewall to open port 8501:
sudo iptables -I INPUT 6 -m state --state NEW -p tcp --dport 8501 -j ACCEPT- Setup subnet security list to open port 8501: From Compute select your instance , Select subnet for your instance and Select the default security list and add port 8501 for TCP traffic

- Index the documents:
python3 demo-chroma-create-v1.py- Start the chroma server:
chroma run --host localhost --port 8000 --path ./chroma.sqlite3- Run the Streamlit Application:
streamlit run demo-ou-chatbot-chroma-final-v1.py --server.port 8501


