6 min readUpdated Mar 2, 2026

ContextPreview Documentation

Overview

ContextPreview is a feature within the Vantage analytics and data platform that serves as a debugging tool for users to see how AI understands a particular query. It allows users to input a sample question and observe which snippets of data would be selected by the AI, along with their relevance scores and the actual context that will be included in the AI's prompt.

Purpose

The primary purpose of ContextPreview is to provide transparency into the AI's decision-making process by displaying the selected data snippets and their scores when users submit a query. This helps users refine their queries for better outcomes and understand what information the AI will consider when forming responses.

Settings

The following are the settings available in the ContextPreview component:

1. Query Input

2. Page Context Input

3. Loading State

4. Show Raw Context

5. Show Advanced Options

6. Result Data

How It Works

When a user inputs a sample query and clicks the "Preview" button or presses "Enter," the following sequence occurs:

  1. The component validates the query to ensure it is not empty.
  2. The loading state is activated while the component fetches data from the endpoint /api/ai/snippets/preview using a POST request, which includes the query and optional page context as JSON.
  3. Upon receiving a response, the component updates the Result state with the data returned, which includes a number of insights on how snippets were selected.
  4. The component displays the relevant snippets along with their scores and context strings, and allows users to toggle the advanced settings.
  5. Users can hide or show raw context details, providing insight into how data is injected into the AI prompt.

Data Expectations

The component expects the following data from the backend when the user runs a query:

Use Cases & Examples

Use Cases

  1. Debugging AI Responses in Customer Support: A support agent can use ContextPreview to refine their queries to ensure the AI retrieves the most relevant snippets to assist customers effectively.

  2. Optimizing Query Performance: Data analysts can leverage ContextPreview to understand which snippets are being selected for queries run frequently, thus optimizing the AI's responses and reducing response times by ensuring high-relevance snippets are used.

  3. Training the AI Models: AI developers can utilize this feature to experiment with different queries and page contexts to assess model performance and adjust training datasets accordingly.

Example Configuration

Use Case: Optimizing Query Performance

An analyst needs to optimize queries for a dashboard showing sales data. They want to ensure that queries about "total sales" and "monthly growth" return the most relevant data snippets.

Configuration Example:

Using this configuration in the ContextPreview:

  1. The analyst enters the query in the Query input box.
  2. They expand the advanced options and enter "dashboard" in the Page Context input.
  3. They click "Preview" to fetch the results.

Expected Results

This configuration not only helps the analyst understand the context of queried information but also aids in refining future queries to ensure optimal performance.