Skip to main content

Class: KeywordExtractor()

Extract keywords from a list of nodes.

Extends

KeywordExtractor<Options>(nodes, options?): Promise<BaseNode<Metadata>[]>

Extract keywords from a list of nodes.

Type Parameters

Options extends Record<string, unknown>

Parameters

nodes: BaseNode<Metadata>[]

options?: Options

Returns

Promise<BaseNode<Metadata>[]>

Defined in

packages/llamaindex/src/extractors/MetadataExtractors.ts:35

Constructors

new KeywordExtractor()

new KeywordExtractor(options?): KeywordExtractor

Constructor for the KeywordExtractor class.

Parameters

options?: KeywordExtractArgs

Returns

KeywordExtractor

Throws

If keywords is less than 1.

Overrides

BaseExtractor.constructor

Defined in

packages/llamaindex/src/extractors/MetadataExtractors.ts:61

Properties

disableTemplateRewrite

disableTemplateRewrite: boolean = false

Inherited from

BaseExtractor.disableTemplateRewrite

Defined in

packages/llamaindex/src/extractors/types.ts:16


id

id: string

Inherited from

BaseExtractor.id

Defined in

packages/core/schema/dist/index.d.ts:171


inPlace

inPlace: boolean = true

Inherited from

BaseExtractor.inPlace

Defined in

packages/llamaindex/src/extractors/types.ts:17


isTextNodeOnly

isTextNodeOnly: boolean = true

Inherited from

BaseExtractor.isTextNodeOnly

Defined in

packages/llamaindex/src/extractors/types.ts:13


keywords

keywords: number = 5

Number of keywords to extract.

Default

5

Defined in

packages/llamaindex/src/extractors/MetadataExtractors.ts:47


llm

llm: LLM<object, object>

LLM instance.

Defined in

packages/llamaindex/src/extractors/MetadataExtractors.ts:40


metadataMode

metadataMode: MetadataMode = MetadataMode.ALL

Inherited from

BaseExtractor.metadataMode

Defined in

packages/llamaindex/src/extractors/types.ts:15


numWorkers

numWorkers: number = 4

Inherited from

BaseExtractor.numWorkers

Defined in

packages/llamaindex/src/extractors/types.ts:18


promptTemplate

promptTemplate: KeywordExtractPrompt

The prompt template to use for the question extractor.

Defined in

packages/llamaindex/src/extractors/MetadataExtractors.ts:53


showProgress

showProgress: boolean = true

Inherited from

BaseExtractor.showProgress

Defined in

packages/llamaindex/src/extractors/types.ts:14

Methods

extract()

extract(nodes): Promise<ExtractKeyword[] | object[]>

Parameters

nodes: BaseNode<Metadata>[]

Nodes to extract keywords from.

Returns

Promise<ExtractKeyword[] | object[]>

Keywords extracted from the nodes.

Overrides

BaseExtractor.extract

Defined in

packages/llamaindex/src/extractors/MetadataExtractors.ts:104


extractKeywordsFromNodes()

extractKeywordsFromNodes(node): Promise<object | ExtractKeyword>

Parameters

node: BaseNode<Metadata>

Node to extract keywords from.

Returns

Promise<object | ExtractKeyword>

Keywords extracted from the node.

Defined in

packages/llamaindex/src/extractors/MetadataExtractors.ts:82


processNodes()

processNodes(nodes, excludedEmbedMetadataKeys, excludedLlmMetadataKeys): Promise<BaseNode<Metadata>[]>

Parameters

nodes: BaseNode<Metadata>[]

Nodes to extract metadata from.

excludedEmbedMetadataKeys: undefined | string[] = undefined

Metadata keys to exclude from the embedding.

excludedLlmMetadataKeys: undefined | string[] = undefined

Metadata keys to exclude from the LLM.

Returns

Promise<BaseNode<Metadata>[]>

Metadata extracted from the nodes.

Inherited from

BaseExtractor.processNodes

Defined in

packages/llamaindex/src/extractors/types.ts:39