TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Typedtemplate: Python Library for Typed String Templates Using Pydantic

1 点作者 Shakakai大约 1 年前

1 comment

Shakakai大约 1 年前
I&#x27;m in the process of releasing a few of my internal libraries for building LLM-based apps. The first release is `typedtemplate`, a library that allows you to use Pydantic syntax to describe the data required by a template to render.<p># What does it currently do?<p>- Documentation: Provides a class that you can easily generate documentation for. This means all your normal python documentation generators and tooling can provide useful docs for your templates that are easily consumable by your team.<p>- IDE&#x2F;Copilot Support: Pydantic classes provide an great developer experience in the IDE with helpful autocomplete and a structure that Copilot understands well.<p>- Validation: Runtime validation that the data conforms to the type definitions.<p># Why did I create this?<p>I&#x27;m working with LLMs everyday now. I have hundreds of LLM prompts (and countless variants) in my project. If you are like me, it doesn&#x27;t take long after creating a template to forget the shape of the data required to make it render properly. I&#x27;m lazy. This library lets me forget more things and lean on my tooling.<p># Notes<p>- Currently works with Jinja2 and Django templating engines. If you need a different engine, just ask (quick to implement).<p>- Was built to play nice with any framework.<p>- Next library coming is a Non-OpenAI interface to LLMs that feels good. Uses LiteLLM under the hood to support almost all available LLMs.