> ## Documentation Index
> Fetch the complete documentation index at: https://prismeai-docs-next.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Building a No-Code RAG Agent

> Learn how to create a powerful retrieval-augmented generation agent without writing code using Knowledges

This tutorial guides you through creating a powerful Retrieval-Augmented Generation (RAG) agent using Prisme.ai's Knowledges product. You'll learn how to build an AI that can intelligently access and leverage your organization's documents to provide accurate, contextual responses—all without writing a single line of code.

## What You'll Build

A complete RAG system with:

* A customizable knowledge base containing your documents
* Vector embedding and intelligent retrieval capabilities
* An interactive chat interface for querying your documents
* Automated testing for continuous quality assurance
* Analytics for performance monitoring

<Note>
  Knowledges functions as a RAG-as-a-Service offering, creating a collaborative environment where Data Scientists, Data Engineers, Developers, and Business Teams can efficiently work together. The platform features a unique methodology called Gen.AI Test-Driven Building, ensuring everyone operates from a single source of truth.
</Note>

## Prerequisites

Before starting this tutorial, make sure you have:

* Access to the Knowledges product (self-hosted or Cloud version)
* Basic understanding of prompting concepts
* Documents to integrate (web pages, PDFs, Word documents, PowerPoint presentations, etc.)

## Step 1: Understanding the Knowledges Interface

Let's familiarize ourselves with the Knowledges product's interface and main components:

<Steps>
  <Step title="Access Knowledges">
    Log in to your Prisme.ai account and navigate to the Knowledges product
  </Step>

  <Step title="Explore the Navigation">
    The interface consists of several key sections:

    * **Agent**: Configure AI models, select embedding models, and set parameters
    * **Test**: Configure and manage automated tests for your AI
    * **Analytics**: Monitor KPIs like token usage, generated answers, and daily usage
    * **Help**: Access embedded product documentation
  </Step>
</Steps>

## Step 2: Creating Your RAG Project

Now, let's set up your first RAG project in Knowledges:

<Steps>
  <Step title="Access Your Dashboard">
    Navigate to the Knowledges dashboard
  </Step>

  <Step title="Create a New Agent">
    Click the "Create Agent" button to start building your RAG agent
  </Step>

  <Step title="Configure Project Settings">
    Enter a name and description for your project that reflects its purpose
  </Step>
</Steps>

## Step 3: Understanding the RAG Architecture

Knowledges uses a Retriever-Augmented Generation architecture that combines document retrieval with language generation:

This architecture allows your agent to:

1. Process and store documents as vector embeddings
2. Retrieve relevant document chunks based on user queries
3. Generate contextually accurate responses using LLMs
4. Provide sources and citations for transparency

<Note>
  Knowledges is designed to be model-agnostic, ensuring compatibility across various LLMs for both embedding and generative tasks. This flexibility allows you to switch models as needed without rebuilding your entire knowledge base.
</Note>

## Step 4: Integrating Documents

Let's add documents to your knowledge base:

<Steps>
  <Step title="Access Document Integration">
    In your project, navigate to the document integration section
  </Step>

  <Step title="Upload Documents">
    Click the "Add Document" button and upload files from your computer, or provide URLs to web content
  </Step>

  <Step title="Configure Document Processing">
    Adjust the document processing settings:

    * **Text Splitter**: Choose between static (fixed-size chunks) or dynamic (content-aware) segmentation
    * **Chunk Size**: Set the optimal size for document segments
    * **Overlap**: Configure how much content overlaps between chunks to maintain context
  </Step>

  <Step title="Process Documents">
    Start the document processing, which includes:

    * Document loading and parsing
    * Text extraction and cleaning
    * Segmentation into chunks
    * Vector embedding generation
    * Metadata extraction
  </Step>
</Steps>

## Step 5: Testing Your RAG Agent

Now that your documents are integrated, you can start querying your knowledge base:

<Steps>
  <Step title="Access the Chat Interface">
    Click on the "Chat" button to access the interactive interface
  </Step>

  <Step title="Ask Questions">
    Enter questions related to your documents to see how the AI responds
  </Step>

  <Step title="Review Sources and Chunks">
    Examine the sources and chunks used to generate each response
  </Step>
</Steps>

<Note>
  Knowledges provides full transparency by showing which document chunks were used to generate each response. This feature allows you to verify the AI's reasoning and ensure accuracy.
</Note>

## Step 6: Implementing Test-Driven Building

A unique aspect of Knowledges is its support for Test-Driven Building (TDB), which ensures your RAG agent performs consistently over time:

<Steps>
  <Step title="Access the Testing Module">
    Navigate to the "Test" section in your project
  </Step>

  <Step title="Create a Test Suite">
    Click "Add Test" to create a new test suite for your RAG agent
  </Step>

  <Step title="Define Test Cases">
    Add test cases with:

    * **Questions**: Queries that users might ask your agent
    * **Expected Answers**: The correct information that should be provided
  </Step>

  <Step title="Configure Test Settings">
    Set how often tests should run (daily, weekly, etc.) and whether they should trigger automatically
  </Step>

  <Step title="Run Tests">
    Execute the tests to evaluate your agent's performance
  </Step>

  <Step title="Review Results">
    Analyze the test results, which include:

    * **Prompt and Context**: The exact prompt and context used for generating responses
    * **Generated Response**: The AI's actual response
    * **Response Evaluation**: Rating of response quality (poor, correct, good)
    * **Context Evaluation**: Rating of context relevance and accuracy
  </Step>
