@langchain/core
Version:
Core LangChain.js abstractions and schemas
1 lines • 1.63 kB
Source Map (JSON)
{"version":3,"file":"context.d.cts","names":["context","TemplateStringsArray"],"sources":["../../src/utils/context.d.ts"],"sourcesContent":["/**\n * A tagged template function for creating formatted strings.\n *\n * This utility provides a clean, template literal-based API for string formatting\n * that can be used for prompts, descriptions, and other text formatting needs.\n *\n * It automatically handles whitespace normalization and indentation, making it\n * ideal for multi-line strings in code.\n *\n * When using this utility, it will:\n * - Strip common leading indentation from all lines\n * - Trim leading/trailing whitespace\n * - Align multi-line interpolated values to match indentation\n * - Support escape sequences: `\\\\n` (newline), `\\\\`` (backtick), `\\\\$` (dollar), `\\\\{` (brace)\n *\n * @example\n * ```typescript\n * import { context } from \"@langchain/core/utils/context\";\n *\n * const role = \"agent\";\n * const prompt = context`\n * You are an ${role}.\n * Your task is to help users.\n * `;\n * // Returns: \"You are an agent.\\nYour task is to help users.\"\n * ```\n *\n * @example\n * ```typescript\n * // Multi-line interpolated values are aligned\n * const items = \"- Item 1\\n- Item 2\\n- Item 3\";\n * const message = context`\n * Shopping list:\n * ${items}\n * End of list.\n * `;\n * // The items will be indented to match \" \" (4 spaces)\n * ```\n */\nexport declare function context(strings: TemplateStringsArray, ...values: unknown[]): string;\n//# sourceMappingURL=context.d.ts.map"],"mappings":";;AAuCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAwBA,OAAAA,UAAiBC"}