メインコンテンツまでスキップ

Class: VectorStoreIndex

The VectorStoreIndex, an index that stores the nodes only according to their vector embedings.

Hierarchy

Constructors

constructor

new VectorStoreIndex(init): VectorStoreIndex

Parameters

NameType
initVectorIndexConstructorProps

Returns

VectorStoreIndex

Overrides

BaseIndex.constructor

Defined in

packages/core/src/indices/vectorStore/index.ts:78

Properties

docStore

docStore: BaseDocumentStore

Inherited from

BaseIndex.docStore

Defined in

packages/core/src/indices/BaseIndex.ts:62


embedModel

embedModel: BaseEmbedding

Defined in

packages/core/src/indices/vectorStore/index.ts:74


imageEmbedModel

Optional imageEmbedModel: MultiModalEmbedding

Defined in

packages/core/src/indices/vectorStore/index.ts:76


imageVectorStore

Optional imageVectorStore: VectorStore

Defined in

packages/core/src/indices/vectorStore/index.ts:75


indexStore

indexStore: BaseIndexStore

Overrides

BaseIndex.indexStore

Defined in

packages/core/src/indices/vectorStore/index.ts:73


indexStruct

indexStruct: IndexDict

Inherited from

BaseIndex.indexStruct

Defined in

packages/core/src/indices/BaseIndex.ts:65


serviceContext

Optional serviceContext: ServiceContext

Inherited from

BaseIndex.serviceContext

Defined in

packages/core/src/indices/BaseIndex.ts:60


storageContext

storageContext: StorageContext

Inherited from

BaseIndex.storageContext

Defined in

packages/core/src/indices/BaseIndex.ts:61


vectorStore

vectorStore: VectorStore

Overrides

BaseIndex.vectorStore

Defined in

packages/core/src/indices/vectorStore/index.ts:72

Methods

asQueryEngine

asQueryEngine(options?): BaseQueryEngine & RetrieverQueryEngine

Create a new query engine from the index. It will also create a retriever and response synthezier if they are not provided.

Parameters

NameTypeDescription
options?Objectyou can supply your own custom Retriever and ResponseSynthesizer
options.nodePostprocessors?BaseNodePostprocessor[]-
options.preFilters?MetadataFilters-
options.responseSynthesizer?BaseSynthesizer-
options.retriever?BaseRetriever-

Returns

BaseQueryEngine & RetrieverQueryEngine

Overrides

BaseIndex.asQueryEngine

Defined in

packages/core/src/indices/vectorStore/index.ts:280


asRetriever

asRetriever(options?): VectorIndexRetriever

Create a new retriever from the index.

Parameters

NameType
options?Omit<VectorIndexRetrieverOptions, "index">

Returns

VectorIndexRetriever

Overrides

BaseIndex.asRetriever

Defined in

packages/core/src/indices/vectorStore/index.ts:274


buildIndexFromNodes

buildIndexFromNodes(nodes, options?): Promise<void>

Get embeddings for nodes and place them into the index.

Parameters

NameType
nodesBaseNode<Metadata>[]
options?Object
options.logProgress?boolean

Returns

Promise<void>

Defined in

packages/core/src/indices/vectorStore/index.ts:197


deleteRefDoc

deleteRefDoc(refDocId, deleteFromDocStore?): Promise<void>

Parameters

NameTypeDefault value
refDocIdstringundefined
deleteFromDocStorebooleantrue

Returns

Promise<void>

Overrides

BaseIndex.deleteRefDoc

Defined in

packages/core/src/indices/vectorStore/index.ts:349


deleteRefDocFromStore

deleteRefDocFromStore(vectorStore, refDocId): Promise<void>

Parameters

NameType
vectorStoreVectorStore
refDocIdstring

Returns

Promise<void>

Defined in

packages/core/src/indices/vectorStore/index.ts:363


getImageNodeEmbeddingResults

getImageNodeEmbeddingResults(nodes, options?): Promise<ImageNode<Metadata>[]>

Calculates the embeddings for the given image nodes.

Parameters

NameTypeDescription
nodesImageNode<Metadata>[]An array of ImageNode objects representing the nodes for which embeddings are to be calculated.
options?ObjectAn optional object containing additional parameters.
options.logProgress?booleanA boolean indicating whether to log progress to the console (useful for debugging).

Returns

Promise<ImageNode<Metadata>[]>

Defined in

packages/core/src/indices/vectorStore/index.ts:389


getNodeEmbeddingResults

getNodeEmbeddingResults(nodes, options?): Promise<BaseNode<Metadata>[]>

Calculates the embeddings for the given nodes.

Parameters

NameTypeDescription
nodesBaseNode<Metadata>[]An array of BaseNode objects representing the nodes for which embeddings are to be calculated.
options?ObjectAn optional object containing additional parameters.
options.logProgress?booleanA boolean indicating whether to log progress to the console (useful for debugging).

Returns

Promise<BaseNode<Metadata>[]>

Defined in

packages/core/src/indices/vectorStore/index.ts:178


insert

insert(document): Promise<void>

Insert a document into the index.

Parameters

NameType
documentDocument<Metadata>

Returns

Promise<void>

Inherited from

BaseIndex.insert

Defined in

packages/core/src/indices/BaseIndex.ts:96


insertNodes

insertNodes(nodes, options?): Promise<void>

Parameters

NameType
nodesBaseNode<Metadata>[]
options?Object
options.logProgress?boolean

Returns

Promise<void>

Overrides

BaseIndex.insertNodes

Defined in

packages/core/src/indices/vectorStore/index.ts:320


insertNodesToStore

insertNodesToStore(vectorStore, nodes): Promise<void>

Parameters

NameType
vectorStoreVectorStore
nodesBaseNode<Metadata>[]

Returns

Promise<void>

Defined in

packages/core/src/indices/vectorStore/index.ts:295


fromDocuments

fromDocuments(documents, args?): Promise<VectorStoreIndex>

High level API: split documents, get embeddings, and build index.

Parameters

NameType
documentsDocument<Metadata>[]
argsVectorIndexOptions & { docStoreStrategy?: DocStoreStrategy }

Returns

Promise<VectorStoreIndex>

Defined in

packages/core/src/indices/vectorStore/index.ts:210


fromVectorStore

fromVectorStore(vectorStore, serviceContext?, imageVectorStore?): Promise<VectorStoreIndex>

Parameters

NameType
vectorStoreVectorStore
serviceContext?ServiceContext
imageVectorStore?VectorStore

Returns

Promise<VectorStoreIndex>

Defined in

packages/core/src/indices/vectorStore/index.ts:249


init

init(options): Promise<VectorStoreIndex>

The async init function creates a new VectorStoreIndex.

Parameters

NameType
optionsVectorIndexOptions

Returns

Promise<VectorStoreIndex>

Defined in

packages/core/src/indices/vectorStore/index.ts:95


setupIndexStructFromStorage

setupIndexStructFromStorage(indexStore, options): Promise<undefined | IndexDict>

Parameters

NameType
indexStoreBaseIndexStore
optionsIndexStructOptions

Returns

Promise<undefined | IndexDict>

Defined in

packages/core/src/indices/vectorStore/index.ts:136