@langchain/core
Version:
Core LangChain.js abstractions and schemas
1 lines • 3.29 kB
Source Map (JSON)
{"version":3,"file":"template.d.cts","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":";;;;;;;AAKA;AAKYG,KALAD,cAAAA,GAKkB,UAAA,GAAA,UAAA;AAW9B;AACA;AACA;AACA;AACqBM,KAfTL,kBAAAA,GAe+E;EAMtFM,IAAAA,EAAAA,SAAY;EAKZC,IAAAA,EAAAA,MAAM;AACX,CAAA,GAAqBC;EAAkCT,IAAAA,EAAAA,UAAAA;EAAgBO,IAAAA,EAAAA,MAAAA;CAAvBG;AAAM;AACtD;;;AAA6CA,KAjBjCR,iBAAAA,GAAoBD,kBAiBaS;AAAM,cAhB9BP,YAgB8B,EAAA,CAAA,QAAA,EAAA,MAAA,EAAA,GAhBMF,kBAgBN,EAAA;AAC9BW,cAhBAR,aAgBmDJ,EAAAA,CAAAA,QAAAA,EAAAA,MAA6BD,EAAAA,GAhB3CE,kBAgBsD,EAAA;AAC3FY,cAhBAR,kBAgBkDL,EAAAA,CAAAA,QAAmBC,EAAAA,MAAAA,EAAAA,MAAAA,EAhBtBF,WAgBwC,EAAA,GAAA,MAAA;AACvFe,cAhBAR,mBAgB+BR,EAAAA,CAAAA,QAAAA,EAAAA,MAAgCE,EAAAA,MAAAA,EAhBfD,WAgB6B,EAAA,GAAA,MAAA;;;;;;KAV7FQ,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"}