Skip to main content

Class: PromptTemplate<TemplatesVar, Vars, Template>

Extends

Type Parameters

TemplatesVar extends readonly string[] = string[]

Vars extends readonly string[] = string[]

Template extends StringTemplate<TemplatesVar> = StringTemplate<TemplatesVar>

Constructors

new PromptTemplate()

new PromptTemplate<TemplatesVar, Vars, Template>(options): PromptTemplate<TemplatesVar, Vars, Template>

Parameters

options: PromptTemplateOptions<TemplatesVar, Vars, Template>

Returns

PromptTemplate<TemplatesVar, Vars, Template>

Overrides

BasePromptTemplate.constructor

Defined in

packages/core/prompts/dist/index.d.ts:47

Properties

functionMappings

functionMappings: Partial<Record<string & object | TemplatesVar[number], MappingFn<string[]>>>

Inherited from

BasePromptTemplate.functionMappings

Defined in

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


metadata

metadata: Metadata

Inherited from

BasePromptTemplate.metadata

Defined in

packages/core/prompts/dist/index.d.ts:19


options

options: Partial<Record<string & object | TemplatesVar[number], string>>

Inherited from

BasePromptTemplate.options

Defined in

packages/core/prompts/dist/index.d.ts:21


outputParser

outputParser: undefined | BaseOutputParser<any>

Inherited from

BasePromptTemplate.outputParser

Defined in

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


promptType

promptType: "summary" | "insert" | "tree_select" | "tree_select_multiple" | "text_qa" | "refine" | "keyword_extract" | "query_keyword_extract" | "schema_extract" | "text_to_sql" | "text_to_graph_query" | "table_context" | "knowledge_triplet_extract" | "simple_input" | "pandas" | "json_path" | "single_select" | "multi_select" | "vector_store_query" | "sub_question" | "sql_response_synthesis" | "sql_response_synthesis_v2" | "conversation" | "decompose" | "choice_select" | "custom" | "rankgpt_rerank"

Defined in

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


templateVarMappings

templateVarMappings: Partial<Record<string & object | Vars[number], string & object | TemplatesVar[number]>>

Inherited from

BasePromptTemplate.templateVarMappings

Defined in

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


templateVars

templateVars: Set<string>

Inherited from

BasePromptTemplate.templateVars

Defined in

packages/core/prompts/dist/index.d.ts:20

Accessors

template

get template(): Template

Returns

Template

Overrides

BasePromptTemplate.template

Defined in

packages/core/prompts/dist/index.d.ts:51

Methods

format()

format(options?): string

Parameters

options?: Partial<Record<string & object | TemplatesVar[number], string>>

Returns

string

Overrides

BasePromptTemplate.format

Defined in

packages/core/prompts/dist/index.d.ts:49


formatMessages()

formatMessages(options?): ChatMessage[]

Parameters

options?: Partial<Record<string & object | TemplatesVar[number], string>>

Returns

ChatMessage[]

Overrides

BasePromptTemplate.formatMessages

Defined in

packages/core/prompts/dist/index.d.ts:50


mapAllVars()

protected mapAllVars(options): Record<string, string>

Parameters

options: Record<string & object | TemplatesVar[number], string>

Returns

Record<string, string>

Inherited from

BasePromptTemplate.mapAllVars

Defined in

packages/core/prompts/dist/index.d.ts:30


mapFunctionVars()

protected mapFunctionVars(options): Record<TemplatesVar[number], string>

Parameters

options: Record<string & object | TemplatesVar[number], string>

Returns

Record<TemplatesVar[number], string>

Inherited from

BasePromptTemplate.mapFunctionVars

Defined in

packages/core/prompts/dist/index.d.ts:29


mapTemplateVars()

protected mapTemplateVars(options): object

Parameters

options: Record<string & object | TemplatesVar[number], string>

Returns

object

Inherited from

BasePromptTemplate.mapTemplateVars

Defined in

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


partialFormat()

partialFormat(options): PromptTemplate<TemplatesVar, Vars, Template>

Parameters

options: Partial<Record<string & object | TemplatesVar[number], string>>

Returns

PromptTemplate<TemplatesVar, Vars, Template>

Overrides

BasePromptTemplate.partialFormat

Defined in

packages/core/prompts/dist/index.d.ts:48