{"_id":"@anuran-roy/langtache","_rev":"5-06a68b646bc19bb52011149ee92dbccf","name":"@anuran-roy/langtache","dist-tags":{"fix1":"0.1.0-fix1","latest":"0.1.1-beta"},"versions":{"0.1.0":{"name":"@anuran-roy/langtache","version":"0.1.0","license":"MIT","_id":"@anuran-roy/langtache@0.1.0","maintainers":[{"name":"anuran-roy","email":"anuranroy02@gmail.com"}],"homepage":"https://github.com/anuran-roy/langtache#readme","bugs":{"url":"https://github.com/anuran-roy/langtache/issues"},"dist":{"shasum":"0ac88f3e0e14e3e5078d0d163c51501779a22fe0","tarball":"https://registry.npmjs.org/@anuran-roy/langtache/-/langtache-0.1.0.tgz","fileCount":7,"integrity":"sha512-eY/6hq6Huwz9v/Ne8jVzZn+kzvBYqNCQiJZ1z6BPaWmholt7L5MqRGMLgvkbnUrhIgLm6X4FijkJHo2hixIh2A==","signatures":[{"sig":"MEYCIQCZS5WVnoCAipw0un+rdGPnCFPN1Z4EgrZ17HO8ztC2dgIhAN7KuRFFvs0PeQuRjp07JLa/2LHFB30DEPy2ZfYM6+X8","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":161743},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"bun":">=1.0.0","node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"02d93b3c081acdb78e4423bf5e9dea6558ac98b9","scripts":{"test":"echo \"No test provided\"","build":"bunx tsc -p tsconfig.build.json && bunx tsup src/index.ts --dts --format esm,cjs --out-dir dist","clean":"rm -rf dist","prepublishOnly":"bun run clean && bun run build"},"_npmUser":{"name":"anuran-roy","email":"anuranroy02@gmail.com"},"repository":{"url":"git+https://github.com/anuran-roy/langtache.git","type":"git"},"_npmVersion":"11.5.1","description":"Mustache-driven chat prompt helpers","directories":{},"_nodeVersion":"24.7.0","dependencies":{"typescript":"^5.9.2","@types/mustache":"^4.2.6"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0"},"_npmOperationalInternal":{"tmp":"tmp/langtache_0.1.0_1758153761752_0.2548011525712899","host":"s3://npm-registry-packages-npm-production"}},"0.1.0-fix1":{"name":"@anuran-roy/langtache","version":"0.1.0-fix1","license":"MIT","_id":"@anuran-roy/langtache@0.1.0-fix1","maintainers":[{"name":"anuran-roy","email":"anuranroy02@gmail.com"}],"homepage":"https://github.com/anuran-roy/langtache#readme","bugs":{"url":"https://github.com/anuran-roy/langtache/issues"},"dist":{"shasum":"05227a69fa2f91342c39dc4dd1b311c6ce5d7ae0","tarball":"https://registry.npmjs.org/@anuran-roy/langtache/-/langtache-0.1.0-fix1.tgz","fileCount":7,"integrity":"sha512-a/4BeiPapMB1vsX3XJFN4Pw+Cvy2B88OHr1CCWjgtQM5Kg/nWl8s65US/uho2l9IsgIFceoOu7x/T2Lv24TAQw==","signatures":[{"sig":"MEUCIQDefopX4yP2H6pl2l+/eyu8fuvxZpnHiB3Dahh5dXjdDgIgQgTRq5ZNRNSMVcknkpfX9sOmeJ3gYFs2Sx2/aX5g5OY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":112082},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"bun":">=1.0.0","node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"38b3aac41fb2f09c2eeb3790d7fd5827834f5734","scripts":{"test":"echo \"No test provided\"","build":"bunx tsc -p tsconfig.build.json && bunx tsup src/index.ts --dts --format esm,cjs --out-dir dist","clean":"rm -rf dist","prepublishOnly":"bun run clean && bun run build"},"_npmUser":{"name":"anuran-roy","email":"anuranroy02@gmail.com"},"repository":{"url":"git+https://github.com/anuran-roy/langtache.git","type":"git"},"_npmVersion":"11.5.1","description":"Mustache-driven chat prompt helpers","directories":{},"_nodeVersion":"24.7.0","dependencies":{"mustache":"^4.2.0","typescript":"^5.9.2","partial-json":"^0.1.7","@types/mustache":"^4.2.6"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^8.5.0"},"_npmOperationalInternal":{"tmp":"tmp/langtache_0.1.0-fix1_1758182613494_0.47073817989082833","host":"s3://npm-registry-packages-npm-production"}},"0.1.0-patch":{"name":"@anuran-roy/langtache","version":"0.1.0-patch","license":"MIT","_id":"@anuran-roy/langtache@0.1.0-patch","maintainers":[{"name":"anuran-roy","email":"anuranroy02@gmail.com"}],"homepage":"https://github.com/anuran-roy/langtache#readme","bugs":{"url":"https://github.com/anuran-roy/langtache/issues"},"dist":{"shasum":"e658dc6fff94091b77a98cbe4171e4fa77f16ce6","tarball":"https://registry.npmjs.org/@anuran-roy/langtache/-/langtache-0.1.0-patch.tgz","fileCount":7,"integrity":"sha512-aMIzMRsxx6+R2KXSJ6i/0InvHF1Soa/8PAslEShab8pe7BCaP1b2nCTvsXpr8KiY9Uk1f7BfyyY2ZDOW4aPSvA==","signatures":[{"sig":"MEUCIQCSV1ZoNhk3gUc+wTeweF6fwyMNSENt11n5/MDR5g3NngIgYyPtGWTNT91nCOyvaXaQz9xk9/LMAxzRwGMJT5B5a0U=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":112083},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"bun":">=1.0.0","node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"05cbb3f6e3e90d192b484ba8971910c436c98c18","scripts":{"test":"echo \"No test provided\"","build":"bunx tsc -p tsconfig.build.json && bunx tsup src/index.ts --dts --format esm,cjs --out-dir dist","clean":"rm -rf dist","prepublishOnly":"bun run clean && bun run build"},"_npmUser":{"name":"anuran-roy","email":"anuranroy02@gmail.com"},"repository":{"url":"git+https://github.com/anuran-roy/langtache.git","type":"git"},"_npmVersion":"11.5.1","description":"Mustache-driven chat prompt helpers","directories":{},"_nodeVersion":"24.7.0","dependencies":{"mustache":"^4.2.0","typescript":"^5.9.2","partial-json":"^0.1.7","@types/mustache":"^4.2.6"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0"},"_npmOperationalInternal":{"tmp":"tmp/langtache_0.1.0-patch_1758183935086_0.11385072928626827","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@anuran-roy/langtache","version":"0.1.1","keywords":["langchain","genai","openai","llm","generative-ai","rag","mustache"],"license":"MIT","_id":"@anuran-roy/langtache@0.1.1","maintainers":[{"name":"anuran-roy","email":"anuranroy02@gmail.com"}],"homepage":"https://github.com/anuran-roy/langtache#readme","bugs":{"url":"https://github.com/anuran-roy/langtache/issues"},"dist":{"shasum":"218e563cb8c583b350788a908a7a690707bf9bb5","tarball":"https://registry.npmjs.org/@anuran-roy/langtache/-/langtache-0.1.1.tgz","fileCount":7,"integrity":"sha512-OJnXiwdnVWoIDb84Kl7He+NYFNyPUMNx3OSuuaRNbRmaGOjaOFS/9X31aPoXXplit3vJIq1zbl7wxqYIHl99pg==","signatures":[{"sig":"MEUCIQDBhxwuU+XJDAzv5iU7kM8LopLQtZbVFUxFAypFceDrAAIgCDBfUNdb9JIfzqDAP2eyG98r3rz1dKVgmeoApc025vU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":112200},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"bun":">=1.0.0","node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"5dbe3ebf72cc43a316e2cefad8869a76a0a35769","scripts":{"test":"echo \"No test provided\"","build":"bunx tsc -p tsconfig.build.json && bunx tsup src/index.ts --dts --format esm,cjs --out-dir dist","clean":"rm -rf dist","prepublishOnly":"bun run clean && bun run build"},"_npmUser":{"name":"anuran-roy","email":"anuranroy02@gmail.com"},"repository":{"url":"git+https://github.com/anuran-roy/langtache.git","type":"git"},"_npmVersion":"11.5.1","description":"Mustache-driven chat prompt helpers","directories":{},"_nodeVersion":"24.7.0","dependencies":{"mustache":"^4.2.0","typescript":"^5.9.2","partial-json":"^0.1.7","@types/mustache":"^4.2.6"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0"},"_npmOperationalInternal":{"tmp":"tmp/langtache_0.1.1_1758216066691_0.3887511847933849","host":"s3://npm-registry-packages-npm-production"}},"0.1.1-beta":{"name":"@anuran-roy/langtache","version":"0.1.1-beta","description":"Mustache-driven chat prompt helpers","keywords":["langchain","genai","openai","llm","generative-ai","rag","mustache"],"type":"module","main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.js","require":"./dist/index.cjs","types":"./dist/index.d.ts"}},"scripts":{"build":"bunx tsc -p tsconfig.build.json && bunx tsup src/index.ts --dts --format esm,cjs --out-dir dist","clean":"rm -rf dist","prepublishOnly":"bun run clean && bun run build","test":"echo \"No test provided\""},"engines":{"bun":">=1.0.0","node":">=18"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/anuran-roy/langtache.git"},"dependencies":{"@types/mustache":"^4.2.6","dotenv":"^17.2.3","mustache":"^4.2.0","openai":"^6.3.0","partial-json":"^0.1.7","typescript":"^5.9.2","zod":"^4.1.12","zod-to-json-schema":"^3.24.6"},"devDependencies":{"tsup":"^8.5.0"},"_id":"@anuran-roy/langtache@0.1.1-beta","gitHead":"6535a7f8d38f2ef289061b4c646040f9621e9acb","bugs":{"url":"https://github.com/anuran-roy/langtache/issues"},"homepage":"https://github.com/anuran-roy/langtache#readme","_nodeVersion":"24.7.0","_npmVersion":"11.5.1","dist":{"integrity":"sha512-+oJUMo+Rk/6txyBtYgxR9EriD3pnR6mnl8Xp7AsuQ9N/sO6pNOHzTMGNHDq0tKc7IK4OFtvJEkkDTGvyPAD13A==","shasum":"15c4f0e160cec41d6c935e7769b9134f503bd855","tarball":"https://registry.npmjs.org/@anuran-roy/langtache/-/langtache-0.1.1-beta.tgz","fileCount":7,"unpackedSize":24075,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC+yyz3edRp/oyVmMlHu3ZiscVTqD8hQ4GuMysr8/nFswIhANFuNsi+GK83U9ls8UfX1auAhoGouDIwrcc2tSnsKEc5"}]},"_npmUser":{"name":"anuran-roy","email":"anuranroy02@gmail.com"},"directories":{},"maintainers":[{"name":"anuran-roy","email":"anuranroy02@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/langtache_0.1.1-beta_1760228126580_0.8602038680960822"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-18T00:02:41.684Z","modified":"2025-10-12T00:15:26.975Z","0.1.0":"2025-09-18T00:02:41.945Z","0.1.0-fix1":"2025-09-18T08:03:33.689Z","0.1.0-patch":"2025-09-18T08:25:35.265Z","0.1.1":"2025-09-18T17:21:06.856Z","0.1.1-beta":"2025-10-12T00:15:26.792Z"},"bugs":{"url":"https://github.com/anuran-roy/langtache/issues"},"license":"MIT","homepage":"https://github.com/anuran-roy/langtache#readme","keywords":["langchain","genai","openai","llm","generative-ai","rag","mustache"],"repository":{"type":"git","url":"git+https://github.com/anuran-roy/langtache.git"},"description":"Mustache-driven chat prompt helpers","maintainers":[{"name":"anuran-roy","email":"anuranroy02@gmail.com"}],"readme":"# Langtache\n\n> NOTE: WIP, don't use in production yet.\n\nA quick way to offramp from LangChain.\n\nDrop in replacements for popular LangChain types, without the OOP hell.\n\n## Why this?\n\nWell, LangChain is...not frankly what I would like to use anymore, something that I never thought I would do when I first tried it out in early 2023.\n\nTurns out, many other are facing the same situation, so I just decided to put up this small package.\n\nAlso, from most use cases that I have seen (as per my limited knowledge), they involve just plain templating that could've been done with a templating language already. This project is a step in that direction, to reduce the OOP madness.\n\n## Examples\n### Example 1: Simple \"Hello, world!\" implementation\n\n```typescript helloLangtache.ts\nimport { OpenAI } from 'openai';\nimport { ChatPromptTemplate, getStructuredOutput } from '../src';\n\nconst chatClient = new OpenAI();\nconst chatPrompt = new ChatPromptTemplate({\n  template: `Hello there, my name is {{name}}`,\n  inputVariables: [\"name\"],\n  templateFormat: 'mustache' // Currently only mustache is supported\n})\n\nconst chatPromptChain = chatPrompt.pipe(chatClient);\n\nconst chatPromptResult = await chatPromptChain.invoke(\n  'gpt-5-nano', // Invoke model during runtime - enables easy handoffs and orchestration in multi-agent systems.\n  {\n    \"name\": \"Anuran\"\n  });\n\nconsole.log(chatPromptResult.choices[0]?.message?.content?.toString() ?? 'No response content')\n```\n\n## Example 2: Structured output\n```typescript structuredOutputLangtache.ts\nimport { OpenAI } from 'openai';\nimport z from 'zod';\nimport { ChatPromptTemplate, getStructuredOutput } from '../src';\n\nconst chatClient = new OpenAI();\nconst chatPromptStructuredOutput = new ChatPromptTemplate({\n  template: `Given the user's Linkedin bio, return their name, role and company name in a JSON format. The data is:\n  \\`\\`\\`\n  {{bio}}\n  \\`\\`\\``,\n  inputVariables: [\"bio\"],\n  templateFormat: 'mustache' // Currently only mustache is supported\n});\n\nconst structuredOutputSchema = z.object({\n  \"name\": z.string(),\n  \"company\": z.string(),\n  \"role\": z.string()\n});\n\nconst structuredOutputGenerator = getStructuredOutput(structuredOutputSchema);\nconst input = {\n  \"bio\": \"Hey there, I am Anuran. I am the co-founder and CTO at Alchemyst AI.\"\n}\n\nconst chatPromptStructedOutput = chatPromptStructuredOutput.format(input);\n\nconst finalPrompt = structuredOutputGenerator(chatPromptStructedOutput);\n\nconst chatPromptStructuredOutputResult = await chatClient.chat.completions.create({\n  messages: [\n    {\n      \"content\": finalPrompt,\n      role: \"user\"\n    }\n  ],\n  model: \"gpt-5-nano\"\n})\n\nconst receivedResponse = chatPromptStructuredOutputResult.choices[0]?.message?.content?.toString() ?? 'No response content'\nconsole.log(receivedResponse)\n\n// Now validate it\n\nconst validatedOutput = getValidatedOutput(structuredOutputSchema, receivedResponse)\n\nif (validatedOutput.error) { // Escape hatch in case of error\n  console.error(validatedOutput.error)\n} else if (validatedOutput.data) { // If LLM response is good.\n  console.info(validatedOutput.data) // Ensures that the output type is always of type z.infer<typeof structuredOutputSchema>;\n}\n```","readmeFilename":"README.md"}