LanceDB VectorDB Recipes

repository·main·Indexed 21 days ago

https://github.com/lancedb/vectordb-recipes

A repository of practical examples, tutorials, and starter code for building Generative AI applications using LanceDB. Includes implementations for RAG chatbots, document interaction tools (PDF, Wikipedia, GitHub CodeSpaces), and specialized assistants for healthcare, HR, and credit card statement analysis using frameworks like LangChain, FastAPI, Streamlit, and Gradio.

Tokens
129.6K
Snippets
436
Records
572
Agent score
76%

What's inside vectordb-recipes

  1. Overview of the Feature Engineering tutorial

    main

    This tutorial provides a guide on using LanceDB's Feature Engineering capabilities. The workflow covers the following stages:

    1. Setup and data loading: Preparing the environment and ingesting initial data.
    2. Running first feature engineering jobs: Executing basic transformations.
    3. Adding embeddings with CLIP: Using the CLIP model to generate multimodal embeddings.
    4. Indexing: Creating indexes on the engineered features for efficient retrieval.
    5. Running on remote Ray clusters: (Planned) Scaling feature engineering jobs using Ray.
    6. Materialized views: (Planned) Utilizing materialized views for optimized data access.

    You can follow the interactive tutorial in Google Colab.

    [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/lancedb/vectordb-recipes/blob/main/tutorials/feature-engineering/feature-engineering-101.ipynb)
  2. Overview of Video Search with V-Jepa 2 and LanceDB

    main
    This recipe demonstrates how to perform video search using the V-Jepa 2 model integrated with LanceDB. V-Jepa 2 is a self-supervised video model optimized for understanding, prediction, and planning in real-world environments. It uses a mask-denoising technique in representation space and can be used for tasks such as video understanding, human action anticipation, and video question-answering when integrated with a Large Language Model (LLM).
  3. Overview of NER-powered Semantic Search with LanceDB

    main

    This tutorial demonstrates how to implement semantic search enhanced by Named Entity Recognition (NER). The approach leverages LanceDB as the vector database to store and query embeddings, combined with NER techniques to improve the precision of search results by identifying specific entities within text.

    For a full interactive implementation, you can use the provided Google Colab notebook.

    [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/lancedb/vectordb-recipes/blob/main/tutorials/NER-powered-Semantic-Search/NER_powered_Semantic_Search_with_LanceDB.ipynb)
  4. Overview of the Multi-Source RAG Agent

    main

    The Multi-Source RAG Agent is a Retrieval Augmented Generation system designed for complex guidance tasks, such as navigating export and import regulations. It combines internal knowledge retrieval with real-time web searching to provide comprehensive answers.

    Key components include:

    • LanceDB: Used for efficient retrieval of structured and unstructured internal documentation (e.g., product classifications, compliance guidelines).
    • Tavily: Used for real-time external searches to fetch the latest policy updates, HS codes, and industry news.
    • LangGraph: Manages the agent's memory and streaming capabilities to handle multi-step reasoning and stateful interactions.
  5. Overview of VectorDB-recipes

    main

    VectorDB-recipes is a collection of examples, applications, starter code, and tutorials designed to help developers build Generative AI (GenAI) applications. The projects are built using LanceDB, a free, open-source, serverless vector database.

    Key features of the underlying technology used in these recipes:

    • No setup required: LanceDB is serverless.
    • Python Ecosystem Integration: Works seamlessly with pandas, arrow, and pydantic for data pipelines.
    • Native TypeScript SDK: Enables running vector search within serverless functions.
  6. Overview of the Fintech AI Agent workflow

    main

    The Fintech AI Agent is an intelligent system designed to process loan and insurance queries through a multi-agent architecture:

    • Loan Intent Extraction: Uses an LLM to classify user queries (e.g., home improvement, medical) and a RandomForest model to predict eligibility.
    • Insurance Claim Generation: Uses a synthetic data generation pipeline to create realistic auto insurance claim queries.
    • Semantic Search: Uses LanceDB with sentence-embeddings to perform semantic similarity searches, which are used to evaluate insurance claim approvals.
    • Query Routing: Employs a Kernel Agent to classify incoming queries and route them to either a specialized Loan Agent or an Insurance Agent.
  7. Overview of GraphRAG with cognee

    main
    GraphRAG (Graph Retrieval Augmented Generation) uses cognee to process and index audio, video, and text data into hierarchical knowledge graphs. Unlike traditional RAG, this approach structures data into a graph format to enhance semantic search and retrieval capabilities. This implementation uses LanceDB as the vector database to manage large, complex datasets and perform efficient vector similarity searches.
  8. Speaker Identification and Transcription Mapping Workflow

    main

    This project implements a pipeline for speaker diarization and transcription that maps detected speaker identities to actual names using vector search.

    The workflow follows these steps:

    1. Create a Known Speaker Database: Use LanceDB to store embeddings of known speakers (e.g., employees). This database allows for retrieving correct names based on audio similarity.
    2. Transcription and Diarization:
      • Use OpenAI's Whisper Model for generating audio transcriptions.
      • Use Nvidia's Nemo-MSDD model for speaker diarization (detecting who spoke when).
    3. Speaker Mapping: Perform a vector search against the LanceDB speaker database to map the diarized speaker IDs to their real names.
    4. Alignment and Export: Align timestamps with transcriptions and export the final transcription with correct speaker labels (e.g., updating the RTTM file).
  9. Build a RAG application with LangChain and LanceDB

    main

    FarmerGPT is a template for building a Retrieval-Augmented Generation (RAG) application specifically designed to process PDF data (e.g., agricultural crop information).

    Core Components

    • LangChain: Used as the orchestration framework to manage the LLM workflow, prompts, and memory.
    • LanceDB: Serves as the vector database to store document embeddings and perform efficient retrieval of relevant context from the PDF.

    Key Capabilities

    • PDF Integration: Extracts and indexes data from PDF files for semantic search.
    • Memory Support: Maintains conversation context during multi-turn interactions.
    • Customizable Prompts: Allows developers to modify the system instructions to change how the LLM responds to queries.
  10. Build a Chatbot Q&A tool using Crawl4AI and LanceDB

    main

    This recipe demonstrates how to build an advanced Q&A tool that extracts information from any website URL and uses semantic search to answer questions. It combines Crawl4AI for efficient web crawling and text extraction with LanceDB for high-performance, serverless vector search.

    Workflow

    1. Web Crawling: Use Crawl4AI to crawl specified URLs. It supports multiple browsers (Chromium, Firefox, WebKit) and can extract media tags, metadata, links, and page structure in formats like JSON, cleaned HTML, or Markdown.
    2. Vector Storage: Store the extracted data in LanceDB. The extracted text is converted into embeddings to enable semantic search.
    3. Question Answering: Perform vector-based searches in LanceDB to retrieve relevant context from the crawled websites to answer user queries.