Skip to main content
Retrieval Augmented Generation (RAG) is the core technology that allows AI agents to leverage your organization’s knowledge & database. Prisme.ai provides two powerful approaches to customize RAG behavior: YAML-based tools and webhooks. These methods give you granular control over every aspect of the RAG pipeline.

Configuration Approaches

For basic configurations, you can use the built-in UI settings:
  • Instructions
    • Keep clear and precise instructions with Titles and Sections.
      • Specify language (Reply in the user language, reply in English only, …)
      • Tone (Friendly, empathic, formal, …)
      • Output instructions (concise, detailled, …)
    • Documents and tools results placed in the $ keyword
    • Date placed in the $ keyword. Specify your users timezone.
  • Text Splitter Configuration
    • Chunk Size
    • Chunk Overlap
    • Enable override by document
  • Embeddings Settings
    • Number of chunks to retrieve
  • Self-Query
    • Enable filtering on tags set on your documents
    • Configure from AI Store input
    • Used:
      • Automatically, in AI > Self Query > Enabled, so the AI dynamically chooses which tags to use for a query
      • Set by the user, In AI > Self Query > Enabled by the user. Users will see a ”+” button in the AI Store to add tags.
      • Set mandatory tags for user or groups, in the User sharing page.
  • Query Enhancement
    • Select model
    • Add instructions and definitions
  • Post-Processing
    • Show suggested questions
    • Filter displayed sources

RAG Pipeline Components

The RAG pipeline in Prisme.ai consists of several stages, each of which can be customized using YAML tools or webhooks:
1

Query Processing

Transform and enhance the user’s question before retrieval
2

Retrieval

Find relevant documents in your knowledge base
3

Context Assembly

Organize retrieved documents into a coherent context
4

Prompt Generation

Create the prompt that will be sent to the LLM
5

Response Generation

Generate the final answer using the LLM
6

Post-Processing

Enhance the response with additional information or formatting

Documents Tags

Documents can have tags assigned to them. These tags can be used to reduce the load on the embedding model when retrieving documents by narrowing the search scope. They can also help avoid conflicts when multiple documents express opposing statements depending on the context. You have three ways to use tags:
  • Automatic:
    • Enabled in AI > Self Query > Enabled. The AI automatically determines which tags to use for each query.
  • User-defined:
    • Enabled in AI > Self Query > Enabled by the user. Users can manually add tags using the “+” button available in the AI Store.
  • Mandatory (by user or group):
    • Configured in the User sharing page, where you can assign required tags to specific users or groups.
Enable the self-query option in AI > Self Query > Enabled to let the LLM automatically determine the relevant tags for each question.
The system will then filter documents dynamically based on the inferred tags.
When multiple tag sources are combined, the logic follows this order:
  • All tags defined in the User panel are combined with OR logic.
  • All tags selected in the AI Store (chat interface) are also combined with OR logic.
  • Then, both resulting sets are combined using AND logic.
This means: A user with mandatory tags [A, B] and selected tags [C, D] will retrieve documents that contain at least one tag from each set, resulting in the following combinations: [A, C], [A, D], [B, C], [B, D].

YAML Tool Examples

This tool enhances user queries by generating alternative phrasings:
Usage scenario: Improve retrieval quality for ambiguous or tersely worded queries.
This tool augments the knowledge base with real-time web search results:
Usage scenario: Supplement your knowledge base with up-to-date information from the web.
This tool implements intelligent document chunking based on semantic boundaries:
Usage scenario: Improve retrieval quality for documents with complex structure or mixed topics.
This tool dynamically adjusts retrieval parameters based on query complexity:
Usage scenario: Automatically optimize retrieval for different query types (simple vs. complex, factual vs. exploratory).
This tool combines information from multiple retrieved chunks into a coherent context:
Usage scenario: Create more coherent context for complex queries that require information from multiple documents.

Webhook Integration

Webhooks provide an alternative approach to customizing the RAG pipeline by intercepting key events and modifying the behavior via external HTTP endpoints.
To configure a webhook for your AI Knowledge agent:
  1. Go to your agent’s settings
  2. Navigate to the “Webhooks” section
  3. Enter your HTTPS webhook URL
  4. Select which events to subscribe to
All webhook endpoints must use HTTPS and respond within 30 seconds to avoid timeouts.
Webhooks can intercept document creation, update, and deletion events:Request Example (Document Creation):
Response Example (Modify Document):
This allows you to:
  • Preprocess documents before indexing
  • Add or modify metadata
  • Override chunking settings per document
  • Reject documents that don’t meet criteria
Webhooks can intercept user queries and modify various aspects of the RAG process:Request Example:
Response Options:
  1. Override Retrieved Context:
  1. Override Prompt Generation:
  1. Override Answer Generation:
  1. Override AI Parameters:
  1. Override Search Results:
Webhooks can also intercept test results for analysis and evaluation:Request Example:
Response Example:
This allows you to:
  • Implement custom evaluation metrics
  • Track test results in external systems
  • Apply domain-specific scoring criteria

Combining YAML Tools and Webhooks

For the most sophisticated RAG configurations, you can combine YAML tools and webhooks:

Sequential Pipeline

Chain multiple YAML tools to create a sequential processing pipeline, with webhooks for external integration at key points.Example: YAML tool for query reformulation → webhook for sensitive query detection → YAML tool for retrieval customization

Fallback Mechanisms

Configure webhooks as fallbacks when YAML tools don’t produce satisfactory results.Example: Try native retrieval first, but if no good matches are found, call webhook to query external knowledge bases

A/B Testing

Use different YAML tools or webhooks based on query characteristics or for experimentation.Example: Route technical questions through one pipeline and customer support questions through another

Hybrid Processing

Let webhooks handle some RAG components while YAML tools handle others.Example: Webhook handles retrieval from proprietary databases, YAML tool handles context optimization

Best Practices

  • Start with simple tools and incrementally add complexity
  • Use a consistent naming convention for tools
  • Thoroughly test tools with varied inputs
  • Document each tool’s purpose and expected inputs/outputs
  • Consider performance implications for complex processing
  • Ensure webhooks are hosted on reliable, low-latency infrastructure
  • Implement proper error handling and fallbacks
  • Cache results when appropriate to improve response times
  • Use secure authentication to protect sensitive data
  • Monitor webhook performance and error rates
  • Clearly define which components require customization
  • Choose the appropriate approach (UI, YAML, webhook) based on complexity
  • Test changes incrementally to isolate effects
  • Monitor key metrics before and after changes
  • Document your RAG pipeline configuration for maintainability

Next Steps

Tools Integration

Learn more about integrating specialized tools with AI Knowledge

Agent Testing

Test and validate your RAG configuration

Advanced RAG

Explore sophisticated RAG architectures

Analytics

Monitor your RAG pipeline’s performance