跳到主要内容

Class: TitleExtractor

Extract title from a list of nodes.

Extends

Constructors

new TitleExtractor()

new TitleExtractor(options?): TitleExtractor

Constructor for the TitleExtractor class.

Parameters

options?: TitleExtractorsArgs

Returns

TitleExtractor

Overrides

BaseExtractor . constructor

Source

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

Properties

combineTemplate

combineTemplate: string

The prompt template to merge title with..

Source

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


disableTemplateRewrite

disableTemplateRewrite: boolean = false

Inherited from

BaseExtractor . disableTemplateRewrite

Source

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


inPlace

inPlace: boolean = true

Inherited from

BaseExtractor . inPlace

Source

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


isTextNodeOnly

isTextNodeOnly: boolean = false

Can work for mixture of text and non-text nodes

Default

false

Overrides

BaseExtractor . isTextNodeOnly

Source

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


llm

llm: LLM<object, object>

LLM instance.

Source

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


metadataMode

metadataMode: MetadataMode = MetadataMode.ALL

Inherited from

BaseExtractor . metadataMode

Source

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


nodeTemplate

nodeTemplate: string

The prompt template to use for the title extractor.

Source

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


nodes

nodes: number = 5

Number of nodes to extrct titles from.

Default

5

Source

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


numWorkers

numWorkers: number = 4

Inherited from

BaseExtractor . numWorkers

Source

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


showProgress

showProgress: boolean = true

Inherited from

BaseExtractor . showProgress

Source

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

Methods

extract()

extract(nodes): Promise<ExtractTitle[]>

Extract titles from a list of nodes.

Parameters

nodes: BaseNode <Metadata>[]

Nodes to extract titles from.

Returns

Promise<ExtractTitle[]>

Titles extracted from the nodes.

Overrides

BaseExtractor . extract

Source

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


extractTitles()

private extractTitles(nodesByDocument): Promise<Record<string, string>>

Parameters

nodesByDocument: Record<string, BaseNode <Metadata>[]>

Returns

Promise<Record<string, string>>

Source

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


filterNodes()

private filterNodes(nodes): BaseNode <Metadata>[]

Parameters

nodes: BaseNode <Metadata>[]

Returns

BaseNode <Metadata>[]

Source

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


getTitlesCandidates()

private getTitlesCandidates(nodes): Promise<string[]>

Parameters

nodes: BaseNode <Metadata>[]

Returns

Promise<string[]>

Source

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


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

Source

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


separateNodesByDocument()

private separateNodesByDocument(nodes): Record<string, BaseNode <Metadata>[]>

Parameters

nodes: BaseNode <Metadata>[]

Returns

Record<string, BaseNode <Metadata>[]>

Source

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


transform()

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

Parameters

nodes: BaseNode <Metadata>[]

options?: any

Returns

Promise <BaseNode <Metadata>[]>

Inherited from

BaseExtractor . transform

Source

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