PGVector Store Tool icon

PGVector Store Tool

AI Agent tool for knowledge base operations

Recall (Search)

AI-generated

Summary

Vector search over a pgvector knowledge base, returning up to topK results filtered by minimum similarity, output as a numbered list with content, IDs, and metadata tags.

Inputs

  • collection (required) — Name of the knowledge base collection (partition value)
  • topK — Maximum number of results to return (default: 5)
  • minSimilarity — Only return results with similarity above this threshold (0-1). 0 = all results. (default: 0)
  • distanceMetric — Similarity metric: cosine (recommended), l2, or inner_product (default: cosine)
  • schemaMode — How to interact with the database: default schema, field mapping (custom columns), or SQL template (advanced)
  • tableName — Database table name (default: embeddings). Shown when schemaMode is fieldMapping or sqlTemplate.
  • createTable — Create the table if it does not exist. Requires proper column config. Shown when schemaMode is fieldMapping. (default: false)
  • columnMapping — Configure custom column names for an existing table. Shown when schemaMode is fieldMapping.
  • extraReturnColumns — Additional columns to return in query results (comma-separated). Shown when schemaMode is fieldMapping.
  • searchSqlTemplate — Custom SQL for search. Placeholders: $1=embedding, $2=partition, $3=limit. Shown when schemaMode is sqlTemplate.
  • toolDescription — Custom description for the AI (leave empty for auto-generated).

Output shape

A formatted string listing up to topK results. Each result is numbered with its similarity score (0-1, computed as 1 - pgvector distance score), followed by content excerpt, ID, and optional metadata tags. If no results meet the threshold, returns 'No results found for: ...'. Embeddings are not included in returned rows.

Similarity threshold filtering uses the formula: keep rows where pgvector distance score <= 1 - minSimilarity. Higher minSimilarity = stricter filtering.

Examples

Example 1: Search knowledge base for similar entries to a query

collection=knowledge, topK=5, minSimilarity=0.5, distanceMetric=cosine, schemaMode=default

Discussion