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:71
Properties
docStore
• docStore: BaseDocumentStore
Inherited from
Defined in
packages/core/src/indices/BaseIndex.ts:60
embedModel
• embedModel: BaseEmbedding
Defined in
packages/core/src/indices/vectorStore/index.ts:67
imageEmbedModel
• Optional
imageEmbedModel: MultiModalEmbedding
Defined in
packages/core/src/indices/vectorStore/index.ts:69
imageVectorStore
• Optional
imageVectorStore: VectorStore
Defined in
packages/core/src/indices/vectorStore/index.ts:68
indexStore
• indexStore: BaseIndexStore
Overrides
Defined in
packages/core/src/indices/vectorStore/index.ts:66
indexStruct
• indexStruct: IndexDict
Inherited from
Defined in
packages/core/src/indices/BaseIndex.ts:63
serviceContext
• serviceContext: ServiceContext
Inherited from
Defined in
packages/core/src/indices/BaseIndex.ts:58
storageContext
• storageContext: StorageContext
Inherited from
Defined in
packages/core/src/indices/BaseIndex.ts:59
vectorStore
• vectorStore: VectorStore
Overrides
Defined in
packages/core/src/indices/vectorStore/index.ts:65
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
Name | Type | Description |
---|---|---|
options? | Object | you can supply your own custom Retriever and ResponseSynthesizer |
options.nodePostprocessors? | BaseNodePostprocessor [] | - |
options.preFilters? | MetadataFilters | - |
options.responseSynthesizer? | BaseSynthesizer | - |
options.retriever? | BaseRetriever | - |
Returns
BaseQueryEngine
& RetrieverQueryEngine
Overrides
Defined in
packages/core/src/indices/vectorStore/index.ts:270
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:264
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:191
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:339
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:353
getImageNodeEmbeddingResults
▸ getImageNodeEmbeddingResults(nodes
, options?
): Promise
<ImageNode
<Metadata
>[]>
Calculates the embeddings for the given image nodes.
Parameters
Name | Type | Description |
---|---|---|
nodes | ImageNode <Metadata >[] | An array of ImageNode 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
Promise
<ImageNode
<Metadata
>[]>
Defined in
packages/core/src/indices/vectorStore/index.ts:379
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:172
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:94
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:310
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:285
fromDocuments
▸ fromDocuments(documents
, args?
): Promise
<VectorStoreIndex
>
High level API: split documents, get embeddings, and build index.
Parameters
Name | Type |
---|---|
documents | Document <Metadata >[] |
args | VectorIndexOptions |
Returns
Promise
<VectorStoreIndex
>
Defined in
packages/core/src/indices/vectorStore/index.ts:214
fromVectorStore
▸ fromVectorStore(vectorStore
, serviceContext
, imageVectorStore?
): Promise
<VectorStoreIndex
>
Parameters
Name | Type |
---|---|
vectorStore | VectorStore |
serviceContext | ServiceContext |
imageVectorStore? | VectorStore |
Returns
Promise
<VectorStoreIndex
>
Defined in
packages/core/src/indices/vectorStore/index.ts:239
init
▸ init(options
): Promise
<VectorStoreIndex
>
The async init function creates a new VectorStoreIndex.
Parameters
Name | Type |
---|---|
options | VectorIndexOptions |
Returns
Promise
<VectorStoreIndex
>
Defined in
packages/core/src/indices/vectorStore/index.ts:88
setupIndexStructFromStorage
▸ setupIndexStructFromStorage(indexStore
, options
): Promise
<undefined
| IndexDict
>
Parameters
Name | Type |
---|---|
indexStore | BaseIndexStore |
options | IndexStructOptions |
Returns
Promise
<undefined
| IndexDict
>