---
schema_version: "1"
id: dd045298119c60bb3846217e7aea9c79d8e77596d98614bcadc358122771219a
title: Customize Retriever Output with Prefilters
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ai/264-0-0/prompt_builder_prefilters.md
canonical_url: https://help.salesforce.com/s/articleView?id=ai.prompt_builder_prefilters.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 88989be32adfc78335962269ab65a70a17ecc1b5ff5c3215a868bf75f4664eac
description: Get more relevant search results using prefilters in your prompt templates. Prefilters define the conditions that limit the scope of a retriever’s search so that only the most relevant information is returned. For example, you can use prefilters to retrieve content associated with only a particular country or product. The filter value, such as the country code or product Id, is specified in the prompt template at run time.
products:
  - Agentforce
  - Cross Cloud
release: "264"
---
# Customize Retriever Output with Prefilters

Get more relevant search results using prefilters in your prompt templates. Prefilters define the conditions that limit the scope of a retriever’s search so that only the most relevant information is returned. For example, you can use prefilters to retrieve content associated with only a particular country or product. The filter value, such as the country code or product Id, is specified in the prompt template at run time.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Performance</strong>, and <strong>Unlimited</strong> Editions with the Einstein for Platform, or Einstein or Agentforce for Sales or Service add-on, or Agentforce Foundations</td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col>
          <col>
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d162609e71">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d162609e71 ">To create and manage prompt templates in Prompt Builder:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d162609e71 ">Prompt Template Manager permission set</td>

          </tr>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d162609e71 ">To create and manage retrievers:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d162609e71 ">Data Cloud permission set</td>

          </tr>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d162609e71 ">To run prompts with Einstein search:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d162609e71 ">Data Cloud User permission set</td>

          </tr>
        </tbody>
      </table>

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/images/icon_note.png)

Note To use prefilters in Prompt Builder, the Einstein Search retriever must be configured in AI Models (formerly Einstein Studio) with at least one filter condition with the Dynamic property selected. To learn more, see the instructions for defining filter conditions in [Create an Individual Retriever](https://help.salesforce.com/s/articleView?id=data.c360_a_ai_retriever_create.htm&language=en_US).

1. In Prompt Builder, create or edit a prompt template.
2. In the Prompt Template Workspace, click where you want to insert the retriever.
3. Type **@** or click **Insert Resource**, click **Retrievers**, and click **Configure Retrievers +**.
4. Select the retriever you want to add to the prompt template.
    
    This retriever must have at least one filter condition with the Dynamic setting enabled.
5. Under Template Settings, scroll to the Search Parameters section and find a Pre-filter input field. Example:
    
    ![Screen shot of example pre-filter field.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/generative_ai/images/prompt_builder_prefilters.png)
    
    If you don’t see a Pre-filter input field, go to AI Models and verify that the selected retriever is configured with at least one filter condition that's configured as Dynamic.
6. Click the **Pre-filter** field to open the resource picker and select the source of the filter value for the pre-filter field.
    
    ![Screen shot of options for pre-filter field.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/generative_ai/images/prompt_builder_prefilters_options.png)
    
    The selected value appears in the Pre-filter field.
7. To remove a setting, select the X. To return to a previously selected setting, select the undo (![Undo button](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/generative_ai/images/prompt_builder_undo.png)) icon.
8. Change other template settings, if you want.
9. Click **Apply and Insert**.
10. Save your work.
11. Test your changes. Preview the prompt template and review the LLM-generated response.

#### See Also

- [Create an Individual Retriever](https://help.salesforce.com/s/articleView?id=data.c360_a_ai_retriever_create.htm&language=en_US)
- [Add a Retriever to a Field Generation Prompt Template](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_add_retriever_field_gen.htm&release=264.0.0&type=5 "Add a retriever to a field generation prompt template by selecting it from the Resource field.")
- [Ground with Knowledge Using Retrieval Augmented Generation](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_ground_rag.htm&release=264.0.0&type=5 "Retrieval augmented generation (RAG) in Data 360 improves the quality, accuracy, and relevance of your LLM-generated responses. Enhance your prompt templates using retrievers with Einstein Search. Add relevant knowledge from unstructured text sources into your LLM prompts. Retrieve knowledge from articles, emails, chat transcripts, and other sources.")