Passa al contenuto principale

Class: QuestionsAnsweredExtractor

Extract questions from a list of nodes.

Hierarchy

Constructors

constructor

new QuestionsAnsweredExtractor(options?): QuestionsAnsweredExtractor

Constructor for the QuestionsAnsweredExtractor class.

Parameters

NameType
options?QuestionAnswerExtractArgs

Returns

QuestionsAnsweredExtractor

Overrides

BaseExtractor.constructor

Defined in

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

Properties

disableTemplateRewrite

disableTemplateRewrite: boolean = false

Inherited from

BaseExtractor.disableTemplateRewrite

Defined in

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


embeddingOnly

embeddingOnly: boolean = false

Wheter to use metadata for embeddings only

Default

false

Defined in

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


inPlace

inPlace: boolean = true

Inherited from

BaseExtractor.inPlace

Defined in

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


isTextNodeOnly

isTextNodeOnly: boolean = true

Inherited from

BaseExtractor.isTextNodeOnly

Defined in

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


llm

llm: LLM<Record<string, unknown>>

LLM instance.

Defined in

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


metadataMode

metadataMode: MetadataMode = MetadataMode.ALL

Inherited from

BaseExtractor.metadataMode

Defined in

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


numWorkers

numWorkers: number = 4

Inherited from

BaseExtractor.numWorkers

Defined in

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


promptTemplate

promptTemplate: string

The prompt template to use for the question extractor.

Defined in

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


questions

questions: number = 5

Number of questions to generate.

Default

5

Defined in

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


showProgress

showProgress: boolean = true

Inherited from

BaseExtractor.showProgress

Defined in

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

Methods

extract

extract(nodes): Promise<{}[] | ExtractQuestion[]>

Extract answered questions from a list of nodes.

Parameters

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

Returns

Promise<{}[] | ExtractQuestion[]>

Questions extracted from the nodes.

Overrides

BaseExtractor.extract

Defined in

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


extractQuestionsFromNode

extractQuestionsFromNode(node): Promise<{} | ExtractQuestion>

Extract answered questions from a node.

Parameters

NameTypeDescription
nodeBaseNode<Metadata>Node to extract questions from.

Returns

Promise<{} | ExtractQuestion>

Questions extracted from the node.

Defined in

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


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


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