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:51

Properties

functionMappings

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

Inherited from

BasePromptTemplate.functionMappings

Defined in

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


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:25


outputParser

outputParser: undefined | BaseOutputParser<any>

Inherited from

BasePromptTemplate.outputParser

Defined in

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


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:50


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:27


templateVars

templateVars: Set<string>

Set of template variables used in the prompt template. Used for type hints only. To get the list of template variables used in the prompt at run-time, use the vars method.

Inherited from

BasePromptTemplate.templateVars

Defined in

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

Accessors

template

Get Signature

get template(): Template

Returns

Template

Overrides

BasePromptTemplate.template

Defined in

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

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:53


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:54


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:34


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:33


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:30


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:52


vars()

vars(): string[]

Returns all the template variables used in the prompt template.

Returns

string[]

Defined in

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