Search vectors
Performs a vector search agains a PostgreSQL database and returns an IVectorSearchResult object that can be passed to a Chat completion action.
Example
This flow processes a user's chat question by first receiving it through a Chat completion trigger, then converting it into a vector using a text embedder, performing a Vector search in a postgreSQL database for relevant context, and finally passing the user input and retrieved context to an Azure AI Chat completion action, which generates a response that is returned to the client via the Return node.
Properties
Name | Type | Description |
---|---|---|
Title | Optional | The title or name of the action. |
Connection | Required | The PostgreSQL database connection that will be used for the search. |
Table | Required | The name of the table where the vector search will be performed. |
Search text | Required | The input text string used to perform the vector search, can be provided by a trigger (see below). |
Record definition | Required | The definition of columns used in vector search. Note! The vector column is not part of the returned data. |
Filter | Optional | A filter expression to narrow down the records (e.g., category = blue). |
Top | Optional | The maximum number of top results to return. |
Skip | Optional | The number of top results to skip (default: 0). |
Distance function | Optional | The method for calculating vector similarity, e.g., Cosine Distance (default). |
Score limit | Optional | A threshold value that limits results to those with a distance score at or below this score (for e.g. CosineDistance). |
Prompt template | Optional | The prompt template controls the output format for your search results. The system replaces placeholders, such as @[fieldName], with the corresponding data from your vector search fields. See example below. |
Search result variable name | Optional | The name of the variable to store results. |
Description | Optional | Any additional notes or information relevant to the search configuration. |
Search text
Example
Record definition
The record defintion specifies the data returned from the search.
You are required to specify the key, content and vector fields in Field definitions.
Prompt template
The prompt template allows you to customize the format of the output from your vector search. This is useful for structuring the search results in a way that is most useful for your application. You can use placeholders in the format @[fieldName] to include specific data from your search results. The system will replace these placeholders with the actual values from the corresponding fields in the search results.
Example
Returns
The Search vectors action returns an IVectorSearchResult object that can be passed to the Chat completion Context property.