Skip to content

This repo contains all the work done on the development of a RAG application using Oracle DB Vector Store, LlamaIndex, LangChain and Oracle GenAI service

License

Notifications You must be signed in to change notification settings

luigisaetta/llamaindex_oracle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Integrate Oracle AI Vector DB and OCI GenAI with Llama-index and LangChain

Code style: black

The UI of the Knowledge Assistant you can build using following examples.

screenshot

This repository contains all the work done on the development of RAG applications using:

In the Video demos section of the Wiki you'll find some video of the demo.

What is RAG?

A very good introduction to what Retrieval Augmented Generation (RAG) is can be found here

Features

  • basic (12/2023) integration between Oracle DB Vector Store (23c) and llama-index
  • All documents stored in an Oracle DB
  • Oracle AI Vector Search used for Semantic Search
  • Reranking to improve retrieval
  • How to show references (documents used for the response generation)
  • (30/12) Added reranker implemented as OCI Model Deployment
  • (20/01) Added implementation of Vector Store for LangChain and demo
  • Finding duplicates in the documentation
  • (2/03/2024) Added Phoenix Traces for observability

Demos

  • demo1 This NB shows a demo where you get answers to questions on Oracle Database and new features in 23c
  • demo2 This NB shows a QA demo on Medicine (Covid19), using Public docs from NIH.
  • Bot powered by Oracle Vector DB and OCI GenAI
  • demo3 shows how to add a Reranker to the RAG chain; I have used Cohere
  • demo5 shows a full rag chain where the reranker is deployed on OCI DS
  • LangChain demo based on Oracle Vector DB and LangChain
  • finding duplicates
  • Knowledge assistant full demo

Setup

See the wiki pages.

Loading data

  • You can use create_save_embeddings to load all the data in the Oracle DB schema.
  • You can launch it using the script load_books.
  • The list of files to be loaded is specified in the file config.py

You need to have pdf files in the same directory.

Limited Availability

  • (News) OCI GenAI is General Availability since 23/01/2024, see updated docs for setup

Oracle AI Vector Search (Vector DB) is a new feature in Oracle DB 23c, in Limited Availability.

Customers can easily enter in the LA programs.

To test these functionalities you need to enroll in the LA programs and install the proper versions of software libraries.

Code and functionalities can change, as a result of feedbacks from customers.

Releases used for the demo

  • OCI 2.119.1
  • OCI ADS 2.10.0
  • LangChain >= 0.1.4
  • LangChain Community >= 0.0.16
  • Llama-index >= 0.9.37.post1 < 0.10
  • Oracle Database 23c (23.4) free edition with Vector DB

You can install a complete Python environment using the instructions in the *Setup section of the Wiki.

Libraries

  • OCI Python SDK
  • OCI ADS
  • oracledb
  • Streamlit
  • Llama-index
  • LangChain
  • Arize-AI/phoenix for Observability and Tracing

Documentation

Embeddings

One of the key pieces in RAG is the Retrieval module. To use the DB Vector Store you need an Embeddings Model: a model that does the magic of transforming text in vectors, capturing the content and the semantic of the text. The Embeddings Model used in these demos is Cohere Embeds V3, provided from OCI GenAI service.

With few changes you can switch to use an Open Source model. But you need to have the computational power to run it.

Observability

(02/03/2024) I have added integration with Arize Phoenix (Phoenix traces). To enable tracing in config.py you must set ADD_PHX_TRACING = True

In case of troubles with installing OpenTelemetry a quick solution is to disable it.

Factory methods

In the module prepare_chain are defined factory methods to create: embedder, llm, reranker...

The philosophy is to make things simpler. So all the configuration are taken from config.py.

If you want to change the llm, (or anything else) go to config.py. No params in the NBs

About

This repo contains all the work done on the development of a RAG application using Oracle DB Vector Store, LlamaIndex, LangChain and Oracle GenAI service

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published