Logo
Classes

BaseIndex

Defined in: packages/llamaindex/src/indices/BaseIndex.ts:51

Indexes are the data structure that we store our nodes and embeddings in so they can be retrieved for our queries.

Extended by

Type Parameters

T

T

Constructors

Constructor

new BaseIndex<T>(init): BaseIndex<T>

Defined in: packages/llamaindex/src/indices/BaseIndex.ts:57

Parameters

init

BaseIndexInit<T>

Returns

BaseIndex<T>

Properties

storageContext

storageContext: StorageContext

Defined in: packages/llamaindex/src/indices/BaseIndex.ts:52


docStore

docStore: BaseDocumentStore

Defined in: packages/llamaindex/src/indices/BaseIndex.ts:53


indexStore?

optional indexStore: BaseIndexStore

Defined in: packages/llamaindex/src/indices/BaseIndex.ts:54


indexStruct

indexStruct: T

Defined in: packages/llamaindex/src/indices/BaseIndex.ts:55

Methods

asRetriever()

abstract asRetriever(options?): BaseRetriever

Defined in: packages/llamaindex/src/indices/BaseIndex.ts:69

Create a new retriever from the index.

Parameters

options?

any

Returns

BaseRetriever


asQueryEngine()

abstract asQueryEngine(options?): BaseQueryEngine

Defined in: packages/llamaindex/src/indices/BaseIndex.ts:76

Create a new query engine from the index. It will also create a retriever and response synthezier if they are not provided.

Parameters

options?

you can supply your own custom Retriever and ResponseSynthesizer

retriever?

BaseRetriever

responseSynthesizer?

BaseSynthesizer

Returns

BaseQueryEngine


asChatEngine()

abstract asChatEngine(options?): BaseChatEngine

Defined in: packages/llamaindex/src/indices/BaseIndex.ts:85

Create a new chat engine from the index.

Parameters

options?

Omit<ContextChatEngineOptions, "retriever">

Returns

BaseChatEngine


asQueryTool()

asQueryTool(params): QueryEngineTool

Defined in: 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

params

QueryToolParams

Returns

QueryEngineTool


insert()

insert(document): Promise<void>

Defined in: packages/llamaindex/src/indices/BaseIndex.ts:110

Insert a document into the index.

Parameters

document

Document

Returns

Promise<void>


insertNodes()

abstract insertNodes(nodes): Promise<void>

Defined in: packages/llamaindex/src/indices/BaseIndex.ts:116

Parameters

nodes

BaseNode<Metadata>[]

Returns

Promise<void>


deleteRefDoc()

abstract deleteRefDoc(refDocId, deleteFromDocStore?): Promise<void>

Defined in: packages/llamaindex/src/indices/BaseIndex.ts:117

Parameters

refDocId

string

deleteFromDocStore?

boolean

Returns

Promise<void>


retriever()

retriever(options?): BaseRetriever

Defined in: packages/llamaindex/src/indices/BaseIndex.ts:127

Alias for asRetriever

Parameters

options?

any

Returns

BaseRetriever


queryEngine()

queryEngine(options?): BaseQueryEngine

Defined in: packages/llamaindex/src/indices/BaseIndex.ts:135

Alias for asQueryEngine

Parameters

options?

you can supply your own custom Retriever and ResponseSynthesizer

retriever?

BaseRetriever

responseSynthesizer?

BaseSynthesizer

Returns

BaseQueryEngine


queryTool()

queryTool(params): QueryEngineTool

Defined in: 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

params

QueryToolParams

Returns

QueryEngineTool