Getting Started with Korvus: Your Unified RAG Pipeline

Jul 28, 2021 | Educational

Welcome to the world of Korvus, the innovative search SDK that streamlines your Retrieval-Augmented Generation (RAG) processes into a single database query. This article will guide you through the setup and usage of Korvus as well as trouble-shooting tips to make your experience seamless.

What is Korvus?

Korvus is an all-in-one open-source RAG pipeline specifically designed for Postgres. It combines several powerful capabilities like LLMs, vector memory, embedding generation, reranking, summarization, and custom models, allowing all of this functionality to be executed through a single query.

korvus-demo

Languages

Korvus is flexible and supports SDK integration across multiple programming languages:

Why Choose Korvus?

Here are some compelling reasons to adopt Korvus for your search needs:

  1. Postgres-Native RAG: By utilizing Postgres’ advanced capabilities, you can run intricate RAG tasks directly from your database, eliminating unnecessary API calls and reducing latency.
  2. Single Query Efficiency: All RAG processes are encapsulated within a single SQL query, simplifying your overall architecture while enhancing performance.
  3. Scalability: Korvus scales effortlessly with Postgres, maintaining remarkable performance as your datasets grow.

Key Features

  • Simplified Architecture
  • High Performance
  • Open Source
  • Multi-Language Support
  • Unified Pipeline
  • Postgres-Powered Efficiency

System Architecture

Korvus employs the PostgresML’s pgml and pgvector extensions to encapsulate the entire RAG pipeline right within Postgres.

PostgresML_Old-V-New_Diagram-Update

Getting Started

Prerequisites

To kick off with Korvus, ensure your environment meets the following requirements:

  1. Self-hosted: Set up your own Postgres database with pgml and pgvector. Follow the self-hosting guide.
  2. Hosted Service: Opt for our managed Postgres service with pgml and pgvector already set up. Sign up for PostgresML Cloud.

Quick Start

Follow these steps to utilize Korvus:

  1. Install Korvus:
    pip install korvus
  2. Set the database connection string:
    export KORVUS_DATABASE_URL=YOUR_DATABASE_CONNECTION_STRING
  3. Initialize a Collection and Pipeline:
    from korvus import Collection, Pipeline
    import asyncio
    
    collection = Collection('korvus-demo-v0')
    pipeline = Pipeline(...)
    
    async def add_pipeline():
        await collection.add_pipeline(pipeline)
    asyncio.run(add_pipeline())
  4. Insert documents:
    async def upsert_documents():
        documents = [
            {'id': 1, 'text': 'Korvus is incredibly fast and easy to use.'},
            {'id': 2, 'text': 'Tomatoes are incredible on burgers.'},
        ]
        await collection.upsert_documents(documents)
    asyncio.run(upsert_documents())
  5. Perform RAG:
    async def rag():
        query = 'Is Korvus fast?'
        results = await collection.rag(
            {'context': {'vector_search': {'query': {'fields': 'text', 'query': query}}}},
            {'pipeline': pipeline}
        )
        print(results)
    asyncio.run(rag())

The Power of SQL

While Korvus allows for an easy-to-use interface, it harnesses the power of optimized SQL queries at its core. This provides:

  • Transparency: Understand the underlying queries easily.
  • Customizability: Extend the capabilities by modifying SQL operations.
  • Performance: Take advantage of PostgreSQL’s advanced optimization techniques.

Don’t worry if you’re not a SQL expert; Korvus simplifies this while retaining SQL’s functional potency.

Documentation

For detailed guidance, API references, and best practices, visit the official documentation.

Troubleshooting

If you encounter any issues while using Korvus, here are some troubleshooting tips:

  • Ensure that all dependencies are installed and your environment is correctly set up.
  • Double-check your database connection string for any syntax errors.
  • Review the collection and pipeline setups to ensure they align with your project needs.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox