@langchain/core
Version:
Core LangChain.js abstractions and schemas
1 lines • 3.29 kB
Source Map (JSON)
{"version":3,"file":"template.d.ts","names":["MessageContent","InputValues","TemplateFormat","ParsedTemplateNode","ParsedFStringNode","parseFString","parseMustache","interpolateFString","interpolateMustache","Interpolator","Parser","DEFAULT_FORMATTER_MAPPING","Record","DEFAULT_PARSER_MAPPING","renderTemplate","parseTemplate","checkValidTemplate"],"sources":["../../src/prompts/template.d.ts"],"sourcesContent":["import { MessageContent } from \"../messages/index.js\";\nimport type { InputValues } from \"../utils/types/index.js\";\n/**\n * Type that specifies the format of a template.\n */\nexport type TemplateFormat = \"f-string\" | \"mustache\";\n/**\n * Type that represents a node in a parsed format string. It can be either\n * a literal text or a variable name.\n */\nexport type ParsedTemplateNode = {\n type: \"literal\";\n text: string;\n} | {\n type: \"variable\";\n name: string;\n};\n/**\n * Alias for `ParsedTemplateNode` since it is the same for\n * both f-string and mustache templates.\n */\nexport type ParsedFStringNode = ParsedTemplateNode;\nexport declare const parseFString: (template: string) => ParsedTemplateNode[];\nexport declare const parseMustache: (template: string) => ParsedTemplateNode[];\nexport declare const interpolateFString: (template: string, values: InputValues) => string;\nexport declare const interpolateMustache: (template: string, values: InputValues) => string;\n/**\n * Type that represents a function that takes a template string and a set\n * of input values, and returns a string where all variables in the\n * template have been replaced with their corresponding values.\n */\ntype Interpolator = (template: string, values: InputValues) => string;\n/**\n * Type that represents a function that takes a template string and\n * returns an array of `ParsedTemplateNode`.\n */\ntype Parser = (template: string) => ParsedTemplateNode[];\nexport declare const DEFAULT_FORMATTER_MAPPING: Record<TemplateFormat, Interpolator>;\nexport declare const DEFAULT_PARSER_MAPPING: Record<TemplateFormat, Parser>;\nexport declare const renderTemplate: (template: string, templateFormat: TemplateFormat, inputValues: InputValues) => string;\nexport declare const parseTemplate: (template: string, templateFormat: TemplateFormat) => ParsedTemplateNode[];\nexport declare const checkValidTemplate: (template: MessageContent, templateFormat: TemplateFormat, inputVariables: string[]) => void;\nexport {};\n//# sourceMappingURL=template.d.ts.map"],"mappings":";;;;;;;;AAKYE,KAAAA,cAAAA,GAAc,UAAA,GAAA,UAAA;AAK1B;AAWA;AACA;AACA;AACqBK,KAdTJ,kBAAAA,GAc8E;EACrEK,IAAAA,EAAAA,SAAAA;EAMhBC,IAAAA,EAAAA,MAAAA;AAAqD,CAAA,GAKrDC;EACgBC,IAAAA,EAAAA,UAAAA;EAAkCT,IAAAA,EAAAA,MAAAA;CAAgBO;;AAAjB;AACtD;;AAAoEC,KAjBxDN,iBAAAA,GAAoBD,kBAiBoCO;AAAvBE,cAhBxBP,YAgBwBO,EAAAA,CAAAA,QAAAA,EAAAA,MAAAA,EAAAA,GAhBYT,kBAgBZS,EAAAA;AAAM,cAf9BN,aAe8B,EAAA,CAAA,QAAA,EAAA,MAAA,EAAA,GAfOH,kBAeP,EAAA;AAC9BW,cAfAP,kBAemDL,EAAAA,CAAAA,QAA6BD,EAAAA,MAAAA,EAAAA,MAAW,EAf5CA,WAe4C,EAAA,GAAA,MAAA;AAC3Fc,cAfAP,mBAekDN,EAAAA,CAAAA,QAAmBC,EAAAA,MAAAA,EAAAA,MAAkB,EAfvCF,WAeuC,EAAA,GAAA,MAAA;AAC5G;;;;;KAVKQ,YAAAA,8BAA0CR;;;;;KAK1CS,MAAAA,yBAA+BP;cACfQ,2BAA2BC,OAAOV,gBAAgBO;cAClDI,wBAAwBD,OAAOV,gBAAgBQ;cAC/CI,mDAAmDZ,6BAA6BD;cAChFc,kDAAkDb,mBAAmBC;cACrEa,+BAA+BhB,gCAAgCE"}