Skip to main content

Class: PromptHelper

A collection of helper functions for working with prompts.

Constructors

new PromptHelper()

new PromptHelper(options?): PromptHelper

Parameters

options?: PromptHelperOptions

Returns

PromptHelper

Defined in

packages/core/dist/indices/index.d.ts:28

Properties

chunkOverlapRatio

chunkOverlapRatio: number

Defined in

packages/core/dist/indices/index.d.ts:24


chunkSizeLimit

chunkSizeLimit: undefined | number

Defined in

packages/core/dist/indices/index.d.ts:25


contextWindow

contextWindow: number

Defined in

packages/core/dist/indices/index.d.ts:22


numOutput

numOutput: number

Defined in

packages/core/dist/indices/index.d.ts:23


separator

separator: string

Defined in

packages/core/dist/indices/index.d.ts:27


tokenizer

tokenizer: Tokenizer

Defined in

packages/core/dist/indices/index.d.ts:26

Methods

getTextSplitterGivenPrompt()

getTextSplitterGivenPrompt(prompt, numChunks?, padding?): SentenceSplitter

Creates a text splitter with the correct chunk sizes and overlaps given a prompt.

Parameters

prompt: PromptTemplate<string[], string[], string>

numChunks?: number

padding?: number

Returns

SentenceSplitter

Defined in

packages/core/dist/indices/index.d.ts:42


repack()

repack(prompt, textChunks, padding?): string[]

Repack resplits the strings based on the optimal text splitter.

Parameters

prompt: PromptTemplate<string[], string[], string>

textChunks: string[]

padding?: number

Returns

string[]

Defined in

packages/core/dist/indices/index.d.ts:46