Skip to main content

Store documents and text in Retool-managed Vectors

Learn how to store text in a Retool-managed vector database for use with AI models.

You can use Retool-managed Vectors to store and generate AI-related vector data for plain text or extracted text from PDF documents. Retool can then provide AI models with related information when performing AI actions.

Add a document

Workflows only accept plain text

You cannot use the Convert document to text AI action in a workflow. You need to extract the text first and make it available for the workflow to use.

You can add documents or plain text to a vector manually or query the Retool Vectors resource in apps or workflows.

  1. Navigate to the Resources settings and click Retool Vectors.
  2. Select the vector in which to add.
  3. Click Add document, then select either Upload file or Add plain text.

When run, the query adds a new document to the vector. If a document with the same name already exists, the query returns an error.

Update or upsert a document

Use the Update document action to update an existing document. You can also use the Upsert document action to update an existing document or create one if it doesn't exist.

Combine this with the List documents action in apps to enable users to select from a list of documents in a vector.

  1. Set Resource to Retool Vectors.
  2. Set Vector action to Update document or Upsert document.
  3. Set Document content to the desired text.
  4. Specify a name for the document in the Document name field.

When run, the query adds a new document to the vector. If a document with the same name already exists, the contents are updated.

Delete an existing document

Use the Delete an existing document action to remove a specified document from a vector.

Destructive action

Any documents you delete from a Vector are unrecoverable.

  1. Set Vector action to Delete document.
  2. Select the vector in the Vector field.
  3. Specify the name of the document in the Document name field.
Add a warning message for users

Enable Show a confirmation modal before running in the Advanced tab to display a confirmation message and prevent accidental deletion.

List documents

Use the List documents action to retrieve a list of all documents in an existing vector.

  1. Set Vector action to List document.
  2. Set Document content to the desired text.
  3. Specify a name for the document in the Document name field.

Get document chunks

Use the Get document chunks action to retrieve the text for a specified document. When run, the query returns a list of text strings.

  1. Set Vector action to Get document chunks.
  2. Select the vector in the Vector field.
  3. Specify the name of the document in the Document name field.

Clear Vector documents

Use the Clear Vector documents action to delete all documents in the specified vector.

Destructive action

Any documents you delete from a Vector are unrecoverable.

  1. Set Vector action to Clear Vector documents.
  2. Select the vector in the Vector field.
Add a warning message for app users

Enable Show a confirmation modal before running in the Advanced tab to display a confirmation message and prevent accidental deletion.