Class: VectorStoreIndex
The VectorStoreIndex, an index that stores the nodes only according to their vector embedings.
Hierarchy
Constructors
constructor
• new VectorStoreIndex(init
): VectorStoreIndex
Parameters
Name | Type |
---|---|
init | VectorIndexConstructorProps |
Returns
Overrides
Defined in
packages/core/src/indices/vectorStore/index.ts:73
Properties
docStore
• docStore: BaseDocumentStore
Inherited from
Defined in
packages/core/src/indices/BaseIndex.ts:62
embedModel
• embedModel: BaseEmbedding
Defined in
packages/core/src/indices/vectorStore/index.ts:69
imageEmbedModel
• Optional
imageEmbedModel: MultiModalEmbedding
Defined in
packages/core/src/indices/vectorStore/index.ts:71
imageVectorStore
• Optional
imageVectorStore: VectorStore
Defined in
packages/core/src/indices/vectorStore/index.ts:70
indexStore
• indexStore: BaseIndexStore
Overrides
Defined in
packages/core/src/indices/vectorStore/index.ts:68
indexStruct
• indexStruct: IndexDict
Inherited from
Defined in
packages/core/src/indices/BaseIndex.ts:65
serviceContext
• Optional
serviceContext: ServiceContext
Inherited from
Defined in
packages/core/src/indices/BaseIndex.ts:60
storageContext
• storageContext: StorageContext
Inherited from
Defined in
packages/core/src/indices/BaseIndex.ts:61
vectorStore
• vectorStore: VectorStore
Overrides
Defined in
packages/core/src/indices/vectorStore/index.ts:67
Methods
asQueryEngine
▸ asQueryEngine(options?
): QueryEngine
& RetrieverQueryEngine
Create a RetrieverQueryEngine. similarityTopK is only used if no existing retriever is provided.
Parameters
Name | Type |
---|---|
options? | Object |
options.nodePostprocessors? | BaseNodePostprocessor [] |
options.preFilters? | MetadataFilters |
options.responseSynthesizer? | BaseSynthesizer |
options.retriever? | BaseRetriever |
options.similarityTopK? | number |
Returns
QueryEngine
& RetrieverQueryEngine
Overrides
Defined in
packages/core/src/indices/vectorStore/index.ts:286
asRetriever
▸ asRetriever(options?
): VectorIndexRetriever
Create a new retriever from the index.
Parameters
Name | Type |
---|---|
options? | Omit <VectorIndexRetrieverOptions , "index" > |
Returns
Overrides
Defined in
packages/core/src/indices/vectorStore/index.ts:276
buildIndexFromNodes
▸ buildIndexFromNodes(nodes
, options?
): Promise
<void
>
Get embeddings for nodes and place them into the index.
Parameters
Name | Type |
---|---|
nodes | BaseNode <Metadata >[] |
options? | Object |
options.logProgress? | boolean |
Returns
Promise
<void
>
Defined in
packages/core/src/indices/vectorStore/index.ts:199
deleteRefDoc
▸ deleteRefDoc(refDocId
, deleteFromDocStore?
): Promise
<void
>
Parameters
Name | Type | Default value |
---|---|---|
refDocId | string | undefined |
deleteFromDocStore | boolean | true |
Returns
Promise
<void
>
Overrides
Defined in
packages/core/src/indices/vectorStore/index.ts:352
deleteRefDocFromStore
▸ deleteRefDocFromStore(vectorStore
, refDocId
): Promise
<void
>
Parameters
Name | Type |
---|---|
vectorStore | VectorStore |
refDocId | string |
Returns
Promise
<void
>
Defined in
packages/core/src/indices/vectorStore/index.ts:366
getNodeEmbeddingResults
▸ getNodeEmbeddingResults(nodes
, options?
): Promise
<BaseNode
<Metadata
>[]>
Calculates the embeddings for the given nodes.
Parameters
Name | Type | Description |
---|---|---|
nodes | BaseNode <Metadata >[] | An array of BaseNode objects representing the nodes for which embeddings are to be calculated. |
options? | Object | An optional object containing additional parameters. |
options.logProgress? | boolean | A boolean indicating whether to log progress to the console (useful for debugging). |
Returns
Defined in
packages/core/src/indices/vectorStore/index.ts:173
insert
▸ insert(document
): Promise
<void
>
Insert a document into the index.
Parameters
Name | Type |
---|---|
document | Document <Metadata > |
Returns
Promise
<void
>
Inherited from
Defined in
packages/core/src/indices/BaseIndex.ts:96
insertNodes
▸ insertNodes(nodes
, options?
): Promise
<void
>
Parameters
Name | Type |
---|---|
nodes | BaseNode <Metadata >[] |
options? | Object |
options.logProgress? | boolean |
Returns
Promise
<void
>
Overrides
Defined in
packages/core/src/indices/vectorStore/index.ts:333
insertNodesToStore
▸ insertNodesToStore(vectorStore
, nodes
): Promise
<void
>
Parameters
Name | Type |
---|---|
vectorStore | VectorStore |
nodes | BaseNode <Metadata >[] |
Returns
Promise
<void
>
Defined in
packages/core/src/indices/vectorStore/index.ts:308