Retool-managed Vectors tutorial
Learn how to store and retrieve data for AI models using Retool's managed vector database.
Retool-managed Vectors is a hosted vector database that enables you to store unstructured text from documents and web pages for use with AI models through Retool. Retool abstracts away the complexities of preparing text and automatically generates the required data for AI models to make decisions using your data.
You can include related information from Retool-managed Vectors to provide more context. This allows you to instruct AI models to use your own data when making decisions, such as responding to a customer with context from support articles.
The following guide explains how to add text to Retool-managed Vectors and use it with the Generate text AI Action. To get started, navigate to the Resources tab in your organization and select Retool Vectors.
Each vector you create can contain either document text or URLs, not both.
1. Create a Vector
You can create two types of Vectors:
- Document Vector: Store plain text that you enter manually or extract from uploaded PDF documents.
- URL Vector: Store text fetched from publicly accessible web pages.
The following instructions cover both Vector types. To continue with this guide, create a URL Vector.
- Document Vector
- URL Vector
To create a Document Vector:
- Navigate to the Resources settings and click Retool Vectors.
- Click Add Vector.
- Specify a name and select Document.
- Click Create.
To create a URL Vector:
- Navigate to the Resources settings and click Retool Vectors.
- Click Add Vector.
- Specify a name and select Site URLs.
- Click Create.
2. Add embeddings
- Document Vector
- URL Vector
Click Add document and select whether to upload a PDF file or add plain text manually. Retool extracts text from PDF documents automatically.
Retool can only crawl URLs that are publicly accessible and linked from other pages that match the base URLs. Pages that can only be accessed directly or require authentication cannot be added.
Click Add URLs to add web pages to the Vector then add a base URL to Links to crawl. You can specify multiple URLs by clicking Add link.
You only need to specify a base URL, such as https://docs.retool.com
—Retool crawls the URL and fetches text for any pages at this location. You can exclude web pages by providing a base URL in Link prefix to exclude—any URLs that match are not crawled.
For the purposes of this guide, set the following:
- Links to crawl:
https://docs.retool.com
- Link prefix to exclude:
https://docs.retool.com/changelog
This instructs Retool-managed Vectors to crawl Retool Docs but exclude changelog content.
3. Use Retool-managed Vectors in AI Actions
You can include context from Retool-managed Vectors in apps and workflows using the Generate text and Generate chat response AI Actions. This step assumes you have created a URL Vector using https://docs.retool.com
.
- Navigate to the Query Library tab and click + New.
- Set Resource to Retool AI.
- Select the Generate text action.
- Enter
What is a resource?
as the Input. - Enable Use Retool Vectors to provide more context to your query and select the URL Vector you created.
- Click ▶︎ to run the query.
Retool automatically includes relevant context to the AI model from the specified Vector.
Wrap up
You have now created a new vector store using Retool-managed Vectors, added text content, and performed an AI Action with Vector context.