Nhảy tới nội dung

Class: VectorStoreIndex

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

Extends

Constructors

new VectorStoreIndex()

private new VectorStoreIndex(init): VectorStoreIndex

Parameters

init: VectorIndexConstructorProps

Returns

VectorStoreIndex

Overrides

BaseIndex . constructor

Source

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

Properties

docStore

docStore: BaseDocumentStore

Inherited from

BaseIndex . docStore

Source

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


embedModel

embedModel: BaseEmbedding

Source

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


imageEmbedModel?

optional imageEmbedModel: MultiModalEmbedding

Source

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


imageVectorStore?

optional imageVectorStore: VectorStore

Source

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


indexStore

indexStore: BaseIndexStore

Overrides

BaseIndex . indexStore

Source

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


indexStruct

indexStruct: IndexDict

Inherited from

BaseIndex . indexStruct

Source

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


serviceContext?

optional serviceContext: ServiceContext

Inherited from

BaseIndex . serviceContext

Source

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


storageContext

storageContext: StorageContext

Inherited from

BaseIndex . storageContext

Source

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


vectorStore

vectorStore: VectorStore

Overrides

BaseIndex . vectorStore

Source

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

Methods

asQueryEngine()

asQueryEngine(options?): QueryEngine & 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

QueryEngine & RetrieverQueryEngine

Overrides

BaseIndex . asQueryEngine

Source

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


asRetriever()

asRetriever(options?): VectorIndexRetriever

Create a new retriever from the index.

Parameters

options?: Omit <VectorIndexRetrieverOptions, "index">

Returns

VectorIndexRetriever

Overrides

BaseIndex . asRetriever

Source

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


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>

Source

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


deleteRefDoc()

deleteRefDoc(refDocId, deleteFromDocStore): Promise<void>

Parameters

refDocId: string

deleteFromDocStore: boolean= true

Returns

Promise<void>

Overrides

BaseIndex . deleteRefDoc

Source

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


deleteRefDocFromStore()

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

Parameters

vectorStore: VectorStore

refDocId: string

Returns

Promise<void>

Source

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


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>[]>

Source

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


insert()

insert(document): Promise<void>

Insert a document into the index.

Parameters

document: Document <Metadata>

Returns

Promise<void>

Inherited from

BaseIndex . insert

Source

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


insertNodes()

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

Parameters

nodes: BaseNode <Metadata>[]

options?

options.logProgress?: boolean

Returns

Promise<void>

Overrides

BaseIndex . insertNodes

Source

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


insertNodesToStore()

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

Parameters

vectorStore: VectorStore

nodes: BaseNode <Metadata>[]

Returns

Promise<void>

Source

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


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>

Source

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


fromVectorStore()

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

Parameters

vectorStore: VectorStore

serviceContext?: ServiceContext

imageVectorStore?: VectorStore

Returns

Promise <VectorStoreIndex>

Source

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


init()

static init(options): Promise <VectorStoreIndex>

The async init function creates a new VectorStoreIndex.

Parameters

options: VectorIndexOptions

Returns

Promise <VectorStoreIndex>

Source

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


setupIndexStructFromStorage()

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

Parameters

indexStore: BaseIndexStore

options: IndexStructOptions

Returns

Promise<undefined | IndexDict>

Source

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