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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Show HN: Instruct LLMs to do what you want in Ruby

4 点作者 mackross5 个月前
I’ve been working on this gem part-time for a few months now. The API is not yet fully stable so I wouldn’t recommend for anything other than experimenting. Nevertheless, my company is using it in production (as of today :)), so it seemed like a nice time to share.<p>So why did I write yet another LLM prompting library?<p>I found the existing Ruby ones either too abstract — hiding the LLM’s capabilities behind unseen prompts, too low-level — leaving my classes hard to follow and littered with boilerplate managing prompts and responses, or they used class level abstractions — forcing me to create classes when I didn’t want to.<p>After reading an early version of Patterns of Application Development Using AI by Obie Fernandez and using Obie’s library raix, I felt inspired. The book has many great patterns, and raix’s transcript management and tool management were the first I’d used that felt ruby-ish. At the same time libraries in the python community such as guidance, DSPy, LangSmith, and TEXTGRAD had caught my eye. I also liked what the cross-platform BAML was doing too. I didn’t love the code generation and freemium aspects.<p>So, with motivation high, I set out to build an opinionated library of gems that improves my Ruby (and Rails) LLM developer experience.<p>The first gem (this one) is instruct. It is the flexible foundation that the other gems will build on. While the API is similar to guidance, it has a different architecture based around attributed strings and middleware which enables some unique features (like async guard rails, content filters, self-healing, auto-continuation, and native multi-modal support).<p>I’m currently working on a hopefully elegant API that makes requesting and handling streaming structured output easy (taking inspiration from BAML, but with automatic upgrades to json schema if the API supports it). Along with that, I’ve been working on a conversational memory middleware that automatically prunes historic irrelevant bits of the conversation transcript. I hope this keeps the model more steerable, but without loss of crucial details.<p>Thanks in advance for taking a look and providing any constructive feedback or ideas. Lastly, if you’re interested in contributing, please message me.

暂无评论

暂无评论