Your Personal Philosopher:This project is a Retrieval-Augmented Generation (RAG) system that uses a Large Language Model (LLM) to provide philosophical insights from Mankuthimmana Kagga. It leverages a curated knowledge base to ground the LLM's responses, making them contextually accurate and relevant.
Tech Stack for my experiments with LLM augmentation using RAG, vector embeddings, and vector DB store involves:
- Agent Framework: LangChain for orchestrating the RAG workflow.
- Vector Embeddings: A Google embedding model to convert text into vector representations.
- Vector Database: Pinecone for high-performance storage and retrieval of embeddings. Dense with 768 dimensions insights.
- Generative Model: Gemini on LangChain for generating coherent responses.
- Language: TypeScript for a robust and type-safe application.
How It Works:The system follows a standard RAG pipeline:
- Unstructured data source from pdf, docs, etc. is loaded, chunked, and embedded using Langchain tools and Google embedding model.
- These embeddings are stored in a Pinecone vector database and indexed.
- When a user query is received, the system retrieves the most relevant text chunks from the database.
- The retrieved context is then provided to the Gemini LLM, which uses this information to generate a grounded and insightful response, ergo ur Philosopher.
Getting Started Prerequisites:
-
Get your Pinecone API Key and Index.
-
Google API key.
-
Installation:
git clone <repository-url>
npm install -g bun && bun install
cd src
- Configuration: Create a
.env
file insidesrc
folder and add your keys, example below:
PINECONE_API_KEY=<YOUR_PINECONE_API_KEY>
GOOGLE_API_KEY=<YOUR_GOOGLE_API_KEY>
PINECONE_INDEX = <YOUR_PINECONE_INDEX>
DO_EMBED_COSTLY_OP = <ENABLED | DISABLED>
Note!
: You should be in src
folder by now, to run these cmds:
Note!
: Since, ingestion is a costly ops! feature flag has been provided below to avoid any accidental runs!
- To populate the vector database with embeddings (manual upload):
in your .env
file set below feature flag to enable the ingestion:
DO_EMBED_COSTLY_OP: ENABLED
then:
bun run ingest.ts
Note!
: You may want to turn back the above feature flag to DISABLED
now!
- Finally To run chat:
bun run philosopherChat.ts
- Once you are done with your query type
/bye
to exit app.
Acknowledgments: Although this project is for my understanding of RAG-based augmentation, it's also a tribute to D. V. Gundappa, whose timeless wisdom serves as a cornerstone for many. His work continues to inspire generations.
Trying to bring code and art-storytelling together.