
Node Details
- Name: Postgres_VectorStores
- Type: Postgres
- Version: 6.0
- Category: Vector Stores
Base Classes
- Postgres
- VectorStoreRetriever
- BaseRetriever
Credential
- Type: PostgresApi
-
Required Fields:
- User
- Password
Input Parameters
-
Document (optional, list)
- Type: Document
- Description: List of documents to be stored in the vector store
-
Embeddings
- Type: Embeddings
- Description: Embedding model to use for vectorizing documents
-
Record Manager (optional)
- Type: RecordManager
- Description: Keeps track of records to prevent duplication
-
Host
- Type: string
- Description: PostgreSQL server host
-
Database
- Type: string
- Description: Name of the PostgreSQL database
-
Port (optional)
- Type: number
- Default: 6432
- Description: PostgreSQL server port
-
Table Name (optional)
- Type: string
- Default: “documents”
- Description: Name of the table to store vectors
-
File Upload (optional)
- Type: boolean
- Description: Enables file upload functionality in the chat
-
Additional Configuration (optional)
- Type: JSON
- Description: Additional PostgreSQL connection options
-
Top K (optional)
- Type: number
- Default: 4
- Description: Number of top results to fetch in similarity search
-
Postgres Metadata Filter (optional)
- Type: JSON
- Description: Filter to apply on metadata during similarity search
Outputs
-
Postgres Retriever
- Type: VectorStoreRetriever
- Description: A retriever object for similarity search operations
-
Postgres Vector Store
- Type: TypeORMVectorStore
- Description: The vector store object for direct interactions
Functionality
Initialization
- Establishes a connection to the PostgreSQL database
- Sets up the vector store with the specified table and embeddings
- Configures similarity search function to use pg pool for better performance
Upsert Method
- Allows adding new documents to the vector store
- Handles file upload scenarios by adding chat ID to metadata
- Supports using a record manager to prevent duplicates
Delete Method
- Enables deletion of documents from the vector store
- Supports deletion using record manager or direct ID-based deletion
Similarity Search
- Performs similarity search on stored vectors
- Applies metadata filters if specified
- Returns top K results based on cosine similarity
Use Cases
- Document storage and retrieval in AI-powered applications
- Semantic search functionality in large document collections
- Building knowledge bases for question-answering systems
Notes
- Requires PostgreSQL with pgvector extension installed
- Optimized for performance with connection pooling
- Supports additional configuration for fine-tuning PostgreSQL connection
- Integrates with file upload functionality for chat-based document ingestion