Turning Documentation into Intelligence: Build a RAG System with RisingWave

Turning Documentation into Intelligence: Build a RAG System with RisingWave

Documentation is essential—but finding the right answer at the right time is harder than it should be. Developers dig through pages of text, struggle with vague search results, and often give up before finding what they need. It slows down onboarding, hinders debugging, and eats into precious engineering time.

But what if your documentation could answer questions like a human expert?

With RisingWave's new support for Retrieval-Augmented Generation (RAG), you can now turn static documentation into an intelligent assistant that actually understands your content—and delivers contextual, accurate answers in seconds.

The pain of searching docs

Traditional search is keyword-based. Ask “how do I write a Python UDF,” and you might get dozens of links containing the words “Python” and “UDF”—but no useful explanation. That’s because static search doesn’t understand meaning, only matching.

As documentation grows, so does the gap between having the answer and finding it. This challenge isn’t limited to RisingWave; it’s universal across modern engineering teams working with internal tools, APIs, or fast-changing systems.

RisingWave now offers a streamlined way to build a RAG system directly on top of your documentation.

Here’s how it works:

  • Ingest documentation into a RisingWave table.

  • Automatically generate vector embeddings for each document using OpenAI.

  • When a user asks a question, generate an embedding for the query.

  • Retrieve the most semantically similar docs using a custom cosine_similarity UDF.

  • Feed the results to an LLM to generate a concise, context-aware answer.

You get semantic search and AI-powered answers, without standing up a separate vector database or custom backend.

The architecture: from raw text to smart answers

Building a RAG system typically requires piecing together multiple disparate tools, such as a vector database, an LLM, and custom orchestration logic. RisingWave simplifies this complex architecture by consolidating these functions into its streaming SQL engine.

It natively handles vector embeddings and similarity search, manages materialized views for rapid data retrieval, and supports both SQL and Python UDFs for flexible custom logic. Furthermore, its direct integration with the OpenAI API streamlines the entire workflow, creating a unified and more efficient platform for your RAG applications.

Building the system takes just three steps:

  1. Set up the pipeline

    Create a documents table and a document_embeddings materialized view using a UDF that calls OpenAI’s embedding API. The view uses a SQL UDF called openai_embedding—a new built-in function introduced in RisingWave 2.5.0. See openai_embedding function documentation for more details.

     CREATE FUNCTION text_embedding(t VARCHAR) RETURNS REAL[] LANGUAGE sql AS $$
         SELECT openai_embedding('your-openai-api-key', 'text-embedding-3-small', t)
     $$;
    
  2. Load your docs

    Clone the RisingWave documentation repo and insert the content into the documents table.

  3. Ask questions

    Generate a query embedding, compare it with stored embeddings using the cosine_similarity UDF, and retrieve the top matches.

For detailed step-by-step guides, see Building a RAG system on RisingWave.

This new capability opens the door to several powerful applications:

  • Self-service developer support: Answer onboarding and usage questions automatically.

  • AI assistants for internal tools: Embed natural-language Q&A into your dev dashboards or CLIs.

  • Product search that understands meaning: Power help centers with real intelligence, not just full-text search.

And best of all, it’s all done using standard SQL and built-in features in RisingWave.

Try it yourself

Ready to move from endless searching to real finding? Transform your documentation with RisingWave and RAG.

Start building your own RAG-powered Q&A system today!

The Modern Backbone for Your
Data Streaming Workloads
GitHubXLinkedInSlackYouTube
Sign up for our to stay updated.