Class: VectorStoreIndex
The VectorStoreIndex, an index that stores the nodes only according to their vector embedings.
Hierarchy
Constructors
constructor
• Private
new VectorStoreIndex(init
)
Parameters
Name | Type |
---|---|
init | VectorIndexConstructorProps |
Overrides
Defined in
indices/vectorStore/VectorStoreIndex.ts:36
Properties
docStore
• docStore: BaseDocumentStore
Inherited from
Defined in
indices/BaseIndex.ts:117
indexStore
• Optional
indexStore: BaseIndexStore
Inherited from
Defined in
indices/BaseIndex.ts:119
indexStruct
• indexStruct: IndexDict
Inherited from
Defined in
indices/BaseIndex.ts:120
serviceContext
• serviceContext: ServiceContext
Inherited from
Defined in
indices/BaseIndex.ts:115
storageContext
• storageContext: StorageContext
Inherited from
Defined in
indices/BaseIndex.ts:116
vectorStore
• vectorStore: VectorStore
Overrides
Defined in
indices/vectorStore/VectorStoreIndex.ts:34
Methods
asQueryEngine
▸ asQueryEngine(options?
): BaseQueryEngine
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.responseSynthesizer? | ResponseSynthesizer | - |
options.retriever? | BaseRetriever | - |
Returns
Overrides
Defined in
indices/vectorStore/VectorStoreIndex.ts:215
asRetriever
▸ asRetriever(options?
): VectorIndexRetriever
Create a new retriever from the index.
Parameters
Name | Type |
---|---|
options? | any |
Returns
Overrides
Defined in
indices/vectorStore/VectorStoreIndex.ts:211
buildIndexFromNodes
▸ Static
buildIndexFromNodes(nodes
, serviceContext
, vectorStore
, docStore
): Promise
<IndexDict
>
Get embeddings for nodes and place them into the index.
Parameters
Name | Type |
---|---|
nodes | BaseNode [] |
serviceContext | ServiceContext |
vectorStore | VectorStore |
docStore | BaseDocumentStore |
Returns
Promise
<IndexDict
>
Defined in
indices/vectorStore/VectorStoreIndex.ts:151
fromDocuments
▸ Static
fromDocuments(documents
, args?
): Promise
<VectorStoreIndex
>
High level API: split documents, get embeddings, and build index.
Parameters
Name | Type |
---|---|
documents | Document [] |
args | Object |
args.serviceContext? | ServiceContext |
args.storageContext? | StorageContext |
Returns
Promise
<VectorStoreIndex
>
Defined in
indices/vectorStore/VectorStoreIndex.ts:186
getNodeEmbeddingResults
▸ Static
getNodeEmbeddingResults(nodes
, serviceContext
, logProgress?
): Promise
<NodeWithEmbedding
[]>
Get the embeddings for nodes.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
nodes | BaseNode [] | undefined | |
serviceContext | ServiceContext | undefined | |
logProgress | boolean | false | log progress to console (useful for debugging) |
Returns
Promise
<NodeWithEmbedding
[]>
Defined in
indices/vectorStore/VectorStoreIndex.ts:123
init
▸ Static
init(options
): Promise
<VectorStoreIndex
>
The async init function should be called after the constructor. This is needed to handle persistence.
Parameters
Name | Type |
---|---|
options | VectorIndexOptions |
Returns
Promise
<VectorStoreIndex
>
Defined in
indices/vectorStore/VectorStoreIndex.ts:47