Use Retool AI to query vectors with filters and metadata
Learn how to query Retool Vectors using filters and metadata.
You can use AI actions in Retool to reference the embeddings stored in Retool Vectors. Retool Vectors can be queried from Retool Apps or Retool Workflows using AI Actions.
- Metadata allows you to provide additional context about your data with a key-value pair and can help you organize and manage your vectors.
- Filter labels help you select and retrieve the vectors that are relevant to a query.
Before you can use Retool AI to query a vector with filters or metadata, they must first be added to a Retool Vector. See Manage embeddings in Retool-managed Vectors for more information.
Generate text with Retool AI
Use the Generate text AI action with the filter labels applied to your vectors to generate a text response based on specific embeddings.
- Open the Code panel.
- Click the + sign and select AI Action, or add a Resource query and change the Resource field to Retool AI.
- Select Generate text as the Action. Refer to Generate text for more information.
- Toggle the checkbox on to Use Retool Vectors to provide more context to your query.
- Select the vector(s) you want to query in the Select Vector field.
- In the Filters field, select the vector document or URL that you want to use for your query.
- Add a prompt to the Input field.
- Click Save.
- Click Run to display the generated text in the Output message.
Generate chat response with Retool AI
Use the Generate chat response AI action with the filter labels applied to your vectors to generate a chat response based on specific embeddings.
- Open the Components panel.
- Search for the Chat component and drag it to the canvas.
- A chat query is automatically created with the Generate chat response AI action selected. Refer to Retool AI chat actions for more information.
- Toggle the checkbox on to Use Retool Vectors to provide more context to your query.
- Select the vector(s) you want to query in the Select Vector field.
- In the Filters field, select the vector document or URL that you want to use for your query.
- Click Save.
- Type a message in the chat component to generate a response.