Skip to main content

Class: VectorStoreIndex

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

Extends

Properties

docStore

docStore: BaseDocumentStore

Inherited from

BaseIndex.docStore

Defined in

packages/llamaindex/src/indices/BaseIndex.ts:27


embedModel?

optional embedModel: BaseEmbedding

Defined in

packages/llamaindex/src/indices/vectorStore/index.ts:66


indexStore

indexStore: BaseIndexStore

Overrides

BaseIndex.indexStore

Defined in

packages/llamaindex/src/indices/vectorStore/index.ts:65


indexStruct

indexStruct: IndexDict

Inherited from

BaseIndex.indexStruct

Defined in

packages/llamaindex/src/indices/BaseIndex.ts:29


serviceContext?

optional serviceContext: ServiceContext

Inherited from

BaseIndex.serviceContext

Defined in

packages/llamaindex/src/indices/BaseIndex.ts:25


storageContext

storageContext: StorageContext

Inherited from

BaseIndex.storageContext

Defined in

packages/llamaindex/src/indices/BaseIndex.ts:26


vectorStores

vectorStores: VectorStoreByType

Defined in

packages/llamaindex/src/indices/vectorStore/index.ts:67

Methods

asQueryEngine()

asQueryEngine(options?): RetrieverQueryEngine

Create a RetrieverQueryEngine. similarityTopK is only used if no existing retriever is provided.

Parameters

options?

options.nodePostprocessors?: BaseNodePostprocessor[]

options.preFilters?: MetadataFilters

options.responseSynthesizer?: BaseSynthesizer

options.retriever?: BaseRetriever

options.similarityTopK?: number

Returns

RetrieverQueryEngine

Overrides

BaseIndex.asQueryEngine

Defined in

packages/llamaindex/src/indices/vectorStore/index.ts:286


asRetriever()

asRetriever(options?): VectorIndexRetriever

Create a new retriever from the index.

Parameters

options?: Omit<object & object, "index"> | Omit<object & object, "index">

Returns

VectorIndexRetriever

Overrides

BaseIndex.asRetriever

Defined in

packages/llamaindex/src/indices/vectorStore/index.ts:276


buildIndexFromNodes()

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

Get embeddings for nodes and place them into the index.

Parameters

nodes: BaseNode<Metadata>[]

options?

options.logProgress?: boolean

Returns

Promise<void>

Defined in

packages/llamaindex/src/indices/vectorStore/index.ts:186


deleteRefDoc()

deleteRefDoc(refDocId, deleteFromDocStore): Promise<void>

Parameters

refDocId: string

deleteFromDocStore: boolean = true

Returns

Promise<void>

Overrides

BaseIndex.deleteRefDoc

Defined in

packages/llamaindex/src/indices/vectorStore/index.ts:347


deleteRefDocFromStore()

protected deleteRefDocFromStore(vectorStore, refDocId): Promise<void>

Parameters

vectorStore: BaseVectorStore

refDocId: string

Returns

Promise<void>

Defined in

packages/llamaindex/src/indices/vectorStore/index.ts:359


getNodeEmbeddingResults()

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

Calculates the embeddings for the given nodes.

Parameters

nodes: BaseNode<Metadata>[]

An array of BaseNode objects representing the nodes for which embeddings are to be calculated.

options?

An optional object containing additional parameters.

options.logProgress?: boolean

A boolean indicating whether to log progress to the console (useful for debugging).

Returns

Promise<BaseNode<Metadata>[]>

Defined in

packages/llamaindex/src/indices/vectorStore/index.ts:163


insert()

insert(document): Promise<void>

Insert a document into the index.

Parameters

document: Document<Metadata>

Returns

Promise<void>

Inherited from

BaseIndex.insert

Defined in

packages/llamaindex/src/indices/BaseIndex.ts:59


insertNodes()

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

Parameters

nodes: BaseNode<Metadata>[]

options?

options.logProgress?: boolean

Returns

Promise<void>

Overrides

BaseIndex.insertNodes

Defined in

packages/llamaindex/src/indices/vectorStore/index.ts:331


insertNodesToStore()

protected insertNodesToStore(newIds, nodes, vectorStore): Promise<void>

Parameters

newIds: string[]

nodes: BaseNode<Metadata>[]

vectorStore: BaseVectorStore

Returns

Promise<void>

Defined in

packages/llamaindex/src/indices/vectorStore/index.ts:307


fromDocuments()

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

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

Parameters

documents: Document<Metadata>[]

args: VectorIndexOptions & object = {}

Returns

Promise<VectorStoreIndex>

Defined in

packages/llamaindex/src/indices/vectorStore/index.ts:199


fromVectorStore()

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

Parameters

vectorStore: BaseVectorStore

serviceContext?: ServiceContext

Returns

Promise<VectorStoreIndex>

Defined in

packages/llamaindex/src/indices/vectorStore/index.ts:266


fromVectorStores()

static fromVectorStores(vectorStores, serviceContext?): Promise<VectorStoreIndex>

Parameters

vectorStores: VectorStoreByType

serviceContext?: ServiceContext

Returns

Promise<VectorStoreIndex>

Defined in

packages/llamaindex/src/indices/vectorStore/index.ts:243


init()

static init(options): Promise<VectorStoreIndex>

The async init function creates a new VectorStoreIndex.

Parameters

options: VectorIndexOptions

Returns

Promise<VectorStoreIndex>

Defined in

packages/llamaindex/src/indices/vectorStore/index.ts:81