Przejdź do głównej zawartości

Class: KeywordTableIndex

The KeywordTableIndex, an index that extracts keywords from each Node and builds a mapping from each keyword to the corresponding Nodes of that keyword.

Hierarchy

Constructors

constructor

new KeywordTableIndex(init)

Parameters

NameType
initBaseIndexInit<KeywordTable>

Overrides

BaseIndex.constructor

Defined in

packages/core/src/indices/keyword/KeywordTableIndex.ts:52

Properties

docStore

docStore: BaseDocumentStore

Inherited from

BaseIndex.docStore

Defined in

packages/core/src/indices/BaseIndex.ts:156


indexStore

Optional indexStore: BaseIndexStore

Inherited from

BaseIndex.indexStore

Defined in

packages/core/src/indices/BaseIndex.ts:158


indexStruct

indexStruct: KeywordTable

Inherited from

BaseIndex.indexStruct

Defined in

packages/core/src/indices/BaseIndex.ts:159


serviceContext

serviceContext: ServiceContext

Inherited from

BaseIndex.serviceContext

Defined in

packages/core/src/indices/BaseIndex.ts:154


storageContext

storageContext: StorageContext

Inherited from

BaseIndex.storageContext

Defined in

packages/core/src/indices/BaseIndex.ts:155


vectorStore

Optional vectorStore: VectorStore

Inherited from

BaseIndex.vectorStore

Defined in

packages/core/src/indices/BaseIndex.ts:157

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

NameTypeDescription
options?Objectyou can supply your own custom Retriever and ResponseSynthesizer
options.nodePostprocessors?BaseNodePostprocessor[]-
options.preFilters?unknown-
options.responseSynthesizer?BaseSynthesizer-
options.retriever?BaseRetriever-

Returns

BaseQueryEngine

Overrides

BaseIndex.asQueryEngine

Defined in

packages/core/src/indices/keyword/KeywordTableIndex.ts:133


asRetriever

asRetriever(options?): BaseRetriever

Create a new retriever from the index.

Parameters

NameType
options?any

Returns

BaseRetriever

Overrides

BaseIndex.asRetriever

Defined in

packages/core/src/indices/keyword/KeywordTableIndex.ts:122


deleteNode

deleteNode(nodeId): void

Parameters

NameType
nodeIdstring

Returns

void

Defined in

packages/core/src/indices/keyword/KeywordTableIndex.ts:227


deleteNodes

deleteNodes(nodeIds, deleteFromDocStore): Promise<void>

Parameters

NameType
nodeIdsstring[]
deleteFromDocStoreboolean

Returns

Promise<void>

Defined in

packages/core/src/indices/keyword/KeywordTableIndex.ts:245


deleteRefDoc

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

Parameters

NameType
refDocIdstring
deleteFromDocStore?boolean

Returns

Promise<void>

Overrides

BaseIndex.deleteRefDoc

Defined in

packages/core/src/indices/keyword/KeywordTableIndex.ts:259


insert

insert(document): Promise<void>

Insert a document into the index.

Parameters

NameType
documentDocument<Metadata>

Returns

Promise<void>

Inherited from

BaseIndex.insert

Defined in

packages/core/src/indices/BaseIndex.ts:190


insertNodes

insertNodes(nodes): Promise<void>

Parameters

NameType
nodesBaseNode<Metadata>[]

Returns

Promise<void>

Overrides

BaseIndex.insertNodes

Defined in

packages/core/src/indices/keyword/KeywordTableIndex.ts:217


buildIndexFromNodes

Static buildIndexFromNodes(nodes, docStore, serviceContext): Promise<KeywordTable>

Get keywords for nodes and place them into the index.

Parameters

NameType
nodesBaseNode<Metadata>[]
docStoreBaseDocumentStore
serviceContextServiceContext

Returns

Promise<KeywordTable>

Defined in

packages/core/src/indices/keyword/KeywordTableIndex.ts:200


extractKeywords

Static extractKeywords(text, serviceContext): Promise<Set<string>>

Parameters

NameType
textstring
serviceContextServiceContext

Returns

Promise<Set<string>>

Defined in

packages/core/src/indices/keyword/KeywordTableIndex.ts:148


fromDocuments

Static fromDocuments(documents, args?): Promise<KeywordTableIndex>

High level API: split documents, get keywords, and build index.

Parameters

NameType
documentsDocument<Metadata>[]
argsObject
args.serviceContext?ServiceContext
args.storageContext?StorageContext

Returns

Promise<KeywordTableIndex>

Defined in

packages/core/src/indices/keyword/KeywordTableIndex.ts:167


init

Static init(options): Promise<KeywordTableIndex>

Parameters

NameType
optionsKeywordIndexOptions

Returns

Promise<KeywordTableIndex>

Defined in

packages/core/src/indices/keyword/KeywordTableIndex.ts:56