DBConfig
TheDBConfig class specifies the storage location for the index, with options for in-memory storage, databases, or file-based storage.
Parameters
The supported
location options are:
"redis": Use for high-speed, in-memory storage (recommended forindex_location)"postgres": Use for reliable, SQL-based storage (recommended forconfig_location)"memory": Use for temporary in-memory storage (for benchmarking and evaluation purposes)"s3": Use for Amazon S3 or S3-compatible storage"gcs": Use for Google Cloud Storage"local": Use for local file system storage
Example Usage
Embeddings
The LangChain integration supports multiple embedding model types:Supported Embedding Types
Example Usage
DistanceMetric
DistanceMetric is a string representing the distance metric used for the index. Options include:
"cosine": Cosine similarity (recommended for normalized embeddings)"euclidean": Euclidean distance"squared_euclidean": Squared Euclidean distance
Metric Characteristics
IndexType
The index type determines the algorithm used for approximate nearest neighbor search.Available Index Types
Example Usage
IndexConfigParams
Optional parameters for configuring the index, passed as a dictionary.Parameters by Index Type
IVFFlat & IVF
IVFPQ
Tuning Guidelines
Document
LangChain Document object used for storing text with metadata.Attributes
Example Usage
Filter Format
Metadata filters use a dictionary format for querying documents.Simple Filters
Advanced Filters
Supported Operators
Return Types
Query Results
Query operations return documents with optional scores:Score Normalization
Scores are normalized to [0, 1] range where:- 1.0 = Perfect match
- 0.0 = Worst match
Async Support
All methods have async variants prefixed witha: