Finally released @synstack/synscript v2 with the #llm package migrated to @vercel.com's AI SDK 🎉 The Llm library is now a chainable, immutable, and type-safe wrapper over the ai sdk If you want to improve your prompting DevX in Typescript, look no further github.com/pAIrprogio/...
Post
For v1, I wrote my own abstraction layer While I love the chainable + immutable + string-templates + type-safety combo, writing my own adapters was too time consuming So after using @mattpocock.com Evalite, I decided to keep my approach but switch the engine to Vercel's sdk as a peer dependency
0 reposts0 likes
1️⃣ Immutability + Chaining I've always been a fan of superagent's clean immutable and chainable API allowing me to build upon a base instance of query github.com/ladjs/super... This was my target to replicate, but for LLMs and most of my libraries published under @synstack operate that way
2️⃣ Type safety There's type safety at every level: 🔶 Tool definitions, filters, & outputs 🔶 Calling the llm with missing required parameters will trigger a TS error 🔶 Message template string values are type-safe as well Even my test coverage is mostly type testing for now github.com/pAIrprogio/...
3️⃣ Template strings I hate the base JS template string because it breaks indentation So I wrote a separate library to fix that. 🔶 Trims text and removes extra indentation 🔶 Auto-resolves promises 🔶 Arrays to separate lines 🔶 Propagates nested indentation github.com/pAIrprogio/...