Zum Hauptinhalt springen

Class: TitleExtractor

Extract title from a list of nodes.

Hierarchy

Constructors

constructor

new TitleExtractor(options?): TitleExtractor

Constructor for the TitleExtractor class.

Parameters

NameType
options?TitleExtractorsArgs

Returns

TitleExtractor

Overrides

BaseExtractor.constructor

Defined in

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

Properties

combineTemplate

combineTemplate: string

The prompt template to merge title with..

Defined in

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


disableTemplateRewrite

disableTemplateRewrite: boolean = false

Inherited from

BaseExtractor.disableTemplateRewrite

Defined in

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


inPlace

inPlace: boolean = true

Inherited from

BaseExtractor.inPlace

Defined in

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


isTextNodeOnly

isTextNodeOnly: boolean = false

Can work for mixture of text and non-text nodes

Default

false

Overrides

BaseExtractor.isTextNodeOnly

Defined in

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


llm

llm: LLM<Record<string, unknown>>

LLM instance.

Defined in

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


metadataMode

metadataMode: MetadataMode = MetadataMode.ALL

Inherited from

BaseExtractor.metadataMode

Defined in

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


nodeTemplate

nodeTemplate: string

The prompt template to use for the title extractor.

Defined in

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


nodes

nodes: number = 5

Number of nodes to extrct titles from.

Default

5

Defined in

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


numWorkers

numWorkers: number = 4

Inherited from

BaseExtractor.numWorkers

Defined in

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


showProgress

showProgress: boolean = true

Inherited from

BaseExtractor.showProgress

Defined in

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

Methods

extract

extract(nodes): Promise<ExtractTitle[]>

Extract titles from a list of nodes.

Parameters

NameTypeDescription
nodesBaseNode<Metadata>[]Nodes to extract titles from.

Returns

Promise<ExtractTitle[]>

Titles extracted from the nodes.

Overrides

BaseExtractor.extract

Defined in

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


extractTitles

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

Parameters

NameType
nodesByDocumentRecord<string, BaseNode<Metadata>[]>

Returns

Promise<Record<string, string>>

Defined in

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


filterNodes

filterNodes(nodes): BaseNode<Metadata>[]

Parameters

NameType
nodesBaseNode<Metadata>[]

Returns

BaseNode<Metadata>[]

Defined in

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


getTitlesCandidates

getTitlesCandidates(nodes): Promise<string[]>

Parameters

NameType
nodesBaseNode<Metadata>[]

Returns

Promise<string[]>

Defined in

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


processNodes

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

Parameters

NameTypeDefault valueDescription
nodesBaseNode<Metadata>[]undefinedNodes to extract metadata from.
excludedEmbedMetadataKeysundefined | string[]undefinedMetadata keys to exclude from the embedding.
excludedLlmMetadataKeysundefined | string[]undefinedMetadata keys to exclude from the LLM.

Returns

Promise<BaseNode<Metadata>[]>

Metadata extracted from the nodes.

Inherited from

BaseExtractor.processNodes

Defined in

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


separateNodesByDocument

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

Parameters

NameType
nodesBaseNode<Metadata>[]

Returns

Record<string, BaseNode<Metadata>[]>

Defined in

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


transform

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

Parameters

NameType
nodesBaseNode<Metadata>[]
options?any

Returns

Promise<BaseNode<Metadata>[]>

Inherited from

BaseExtractor.transform

Defined in

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