展示HN:JSON-Healer:修复和验证来自大型语言模型输出的损坏JSON
构建了json-healer,这是一个小型的npm包,用于修复由大型语言模型(LLMs)生成的格式错误或不完整的JSON。<p>受到OpenRouter最近推出的响应修复工具的启发(<a href="https://openrouter.ai/docs/guides/features/plugins/response-healing" rel="nofollow">https://openrouter.ai/docs/guides/features/plugins/response-...</a>),该实现与模型无关,可以处理来自任何LLM或文本源的JSON,而不仅限于OpenRouter。<p>包含全面的测试用例,设计上易于集成到依赖结构化LLM输出的现有工作流程中。<p><a href="https://www.npmjs.com/package/@freakynit/json-healer" rel="nofollow">https://www.npmjs.com/package/@freakynit/json-healer</a><p>欢迎反馈!
查看原文
Built json-healer, a small npm package that repairs malformed or partial JSON produced by LLMs.<p>Inspired by OpenRouter’s recently launched response healer (<a href="https://openrouter.ai/docs/guides/features/plugins/response-healing" rel="nofollow">https://openrouter.ai/docs/guides/features/plugins/response-...</a>), this implementation is model-agnostic and works with JSON from any LLM or text source, not just OpenRouter.<p>Includes comprehensive test cases and is designed to be easy to drop into existing pipelines that rely on structured LLM output.<p><a href="https://www.npmjs.com/package/@freakynit/json-healer" rel="nofollow">https://www.npmjs.com/package/@freakynit/json-healer</a><p>Feedback welcome!