Skip to content

Repository files navigation

RAG Practice with LangChain & LangGraph

This repository contains my personal experiments and practice scripts for building Retrieval-Augmented Generation (RAG) systems using LangChain and LangGraph.

I use this space to test different vector stores, embeddings, and LLM integrations to understand various RAG architectures.

Current Projects

1. RAG-pinecone.py

A RAG implementation leveraging Pinecone as the serverless vector store.

  • Model: DeepSeek (deepseek-chat)
  • Embeddings: Ollama (mxbai-embed-large)
  • Vector Store: Pinecone (Serverless)
  • Features:
    • Loads text files from data_files/ directory.
    • Splits text into chunks.
    • Indexes chunks into a Pinecone index named fictional-universe.
    • Defines a custom tool search_retrieve for the agent.
    • Example query: "What is a shared universe?"

2. RAG-token-efficient.py

A local RAG setup using ChromaDB focused on efficient token usage.

  • Model: Google Gemini (google_genai:gemini-2.5-flash)
  • Embeddings: Ollama (mxbai-embed-large)
  • Vector Store: ChromaDB (Persisted locally in vectors/)
  • Features:
    • Loads a specific file (Marvel_Cinematic_Universe.txt).
    • Uses a standard LCEL chain (RunnablePassthrough, StrOutputParser) instead of an agent.
    • Simple prompt template for context-based answering.

Setup & Usage

  1. Environment Variables: Create a .env file in the root directory with the following keys:

    PINECONE_API_KEY=your_pinecone_key
    DEEPSEEK_API_KEY=your_deepseek_key
    run_api_key=your_langsmith_key # Optional
    GOOGLE_API_KEY=your_google_ai_key
  2. Ollama: Ensure you have Ollama running locally with the mxbai-embed-large model pulled:

    ollama pull mxbai-embed-large
  3. Dependencies: Install the required packages (see pyproject.toml or install manually):

    pip install langchain langchain-openai langchain-community langchain-chroma langchain-pinecone pinecone-client python-dotenv langchain-deepseek

Future Plans

I plan to add more variations of RAG pipelines, including:

  • GraphRAG implementations using LangGraph.
  • Hybrid search (Keyword + Vector).
  • Multi-modal RAG.
  • Advanced retrieval strategies (Self-querying, Parent Document Retriever).

About

Various RAG implementations using Langchain & Langgraph

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages