Skip to content

πŸš€ RAG LanceDB Demo Agent

The RAG LanceDB Demo Agent showcases high-performance RAG capabilities with LanceDB vector database in SuperOptiX. This demo focuses specifically on how to configure and use RAG with LanceDB for scalable, production-ready knowledge retrieval.

🎯 What This Demo Shows

This demo demonstrates:

  • πŸš€ High-Performance RAG: How to configure RAG with LanceDB in SuperOptiX
  • πŸ“ˆ Scalable Knowledge Retrieval: Production-ready vector database
  • ⚑ Fast Semantic Search: Optimized retrieval performance
  • βš™οΈ Playbook Configuration: How to set up RAG with LanceDB in agent playbooks

πŸš€ Setup RAG with LanceDB

1. Install Ollama Model

Bash
# Install the Ollama model used in this demo
super model install llama3.2:8b

2. Start Ollama Server

Bash
# Start Ollama server (runs on port 11434 by default)
ollama serve

3. Pull and Run the Demo

Bash
# Pull the RAG LanceDB demo agent
super agent pull rag_lancedb_demo

# Compile the agent
super agent compile rag_lancedb_demo

# Run the agent
super agent run rag_lancedb_demo --goal "What is the SuperOptiX framework?"

πŸ”§ RAG Configuration in Playbook

The RAG LanceDB demo showcases how to configure RAG with LanceDB in the agent playbook:

Language Model Configuration

YAML
language_model:
  location: local
  provider: ollama
  model: llama3.2:8b
  api_base: http://localhost:11434
  temperature: 0.7
  max_tokens: 2048

RAG Configuration

YAML
rag:
  enabled: true
  retriever_type: lancedb
  config:
    top_k: 5
    chunk_size: 512
    chunk_overlap: 50
    similarity_threshold: 0.7
  vector_store:
    embedding_model: sentence-transformers/all-MiniLM-L6-v2
    table_name: lancedb_demo_table
    database_path: ./data/lancedb

Key RAG Configuration Points:

  • βœ… enabled: true: Enables RAG functionality
  • πŸ—„οΈ retriever_type: lancedb: Uses LanceDB as vector database
  • πŸ” top_k: 5: Retrieves top 5 most similar documents
  • πŸ“„ chunk_size: 512: Document chunk size for processing
  • πŸ”— chunk_overlap: 50: Overlap between chunks for context
  • 🎯 similarity_threshold: 0.7: Minimum similarity score for retrieval
  • 🧠 embedding_model: Sentence transformers for embeddings
  • πŸ“‹ table_name: LanceDB table name
  • πŸ’Ύ database_path: Local storage directory

πŸš€ LanceDB: Enterprise-Grade RAG

LanceDB is built for production environments where performance and scalability matter. It's the vector database of choice for serious applications:

  • ⚑ Lightning Fast: Optimized for high-speed semantic search across millions of documents
  • πŸ“ˆ Enterprise Scale: Handles massive document collections with ease
  • 🏒 Production Ready: Built with enterprise-grade reliability and consistency
  • ☁️ Cloud Native: Seamlessly works with cloud storage and distributed systems
  • πŸ”„ ACID Compliant: Guarantees data consistency and transaction safety
  • πŸ“‹ Version Control: Track changes and maintain document history

πŸ”§ Customizing RAG Configuration

Adjust Retrieval Settings

Edit agents/rag_lancedb_demo/playbook/rag_lancedb_demo_playbook.yaml:

YAML
rag:
  config:
    top_k: 10  # Retrieve more documents
    chunk_size: 1024  # Larger chunks
    similarity_threshold: 0.8  # Higher similarity threshold

Change Vector Database

YAML
rag:
  retriever_type: chroma  # Use ChromaDB instead
  vector_store:
    collection_name: chromadb_demo_collection
    persist_directory: ./data/chromadb

Use Different Embedding Model

YAML
rag:
  vector_store:
    embedding_model: sentence-transformers/all-mpnet-base-v2  # Different embeddings

🚨 Troubleshooting RAG

Common Issues

  1. Ollama Server Not Running

    Bash
    # Check if Ollama server is running
    curl http://localhost:11434/api/tags
    
    # Start Ollama server
    ollama serve
    

  2. LanceDB Issues

    Bash
    # Check RAG configuration
    super agent inspect rag_lancedb_demo
    
    # Clear LanceDB data if needed
    rm -rf ./data/lancedb
    

  3. RAG Not Working

    Bash
    # Check RAG configuration
    super agent inspect rag_lancedb_demo
    
    # Verify knowledge base is populated
    

Getting Help

Bash
# Check agent status
super agent inspect rag_lancedb_demo

# View agent logs
super agent logs rag_lancedb_demo

# Get RAG help
super agent --help

πŸ”— Next Steps

  1. Try Other RAG Backends: Explore RAG ChromaDB for development