Enable vectorization for a table definition
You can extend a table definition to be searchable via semantic similarity, using vector search. This allows you to use the table as a knowledge source in an AI agent.
|
Vector search can be a useful technical approach to provide your AI agent with context. However, it may not always be the best suited one. Do use vectorization when you want to search a large body of unstructured data. Do not use vectorization to search structured data. If you have a table that contains structured data (for example, sales orders, containing data about customer, product, dates, etc.), use an AI tool of type Table Definition. |
Prerequisites
-
You are using PostgreSQL or Microsoft SQL Server as your database and have installed and enabled the pgvector extension (PostgreSQL) or the experimental vector feature (Microsoft SQL Server).
-
You have set up an embedding model with output type vector in the Model tool.
Enable vectorization
-
Open the Table Definition tool and open the table you want to vectorize.
-
Go to the Properties tab and enter edit mode.
-
Select Vector Store.
Result: A dialog opens to configure the vectorization.
-
Select Enable Vectorization of this table.
Result: A custom column named rowVector is added to the table, and a custom routine is hooked to CREATE/UPDATE operations to perform the vectorization automatically.
-
In Vectorizer, select an AI model that performs the vectorization. Only models with output type vector are available.
-
In Columns to vectorize, select the columns that contain text you want to make searchable. Typically these are your free-text columns.
-
In Result template, define how a matching row is rendered when returned to an agent as a knowledge result.
|
Example
You have created a table that contains the text of instruction manuals, chunked into overlapping segments of 1024 characters. The table has the following fields:
Configure vectorization as follows:
The semantic representation captures both product name and chunk content. When the agent returns a result, it has enough metadata to point the user to the correct file and page. |
Add an index on the vector column
If the embedding model has a fixed vector dimension set, and you are using
PostgreSQL with pgvector, you can add an index on the rowVector column. This
enables fast, approximate semantic search using the HNSW index type internally.
|
Using an index provides a significant speedup for similarity search, but requires
caution when combined with Refer to the pgvector documentation for
more details. To combine |