diff --git a/langchain/src/prompts/few_shot.ts b/langchain/src/prompts/few_shot.ts index 1c61d0795596..13824dd389a4 100644 --- a/langchain/src/prompts/few_shot.ts +++ b/langchain/src/prompts/few_shot.ts @@ -51,7 +51,7 @@ export interface FewShotPromptTemplateInput suffix?: string; /** - * The format of the prompt template. Options are: 'f-string', 'jinja-2' + * The format of the prompt template. Options are: 'f-string' */ templateFormat?: TemplateFormat; diff --git a/langchain/src/prompts/prompt.ts b/langchain/src/prompts/prompt.ts index d0509042c551..966038f23ac0 100644 --- a/langchain/src/prompts/prompt.ts +++ b/langchain/src/prompts/prompt.ts @@ -31,7 +31,7 @@ export interface PromptTemplateInput< template: string; /** - * The format of the prompt template. Options are 'f-string', 'jinja-2' + * The format of the prompt template. Options are 'f-string' * * @defaultValue 'f-string' */ @@ -190,9 +190,6 @@ export class PromptTemplate< "template" | "inputVariables" > = {} ) { - if (templateFormat === "jinja2") { - throw new Error("jinja2 templates are not currently supported."); - } const names = new Set(); parseTemplate(template, templateFormat).forEach((node) => { if (node.type === "variable") { diff --git a/langchain/src/prompts/template.ts b/langchain/src/prompts/template.ts index a70c4ff9a7e6..bc21e6d426bc 100644 --- a/langchain/src/prompts/template.ts +++ b/langchain/src/prompts/template.ts @@ -1,10 +1,10 @@ import { InputValues } from "../schema/index.js"; /** - * Type that specifies the format of a template. It can be either - * "f-string" or "jinja2". + * Type that specifies the format of a template. Only + * "f-string" is supported currently. */ -export type TemplateFormat = "f-string" | "jinja2"; +export type TemplateFormat = "f-string"; /** * Type that represents a node in a parsed format string. It can be either @@ -91,12 +91,10 @@ type Parser = (template: string) => ParsedFStringNode[]; export const DEFAULT_FORMATTER_MAPPING: Record = { "f-string": interpolateFString, - jinja2: (_: string, __: InputValues) => "", }; export const DEFAULT_PARSER_MAPPING: Record = { "f-string": parseFString, - jinja2: (_: string) => [], }; export const renderTemplate = (