Retool-managed Vectors
Learn about storing text from documents or web pages for use with AI.
This guide serves as an introduction to Retool Vectors. It covers many of the concepts and terminology you would come across when storing and using vector data. After reading this page, you should have a good understanding of the fundamentals for Retool Vectors.
Introduction
Retool Vectors enables you to use a vector database to store unstructured text from documents and web pages for use with Retool AI. You can use either:
- Retool-managed Vectors.
- A supported third-party vector store, such as Amazon Knowledge Bases.
AI embeddings and vectors
AI models use embeddings to determine the meaning and connection between objects, such as blocks (chunks) of text. An embedding is a type of vector, a mathematical representation of an object. The more closely related text chunks are, the smaller the difference in their calculated vectors. For example, the vector difference between "water" and "wet" would be smaller than the difference between "water" and "banana".
For use cases that involve similarity search with large datasets, such as an AI-powered chat tool that relies on content from support articles, embedding vectors must be first calculated. This vector data is then provided to the AI model so it can make informed decisions. These vector calculations should be saved in a vector database to allow for efficient storage and retrieval of large datasets of embeddings.
When you reference a Vector in an AI action, Retool includes the most relevant content in the AI model request. When run, Retool automatically:
- Calculates the vector for the AI action's input.
- Identifies which embeddings in the chosen vector closely relate to the input.
- Appends the text from the embeddings when making the request to the AI model.
These steps are performed in the back-end and not visible to users, further reducing complexity.
Vector organization
You can think of Vectors as file directories, and embeddings as the files they contain. Each Vector should contain relevant information that you consider related. For example, if you wanted to build an AI-powered chat tool that can respond using information from support articles, you would create (such as Documentation) and add URLs from your support site.
Use Vectors in AI actions
You reference embeddings from Retool Vectors in AI actions. Retool includes the most relevant content in the AI model request, based on the input. When run, Retool automatically:
- Calculates the vector for the AI action's input.
- Identifies which embeddings in the chosen vector closely relate to the input.
- Appends the text from the embeddings when making the request to the AI model.
These steps are performed in the back-end and not visible to users, further reducing complexity.
Retool-managed Vectors
Retool-managed Vectors abstracts away the complexities of preparing text and automatically generates the required data for AI models to make decisions using your data. You create a vector in which to store embeddings—unstructured text about a particular topic.
Retool automatically generates embeddings, splitting unstructured text into chunks where needed. If you add URLs to a Vector, Retool crawls matching web pages, fetching and storing the text.
Retool uses the OpenAI embeddings API to calculate vectors for text chunks.
You can manually add text to a Vector or write queries that interact with Retool-managed Vectors. Once added, you can manage the embeddings and view the associated text or URL.
Text embeddings
When you add text to Retool-managed vector, Retool automatically performs the following:
- If a document is provided, Retool extracts the text.
- Splits the text into chunks.
- Calculates the vector for each chunk.
- Stores this information in the vector.
URL embeddings
When you add a URL to a Retool-managed vector, Retool automatically performs the following:
- Crawls the URL for any pages that match. For example, specifying
https://docs.retool.com
would includehttps://docs.retool.com/ai
but nothttps://retool.com
. - Fetches the text for each page and creates a new embedding in the vector.
- Splits the text into chunks.
- Calculates the vector for each chunk.
- Stores this information in the vector.
Retool can only fetch text from web pages that are publicly available and directly linked from other pages. Pages that are not accessible (e.g., requires authentication or behind a firewall) or that have no inbound links (e.g., pages only accessible with a direct URL) cannot be crawled.
You can also exclude certain URLs whose domain and path match. For example, https://docs.retool.com/changelog
would prevent any pages that contain this URL from being crawled.
The following limits apply when crawling a website:
- A maximum of three web crawl requests can run concurrently.
- Web crawls are limited to 50 URLs.
- Web crawls time out after 15 seconds.
- A maximum of two web crawls can occur during each five-second interval.
Amazon Knowledge Bases
Retool supports Amazon Knowledge Bases vector stores. You can connect a knowledge base to use for vector embeddings in AI actions. Once configured, Retool communicates directly with the knowledge base to provide context for AI actions.