VectorStoreIndex
Defined in: .build/typescript/packages/llamaindex/src/indices/vectorStore/index.ts:75
The VectorStoreIndex, an index that stores the nodes only according to their vector embeddings.
Extends
Section titled “Extends”BaseIndex
<IndexDict
>
Properties
Section titled “Properties”storageContext
Section titled “storageContext”storageContext:
StorageContext
Defined in: .build/typescript/packages/llamaindex/src/indices/BaseIndex.ts:52
Inherited from
Section titled “Inherited from”docStore
Section titled “docStore”docStore:
BaseDocumentStore
Defined in: .build/typescript/packages/llamaindex/src/indices/BaseIndex.ts:53
Inherited from
Section titled “Inherited from”indexStruct
Section titled “indexStruct”indexStruct:
IndexDict
Defined in: .build/typescript/packages/llamaindex/src/indices/BaseIndex.ts:55
Inherited from
Section titled “Inherited from”indexStore
Section titled “indexStore”indexStore:
BaseIndexStore
Defined in: .build/typescript/packages/llamaindex/src/indices/vectorStore/index.ts:76
Overrides
Section titled “Overrides”embedModel?
Section titled “embedModel?”
optional
embedModel:BaseEmbedding
Defined in: .build/typescript/packages/llamaindex/src/indices/vectorStore/index.ts:77
vectorStores
Section titled “vectorStores”vectorStores:
VectorStoreByType
Defined in: .build/typescript/packages/llamaindex/src/indices/vectorStore/index.ts:78
Methods
Section titled “Methods”asQueryTool()
Section titled “asQueryTool()”asQueryTool(
params
):QueryEngineTool
Defined in: .build/typescript/packages/llamaindex/src/indices/BaseIndex.ts:94
Returns a query tool by calling asQueryEngine. Either options or retriever can be passed, but not both. If options are provided, they are passed to generate a retriever.
Parameters
Section titled “Parameters”params
Section titled “params”Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”insert()
Section titled “insert()”insert(
document
):Promise
<void
>
Defined in: .build/typescript/packages/llamaindex/src/indices/BaseIndex.ts:110
Insert a document into the index.
Parameters
Section titled “Parameters”document
Section titled “document”Document
Returns
Section titled “Returns”Promise
<void
>
Inherited from
Section titled “Inherited from”retriever()
Section titled “retriever()”retriever(
options?
):BaseRetriever
Defined in: .build/typescript/packages/llamaindex/src/indices/BaseIndex.ts:127
Alias for asRetriever
Parameters
Section titled “Parameters”options?
Section titled “options?”any
Returns
Section titled “Returns”BaseRetriever
Inherited from
Section titled “Inherited from”queryEngine()
Section titled “queryEngine()”queryEngine(
options?
):BaseQueryEngine
Defined in: .build/typescript/packages/llamaindex/src/indices/BaseIndex.ts:135
Alias for asQueryEngine
Parameters
Section titled “Parameters”options?
Section titled “options?”you can supply your own custom Retriever and ResponseSynthesizer
retriever?
Section titled “retriever?”BaseRetriever
responseSynthesizer?
Section titled “responseSynthesizer?”BaseSynthesizer
Returns
Section titled “Returns”BaseQueryEngine
Inherited from
Section titled “Inherited from”queryTool()
Section titled “queryTool()”queryTool(
params
):QueryEngineTool
Defined in: .build/typescript/packages/llamaindex/src/indices/BaseIndex.ts:147
Alias for asQueryTool Either options or retriever can be passed, but not both. If options are provided, they are passed to generate a retriever.
Parameters
Section titled “Parameters”params
Section titled “params”Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”init()
Section titled “init()”
static
init(options
):Promise
<VectorStoreIndex
>
Defined in: .build/typescript/packages/llamaindex/src/indices/vectorStore/index.ts:92
The async init function creates a new VectorStoreIndex.
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”Promise
<VectorStoreIndex
>
getNodeEmbeddingResults()
Section titled “getNodeEmbeddingResults()”getNodeEmbeddingResults(
nodes
,options?
):Promise
<BaseNode
<Metadata
>[]>
Defined in: .build/typescript/packages/llamaindex/src/indices/vectorStore/index.ts:173
Calculates the embeddings for the given nodes.
Parameters
Section titled “Parameters”BaseNode
<Metadata
>[]
An array of BaseNode objects representing the nodes for which embeddings are to be calculated.
options?
Section titled “options?”An optional object containing additional parameters.
logProgress?
Section titled “logProgress?”boolean
A boolean indicating whether to log progress to the console (useful for debugging).
progressCallback?
Section titled “progressCallback?”(progress
, total
) => void
Returns
Section titled “Returns”Promise
<BaseNode
<Metadata
>[]>
buildIndexFromNodes()
Section titled “buildIndexFromNodes()”buildIndexFromNodes(
nodes
,options?
):Promise
<void
>
Defined in: .build/typescript/packages/llamaindex/src/indices/vectorStore/index.ts:202
Get embeddings for nodes and place them into the index.
Parameters
Section titled “Parameters”BaseNode
<Metadata
>[]
options?
Section titled “options?”logProgress?
Section titled “logProgress?”boolean
progressCallback?
Section titled “progressCallback?”(progress
, total
) => void
Returns
Section titled “Returns”Promise
<void
>
fromDocuments()
Section titled “fromDocuments()”
static
fromDocuments(documents
,args
):Promise
<VectorStoreIndex
>
Defined in: .build/typescript/packages/llamaindex/src/indices/vectorStore/index.ts:220
High level API: split documents, get embeddings, and build index.
Parameters
Section titled “Parameters”documents
Section titled “documents”Document
<Metadata
>[]
VectorIndexOptions
& object
= {}
Returns
Section titled “Returns”Promise
<VectorStoreIndex
>
fromVectorStores()
Section titled “fromVectorStores()”
static
fromVectorStores(vectorStores
):Promise
<VectorStoreIndex
>
Defined in: .build/typescript/packages/llamaindex/src/indices/vectorStore/index.ts:265
Parameters
Section titled “Parameters”vectorStores
Section titled “vectorStores”VectorStoreByType
Returns
Section titled “Returns”Promise
<VectorStoreIndex
>
fromVectorStore()
Section titled “fromVectorStore()”
static
fromVectorStore(vectorStore
):Promise
<VectorStoreIndex
>
Defined in: .build/typescript/packages/llamaindex/src/indices/vectorStore/index.ts:284
Parameters
Section titled “Parameters”vectorStore
Section titled “vectorStore”BaseVectorStore
Returns
Section titled “Returns”Promise
<VectorStoreIndex
>
asRetriever()
Section titled “asRetriever()”asRetriever(
options?
):VectorIndexRetriever
Defined in: .build/typescript/packages/llamaindex/src/indices/vectorStore/index.ts:288
Create a new retriever from the index.
Parameters
Section titled “Parameters”options?
Section titled “options?”Omit
<object
& object
, "index"
> | Omit
<object
& object
, "index"
>
Returns
Section titled “Returns”Overrides
Section titled “Overrides”asQueryEngine()
Section titled “asQueryEngine()”asQueryEngine(
options?
):RetrieverQueryEngine
Defined in: .build/typescript/packages/llamaindex/src/indices/vectorStore/index.ts:298
Create a RetrieverQueryEngine. similarityTopK is only used if no existing retriever is provided.
Parameters
Section titled “Parameters”options?
Section titled “options?”retriever?
Section titled “retriever?”BaseRetriever
responseSynthesizer?
Section titled “responseSynthesizer?”BaseSynthesizer
preFilters?
Section titled “preFilters?”MetadataFilters
customParams?
Section titled “customParams?”unknown
nodePostprocessors?
Section titled “nodePostprocessors?”BaseNodePostprocessor
[]
similarityTopK?
Section titled “similarityTopK?”number
Returns
Section titled “Returns”RetrieverQueryEngine
Overrides
Section titled “Overrides”asChatEngine()
Section titled “asChatEngine()”asChatEngine(
options
):ContextChatEngine
Defined in: .build/typescript/packages/llamaindex/src/indices/vectorStore/index.ts:331
Convert the index to a chat engine.
Parameters
Section titled “Parameters”options
Section titled “options”VectorIndexChatEngineOptions
= {}
The options for creating the chat engine
Returns
Section titled “Returns”ContextChatEngine
A ContextChatEngine that uses the index’s retriever to get context for each query
Overrides
Section titled “Overrides”insertNodesToStore()
Section titled “insertNodesToStore()”
protected
insertNodesToStore(newIds
,nodes
,vectorStore
):Promise
<void
>
Defined in: .build/typescript/packages/llamaindex/src/indices/vectorStore/index.ts:351
Parameters
Section titled “Parameters”newIds
Section titled “newIds”string
[]
BaseNode
<Metadata
>[]
vectorStore
Section titled “vectorStore”BaseVectorStore
Returns
Section titled “Returns”Promise
<void
>
insertNodes()
Section titled “insertNodes()”insertNodes(
nodes
,options?
):Promise
<void
>
Defined in: .build/typescript/packages/llamaindex/src/indices/vectorStore/index.ts:375
Parameters
Section titled “Parameters”BaseNode
<Metadata
>[]
options?
Section titled “options?”logProgress?
Section titled “logProgress?”boolean
progressCallback?
Section titled “progressCallback?”(progress
, total
) => void
Returns
Section titled “Returns”Promise
<void
>
Overrides
Section titled “Overrides”deleteRefDoc()
Section titled “deleteRefDoc()”deleteRefDoc(
refDocId
,deleteFromDocStore
):Promise
<void
>
Defined in: .build/typescript/packages/llamaindex/src/indices/vectorStore/index.ts:396
Parameters
Section titled “Parameters”refDocId
Section titled “refDocId”string
deleteFromDocStore
Section titled “deleteFromDocStore”boolean
= true
Returns
Section titled “Returns”Promise
<void
>
Overrides
Section titled “Overrides”deleteRefDocFromStore()
Section titled “deleteRefDocFromStore()”
protected
deleteRefDocFromStore(vectorStore
,refDocId
):Promise
<void
>
Defined in: .build/typescript/packages/llamaindex/src/indices/vectorStore/index.ts:408
Parameters
Section titled “Parameters”vectorStore
Section titled “vectorStore”BaseVectorStore
refDocId
Section titled “refDocId”string
Returns
Section titled “Returns”Promise
<void
>