@langchain/core
Version:
Core LangChain.js abstractions and schemas
1 lines • 1.75 kB
Source Map (JSON)
{"version":3,"file":"string.cjs","names":["BasePromptTemplate","values: TypedPromptInputValues<RunInput>","StringPromptValue"],"sources":["../../src/prompts/string.ts"],"sourcesContent":["// Default generic \"any\" values are for backwards compatibility.\n// Replace with \"string\" when we are comfortable with a breaking change.\n\nimport type { InputValues } from \"../utils/types/index.js\";\nimport {\n type StringPromptValueInterface,\n StringPromptValue,\n} from \"../prompt_values.js\";\nimport { BasePromptTemplate, type TypedPromptInputValues } from \"./base.js\";\n\n/**\n * Base class for string prompt templates. It extends the\n * BasePromptTemplate class and overrides the formatPromptValue method to\n * return a StringPromptValue.\n */\nexport abstract class BaseStringPromptTemplate<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RunInput extends InputValues = any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n PartialVariableName extends string = any\n> extends BasePromptTemplate<\n RunInput,\n StringPromptValueInterface,\n PartialVariableName\n> {\n /**\n * Formats the prompt given the input values and returns a formatted\n * prompt value.\n * @param values The input values to format the prompt.\n * @returns A Promise that resolves to a formatted prompt value.\n */\n async formatPromptValue(\n values: TypedPromptInputValues<RunInput>\n ): Promise<StringPromptValueInterface> {\n const formattedPrompt = await this.format(values);\n return new StringPromptValue(formattedPrompt);\n }\n}\n"],"mappings":";;;;;;;;;AAeA,IAAsB,2BAAtB,cAKUA,gCAIR;;;;;;;CAOA,MAAM,kBACJC,QACqC;EACrC,MAAM,kBAAkB,MAAM,KAAK,OAAO,OAAO;AACjD,SAAO,IAAIC,wCAAkB;CAC9B;AACF"}