Skip to main content

Retool Vectors

Learn about storing text from documents or web pages for use with AI.

Retool Vectors is a managed vector database that enables you to store unstructured text from documents and web pages for use with AI models through Retool.

AI embeddings and vectors

AI models use 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.

How Retool Vectors works

Retool 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.

When you reference a Vector in an AI action, such as generating a chat response, Retool appends all relevant information in the request.

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 a Vector (such as Documentation) and add URLs from your support site.

You can manually add text to a Vector or write queries that interact with Retool Vectors. Once added, you can manage the embeddings and view the associated text or URL.

Text embeddings

When you add text to a Vector, Retool automatically performs the following:

  1. If a document is provided, Retool extracts the text.
  2. Splits the text into chunks.
  3. Calculates the vector for each chunk.
  4. Stores this information in the vector.

URL embeddings

When you add a URL to a Vector, Retool automatically performs the following:

  1. Crawls the URL for any pages that match. For example, specifying https://docs.retool.com would include https://docs.retool.com/ai but not https://retool.com.
  2. Fetches the text for each page and creates a new embedding in the vector.
  3. Splits the text into chunks.
  4. Calculates the vector for each chunk.
  5. 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.

Use Vectors in AI actions

You can 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:

  1. Calculates the vector for the AI action's input.
  2. Identifies which embeddings in the chosen vector closely relate to the input.
  3. 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.