</Steps>

<Note>
  Business experts can manually assess responses, context, and instances of hallucination. We recommend running tests after each modification to the model, prompt, AI parameters, chunk size, image inclusion settings, self-query configuration, and other adjustments.
</Note>

## Step 7: Advanced Customization Options

After setting up your basic RAG agent, you can explore advanced customization options:

<Tabs>
  <Tab title="Using Builder Product">
    <Steps>
      <Step title="Access the Builder">
        Navigate to the Builder product on the Prisme.ai Platform
      </Step>

      <Step title="Implement Custom Logic">
        Create automations with Python or NodeJS using frameworks like LlamaIndex or Langchain
      </Step>

      <Step title="Connect to Knowledges">
        Copy the automation URL and go to Advanced > API & Webhook in Knowledges
      </Step>

      <Step title="Enable Webhook">
        Enter your automation URL and subscribe to events like questions asked, documents added/deleted/updated, and test runs
      </Step>
    </Steps>
  </Tab>

  <Tab title="Using External Code">
    <Steps>
      <Step title="Develop External Service">
        Build your custom processing logic as an external service with an API endpoint
      </Step>

      <Step title="Configure Webhook">
        Navigate to Advanced > API & Webhook in Knowledges
      </Step>

      <Step title="Connect Your Service">
        Enter your service's URL to receive events from Knowledges
      </Step>

      <Step title="Set Up Event Handlers">
        Configure your service to respond appropriately to different event types
      </Step>
    </Steps>
  </Tab>
</Tabs>

## Step 8: Handling PII and Safety Controls

For organizations dealing with sensitive information, Knowledges offers options for privacy and safety:

<Steps>
  <Step title="Implement PII Controls">
    Use the Webhook functionality to detect and handle personally identifiable information
  </Step>

  <Step title="Configure Data Anonymization">
    Decide whether to anonymize personal data based on your use case
  </Step>

  <Step title="Add Custom Safety Controls">
    Integrate specific safety measures tailored to your organization's compliance requirements
  </Step>
</Steps>

## Step 9: Monitoring and Maintenance

Keep your RAG agent performing optimally with regular monitoring:

<Steps>
  <Step title="Review Analytics">
    Check the Analytics section to monitor usage patterns, token consumption, and response quality
  </Step>

  <Step title="Set Up Alerts">
    Use the Webhook feature with Builder to implement alerts on platforms like Slack, Teams, or Jira
  </Step>

  <Step title="Regular Maintenance">
    Update your knowledge base as new documents become available or existing information changes
  </Step>

  <Step title="Performance Optimization">
    Based on analytics and test results, adjust settings to improve response quality and efficiency
  </Step>
</Steps>

## Best Practices for High-Performance RAG

To maximize the effectiveness of your RAG agent, consider these recommendations:

<CardGroup cols="2">
  <Card title="Knowledge Architecture" icon="sitemap">
    Design a well-organized structure for easy access and interpretation by AI systems
  </Card>

  <Card title="Data Quality" icon="database">
    Ensure data is accurate, well-formatted, and relevant—this accounts for \~80% of success
  </Card>

  <Card title="Hybrid Technologies" icon="code-branch">
    Consider combining NLU for tag extraction with LLMs for generation to improve efficiency
  </Card>

  <Card title="Continuous Optimization" icon="arrow-trend-up">
    Regularly monitor response times, accuracy, and retrieval effectiveness
  </Card>
</CardGroup>

## Wrapping Up

By following this tutorial, you've created a powerful RAG agent that can access and leverage your organization's knowledge without requiring any coding. Your AI can now provide accurate, contextual responses based on your documents, with full transparency about its sources and reasoning.

The Test-Driven Building approach ensures your agent maintains high performance over time, while the flexible architecture allows you to adapt and extend its capabilities as your needs evolve.

## Next Steps

<CardGroup cols="2">
  <Card title="Document Classification" icon="file" href="/resources/tutorials/data-classification-agent">
    Learn how to automatically classify and organize your documents with AI
  </Card>

  <Card title="AI Contact Routing" icon="phone" href="/resources/tutorials/ai-contact-routing">
    Create an intelligent contact form that routes inquiries to the right department
  </Card>

  <Card title="Webhook Integration" icon="webhook" href="/resources/tutorials/webhook-builder">
    Build advanced integrations between your RAG agent and other systems
  </Card>

  <Card title="Website to RAG" icon="globe" href="/resources/tutorials/website-to-rag-agent">
    Turn website content into a comprehensive knowledge base for your RAG agent
  </Card>
</CardGroup>
