Interface IVectorStoreManager

IVectorStoreManager

Description

Manages and provides access to various configured IVectorStore instances. It allows higher-level services like the RetrievalAugmentor to be agnostic of the specific vector database being used for a particular data source or category, based on the provided VectorStoreManagerConfig and RagDataSourceConfig.

interface IVectorStoreManager {
    initialize(managerConfig, dataSourceConfigs): Promise<void>;
    getProvider(providerId): IVectorStore;
    getDefaultProvider(): IVectorStore;
    getStoreForDataSource(dataSourceId): Promise<{
        store: IVectorStore;
        collectionName: string;
        dimension?: number;
    }>;
    listProviderIds(): string[];
    listDataSourceIds(): string[];
    checkHealth(providerId?): Promise<VectorStoreManagerHealthReport>;
    shutdownAllProviders(): Promise<void>;
}

Implemented by

Methods

  • Initializes the VectorStoreManager with configurations for all its managed providers and data sources. This involves instantiating and initializing each configured IVectorStore provider.

    Parameters

    • managerConfig: VectorStoreManagerConfig

      The manager's configuration, including an array of individual vector store provider configurations.

    • dataSourceConfigs: RagDataSourceConfig[]

      An array of configurations for all logical data sources, which map to specific providers and collections/indexes within them.

    Returns Promise<void>

    A promise that resolves when the manager and all its essential providers are successfully initialized.

    Async

    Throws

    If initialization fails due to invalid configuration, inability to connect to a critical provider, or other setup errors.

  • Retrieves a specific, initialized IVectorStore provider instance by its configured ID. The provider ID corresponds to VectorStoreProviderConfig.id.

    Parameters

    • providerId: string

      The unique ID of the vector store provider instance.

    Returns IVectorStore

    The IVectorStore instance.

    Throws

    If the providerId is not configured, not found, or the provider failed to initialize.

  • Retrieves the default IVectorStore provider instance as configured in VectorStoreManagerConfig.defaultProviderId.

    Returns IVectorStore

    The default IVectorStore instance.

    Throws

    If no default provider is configured, the configured default provider is not found, or it failed to initialize.

  • Retrieves an IVectorStore instance and the specific collection name within that store associated with a given logical RAG Data Source ID. This is a convenience method for services like RetrievalAugmentor that operate on logical dataSourceIds.

    Parameters

    • dataSourceId: string

      The logical RAG Data Source ID (from RagDataSourceConfig.dataSourceId).

    Returns Promise<{
        store: IVectorStore;
        collectionName: string;
        dimension?: number;
    }>

    A promise that resolves with the IVectorStore instance, the actual collection name to use with that store for this data source, and the expected embedding dimension.

    Throws

    If the dataSourceId is not configured, or its associated provider is unavailable.

  • Lists the unique IDs of all vector store providers configured and managed by this manager.

    Returns string[]

    An array of provider IDs.

  • Lists the unique IDs of all logical RAG Data Sources configured.

    Returns string[]

    An array of RAG Data Source IDs.

  • Checks the health of all managed vector store providers or a specific one. This aggregates health information from individual IVectorStore.checkHealth() calls.

    Parameters

    • Optional providerId: string

      Optional: If provided, checks only this specific provider. If omitted, checks all configured providers.

    Returns Promise<VectorStoreManagerHealthReport>

    A promise that resolves with a comprehensive health report.

    Async

  • Gracefully shuts down all managed vector store providers. This calls the shutdown() method on each initialized IVectorStore instance.

    Returns Promise<void>

    A promise that resolves when all providers have been shut down.

    Async