<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
>
<channel>
<title><![CDATA[OneTwoOne]]></title> 
<atom:link href="https://cn121.com/rss.php" rel="self" type="application/rss+xml" />
<description><![CDATA[开源项目资料库 · 中文整理 - OneTwoOne]]></description>
<link>https://cn121.com/</link>
<language>zh-cn</language>

<item>
    <title>llm-cookbook - 面向开发者的 LLM 入门教程</title>
    <link>https://cn121.com/llm/datawhalechina-llm-cookbook.html</link>
    <description><![CDATA[<h1>面向开发者的大模型手册 - LLM Cookbook</h1>
<h2>项目简介</h2>
<p>本项目是一个面向开发者的大模型手册，针对国内开发者的实际需求，主打 LLM 全方位入门实践。本项目基于吴恩达老师大模型系列课程内容，对原课程内容进行筛选、翻译、复现和调优，覆盖从 Prompt Engineering 到 RAG 开发、模型微调的全部流程，用最适合国内学习者的方式，指导国内开发者如何学习、入门 LLM 相关项目。</p>
<p>针对不同内容的特点，我们对共计 11 门吴恩达老师的大模型课程进行了翻译复现，并结合国内学习者的实际情况，对不同课程进行了分级和排序，初学者可以先系统学习我们的必修类课程，掌握入门 LLM 所有方向都需要掌握的基础技能和概念，再选择性地学习我们的选修类课程，在自己感兴趣的方向上不断探索和学习。</p>
<p>如果有你非常喜欢但我们还没有进行复现的吴恩达老师大模型课程，我们欢迎每一位开发者参考我们已有课程的格式和写法来对课程进行复现并提交 PR，在 PR 审核通过后，我们会根据课程内容将课程进行分级合并。欢迎每一位开发者的贡献！</p>
<p><strong>在线阅读地址：<a href="https://datawhalechina.github.io/llm-cookbook/">面向开发者的 LLM 入门课程 - 在线阅读</a></strong></p>
<p><strong>PDF 下载地址：<a href="https://github.com/datawhalechina/llm-cookbook/releases/tag/v1%2C0%2C0">面向开发者的 LLM 入门教程 - PDF</a></strong></p>
<p><strong>英文原版地址：<a href="https://learn.deeplearning.ai">吴恩达关于大模型的系列课程</a></strong></p>
<h2>项目意义</h2>
<p>LLM 正在逐步改变人们的生活，而对于开发者，如何基于 LLM 提供的 API 快速、便捷地开发一些具备更强能力、集成 LLM 的应用，来便捷地实现一些更新颖、更实用的能力，是一个急需学习的重要能力。</p>
<p>由吴恩达老师与 OpenAI 合作推出的大模型系列教程，从大模型时代开发者的基础技能出发，深入浅出地介绍了如何基于大模型 API、LangChain 架构快速开发结合大模型强大能力的应用。其中，《Prompt Engineering for Developers》教程面向入门 LLM 的开发者，深入浅出地介绍了对于开发者，如何构造 Prompt 并基于 OpenAI 提供的 API 实现包括总结、推断、转换等多种常用功能，是入门 LLM 开发的经典教程；《Building Systems with the ChatGPT API》教程面向想要基于 LLM 开发应用程序的开发者，简洁有效而又系统全面地介绍了如何基于 ChatGPT API 打造完整的对话系统；《LangChain for LLM Application Development》教程结合经典大模型开源框架 LangChain，介绍了如何基于 LangChain 框架开发具备实用功能、能力全面的应用程序，《LangChain Chat With Your Data》教程则在此基础上进一步介绍了如何使用 LangChain 架构结合个人私有数据开发个性化大模型应用；《Building Generative AI Applications with Gradio》、《Evaluating and Debugging Generative AI》教程分别介绍了两个实用工具 Gradio 与 W&amp;B，指导开发者如何结合这两个工具来打造、评估生成式 AI 应用。</p>
<p>上述教程非常适用于开发者学习以开启基于 LLM 实际搭建应用程序之路。因此，我们将该系列课程翻译为中文，并复现其范例代码，也为其中一个视频增加了中文字幕，支持国内中文学习者直接使用，以帮助中文学习者更好地学习 LLM 开发；我们也同时实现了效果大致相当的中文 Prompt，支持学习者感受中文语境下 LLM 的学习使用，对比掌握多语言语境下的 Prompt 设计与 LLM 开发。未来，我们也将加入更多 Prompt 高级技巧，以丰富本课程内容，帮助开发者掌握更多、更巧妙的 Prompt 技能。</p>
<h2>项目受众</h2>
<p>所有具备基础 Python 能力，想要入门 LLM 的开发者。</p>
<h2>项目亮点</h2>
<p>《ChatGPT Prompt Engineering for Developers》、《Building Systems with the ChatGPT API》等教程作为由吴恩达老师与 OpenAI 联合推出的官方教程，在可预见的未来会成为 LLM 的重要入门教程，但是目前还只支持英文版且国内访问受限，打造中文版且国内流畅访问的教程具有重要意义；同时，GPT 对中文、英文具有不同的理解能力，本教程在多次对比、实验之后确定了效果大致相当的中文 Prompt，支持学习者研究如何提升 ChatGPT 在中文语境下的理解与生成能力。</p>
<h2>学习指南</h2>
<p>本教程适用于所有具备基础 Python 能力，想要入门 LLM 的开发者。</p>
<p>如果你想要开始学习本教程，你需要提前具备：</p>
<ol>
<li>至少一个 LLM API（最好是 OpenAI，如果是其他 API，你可能需要参考 <a href="https://github.com/datawhalechina/llm-universe">其他教程</a> 对 API 调用代码进行修改）</li>
<li>能够使用 Python Jupyter Notebook </li>
</ol>
<p>本教程共包括 11 门课程，分为必修类、选修类两个类别。必修类课程是我们认为最适合初学者学习以入门 LLM 的课程，包括了入门 LLM 所有方向都需要掌握的基础技能和概念，我们也针对必修类课程制作了适合阅读的在线阅读和 PDF 版本，在学习必修类课程时，我们建议学习者按照我们列出的顺序进行学习；选修类课程是在必修类课程上的拓展延伸，包括了 RAG 开发、模型微调、模型评估等多个方面，适合学习者在掌握了必修类课程之后选择自己感兴趣的方向和课程进行学习。</p>
<p>必修类课程包括：</p>
<ol>
<li>面向开发者的 Prompt Engineering。基于吴恩达老师《ChatGPT Prompt Engineering for Developers》课程打造，面向入门 LLM 的开发者，深入浅出地介绍了对于开发者，如何构造 Prompt 并基于 OpenAI 提供的 API 实现包括总结、推断、转换等多种常用功能，是入门 LLM 开发的第一步。</li>
<li>搭建基于 ChatGPT 的问答系统。基于吴恩达老师《Building Systems with the ChatGPT API》课程打造，指导开发者如何基于 ChatGPT 提供的 API 开发一个完整的、全面的智能问答系统。通过代码实践，实现了基于 ChatGPT 开发问答系统的全流程，介绍了基于大模型开发的新范式，是大模型开发的实践基础。</li>
<li>使用 LangChain 开发应用程序。基于吴恩达老师《LangChain for LLM Application Development》课程打造，对 LangChain 展开深入介绍，帮助学习者了解如何使用 LangChain，并基于 LangChain 开发完整的、具备强大能力的应用程序。</li>
<li>使用 LangChain 访问个人数据。基于吴恩达老师《LangChain Chat with Your Data》课程打造，深入拓展 LangChain 提供的个人数据访问能力，指导开发者如何使用 LangChain 开发能够访问用户个人数据、提供个性化服务的大模型应用。</li>
</ol>
<p>选修类课程包括：</p>
<ol>
<li>使用 Gradio 搭建生成式 AI 应用。基于吴恩达老师《Building Generative AI Applications with Gradio》课程打造，指导开发者如何使用 Gradio 通过 Python 接口程序快速、高效地为生成式 AI 构建用户界面。</li>
<li>评估改进生成式 AI。基于吴恩达老师《Evaluating and Debugging Generative AI》课程打造，结合 wandb，提供一套系统化的方法和工具，帮助开发者有效地跟踪和调试生成式 AI 模型。</li>
<li>微调大语言模型。基于吴恩达老师《Finetuning Large Language Model》课程打造，结合 lamini 框架，讲述如何便捷高效地在本地基于个人数据微调开源大语言模型。</li>
<li>大模型与语义检索。基于吴恩达老师《Large Language Models with Semantic Search》课程打造，针对检索增强生成，讲述了多种高级检索技巧以实现更准确、高效的检索增强 LLM 生成效果。</li>
<li>基于 Chroma 的高级检索。基于吴恩达老师《Advanced Retrieval for AI with Chroma》课程打造，旨在介绍基于 Chroma 的高级检索技术，提升检索结果的准确性。</li>
<li>搭建和评估高级 RAG 应用。基于吴恩达老师《Building and Evaluating Advanced RAG Applications》课程打造，介绍构建和实现高质量 RAG 系统所需的关键技术和评估框架。</li>
<li>LangChain 的 Functions、Tools 和 Agents。基于吴恩达老师《Functions, Tools and Agents with LangChain》课程打造，介绍如何基于 LangChain 的新语法构建 Agent。</li>
<li>Prompt 高级技巧。包括 CoT、自我一致性等多种 Prompt 高级技巧的基础理论与代码实现。</li>
</ol>
<p>其他资料包括：</p>
<p><strong>双语字幕视频地址：<a href="https://www.bilibili.com/video/BV1Bo4y1A7FU/?share_source=copy_web">吴恩达 x OpenAI 的 Prompt Engineering 课程专业翻译版</a></strong></p>
<p><strong>中英双语字幕下载：<a href="https://github.com/GitHubDaily/ChatGPT-Prompt-Engineering-for-Developers-in-Chinese">《ChatGPT 提示工程》非官方版中英双语字幕</a></strong></p>
<p><strong>视频讲解：<a href="https://www.bilibili.com/video/BV1PN4y1k7y2/?spm_id_from=333.999.0.0">面向开发者的 Prompt Engineering 讲解（数字游民大会）</a></strong></p>
<p>目录结构说明：</p>
<pre><code>content：基于原课程复现的双语版代码，可运行的 Notebook，更新频率最高，更新速度最快。

docs：必修类课程文字教程版在线阅读源码，适合阅读的 Markdown。

figures：图片文件。</code></pre>
<h2>致谢</h2>
<p><strong>核心贡献者</strong></p>
<ul>
<li><a href="https://github.com/logan-zou">邹雨衡-项目负责人</a>（Datawhale成员-对外经济贸易大学研究生）</li>
<li><a href="https://github.com/LinChentang">左春生-项目负责人</a>（内容创作者-Datawhale成员）</li>
<li><a href="https://yam.gift/">长琴-项目发起人</a>（内容创作者-Datawhale成员-AI算法工程师）</li>
<li><a href="https://github.com/Sophia-Huang">玉琳-项目发起人</a>（内容创作者-Datawhale成员）</li>
<li><a href="https://github.com/xuhu0115">徐虎-教程编撰者</a>（内容创作者-Datawhale成员）</li>
<li><a href="https://github.com/Weihong-Liu">刘伟鸿-教程编撰者</a>（内容创作者-江南大学非全研究生）</li>
<li><a href="https://Joyenjoye.com">Joye-教程编撰者</a>（内容创作者-数据科学家）</li>
<li><a href="https://github.com/0-yy-0">高立业</a>（内容创作者-DataWhale成员-算法工程师）</li>
<li><a href="https://github.com/GKDGKD">邓宇文</a>（内容创作者-Datawhale成员）</li>
<li><a href="https://github.com/wisdom-pan">魂兮</a>（内容创作者-前端工程师）</li>
<li><a href="https://github.com/KMnO4-zx">宋志学</a>（内容创作者-Datawhale成员）</li>
<li><a href="https://github.com/YikunHan42">韩颐堃</a>（内容创作者-Datawhale成员）</li>
<li><a href="https://github.com/6forwater29">陈逸涵</a> (内容创作者-Datawhale意向成员-AI爱好者)</li>
<li><a href="https://github.com/ztgg0228">仲泰</a>（内容创作者-Datawhale成员）</li>
<li><a href="https://github.com/leason-wan">万礼行</a>（内容创作者-视频翻译者）</li>
<li><a href="https://github.com/Bald0Wang">王熠明</a>（内容创作者-Datawhale成员）</li>
<li><a href="https://yetingyun.blog.csdn.net">曾浩龙</a>（内容创作者-Datawhale 意向成员-JLU AI 研究生）</li>
<li><a href="https://github.com/xinqi-fan">小饭同学</a>（内容创作者）</li>
<li><a href="https://github.com/sunhanyu714">孙韩玉</a>（内容创作者-算法量化部署工程师）</li>
<li><a href="https://github.com/YinHan-Zhang">张银晗</a>（内容创作者-Datawhale成员）</li>
<li><a href="https://github.com/Jin-Zhang-Yaoguang">张晋</a>（内容创作者-Datawhale成员）</li>
<li><a href="https://github.com/Aphasia0515">李娇娇</a>（内容创作者-Datawhale成员）</li>
<li><a href="https://github.com/Kedreamix">邓恺俊</a>（内容创作者-Datawhale成员）</li>
<li><a href="https://github.com/Zhiyuan-Fan">范致远</a>（内容创作者-Datawhale成员）</li>
<li><a href="https://github.com/Beyondzjl">周景林</a>（内容创作者-Datawhale成员）</li>
<li><a href="https://github.com/very-very-very">诸世纪</a>（内容创作者-算法工程师）</li>
<li><a href="https://github.com/YixinZ-NUS">Zhang Yixin</a>（内容创作者-IT爱好者）</li>
<li>Sarai（内容创作者-AI应用爱好者）</li>
</ul>
<p><strong>其他</strong></p>
<ol>
<li>特别感谢 <a href="https://github.com/Sm1les">@Sm1les</a>、<a href="https://github.com/LSGOMYP">@LSGOMYP</a> 对本项目的帮助与支持；</li>
<li>感谢 <a href="https://github.com/GitHubDaily">GithubDaily</a> 提供的双语字幕；</li>
<li>如果有任何想法可以联系我们 Datawhale 也欢迎大家多多提出 Issues；</li>
<li>特别感谢以下为教程做出贡献的同学！</li>
</ol>
<p><a href="https://datawhalechina.github.io/llm-cookbook/graphs/contributors">  </a></p>
<p>Made with <a href="https://contrib.rocks">contrib.rocks</a>.</p>
<h2>Star History</h2>
<p><a href="https://star-history.com/#datawhalechina/llm-cookbook&amp;Date"></a></p>
<h2>关注我们</h2>
<div align=center>
<p>扫描下方二维码关注公众号：Datawhale</p>

</div>
<p>Datawhale 是一个专注于数据科学与 AI 领域的开源组织，汇集了众多领域院校和知名企业的优秀学习者，聚合了一群有开源精神和探索精神的团队成员。微信搜索公众号 Datawhale 可以加入我们。</p>
<h2>LICENSE</h2>
<p><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"></a><br />本作品采用<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">知识共享署名 - 非商业性使用 - 相同方式共享 4.0 国际许可协议</a>进行许可。</p>]]></description>
    <pubDate>Tue, 15 Sep 2026 17:20:23 +0800</pubDate>
    <dc:creator>OTO</dc:creator>
    <guid>https://cn121.com/llm/datawhalechina-llm-cookbook.html</guid>
</item>
<item>
    <title>letta - 有状态代理的平台：具有高级内存的人工智能</title>
    <link>https://cn121.com/llm/letta-ai-letta.html</link>
    <description><![CDATA[<h1>Letta</h1>
<p>Build stateful agents with memory that can learn and improve over time.</p>
<p>Letta (f.k.a. MemGPT) is actively developed. The current source code lives in <a href="https://github.com/letta-ai/letta-code"><code>letta-ai/letta-code</code></a>, which includes the agent harness, interactive terminal UI, App Server, channels, and the runtime used by the desktop and web apps.</p>
<h2>Get started</h2>
<p>Install Letta from npm:</p>
<pre><code class="language-bash">npm install -g @letta-ai/letta-code</code></pre>
<p>Launch the interactive terminal UI:</p>
<pre><code class="language-bash">letta</code></pre>
<p>Run the App Server for local or self-hosted agents:</p>
<pre><code class="language-bash">letta server</code></pre>
<p>You can also use Letta through:</p>
<ul>
<li>the <a href="https://docs.letta.com/letta-code/desktop-app">desktop app</a> for macOS, Windows, and Linux</li>
<li><a href="https://chat.letta.com">chat.letta.com</a> in your browser, including on mobile</li>
<li><a href="https://docs.letta.com/letta-code/channels">Slack, Telegram, Discord, and custom channels</a></li>
<li>the <a href="https://docs.letta.com/letta-agent-sdk/overview">Letta Agent SDK</a> for building agents into TypeScript applications</li>
<li><a href="https://github.com/letta-ai/letta-code#letta-cloud">Letta Cloud</a> for keeping agent memory, identity, and conversations available across computers</li>
</ul>
<p>See the <a href="https://docs.letta.com">Letta documentation</a> for current installation, development, and deployment instructions.</p>
<h2>Historical source</h2>
<p>The <a href="https://github.com/letta-ai/letta/tree/archive"><code>archive</code></a> branch contains the retired Letta V1 API server. Existing tags and releases remain available for reproducibility, but active projects should use the <a href="https://github.com/letta-ai/letta-code">current source</a>.</p>]]></description>
    <pubDate>Tue, 15 Sep 2026 17:20:17 +0800</pubDate>
    <dc:creator>OTO</dc:creator>
    <guid>https://cn121.com/llm/letta-ai-letta.html</guid>
</item>
<item>
    <title>llm-action - 本项目旨在分享大模型相关技术原理以及实战经验（大模型</title>
    <link>https://cn121.com/llm/liguodongiot-llm-action.html</link>
    <description><![CDATA[<p align="center">

</p>
<p> 
<a href="https://github.com/liguodongiot/llm-action/stargazers">  </a> <a href="https://github.com/liguodongiot/llm-action/blob/main/pic/wx.jpg">  </a> <a href="https://www.zhihu.com/people/liguodong-iot">  </a> <a href="https://juejin.cn/user/3642056016410728">  </a> <a href="https://liguodong.blog.csdn.net/">  </a> <a href="https://www.lab4ai.cn/register?agentID=user-PqCML6LJZO">  </a>
</p> 
<h2>LLM训练</h2>
<h3>LLM训练实战</h3>
<p>下面汇总了我在大模型实践中训练相关的所有教程。从6B到65B，从全量微调到高效微调（LoRA，QLoRA，P-Tuning v2），再到RLHF（基于人工反馈的强化学习）。</p>
<table>
<thead>
<tr>
<th>LLM</th>
<th>预训练/SFT/RLHF...</th>
<th>参数</th>
<th>教程</th>
<th>代码</th>
</tr>
</thead>
<tbody>
<tr>
<td>Alpaca</td>
<td>full fine-turning</td>
<td>7B</td>
<td><a href="https://zhuanlan.zhihu.com/p/618321077">从0到1复现斯坦福羊驼（Stanford Alpaca 7B）</a></td>
<td><a href="https://github.com/liguodongiot/llm-action/tree/main/llm-train/alpaca">配套代码</a></td>
</tr>
<tr>
<td>Alpaca(LLaMA)</td>
<td>LoRA</td>
<td>7B~65B</td>
<td>1.<a href="https://zhuanlan.zhihu.com/p/619426866">足够惊艳，使用Alpaca-Lora基于LLaMA(7B)二十分钟完成微调，效果比肩斯坦福羊驼</a><br>2. <a href="https://zhuanlan.zhihu.com/p/632492604">使用 LoRA 技术对 LLaMA 65B 大模型进行微调及推理</a></td>
<td><a href="https://github.com/liguodongiot/llm-action/tree/main/llm-train/alpaca-lora">配套代码</a></td>
</tr>
<tr>
<td>BELLE(LLaMA/Bloom)</td>
<td>full fine-turning</td>
<td>7B</td>
<td>1.<a href="https://zhuanlan.zhihu.com/p/618876472">基于LLaMA-7B/Bloomz-7B1-mt复现开源中文对话大模型BELLE及GPTQ量化</a> <br> 2. <a href="https://zhuanlan.zhihu.com/p/621128368">BELLE(LLaMA-7B/Bloomz-7B1-mt)大模型使用GPTQ量化后推理性能测试</a></td>
<td>N/A</td>
</tr>
<tr>
<td>ChatGLM</td>
<td>LoRA</td>
<td>6B</td>
<td><a href="https://zhuanlan.zhihu.com/p/621793987">从0到1基于ChatGLM-6B使用LoRA进行参数高效微调</a></td>
<td><a href="https://github.com/liguodongiot/llm-action/tree/main/llm-train/chatglm-lora">配套代码</a></td>
</tr>
<tr>
<td>ChatGLM</td>
<td>full fine-turning/P-Tuning v2</td>
<td>6B</td>
<td><a href="https://zhuanlan.zhihu.com/p/622351059">使用DeepSpeed/P-Tuning v2对ChatGLM-6B进行微调</a></td>
<td><a href="https://github.com/liguodongiot/llm-action/tree/main/llm-train/chatglm">配套代码</a></td>
</tr>
<tr>
<td>Vicuna(LLaMA)</td>
<td>full fine-turning</td>
<td>7B</td>
<td><a href="https://zhuanlan.zhihu.com/p/624012908">大模型也内卷，Vicuna训练及推理指南，效果碾压斯坦福羊驼</a></td>
<td>N/A</td>
</tr>
<tr>
<td>OPT</td>
<td>RLHF</td>
<td>0.1B~66B</td>
<td>1.<a href="https://zhuanlan.zhihu.com/p/626159553">一键式 RLHF 训练 DeepSpeed Chat（一）：理论篇</a> <br> 2. <a href="https://zhuanlan.zhihu.com/p/626214655">一键式 RLHF 训练 DeepSpeed Chat（二）：实践篇</a></td>
<td><a href="https://github.com/liguodongiot/llm-action/tree/main/llm-train/deepspeedchat">配套代码</a></td>
</tr>
<tr>
<td>MiniGPT-4(LLaMA)</td>
<td>full fine-turning</td>
<td>7B</td>
<td><a href="https://zhuanlan.zhihu.com/p/627671257">大杀器，多模态大模型MiniGPT-4入坑指南</a></td>
<td>N/A</td>
</tr>
<tr>
<td>Chinese-LLaMA-Alpaca(LLaMA)</td>
<td>LoRA（预训练+微调）</td>
<td>7B</td>
<td><a href="https://zhuanlan.zhihu.com/p/631360711">中文LLaMA&amp;Alpaca大语言模型词表扩充+预训练+指令精调</a></td>
<td><a href="https://github.com/liguodongiot/llm-action/tree/main/llm-train/chinese-llama-alpaca">配套代码</a></td>
</tr>
<tr>
<td>LLaMA</td>
<td>QLoRA</td>
<td>7B/65B</td>
<td><a href="https://zhuanlan.zhihu.com/p/636644164">高效微调技术QLoRA实战，基于LLaMA-65B微调仅需48G显存，真香</a></td>
<td><a href="https://github.com/liguodongiot/llm-action/tree/main/llm-train/qlora">配套代码</a></td>
</tr>
<tr>
<td>LLaMA</td>
<td>GaLore</td>
<td>60M/7B</td>
<td><a href="https://zhuanlan.zhihu.com/p/686686751">突破内存瓶颈，使用 GaLore 一张4090消费级显卡也能预训练LLaMA-7B</a></td>
<td><a href="https://github.com/liguodongiot/llm-action/blob/main/llm-train/galore/torchrun_main.py">配套代码</a></td>
</tr>
</tbody>
</table>
<p><strong><a href="#目录">⬆ 一键返回目录</a></strong></p>
<h3>LLM微调技术原理</h3>
<p>对于普通大众来说，进行大模型的预训练或者全量微调遥不可及。由此，催生了各种参数高效微调技术，让科研人员或者普通开发者有机会尝试微调大模型。</p>
<p>因此，该技术值得我们进行深入分析其背后的机理，本系列大体分七篇文章进行讲解。</p>
<ul>
<li><a href="https://zhuanlan.zhihu.com/p/635152813">大模型参数高效微调技术原理综述（一）-背景、参数高效微调简介</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/635686756">大模型参数高效微调技术原理综述（二）-BitFit、Prefix Tuning、Prompt Tuning</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/635848732">大模型参数高效微调技术原理综述（三）-P-Tuning、P-Tuning v2</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/636038478">大模型参数高效微调技术原理综述（四）-Adapter Tuning及其变体</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/636215898">大模型参数高效微调技术原理综述（五）-LoRA、AdaLoRA、QLoRA</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/636362246">大模型参数高效微调技术原理综述（六）-MAM Adapter、UniPELT</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/649755252">大模型参数高效微调技术原理综述（七）-最佳实践、总结</a></li>
</ul>
<h3>LLM微调实战</h3>
<p>下面给大家分享<strong>大模型参数高效微调技术实战</strong>，该系列主要针对 HuggingFace PEFT 框架支持的一些高效微调技术进行讲解。</p>
<table>
<thead>
<tr>
<th>教程</th>
<th>代码</th>
<th>框架</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="https://zhuanlan.zhihu.com/p/651744834">大模型参数高效微调技术实战（一）-PEFT概述及环境搭建</a></td>
<td>N/A</td>
<td>HuggingFace PEFT</td>
</tr>
<tr>
<td><a href="https://zhuanlan.zhihu.com/p/646748939">大模型参数高效微调技术实战（二）-Prompt Tuning</a></td>
<td><a href="https://github.com/liguodongiot/llm-action/blob/main/llm-train/peft/clm/peft_prompt_tuning_clm.ipynb">配套代码</a></td>
<td>HuggingFace PEFT</td>
</tr>
<tr>
<td><a href="https://zhuanlan.zhihu.com/p/646876256">大模型参数高效微调技术实战（三）-P-Tuning</a></td>
<td><a href="https://github.com/liguodongiot/llm-action/blob/main/llm-train/peft/clm/peft_p_tuning_clm.ipynb">配套代码</a></td>
<td>HuggingFace PEFT</td>
</tr>
<tr>
<td><a href="https://zhuanlan.zhihu.com/p/648156780">大模型参数高效微调技术实战（四）-Prefix Tuning / P-Tuning v2</a></td>
<td><a href="https://github.com/liguodongiot/llm-action/blob/main/llm-train/peft/clm/peft_p_tuning_v2_clm.ipynb">配套代码</a></td>
<td>HuggingFace PEFT</td>
</tr>
<tr>
<td><a href="https://zhuanlan.zhihu.com/p/649315197">大模型参数高效微调技术实战（五）-LoRA</a></td>
<td><a href="https://github.com/liguodongiot/llm-action/blob/main/llm-train/peft/clm/peft_lora_clm.ipynb">配套代码</a></td>
<td>HuggingFace PEFT</td>
</tr>
<tr>
<td><a href="https://zhuanlan.zhihu.com/p/649707359">大模型参数高效微调技术实战（六）-IA3</a></td>
<td><a href="https://github.com/liguodongiot/llm-action/blob/main/llm-train/peft/clm/peft_ia3_clm.ipynb">配套代码</a></td>
<td>HuggingFace PEFT</td>
</tr>
<tr>
<td><a href="https://zhuanlan.zhihu.com/p/670048482">大模型微调实战（七）-基于LoRA微调多模态大模型</a></td>
<td><a href="https://github.com/liguodongiot/llm-action/blob/main/llm-train/peft/multimodal/blip2_lora_int8_fine_tune.py">配套代码</a></td>
<td>HuggingFace PEFT</td>
</tr>
<tr>
<td><a href="https://zhuanlan.zhihu.com/p/670116171">大模型微调实战（八）-使用INT8/FP4/NF4微调大模型</a></td>
<td><a href="https://github.com/liguodongiot/llm-action/blob/main/llm-train/peft/multimodal/finetune_bloom_bnb_peft.ipynb">配套代码</a></td>
<td>PEFT、bitsandbytes</td>
</tr>
</tbody>
</table>
<p><strong><a href="#目录">⬆ 一键返回目录</a></strong></p>
<h3><a href="https://github.com/liguodongiot/llm-action/tree/main/docs/llm-base/distribution-parallelism">LLM分布式训练并行技术</a></h3>
<p>近年来，随着Transformer、MOE架构的提出，使得深度学习模型轻松突破上万亿规模参数，传统的单机单卡模式已经无法满足超大模型进行训练的要求。因此，我们需要基于单机多卡、甚至是多机多卡进行分布式大模型的训练。</p>
<p>而利用AI集群，使深度学习算法更好地从大量数据中高效地训练出性能优良的大模型是分布式机器学习的首要目标。为了实现该目标，一般需要根据硬件资源与数据/模型规模的匹配情况，考虑对计算任务、训练数据和模型进行划分，从而进行分布式训练。因此，分布式训练相关技术值得我们进行深入分析其背后的机理。</p>
<p>下面主要对大模型进行分布式训练的并行技术进行讲解，本系列大体分九篇文章进行讲解。</p>
<ul>
<li><a href="https://zhuanlan.zhihu.com/p/598714869">大模型分布式训练并行技术（一）-概述</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/650002268">大模型分布式训练并行技术（二）-数据并行</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/653860567">大模型分布式训练并行技术（三）-流水线并行</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/657921100">大模型分布式训练并行技术（四）-张量并行</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/659792351">大模型分布式训练并行技术（五）-序列并行</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/661279318">大模型分布式训练并行技术（六）-多维混合并行</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/662517647">大模型分布式训练并行技术（七）-自动并行</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/662518387">大模型分布式训练并行技术（八）-MOE并行</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/667051845">大模型分布式训练并行技术（九）-总结</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/2053636776309305923">大模型分布式训练并行技术（十）-通信量计算及训练耗时估算</a></li>
</ul>
<p><strong><a href="#目录">⬆ 一键返回目录</a></strong></p>
<h3>分布式AI框架</h3>
<ul>
<li><a href="https://github.com/liguodongiot/llm-action/tree/main/train/pytorch/">PyTorch</a>
<ul>
<li>PyTorch 单机多卡训练</li>
<li>PyTorch 多机多卡训练</li>
</ul></li>
<li><a href="https://github.com/liguodongiot/llm-action/tree/main/train/megatron">Megatron-LM</a>
<ul>
<li>Megatron-LM 单机多卡训练</li>
<li>Megatron-LM 多机多卡训练</li>
<li><a href="https://juejin.cn/post/7259682893648724029">基于Megatron-LM从0到1完成GPT2模型预训练、模型评估及推理</a></li>
</ul></li>
<li><a href="https://github.com/liguodongiot/llm-action/tree/main/train/deepspeed">DeepSpeed</a>
<ul>
<li>DeepSpeed 单机多卡训练</li>
<li>DeepSpeed 多机多卡训练</li>
</ul></li>
<li><a href="https://github.com/liguodongiot/llm-action/tree/main/train/megatron-deepspeed">Megatron-DeepSpeed</a>
<ul>
<li>基于 Megatron-DeepSpeed 从 0 到1 完成 LLaMA 预训练</li>
<li>基于 Megatron-DeepSpeed 从 0 到1 完成 Bloom 预训练</li>
</ul></li>
<li><a href="https://github.com/huggingface/nanotron">Nanotron</a>：一个用于预训练 Transformer 模型的库，其设计目标是易用、快速且可扩展。</li>
<li><a href="https://github.com/alibaba/Pai-Megatron-Patch">Pai-Megatron-Patch</a>：基于阿里云智算服务PAI-灵骏平台的大模型最佳实践解决方案配套工具。是各类开源大模型和Megatron训练加速引擎之间的“桥梁”，为用户提供用Megatron训练开源大模型的易用性以及LLM算法场景定制化的灵活性。 同时它可以帮助大模型开发者快速上手PAI灵骏产品，完成大模型的高效分布式训练，有监督指令微调，模型离线推理验证等完整大模型开发链路。 </li>
</ul>
<h3>分布式训练网络通信</h3>
<p>待更新...</p>
<h3>LLM训练优化技术</h3>
<ul>
<li>FlashAttention V1、V2</li>
<li>混合精度训练</li>
<li>重计算</li>
<li>MQA / GQA</li>
<li>梯度累积</li>
</ul>
<h3>LLM对齐技术</h3>
<ul>
<li>PPO（近端策略优化）</li>
<li>DPO</li>
<li>ORPO</li>
</ul>
<p><strong><a href="#目录">⬆ 一键返回目录</a></strong></p>
<h2><a href="https://github.com/liguodongiot/llm-action/tree/main/inference">LLM推理</a></h2>
<h3>推理引擎</h3>
<ul>
<li><a href="https://www.zhihu.com/question/625415776/answer/3243562246">大模型推理框架概述</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/626008090">大模型的好伙伴，浅析推理加速引擎FasterTransformer</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/666849728">TensorRT-LLM保姆级教程（一）-快速入门</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/667572720">TensorRT-LLM保姆级教程（二）-离线环境搭建、模型量化及推理</a></li>
<li><a href="https://juejin.cn/post/7398122968200593419">TensorRT-LLM保姆级教程（三）-使用Triton推理服务框架部署模型</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/1921914053485376792">一文搞懂大模型生成文本的解码策略</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/1965476299419132173">谈谈LLM生成文本的惩罚参数</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/1961192621759242664">LLM 确定性推理</a></li>
</ul>
<p>迷你LLM推理引擎（非常适合源码学习）：</p>
<ul>
<li><a href="https://github.com/liguodongiot/nano-vllm">Nano-vLLM源码注释</a>：从头开始构建的轻量级 vLLM 实现。</li>
<li><a href="https://github.com/liguodongiot/mini-sglang">Mini-SGLang</a>：一个轻量但高性能的大型语言模型推理框架，SGLang 的紧凑实现。</li>
</ul>
<p>生产级LLM推理引擎：</p>
<ul>
<li><a href="https://github.com/vllm-project/vllm">vLLM</a></li>
<li><a href="https://github.com/sgl-project/sglang">SGLang</a></li>
</ul>
<p>其他推理引擎：</p>
<ul>
<li><a href="https://github.com/InternLM/lmdeploy">LMDeploy</a></li>
<li><a href="https://github.com/ModelTC/lightllm">LightLLM</a>：纯Python开发的大语言模型推理和服务框架</li>
<li><a href="https://github.com/alibaba/MNN">MNN-LLM</a>：基于MNN引擎开发的大型语言模型运行时解决方案</li>
<li><a href="https://github.com/thu-pacman/chitu">赤兔</a></li>
<li><a href="https://github.com/UbiquitousLearning/mllm">mllm</a>：端侧多模态LLM推理引擎</li>
</ul>
<h3>推理服务</h3>
<ul>
<li><a href="https://zhuanlan.zhihu.com/p/721395381">模型推理服务工具综述</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/629336492">模型推理服务化框架Triton保姆式教程（一）：快速入门</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/634143650">模型推理服务化框架Triton保姆式教程（二）：架构解析</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/634444666">模型推理服务化框架Triton保姆式教程（三）：开发实践</a></li>
</ul>
<h3>LLM推理优化技术</h3>
<ul>
<li>[LLM推理优化技术-概述]()</li>
<li><a href="https://www.zhihu.com/question/653658936/answer/3569365986">大模型推理优化技术-KV Cache</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/719610083">大模型推理服务调度优化技术-Continuous batching</a></li>
<li><a href="https://juejin.cn/post/7405158045628596224">大模型低显存推理优化-Offload技术</a></li>
<li><a href="https://juejin.cn/post/7420231738558627874">大模型推理优化技术-KV Cache量化</a></li>
<li>[大模型推理优化技术-张量并行]()</li>
<li>[大模型推理服务调度优化技术-Chunked Prefill]()</li>
<li>[大模型推理优化技术-KV Cache优化方法综述]()</li>
<li>大模型吞吐优化技术-多LoRA推理服务</li>
<li>大模型推理服务调度优化技术-公平性调度</li>
<li>大模型访存优化技术-FlashAttention</li>
<li>大模型显存优化技术-PagedAttention</li>
<li>大模型解码优化-Speculative Decoding及其变体</li>
<li>大模型推理优化-结构化文本生成</li>
<li>Flash Decoding</li>
<li>FlashDecoding++</li>
</ul>
<h2>LLM压缩</h2>
<p>近年来，随着Transformer、MOE架构的提出，使得深度学习模型轻松突破上万亿规模参数，从而导致模型变得越来越大，因此，我们需要一些大模型压缩技术来降低模型部署的成本，并提升模型的推理性能。 模型压缩主要分为如下几类：</p>
<ul>
<li>模型剪枝（Pruning）</li>
<li>知识蒸馏（Knowledge Distillation）</li>
<li>模型量化（Quantization）</li>
<li>低秩分解（Low-Rank Factorization）</li>
</ul>
<h3><a href="https://github.com/liguodongiot/llm-action/tree/main/model-compression/quantization">LLM量化</a></h3>
<p>本系列将针对一些常见大模型量化方案（GPTQ、LLM.int8()、SmoothQuant、AWQ等）进行讲述。</p>
<ul>
<li><a href="https://www.zhihu.com/question/627484732/answer/3261671478">大模型量化概述</a></li>
<li>量化感知训练：
<ul>
<li><a href="https://zhuanlan.zhihu.com/p/647589650">大模型量化感知训练技术原理：LLM-QAT</a></li>
<li>[大模型量化感知微调技术原理：QLoRA]()</li>
<li>PEQA</li>
</ul></li>
<li>训练后量化：
<ul>
<li><a href="https://zhuanlan.zhihu.com/p/680212402">大模型量化技术原理：GPTQ、LLM.int8()</a></li>
<li><a href="https://www.zhihu.com/question/576376372/answer/3388402085">大模型量化技术原理：SmoothQuant</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/681578090">大模型量化技术原理：AWQ、AutoAWQ</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/682871823">大模型量化技术原理：SpQR</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/683813769">大模型量化技术原理：ZeroQuant系列</a></li>
<li><a href="https://www.zhihu.com/question/658712811/answer/3596678896">大模型量化技术原理：FP8</a></li>
<li><a href="https://juejin.cn/post/7412893752090853386">大模型量化技术原理：FP6</a></li>
<li><a href="https://juejin.cn/post/7420231738558627874">大模型量化技术原理：KIVI、IntactKV、KVQuant</a></li>
<li><a href="https://juejin.cn/post/7424334647570513972">大模型量化技术原理：Atom、QuaRot</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/8047106486">大模型量化技术原理：QoQ量化及QServe推理服务系统</a></li>
<li>大模型量化技术原理：QuIP、QuIP#、OmniQuant</li>
<li>[大模型量化技术原理：FP4]()</li>
</ul></li>
<li><a href="https://zhuanlan.zhihu.com/p/11886909512">大模型量化技术原理：总结</a></li>
</ul>
<h3>LLM稀疏化</h3>
<ul>
<li><a href="https://zhuanlan.zhihu.com/p/692858636?">万字长文谈深度神经网络剪枝综述</a></li>
</ul>
<p>目前，大多数针对大模型模型的压缩技术都专注于模型量化领域，即降低单个权重的数值表示的精度。另一种模型压缩方法模型剪枝的研究相对较少，即删除网络元素，包括从单个权重（非结构化剪枝）到更高粒度的组件，如权重矩阵的整行/列（结构化剪枝）。</p>
<p>本系列将针对一些常见大模型稀疏化方案（LLM-Pruner、SliceGPT、SparseGPT、Wanda等）进行讲述。</p>
<ul>
<li><a href="https://www.zhihu.com/question/652126515/answer/3457652467">大模型稀疏化技术原理：概述</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/1912877769827783344">大模型稀疏化技术原理：Double Sparsity</a></li>
<li>大模型稀疏化技术原理：LLM-Pruner、SliceGPT</li>
<li>大模型稀疏化技术原理：SparseGPT、Wanda</li>
<li>大模型稀疏化技术原理：总结</li>
</ul>
<p><strong>结构化剪枝</strong>：</p>
<ul>
<li>LLM-Pruner(LLM-Pruner: On the Structural Pruning of Large Language Models)</li>
<li>LLM-Shearing(Sheared LLaMA: Accelerating Language Model Pre-training via Structured Pruning)</li>
<li>SliceGPT: Compress Large Language Models by Deleting Rows and Columns</li>
<li>LoSparse</li>
</ul>
<p><strong>非结构化剪枝</strong>：</p>
<ul>
<li>SparseGPT(SparseGPT: Massive Language Models Can be Accurately Pruned in One-Shot)</li>
<li>LoRAPrune(LoRAPrune: Pruning Meets Low-Rank Parameter-Efficient Fine-Tuning)</li>
<li>Wanda(A Simple and Effective Pruning Approach for Large Language Models)</li>
<li>Flash-LLM(Flash-LLM: Enabling Cost-Effective and Highly-Efficient Large Generative Model Inference with Unstructured Sparsity)</li>
</ul>
<h3>LLM知识蒸馏</h3>
<ul>
<li><a href="https://www.zhihu.com/question/625415893/answer/3243565375">大模型知识蒸馏概述</a></li>
</ul>
<p><strong>Standard KD</strong>:</p>
<p>使学生模型学习教师模型(LLM)所拥有的常见知识，如输出分布和特征信息，这种方法类似于传统的KD。</p>
<ul>
<li>MINILLM</li>
<li>GKD</li>
</ul>
<p><strong>EA-based KD</strong>:</p>
<p>不仅仅是将LLM的常见知识转移到学生模型中，还涵盖了蒸馏它们独特的涌现能力。具体来说，EA-based KD又分为了上下文学习（ICL）、思维链（CoT）和指令跟随（IF）。</p>
<p>In-Context Learning：</p>
<ul>
<li>In-Context Learning distillation</li>
</ul>
<p>Chain-of-Thought：</p>
<ul>
<li>MT-COT</li>
<li>Fine-tune-CoT</li>
<li>DISCO</li>
<li>SCOTT</li>
<li>SOCRATIC CoT</li>
</ul>
<p>Instruction Following：</p>
<ul>
<li>Lion</li>
</ul>
<h3>低秩分解</h3>
<p>低秩分解旨在通过将给定的权重矩阵分解成两个或多个较小维度的矩阵，从而对其进行近似。低秩分解背后的核心思想是找到一个大的权重矩阵W的分解，得到两个矩阵U和V，使得W≈U V，其中U是一个m×k矩阵，V是一个k×n矩阵，其中k远小于m和n。U和V的乘积近似于原始的权重矩阵，从而大幅减少了参数数量和计算开销。</p>
<p>在LLM研究的模型压缩领域，研究人员通常将多种技术与低秩分解相结合，包括修剪、量化等。</p>
<ul>
<li>ZeroQuant-FP（低秩分解+量化）</li>
<li>LoRAPrune（低秩分解+剪枝）</li>
</ul>
<h2>LLM测评</h2>
<h3>LLM效果评测</h3>
<h4>测评集</h4>
<ul>
<li><a href="https://github.com/liguodongiot/ceval">C-Eval</a>：全面的中文基础模型评估套件，涵盖了52个不同学科的13948个多项选择题，分为四个难度级别。</li>
<li><a href="https://github.com/liguodongiot/CMMLU">CMMLU</a>：一个综合性的中文评估基准，专门用于评估语言模型在中文语境下的知识和推理能力。CMMLU涵盖了从基础学科到高级专业水平的67个主题。它包括：需要计算和推理的自然科学，需要知识的人文科学和社会科学,以及需要生活常识的中国驾驶规则等。此外，CMMLU中的许多任务具有中国特定的答案，可能在其他地区或语言中并不普遍适用。因此是一个完全中国化的中文测试基准。</li>
<li><a href="https://github.com/liguodongiot/LVEval">LVEval</a>：一个具备5个长度等级（16k、32k、64k、128k和256k）、最大文本测试长度达到256k的长文本评测基准。LV-Eval的平均文本长度达到102,380字，最小/最大文本长度为11,896/387,406字。LV-Eval主要有两类评测任务——单跳QA和多跳QA，共包含11个涵盖中英文的评测数据子集。LV-Eval设计时引入3个关键技术：干扰事实插入（Confusiong Facts Insertion，CFI）提高挑战性，关键词和短语替换（Keyword and Phrase Replacement，KPR）减少信息泄漏，以及基于关键词召回的评测指标（Answer Keywords，AK，指代结合答案关键词和字词黑名单的评价指标）提高评测数值客观性。</li>
<li><a href="https://github.com/google-research/google-research/tree/master/instruction_following_eval">IFEval: Instruction Following Eval</a>/<a href="https://arxiv.org/abs/2311.07911">Paper</a>：专注评估大模型遵循指令的能力,包含关键词检测、标点控制、输出格式要求等25种任务。</li>
<li><a href="https://github.com/CLUEbenchmark/SuperCLUE">SuperCLUE</a>：一个综合性大模型评测基准，本次评测主要聚焦于大模型的四个能力象限，包括语言理解与生成、专业技能与知识、Agent智能体和安全性，进而细化为12项基础能力。</li>
<li><a href="https://github.com/ruixiangcui/AGIEval/">AGIEval</a>：用于评估基础模型在与人类认知和解决问题相关的任务中的能力。该基准源自 20 项面向普通考生的官方、公开、高标准的入学和资格考试，例如：普通大学入学考试（例如：中国高考（Gaokao）和美国 SAT）、法学院入学考试、数学竞赛、律师资格考试、国家公务员考试。</li>
<li><a href="https://github.com/THUDM/LongBench">LongBench</a>：一个双语（中英文）多任务基准数据集，旨在评估大语言模型的长上下文理解能力。它包含21个任务，涵盖单文档问答、多文档问答、摘要、小样本学习、合成任务和代码补全等。数据集平均任务长度范围为5k到15k，共包含4750个测试数据。LongBench 采用全自动评估方法，旨在以最低的成本衡量和评估模型理解长上下文的能力。</li>
</ul>
<p>Coding：</p>
<ul>
<li><a href="https://github.com/harbor-framework/terminal-bench-2">Terminal-Bench v2</a>：一套命令行基准测试套件，用于评估 AI 代理在 89 个真实世界的多步骤终端任务中的表现。这些任务涵盖编译、调试到系统管理等多个方面，并在隔离的容器环境中运行，配有严格的验证机制。</li>
<li><a href="https://github.com/swe-bench/SWE-bench">SWE-bench</a>：一个用于评估大型语言模型在真实世界软件问题上表现的基准测试，这些问题收集自GitHub。 给定一个代码库和一个问题,语言模型的任务是生成一个补丁来解决描述的问题。</li>
</ul>
<p>Agent：</p>
<ul>
<li><a href="https://github.com/claw-eval/claw-eval">Claw-Eval</a>：Claw-Eval 是一个用来评估大语言模型作为智能体的评估工具。所有任务均经过人工验证。</li>
</ul>
<p>Storage：</p>
<ul>
<li><a href="https://github.com/mlcommons/storage">MLPerf Storage Benchmark</a>：用于评估机器学习训练场景下存储系统性能的开源基准测试套件。核心目标是衡量存储系统能否以足够快的速度向计算GPU提供训练数据，从而避免昂贵的GPU算力闲置。</li>
</ul>
<h4>测评工具</h4>
<ul>
<li><a href="https://github.com/open-compass/opencompass/blob/main/README_zh-CN.md">OpenCompass</a>：司南 2.0 大模型评测体系。</li>
<li><a href="https://github.com/modelscope/evalscope">EvalScope</a>：魔搭社区官方推出的模型评测与性能基准测试框架，专为多样化的模型评估需求而设计。它支持广泛的模型类型，包括但不限于大语言模型、多模态模型、Embedding 模型、Reranker 模型和 CLIP 模型。EvalScope还适用于多种评测场景，如端到端RAG评测、竞技场模式和模型推理性能压测等，其内置多个常用测试基准和评测指标，如MMLU、CMMLU、C-Eval、GSM8K等。</li>
</ul>
<h3>LLM推理性能压测</h3>
<ul>
<li><a href="https://zhuanlan.zhihu.com/p/1989359577871954448">你真的搞懂了LLM性能压测的各项指标吗？</a></li>
<li><a href="https://github.com/ai-dynamo/aiperf">AIPerf</a>：英伟达开源的性能测试工具</li>
<li><a href="https://github.com/vllm-project/guidellm">GuideLLM</a>：vLLM开源的性能测试工具</li>
<li><a href="https://github.com/modelscope/evalscope">EvalScope</a>：魔搭社区开源的性能测试工具</li>
<li><a href="https://github.com/kubernetes-sigs/inference-perf">Inference Perf</a></li>
<li><a href="https://github.com/sgl-project/genai-bench">genai-bench</a>：SGLang开源的性能测试工具</li>
<li><a href="https://github.com/liguodongiot/perf_analyzer/tree/main/genai-perf">GenAI-Perf</a>：英伟达开源的一个命令行工具（<strong>已逐渐被淘汰，建议使用AIPerf</strong>），用于测量通过推理服务提供生成式AI模型的吞吐量和延迟。GenAI-Perf 收集一组不同的指标来捕获推理服务的性能。</li>
</ul>
<table>
<thead>
<tr>
<th>指标</th>
<th>描述</th>
<th>Aggregations</th>
</tr>
</thead>
<tbody>
<tr>
<td><span id="time_to_first_token_metric">Time to First Token</span></td>
<td>Time between when a request is sent and when its first response is received, one value per request in benchmark</td>
<td>Avg, min, max, p99, p90, p75</td>
</tr>
<tr>
<td><span id="time_to_second_token_metric">Time to Second Token</span></td>
<td>Time between when the first streaming response is received and when the second streaming response is received, one value per request in benchmark</td>
<td>Avg, min, max, p99, p90, p75</td>
</tr>
<tr>
<td><span id="inter_token_latency_metric">Inter Token Latency</span></td>
<td>Time between intermediate responses for a single request divided by the number of generated tokens of the latter response, one value per response per request in benchmark</td>
<td>Avg, min, max, p99, p90, p75</td>
</tr>
<tr>
<td>Request Latency</td>
<td>Time between when a request is sent and when its final response is received, one value per request in benchmark</td>
<td>Avg, min, max, p99, p90, p75</td>
</tr>
<tr>
<td>Output Sequence Length</td>
<td>Total number of output tokens of a request, one value per request in benchmark</td>
<td>Avg, min, max, p99, p90, p75</td>
</tr>
<tr>
<td>Input Sequence Length</td>
<td>Total number of input tokens of a request, one value per request in benchmark</td>
<td>Avg, min, max, p99, p90, p75</td>
</tr>
<tr>
<td><span id="output_token_throughput_metric">Output Token Throughput</span></td>
<td>Total number of output tokens from benchmark divided by benchmark duration</td>
<td>None–one value per benchmark</td>
</tr>
<tr>
<td><span id="request_throughput_metric">Request Throughput</span></td>
<td>Number of final responses from benchmark divided by benchmark duration</td>
<td>None–one value per benchmark</td>
</tr>
</tbody>
</table>
<h2>LLM数据工程</h2>
<p>LLM Data Engineering</p>
<h3>预训练语料处理技术</h3>
<ul>
<li>数据收集</li>
<li>数据处理</li>
</ul>
<blockquote>
<p>README 内容已截断, 请前往 GitHub 查看完整内容。</p>
</blockquote>]]></description>
    <pubDate>Tue, 15 Sep 2026 17:20:10 +0800</pubDate>
    <dc:creator>OTO</dc:creator>
    <guid>https://cn121.com/llm/liguodongiot-llm-action.html</guid>
</item>
<item>
    <title>promptfoo - 测试您的提示</title>
    <link>https://cn121.com/automation/promptfoo-promptfoo.html</link>
    <description><![CDATA[<h1>Promptfoo: LLM evals &amp; red teaming</h1>
<p align="center">
  <a href="https://npmjs.com/package/promptfoo"></a> <a href="https://npmjs.com/package/promptfoo"></a> <a href="https://github.com/promptfoo/promptfoo/actions/workflows/main.yml"></a> <a href="https://github.com/promptfoo/promptfoo/blob/main/LICENSE"></a> <a href="https://discord.gg/promptfoo"></a>
</p>
<p align="center">
  <code>promptfoo</code> is a CLI and library for evaluating and red-teaming LLM apps. Stop the trial-and-error approach - start shipping secure, reliable AI apps.
</p>
<p align="center">
  <a href="https://www.promptfoo.dev">Website</a> · <a href="https://www.promptfoo.dev/docs/getting-started/">Getting Started</a> · <a href="https://www.promptfoo.dev/docs/red-team/">Red Teaming</a> · <a href="https://www.promptfoo.dev/docs/">Documentation</a> · <a href="https://discord.gg/promptfoo">Discord</a>
</p>
<blockquote>
<p>Promptfoo is now part of OpenAI. Promptfoo remains open source and MIT licensed. Read the <a href="https://www.promptfoo.dev/blog/promptfoo-joining-openai/">company update</a>.</p>
</blockquote>
<h2>Quick Start</h2>
<p>Requires <a href="https://nodejs.org/en/download">Node.js</a> <code>&gt;=22.22.0</code> for npm and npx usage. Node.js 24 LTS is recommended; see the <a href="https://www.promptfoo.dev/docs/installation/#nodejs-runtime-support">runtime support guide</a>.</p>
<pre><code class="language-sh">npm install -g promptfoo
promptfoo init --example getting-started</code></pre>
<p>Also available via <code>brew install promptfoo</code> and <code>pip install promptfoo</code>. You can also use <code>npx promptfoo@latest</code> to run any command without installing.</p>
<p>Most LLM providers require an API key. Set yours as an environment variable:</p>
<pre><code class="language-sh">export OPENAI_API_KEY=sk-abc123</code></pre>
<p>Once you're in the example directory, run an eval and view results:</p>
<pre><code class="language-sh">cd getting-started
promptfoo eval
promptfoo view</code></pre>
<p>See <a href="https://www.promptfoo.dev/docs/getting-started/">Getting Started</a> (evals) or <a href="https://www.promptfoo.dev/docs/red-team/">Red Teaming</a> (vulnerability scanning) for more.</p>
<h2>What can you do with Promptfoo?</h2>
<ul>
<li><strong>Test your prompts and models</strong> with <a href="https://www.promptfoo.dev/docs/getting-started/">automated evaluations</a></li>
<li><strong>Secure your LLM apps</strong> with <a href="https://www.promptfoo.dev/docs/red-team/">red teaming</a> and vulnerability scanning</li>
<li><strong>Compare models</strong> side-by-side (OpenAI, Anthropic, Azure, Bedrock, Ollama, and <a href="https://www.promptfoo.dev/docs/providers/">more</a>)</li>
<li><strong>Automate checks</strong> in <a href="https://www.promptfoo.dev/docs/integrations/ci-cd/">CI/CD</a></li>
<li><strong>Review pull requests</strong> for LLM-related security and compliance issues with <a href="https://www.promptfoo.dev/docs/code-scanning/">code scanning</a></li>
<li><strong>Share results</strong> with your team</li>
</ul>
<p>Here's what it looks like in action:</p>
<p>It works on the command line too:</p>
<p>It also can generate <a href="https://www.promptfoo.dev/docs/red-team/">security vulnerability reports</a>:</p>
<h2>Why Promptfoo?</h2>
<ul>
<li><strong>Developer-first</strong>: Fast, with features like live reload and caching</li>
<li><strong>Private</strong>: LLM evals run 100% locally - your prompts never leave your machine</li>
<li><strong>Flexible</strong>: Works with any LLM API or programming language</li>
<li><strong>Battle-tested</strong>: Powers LLM apps serving 10M+ users in production</li>
<li><strong>Data-driven</strong>: Make decisions based on metrics, not gut feel</li>
<li><strong>Open source</strong>: MIT licensed, with an active community</li>
</ul>
<h2>Learn More</h2>
<ul>
<li><a href="https://www.promptfoo.dev/docs/getting-started/">Getting Started</a></li>
<li><a href="https://www.promptfoo.dev/docs/intro/">Full Documentation</a></li>
<li><a href="https://www.promptfoo.dev/docs/red-team/">Red Teaming Guide</a></li>
<li><a href="https://www.promptfoo.dev/docs/usage/command-line/">CLI Usage</a></li>
<li><a href="https://www.promptfoo.dev/docs/usage/node-package/">Node.js Package</a></li>
<li><a href="https://www.promptfoo.dev/docs/providers/">Supported Models</a></li>
<li><a href="https://www.promptfoo.dev/docs/code-scanning/">Code Scanning Guide</a></li>
</ul>
<h2>Contributing</h2>
<p>We welcome contributions! Check out our <a href="https://www.promptfoo.dev/docs/contributing/">contributing guide</a> to get started.</p>
<p>Join our <a href="https://discord.gg/promptfoo">Discord community</a> for help and discussion.</p>
<p><a href="https://github.com/promptfoo/promptfoo/graphs/contributors">  </a></p>]]></description>
    <pubDate>Tue, 15 Sep 2026 17:20:03 +0800</pubDate>
    <dc:creator>OTO</dc:creator>
    <guid>https://cn121.com/automation/promptfoo-promptfoo.html</guid>
</item>
<item>
    <title>toon - 面🎒 向令牌的对象表示法（ TOON ） – LLM</title>
    <link>https://cn121.com/cli/toon-format-toon.html</link>
    <description><![CDATA[<h1>Token-Oriented Object Notation (TOON)</h1>
<p><a href="https://github.com/toon-format/toon/actions"></a> <a href="https://www.npmjs.com/package/@toon-format/toon"></a> <a href="https://github.com/toon-format/spec"></a> <a href="https://www.npmjs.com/package/@toon-format/toon"></a> <a href="https://github.com/toon-format/toon/blob/main/LICENSE"></a></p>
<p><strong>Token-Oriented Object Notation</strong> is a compact, human-readable encoding of the JSON data model that minimizes tokens and makes structure easy for models to follow.</p>
<p>TOON combines YAML's indentation-based structure for nested objects with CSV-style tabular forms for uniform data. Its sweet spot is uniform objects – same fields across items, whether in an array or keyed by ID – reaching CSV-like compactness while adding explicit structure that helps LLMs parse and validate data reliably. For deeply nested or non-uniform data, JSON may be more efficient.</p>
<p>Think of it as a translation layer: use JSON programmatically, and encode it as TOON for LLM input – a drop-in, lossless representation of the JSON you already have.</p>
<blockquote>
<p>[!TIP]<br />
The TOON format is stable, but also an idea in progress. Nothing's set in stone – help shape where it goes by contributing to the <a href="https://github.com/toon-format/spec">spec</a> or sharing feedback.</p>
</blockquote>
<h2>Why TOON?</h2>
<p><strong>LLM tokens cost money</strong> – and JSON spends a lot of them on structure. A weather forecast in TOON:</p>
<pre><code class="language-yaml">location:
  city: Berlin
  country: DE
  units: metric
alerts[2]: frost,wind
forecast[3]{day,temp{min,max},condition,rainChance}:
  Mon,-2,4,snow,80
  Tue,1,7,cloudy,20
  Wed,3,11,sunny,5</code></pre>
<p>The same data as JSON – ~117 tokens against TOON's ~66:</p>
<pre><code class="language-json">{
  "location": {
    "city": "Berlin",
    "country": "DE",
    "units": "metric"
  },
  "alerts": [
    "frost",
    "wind"
  ],
  "forecast": [
    {
      "day": "Mon",
      "temp": {
        "min": -2,
        "max": 4
      },
      "condition": "snow",
      "rainChance": 80
    },
    {
      "day": "Tue",
      "temp": {
        "min": 1,
        "max": 7
      },
      "condition": "cloudy",
      "rainChance": 20
    },
    {
      "day": "Wed",
      "temp": {
        "min": 3,
        "max": 11
      },
      "condition": "sunny",
      "rainChance": 5
    }
  ]
}</code></pre>
<p>Three things are happening at once in the TOON above. Two are <strong>forms</strong> – one rendering of a value, picked automatically from the data's shape – and the third is a header feature:</p>
<ul>
<li><code>alerts[2]: frost,wind</code> is <strong>inline form</strong>: a primitive array on its header line.</li>
<li><code>forecast[3]{day,…}:</code> is <strong>tabular form</strong>: the field list is declared once in the header, then one row per element.</li>
<li><code>temp{min,max}</code> inside that header is a <strong>nested field group</strong>: the uniform nested <code>temp</code> objects fold into the header while rows stay flat.</li>
</ul>
<p>The third form is <strong>keyed tabular</strong>, for objects whose values are uniform objects – config maps, feature flags, records by ID. The colon after the length (<code>[2:]</code>) marks it, and each row carries its own key:</p>
<table>
<tr><th>JSON</th><th>TOON</th></tr>
<tr><td>

```json
{
  "environments": {
    "production": { "region": "eu-central-1", "replicas": 6, "debug": false },
    "staging": { "region": "eu-central-1", "replicas": 2, "debug": true }
  }
}
```

</td><td>

```toon
environments[2:]{region,replicas,debug}:
  production: eu-central-1,6,false
  staging: eu-central-1,2,true
```

</td></tr>
</table>
<p>Anything that fits none of these – mixed types, non-uniform objects – falls back to the fourth form, <strong>list form</strong>: one <code>-</code> item per element, or a bare <code>-</code> for an empty object. Those four cover the shapes; the <a href="https://toonformat.dev/guide/format-overview">Format Overview</a> covers the rest.</p>
<blockquote>
<p>[!TIP]<br />
Try it on your own data – no install required:</p>
<pre><code class="language-bash">cat data.json | npx @toon-format/cli --stats</code></pre>
<p>It prints the TOON alongside what the conversion saved – on the weather forecast above, that's:</p>
<pre><code>ℹ Token estimates: ~117 (JSON) → ~66 (TOON)
✔ Saved ~51 tokens (-43.6%)</code></pre>
</blockquote>
<h2>Key Features</h2>
<ul>
<li>📊 <strong>Token-Efficient &amp; Accurate:</strong> Matches JSON's retrieval accuracy while using 42.6% fewer tokens – see <a href="#benchmarks">Benchmarks</a>.</li>
<li>🔁 <strong>JSON Data Model:</strong> Encodes the same objects, arrays, and primitives as JSON with deterministic, lossless round-trips.</li>
<li>🛤️ <strong>LLM-Friendly Guardrails:</strong> <code>[N]</code> declares how many rows, <code>{fields}</code> how wide – so truncated or malformed output can't slip through.</li>
<li>📐 <strong>Minimal Syntax:</strong> Uses indentation instead of braces and minimizes quoting, giving YAML-like readability with CSV-style compactness.</li>
<li>🧺 <strong>Tabular Forms:</strong> Uniform objects – in an array or under keys – declare the field list once, then stream one row each.</li>
<li>🌐 <strong>Multi-Language Ecosystem:</strong> Official implementations, plus dozens of community ports, all targeting one spec with a shared conformance test suite.</li>
</ul>
<h2>When Not to Use TOON</h2>
<p>TOON excels with arrays of uniform objects. Reach for something else when:</p>
<ul>
<li><strong>Structures are deeply nested or non-uniform</strong> (tabular eligibility ≈ 0%) – compact JSON often wins outright.</li>
<li><strong>Arrays are semi-uniform</strong> (~40–60% eligibility) – savings shrink; stay on JSON if your pipeline already speaks it.</li>
<li><strong>Data is purely tabular</strong> – CSV is smaller. TOON's ~5–10% overhead buys declared lengths, field lists, and delimiter scoping, which is a reliability trade, not a size one.</li>
<li><strong>Latency dominates</strong> – some deployments (notably local or quantized models) process compact JSON faster despite the higher token count. Measure TTFT and total time on your own setup.</li>
</ul>
<p><a href="#benchmarks">Benchmarks</a> below quantify the token and accuracy trade-offs; latency is the one you have to measure yourself.</p>
<h2>Benchmarks</h2>
<p>Two tracks, so every comparison is like-for-like:</p>
<ul>
<li><strong>Mixed-Structure Track</strong>: Nested and semi-uniform datasets (TOON vs JSON, YAML, XML). CSV is excluded – it cannot represent these structures without lossy flattening.</li>
<li><strong>Flat-Only Track</strong>: Flat, fully tabular-eligible datasets, where CSV is a fair competitor.</li>
</ul>
<h3>Retrieval Accuracy</h3>
<!-- automd:file src="./benchmarks/results/retrieval-accuracy.md" -->
<p>Benchmarks test LLM comprehension across different input formats using 244 data retrieval questions on 4 models.</p>
<details class="dsh-details"><summary class="dsh-details-summary"><strong>Show Dataset Catalog</strong></summary><div class="dsh-details-body">
<h4>Dataset Catalog</h4>
<table>
<thead>
<tr>
<th>Dataset</th>
<th>Rows</th>
<th>Structure</th>
<th>CSV Support</th>
<th>Eligibility</th>
</tr>
</thead>
<tbody>
<tr>
<td>Uniform employee records</td>
<td>100</td>
<td>uniform</td>
<td>✓</td>
<td>100%</td>
</tr>
<tr>
<td>E-commerce orders with nested structures</td>
<td>50</td>
<td>nested</td>
<td>✗</td>
<td>33%</td>
</tr>
<tr>
<td>Time-series analytics data</td>
<td>60</td>
<td>uniform</td>
<td>✓</td>
<td>100%</td>
</tr>
<tr>
<td>Top 100 GitHub repositories</td>
<td>100</td>
<td>uniform</td>
<td>✓</td>
<td>100%</td>
</tr>
<tr>
<td>Semi-uniform event logs</td>
<td>75</td>
<td>semi-uniform</td>
<td>✗</td>
<td>50%</td>
</tr>
<tr>
<td>Deeply nested configuration</td>
<td>1</td>
<td>deep</td>
<td>✗</td>
<td>0%</td>
</tr>
<tr>
<td>Valid complete dataset (control)</td>
<td>20</td>
<td>uniform</td>
<td>✓</td>
<td>100%</td>
</tr>
<tr>
<td>Array truncated: 3 rows removed from end</td>
<td>20</td>
<td>uniform</td>
<td>✓</td>
<td>100%</td>
</tr>
<tr>
<td>Extra rows added beyond declared length</td>
<td>20</td>
<td>uniform</td>
<td>✓</td>
<td>100%</td>
</tr>
<tr>
<td>Inconsistent field count (missing salary in row 10)</td>
<td>20</td>
<td>uniform</td>
<td>✓</td>
<td>100%</td>
</tr>
<tr>
<td>Missing required fields (no email in multiple rows)</td>
<td>20</td>
<td>uniform</td>
<td>✓</td>
<td>100%</td>
</tr>
<tr>
<td>Feature flags keyed by name</td>
<td>40</td>
<td>uniform</td>
<td>✗</td>
<td>100%</td>
</tr>
<tr>
<td>Contacts with nested address and plan groups</td>
<td>50</td>
<td>nested</td>
<td>✗</td>
<td>100%</td>
</tr>
</tbody>
</table>
<p><strong>Structure classes:</strong></p>
<ul>
<li><strong>uniform</strong>: All objects have identical fields with primitive values</li>
<li><strong>semi-uniform</strong>: Mix of uniform and non-uniform structures</li>
<li><strong>nested</strong>: Objects with nested structures (nested objects or arrays)</li>
<li><strong>deep</strong>: Highly nested with minimal tabular eligibility</li>
</ul>
<p><strong>CSV Support:</strong> ✓ (supported), ✗ (not supported – would require lossy flattening)</p>
<p><strong>Eligibility:</strong> Percentage of arrays and keyed maps that qualify for TOON's tabular forms (uniform records whose fields are primitives or uniform nested objects folded into nested field groups)</p>
</div></details>
<h4>Efficiency Ranking (Accuracy per 1K Tokens)</h4>
<p>Each format ranked by efficiency (accuracy percentage per 1,000 tokens):</p>
<pre><code>TOON           ████████████████████   29.2 acc%/1K tok  │  72.2%  ±2.8 acc  │  2,474 tokens
JSON compact   ████████████████░░░░   23.8 acc%/1K tok  │  69.0%  ±2.9 acc  │  2,892 tokens
YAML           ██████████████░░░░░░   20.1 acc%/1K tok  │  70.1%  ±2.9 acc  │  3,487 tokens
JSON           ███████████░░░░░░░░░   16.6 acc%/1K tok  │  71.4%  ±2.8 acc  │  4,308 tokens
XML            ██████████░░░░░░░░░░   14.4 acc%/1K tok  │  70.7%  ±2.9 acc  │  4,909 tokens</code></pre>
<p><em>Efficiency score = (Accuracy % ÷ Tokens) × 1,000. Higher is better.</em></p>
<blockquote>
<p>[!TIP]<br />
TOON achieves <strong>72.2%</strong> accuracy (vs JSON's 71.4%) while using <strong>42.6% fewer tokens</strong>.</p>
<p>[!NOTE]<br />
CSV is excluded from the ranking as it only supports 109 of 244 questions (flat tabular data only). While CSV is highly token-efficient for simple tabular data, it cannot represent nested structures that other formats handle.</p>
</blockquote>
<h4>Accuracy on Flat Datasets</h4>
<p>Every format answers the same 109 flat-dataset questions per model, so CSV can be compared on equal footing here.</p>
<table>
<thead>
<tr>
<th>Format</th>
<th>Accuracy</th>
<th>Correct/Total</th>
<th>Avg Tokens</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>toon</code></td>
<td>63.1% ±4.5</td>
<td>275/436</td>
<td>1,994</td>
</tr>
<tr>
<td><code>csv</code></td>
<td>62.2% ±4.5</td>
<td>271/436</td>
<td>1,851</td>
</tr>
<tr>
<td><code>json-pretty</code></td>
<td>60.3% ±4.6</td>
<td>263/436</td>
<td>3,950</td>
</tr>
<tr>
<td><code>xml</code></td>
<td>60.1% ±4.6</td>
<td>262/436</td>
<td>4,516</td>
</tr>
<tr>
<td><code>yaml</code></td>
<td>59.9% ±4.6</td>
<td>261/436</td>
<td>3,270</td>
</tr>
<tr>
<td><code>json-compact</code></td>
<td>58.0% ±4.6</td>
<td>253/436</td>
<td>2,718</td>
</tr>
</tbody>
</table>
<h4>Per-Model Accuracy</h4>
<p>Accuracy across 4 LLMs on 244 data retrieval questions:</p>
<pre><code>claude-haiku-4-5-20251001
→ TOON           █████████████░░░░░░░    65.6% ±5.9 (160/244)
  JSON           █████████████░░░░░░░    63.5% ±6.0 (155/244)
  XML            ████████████░░░░░░░░    62.3% ±6.0 (152/244)
  YAML           ████████████░░░░░░░░    62.3% ±6.0 (152/244)
  JSON compact   ████████████░░░░░░░░    61.9% ±6.0 (151/244)
  CSV            ██████████░░░░░░░░░░    49.5% ±9.2 (54/109)

gemini-3.6-flash
→ TOON           ██████████████░░░░░░    69.3% ±5.8 (169/244)
  JSON           ██████████████░░░░░░    68.4% ±5.8 (167/244)
  YAML           ██████████████░░░░░░    67.6% ±5.8 (165/244)
  XML            █████████████░░░░░░░    65.2% ±5.9 (159/244)
  JSON compact   █████████████░░░░░░░    63.5% ±6.0 (155/244)
  CSV            ████████████░░░░░░░░    57.8% ±9.1 (63/109)

gpt-5.4-nano
  XML            ████████████░░░░░░░░    59.4% ±6.1 (145/244)
  JSON           ███████████░░░░░░░░░    57.4% ±6.2 (140/244)
→ TOON           ███████████░░░░░░░░░    57.0% ±6.2 (139/244)
  JSON compact   ███████████░░░░░░░░░    54.9% ±6.2 (134/244)
  YAML           ███████████░░░░░░░░░    54.5% ±6.2 (133/244)
  CSV            █████████░░░░░░░░░░░    46.8% ±9.2 (51/109)

grok-4.5
→ TOON           ███████████████████░    97.1% ±2.2 (237/244)
  JSON           ███████████████████░    96.3% ±2.5 (235/244)
  XML            ███████████████████░    95.9% ±2.6 (234/244)
  YAML           ███████████████████░    95.9% ±2.6 (234/244)
  JSON compact   ███████████████████░    95.5% ±2.7 (233/244)
  CSV            ███████████████████░    94.5% ±4.5 (103/109)</code></pre>
<blockquote>
<p>[!NOTE]<br />
Accuracy figures include Wilson 95% confidence intervals (±); when two formats' intervals overlap, the difference between them is not statistically meaningful. CSV answers only the 109 flat-dataset questions, so its per-model cells cover a smaller, easier population than the other formats.</p>
</blockquote>
<details class="dsh-details"><summary class="dsh-details-summary"><strong>Performance by dataset and question type</strong></summary><div class="dsh-details-body">
<h4>Performance by Question Type</h4>
<table>
<thead>
<tr>
<th>Question Type</th>
<th>TOON</th>
<th>JSON</th>
<th>XML</th>
<th>YAML</th>
<th>JSON compact</th>
<th>CSV</th>
</tr>
</thead>
<tbody>
<tr>
<td>Field Retrieval</td>
<td>97.8%</td>
<td>99.2%</td>
<td>99.2%</td>
<td>99.7%</td>
<td>98.9%</td>
<td>100.0%</td>
</tr>
<tr>
<td>Aggregation</td>
<td>48.4%</td>
<td>48.4%</td>
<td>46.0%</td>
<td>46.0%</td>
<td>45.2%</td>
<td>32.8%</td>
</tr>
<tr>
<td>Filtering</td>
<td>38.0%</td>
<td>41.1%</td>
<td>37.5%</td>
<td>40.1%</td>
<td>38.0%</td>
<td>33.3%</td>
</tr>
<tr>
<td>Structure Awareness</td>
<td>90.3%</td>
<td>84.0%</td>
<td>84.0%</td>
<td>79.2%</td>
<td>78.5%</td>
<td>82.8%</td>
</tr>
<tr>
<td>Structural Validation</td>
<td>100.0%</td>
<td>50.0%</td>
<td>80.0%</td>
<td>50.0%</td>
<td>45.0%</td>
<td>80.0%</td>
</tr>
</tbody>
</table>
<h4>Performance by Dataset</h4>
<h5>Uniform employee records</h5>
<table>
<thead>
<tr>
<th>Format</th>
<th>Accuracy</th>
<th>Tokens</th>
<th>Correct/Total</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>csv</code></td>
<td>64.6%</td>
<td>2,336</td>
<td>106/164</td>
</tr>
<tr>
<td><code>toon</code></td>
<td>62.8%</td>
<td>2,537</td>
<td>103/164</td>
</tr>
<tr>
<td><code>json-compact</code></td>
<td>62.2%</td>
<td>3,919</td>
<td>102/164</td>
</tr>
<tr>
<td><code>yaml</code></td>
<td>64.0%</td>
<td>4,982</td>
<td>105/164</td>
</tr>
<tr>
<td><code>json-pretty</code></td>
<td>62.2%</td>
<td>6,326</td>
<td>102/164</td>
</tr>
<tr>
<td><code>xml</code></td>
<td>61.0%</td>
<td>7,286</td>
<td>100/164</td>
</tr>
</tbody>
</table>
<h5>E-commerce orders with nested structures</h5>
<table>
<thead>
<tr>
<th>Format</th>
<th>Accuracy</th>
<th>Tokens</th>
<th>Correct/Total</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>json-compact</code></td>
<td>70.7%</td>
<td>6,875</td>
<td>116/164</td>
</tr>
<tr>
<td><code>toon</code></td>
<td>71.3%</td>
<td>7,344</td>
<td>117/164</td>
</tr>
<tr>
<td><code>yaml</code></td>
<td>72.0%</td>
<td>8,456</td>
<td>118/164</td>
</tr>
<tr>
<td><code>json-pretty</code></td>
<td>71.3%</td>
<td>10,842</td>
<td>117/164</td>
</tr>
<tr>
<td><code>xml</code></td>
<td>74.4%</td>
<td>12,180</td>
<td>122/164</td>
</tr>
</tbody>
</table>
<h5>Time-series analytics data</h5>
<table>
<thead>
<tr>
<th>Format</th>
<th>Accuracy</th>
<th>Tokens</th>
<th>Correct/Total</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>csv</code></td>
<td>64.2%</td>
<td>1,408</td>
<td>77/120</td>
</tr>
<tr>
<td><code>toon</code></td>
<td>63.3%</td>
<td>1,595</td>
<td>76/120</td>
</tr>
<tr>
<td><code>json-compact</code></td>
<td>59.2%</td>
<td>2,351</td>
<td>71/120</td>
</tr>
<tr>
<td><code>yaml</code></td>
<td>62.5%</td>
<td>2,951</td>
<td>75/120</td>
</tr>
<tr>
<td><code>json-pretty</code></td>
<td>65.0%</td>
<td>3,678</td>
<td>78/120</td>
</tr>
<tr>
<td><code>xml</code></td>
<td>62.5%</td>
<td>4,386</td>
<td>75/120</td>
</tr>
</tbody>
</table>
<h5>Top 100 GitHub repositories</h5>
<table>
<thead>
<tr>
<th>Format</th>
<th>Accuracy</th>
<th>Tokens</th>
<th>Correct/Total</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>toon</code></td>
<td>57.6%</td>
<td>9,017</td>
<td>76/132</td>
</tr>
<tr>
<td><code>csv</code></td>
<td>54.5%</td>
<td>8,726</td>
<td>72/132</td>
</tr>
<tr>
<td><code>json-compact</code></td>
<td>53.8%</td>
<td>11,650</td>
<td>71/132</td>
</tr>
<tr>
<td><code>yaml</code></td>
<td>53.8%</td>
<td>13,350</td>
<td>71/132</td>
</tr>
<tr>
<td><code>json-pretty</code></td>
<td>55.3%</td>
<td>15,350</td>
<td>73/132</td>
</tr>
<tr>
<td><code>xml</code></td>
<td>53.8%</td>
<td>17,304</td>
<td>71/132</td>
</tr>
</tbody>
</table>
<h5>Semi-uniform event logs</h5>
<table>
<thead>
<tr>
<th>Format</th>
<th>Accuracy</th>
<th>Tokens</th>
<th>Correct/Total</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>json-compact</code></td>
<td>56.7%</td>
<td>4,793</td>
<td>68/120</td>
</tr>
<tr>
<td><code>toon</code></td>
<td>60.8%</td>
<td>5,814</td>
<td>73/120</td>
</tr>
<tr>
<td><code>json-pretty</code></td>
<td>60.0%</td>
<td>6,759</td>
<td>72/120</td>
</tr>
<tr>
<td><code>yaml</code></td>
<td>55.0%</td>
<td>5,798</td>
<td>66/120</td>
</tr>
<tr>
<td><code>xml</code></td>
<td>50.8%</td>
<td>7,668</td>
<td>61/120</td>
</tr>
</tbody>
</table>
<h5>Deeply nested configuration</h5>
<table>
<thead>
<tr>
<th>Format</th>
<th>Accuracy</th>
<th>Tokens</th>
<th>Correct/Total</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>json-compact</code></td>
<td>91.4%</td>
<td>562</td>
<td>106/116</td>
</tr>
<tr>
<td><code>yaml</code></td>
<td>93.1%</td>
<td>675</td>
<td>108/116</td>
</tr>
<tr>
<td><code>toon</code></td>
<td>91.4%</td>
<td>669</td>
<td>106/116</td>
</tr>
<tr>
<td><code>json-pretty</code></td>
<td>94.8%</td>
<td>918</td>
<td>110/116</td>
</tr>
<tr>
<td><code>xml</code></td>
<td>94.0%</td>
<td>1,007</td>
<td>109/116</td>
</tr>
</tbody>
</table>
<h5>Valid complete dataset (control)</h5>
<table>
<thead>
<tr>
<th>Format</th>
<th>Accuracy</th>
<th>Tokens</th>
<th>Correct/Total</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>toon</code></td>
<td>100.0%</td>
<td>566</td>
<td>4/4</td>
</tr>
<tr>
<td><code>json-compact</code></td>
<td>100.0%</td>
<td>772</td>
<td>4/4</td>
</tr>
<tr>
<td><code>yaml</code></td>
<td>100.0%</td>
<td>984</td>
<td>4/4</td>
</tr>
<tr>
<td><code>json-pretty</code></td>
<td>100.0%</td>
<td>1,259</td>
<td>4/4</td>
</tr>
<tr>
<td><code>xml</code></td>
<td>0.0%</td>
<td>1,441</td>
<td>0/4</td>
</tr>
<tr>
<td><code>csv</code></td>
<td>0.0%</td>
<td>473</td>
<td>0/4</td>
</tr>
</tbody>
</table>
<h5>Array truncated: 3 rows removed from end</h5>
<table>
<thead>
<tr>
<th>Format</th>
<th>Accuracy</th>
<th>Tokens</th>
<th>Correct/Total</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>csv</code></td>
<td>100.0%</td>
<td>408</td>
<td>4/4</td>
</tr>
<tr>
<td><code>toon</code></td>
<td>100.0%</td>
<td>498</td>
<td>4/4</td>
</tr>
<tr>
<td><code>xml</code></td>
<td>100.0%</td>
<td>1,229</td>
<td>4/4</td>
</tr>
<tr>
<td><code>json-pretty</code></td>
<td>0.0%</td>
<td>1,075</td>
<td>0/4</td>
</tr>
<tr>
<td><code>yaml</code></td>
<td>0.0%</td>
<td>841</td>
<td>0/4</td>
</tr>
<tr>
<td><code>json-compact</code></td>
<td>0.0%</td>
<td>660</td>
<td>0/4</td>
</tr>
</tbody>
</table>
<h5>Extra rows added beyond declared length</h5>
<table>
<thead>
<tr>
<th>Format</th>
<th>Accuracy</th>
<th>Tokens</th>
<th>Correct/Total</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>csv</code></td>
<td>100.0%</td>
<td>547</td>
<td>4/4</td>
</tr>
<tr>
<td><code>toon</code></td>
<td>100.0%</td>
<td>644</td>
<td>4/4</td>
</tr>
<tr>
<td><code>xml</code></td>
<td>100.0%</td>
<td>1,663</td>
<td>4/4</td>
</tr>
<tr>
<td><code>json-pretty</code></td>
<td>0.0%</td>
<td>1,452</td>
<td>0/4</td>
</tr>
<tr>
<td><code>yaml</code></td>
<td>0.0%</td>
<td>1,135</td>
<td>0/4</td>
</tr>
<tr>
<td><code>json-compact</code></td>
<td>0.0%</td>
<td>893</td>
<td>0/4</td>
</tr>
</tbody>
</table>
<h5>Inconsistent field count (missing salary in row 10)</h5>
<table>
<thead>
<tr>
<th>Format</th>
<th>Accuracy</th>
<th>Tokens</th>
<th>Correct/Total</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>csv</code></td>
<td>100.0%</td>
<td>470</td>
<td>4/4</td>
</tr>
<tr>
<td><code>toon</code></td>
<td>100.0%</td>
<td>563</td>
<td>4/4</td>
</tr>
<tr>
<td><code>json-compact</code></td>
<td>75.0%</td>
<td>767</td>
<td>3/4</td>
</tr>
<tr>
<td><code>xml</code></td>
<td>100.0%</td>
<td>1,432</td>
<td>4/4</td>
</tr>
<tr>
<td><code>yaml</code></td>
<td>75.0%</td>
<td>977</td>
<td>3/4</td>
</tr>
<tr>
<td><code>json-pretty</code></td>
<td>75.0%</td>
<td>1,251</td>
<td>3/4</td>
</tr>
</tbody>
</table>
<h5>Missing required fields (no email in multiple rows)</h5>
<table>
<thead>
<tr>
<th>Format</th>
<th>Accuracy</th>
<th>Tokens</th>
<th>Correct/Total</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>csv</code></td>
<td>100.0%</td>
<td>442</td>
<td>4/4</td>
</tr>
<tr>
<td><code>toon</code></td>
<td>100.0%</td>
<td>535</td>
<td>4/4</td>
</tr>
<tr>
<td><code>xml</code></td>
<td>100.0%</td>
<td>1,386</td>
<td>4/4</td>
</tr>
<tr>
<td><code>yaml</code></td>
<td>75.0%</td>
<td>941</td>
<td>3/4</td>
</tr>
<tr>
<td><code>json-pretty</code></td>
<td>75.0%</td>
<td>1,207</td>
<td>3/4</td>
</tr>
<tr>
<td><code>json-compact</code></td>
<td>50.0%</td>
<td>732</td>
<td>2/4</td>
</tr>
</tbody>
</table>
<h5>Feature flags keyed by name</h5>
<table>
<thead>
<tr>
<th>Format</th>
<th>Accuracy</th>
<th>Tokens</th>
<th>Correct/Total</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>toon</code></td>
<td>97.1%</td>
<td>931</td>
<td>66/68</td>
</tr>
<tr>
<td><code>json-compact</code></td>
<td>94.1%</td>
<td>1,264</td>
<td>64/68</td>
</tr>
<tr>
<td><code>yaml</code></td>
<td>92.6%</td>
<td>1,443</td>
<td>63/68</td>
</tr>
<tr>
<td><code>json-pretty</code></td>
<td>95.6%</td>
<td>1,873</td>
<td>65/68</td>
</tr>
<tr>
<td><code>xml</code></td>
<td>95.6%</td>
<td>2,306</td>
<td>65/68</td>
</tr>
</tbody>
</table>
<h5>Contacts with nested address and plan groups</h5>
<table>
<thead>
<tr>
<th>Format</th>
<th>Accuracy</th>
<th>Tokens</th>
<th>Correct/Total</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>toon</code></td>
<td>94.4%</td>
<td>1,444</td>
<td>68/72</td>
</tr>
<tr>
<td><code>json-compact</code></td>
<td>91.7%</td>
<td>2,357</td>
<td>66/72</td>
</tr>
<tr>
<td><code>yaml</code></td>
<td>94.4%</td>
<td>2,797</td>
<td>68/72</td>
</tr>
<tr>
<td><code>json-pretty</code></td>
<td>97.2%</td>
<td>4,014</td>
<td>70/72</td>
</tr>
<tr>
<td><code>xml</code></td>
<td>98.6%</td>
<td>4,534</td>
<td>71/72</td>
</tr>
</tbody>
</table>
</div></details>
<h4>Run Configuration</h4>
<ul>
<li><strong>Models tested</strong>: <code>claude-haiku-4-5-20251001</code>, <code>gemini-3.6-flash</code>, <code>gpt-5.4-nano</code>, <code>grok-4.5</code></li>
<li><strong>Formats compared</strong>: TOON, JSON, XML, YAML, JSON compact, CSV</li>
<li><strong>Token counting</strong>: Using <code>gpt-tokenizer</code> with <code>o200k_base</code> encoding (GPT-5 tokenizer). Other providers tokenize differently, so absolute counts are tokenizer-specific; relative differences between formats hold directionally.</li>
<li><strong>Reasoning</strong>: Disabled via the AI SDK's universal <code>reasoning: 'none'</code> (Gemini 3 floors at minimal thinking, <code>grok-4.5</code> at <code>low</code>)</li>
<li><strong>Temperature</strong>: Not set (models use their defaults)</li>
<li><strong>Total evaluations</strong>: 244 questions × 6 formats × 4 models = 5,856 LLM calls</li>
</ul>
<p>What the datasets contain, how the questions are generated, and how answers are validated is documented in <a href="https://github.com/toon-format/toon/tree/main/benchmarks#retrieval-accuracy-benchmark">the benchmark README</a>.</p>
<!-- /automd -->
<h3>Token Efficiency</h3>
<p>Token counts are measured using the GPT-5 <code>o200k_base</code> tokenizer via <a href="https://github.com/niieani/gpt-tokenizer"><code>gpt-tokenizer</code></a>. Savings are calculated against formatted JSON (2-space indentation) as the primary baseline, with additional comparisons to compact JSON (minified), YAML, and XML. Actual savings vary by model and tokenizer.</p>
<p>The benchmarks test datasets across different structural patterns (uniform, semi-uniform, nested, deeply nested) to show where TOON excels and where other formats may be better.</p>
<!-- automd:file src="./benchmarks/results/token-efficiency.md" -->
<h4>Mixed-Structure Track</h4>
<p>Datasets with nested or semi-uniform structures. CSV excluded as it cannot properly represent these structures.</p>
<pre><code>🛒 E-commerce orders with nested structures  ┊  Tabular: 33%
   │
   TOON                █████████████░░░░░░░    72,832 tokens
   ├─ vs JSON          (−32.9%)               108,611 tokens
   ├─ vs JSON compact  (+5.6%)                 68,944 tokens
   ├─ vs YAML          (−14.0%)                84,701 tokens
   └─ vs XML           (−40.4%)               122,119 tokens

🧾 Semi-uniform event logs  ┊  Tabular: 50%
   │
   TOON                █████████████████░░░   154,084 tokens
   ├─ vs JSON          (−15.0%)               181,201 tokens
   ├─ vs JSON compact  (+19.9%)               128,529 tokens
   ├─ vs YAML          (−0.8%)                155,397 tokens
   └─ vs XML           (−25.2%)               205,859 tokens

🧩 Deeply nested configuration  ┊  Tabular: 0%
   │
   TOON                █████████████░░░░░░░       589 tokens
   ├─ vs JSON          (−34.9%)                   905 tokens
   ├─ vs JSON compact  (+6.7%)                    552 tokens
   ├─ vs YAML          (−11.0%)                   662 tokens
   └─ vs XML           (−40.9%)                   997 tokens

📊 Feature flags keyed by name  ┊  Tabular: 100%
   │
   TOON                █████████░░░░░░░░░░░    10,503 tokens
   ├─ vs JSON          (−54.6%)                23,141 tokens
   ├─ vs JSON compact  (−32.8%)                15,635 tokens
   ├─ vs YAML          (−41.3%)                17,905 tokens
   └─ vs XML           (−63.3%)                28,655 tokens

📊 Contacts with nested address and plan groups  ┊  Tabular: 100%
   │
   TOON                ███████░░░░░░░░░░░░░    26,726 tokens
   ├─ vs JSON          (−66.5%)                79,779 tokens
   ├─ vs JSON compact  (−42.9%)                46,791 tokens
   ├─ vs YAML          (−51.8%)                55,475 tokens
   └─ vs XML           (−70.4%)                90,306 tokens

──────────────────────────────────── Total ────────────────────────────────────
   TOON                █████████████░░░░░░░   264,734 tokens
   ├─ vs JSON          (−32.7%)               393,637 tokens
   ├─ vs JSON compact  (+1.6%)                260,451 tokens
   ├─ vs YAML          (−15.7%)               314,140 tokens
   └─ vs XML           (−40.9%)               447,936 tokens</code></pre>
<h4>Flat-Only Track</h4>
<p>Datasets with flat, fully tabular-eligible data where CSV is applicable.</p>
<pre><code>👥 Uniform employee records  ┊  Tabular: 100%
   │
   CSV                 ███████████████████░    47,153 tokens
   TOON                ████████████████████    49,978 tokens   (+6.0% vs CSV)
   ├─ vs JSON          (−60.7%)               127,061 tokens
   ├─ vs JSON compact  (−36.8%)                79,057 tokens
   ├─ vs YAML          (−50.0%)               100,054 tokens
   └─ vs XML           (−65.9%)               146,605 tokens

📈 Time-series analytics data  ┊  Tabular: 100%
   │
   CSV                 ██████████████████░░     8,383 tokens
   TOON                ████████████████████     9,115 tokens   (+8.7% vs CSV)
   ├─ vs JSON          (−59.0%)                22,245 tokens
   ├─ vs JSON compact  (−35.9%)                14,211 tokens
   ├─ vs YAML          (−49.0%)                17,858 tokens
   └─ vs XML           (−65.8%)                26,616 tokens

⭐ Top 100 GitHub repositories  ┊  Tabular: 100%
   │
   CSV                 ███████████████████░     8,711 tokens
   TOON                ████████████████████     8,937 tokens   (+2.6% vs CSV)
   ├─ vs JSON          (−41.7%)                15,337 tokens
   ├─ vs JSON compact  (−23.2%)                11,640 tokens
   ├─ vs YAML          (−33.0%)                13,337 tokens
   └─ vs XML           (−48.3%)                17,294 tokens

──────────────────────────────────── Total ────────────────────────────────────
   CSV                 ███████████████████░    64,247 tokens
   TOON                ████████████████████    68,030 tokens   (+5.9% vs CSV)
   ├─ vs JSON          (−58.7%)               164,643 tokens
   ├─ vs JSON compact  (−35.2%)               104,908 tokens
   ├─ vs YAML          (−48.2%)               131,249 tokens
   └─ vs XML           (−64.3%)               190,515 tokens</code></pre>
<p>Token counts use <code>gpt-tokenizer</code> with <code>o200k_base</code> encoding (GPT-5 tokenizer). Other providers tokenize differently, so absolute counts are tokenizer-specific; relative differences between formats hold directionally.</p>
<details class="dsh-details"><summary class="dsh-details-summary"><strong>Show detailed examples</strong></summary><div class="dsh-details-body">
<h4>📈 Time-series analytics data</h4>
<p><strong>Savings:</strong> 13,130 tokens (59.0% reduction vs JSON)</p>
<p><strong>JSON</strong> (22,245 tokens):</p>
<pre><code class="language-json">{
  "metrics": [
    {
      "date": "2025-01-01",
      "views": 6138,
      "clicks": 174,
      "conversions": 12,
      "revenue": 2712.49,
      "bounceRate": 0.35
    },
    {
      "date": "2025-01-02",
      "views": 4616,
      "clicks": 274,
      "conversions": 34,
      "revenue": 9156.29,
      "bounceRate": 0.56
    },
    {
      "date": "2025-01-03",
      "views": 4460,
      "clicks": 143,
      "conversions": 8,
      "revenue": 1317.98,
      "bounceRate": 0.59
    },
    {
      "date": "2025-01-04",
      "views": 4740,
      "clicks": 125,
      "conversions": 13,
      "revenue": 2934.77,
      "bounceRate": 0.37
    },
    {
      "date": "2025-01-05",
      "views": 6428,
      "clicks": 369,
      "conversions": 19,
      "revenue": 1317.24,
      "bounceRate": 0.3
    }
  ]
}</code></pre>
<p><strong>TOON</strong> (9,115 tokens):</p>
<pre><code>metrics[5]{date,views,clicks,conversions,revenue,bounceRate}:
  2025-01-01,6138,174,12,2712.49,0.35
  2025-01-02,4616,274,34,9156.29,0.56
  2025-01-03,4460,143,8,1317.98,0.59
  2025-01-04,4740,125,13,2934.77,0.37
  2025-01-05,6428,369,19,1317.24,0.3</code></pre>
<hr />
<h4>⭐ Top 100 GitHub repositories</h4>
<p><strong>Savings:</strong> 6,400 tokens (41.7% reduction vs JSON)</p>
<p><strong>JSON</strong> (15,337 tokens):</p>
<pre><code class="language-json">{
  "repositories": [
    {
      "id": 132750724,
      "name": "build-your-own-x",
      "repo": "codecrafters-io/build-your-own-x",
      "description": "Master programming by recreating your favorite technologies from scratch.",
      "createdAt": "2018-05-09T12:03:18Z",
      "updatedAt": "2026-07-23T18:57:15Z",
      "pushedAt": "2026-07-14T19:25:58Z",
      "stars": 530712,
      "watchers": 6778,
      "forks": 50205,
      "defaultBranch": "master"
    },
    {
      "id": 21737465,
      "name": "awesome",
      "repo": "sindresorhus/awesome",
      "description": "😎 Awesome lists about all kinds of interesting topics",
      "createdAt": "2014-07-11T13:42:37Z",
      "updatedAt": "2026-07-23T18:57:24Z",
      "pushedAt": "2026-06-30T18:21:16Z",
      "stars": 488074,
      "watchers": 8292,
      "forks": 36010,
      "defaultBranch": "main"
    },
    {
      "id": 28457823,
      "name": "freeCodeCamp",
      "repo": "freeCodeCamp/freeCodeCamp",
      "description": "freeCodeCamp.org's open-source codebase and curriculum. Learn math, programming,…",
      "createdAt": "2014-12-24T17:49:19Z",
      "updatedAt": "2026-07-22T07:01:33Z",
      "pushedAt": "2026-07-21T18:00:51Z",
      "stars": 452380,
      "watchers": 8590,
      "forks": 45624,
      "defaultBranch": "main"
    }
  ]
}</code></pre>
<p><strong>TOON</strong> (8,937 tokens):</p>
<pre><code>repositories[3]{id,name,repo,description,createdAt,updatedAt,pushedAt,stars,watchers,forks,defaultBranch}:
  132750724,build-your-own-x,codecrafters-io/build-your-own-x,Master programming by recreating your favorite technologies from scratch.,"2018-05-09T12:03:18Z","2026-07-23T18:57:15Z","2026-07-14T19:25:58Z",530712,6778,50205,master
  21737465,awesome,sindresorhus/awesome,😎 Awesome lists about all kinds of interesting topics,"2014-07-11T13:42:37Z","2026-07-23T18:57:24Z","2026-06-30T18:21:16Z",488074,8292,36010,main
  28457823,freeCodeCamp,freeCodeCamp/freeCodeCamp,"freeCodeCamp.org's open-source codebase and curriculum. Learn math, programming,…","2014-12-24T17:49:19Z","2026-07-22T07:01:33Z","2026-07-21T18:00:51Z",452380,8590,45624,main</code></pre>
</div></details>
<!-- /automd -->
<h2>Installation &amp; Quick Start</h2>
<pre><code class="language-bash"># npm
npm install @toon-format/toon

# pnpm
pnpm add @toon-format/toon

# yarn
yarn add @toon-format/toon</code></pre>
<p>To keep the <a href="#cli">CLI</a> around instead of invoking it through <code>npx</code>, install it globally:</p>
<pre><code class="language-bash">npm install -g @toon-format/cli</code></pre>
<p><strong>Example usage:</strong></p>
<pre><code class="language-ts">import { encode } from '@toon-format/toon'

const data = {
  users: [
    { id: 1, name: 'Ada', role: 'admin' },
    { id: 2, name: 'Bob', role: 'user' }
  ]
}

console.log(encode(data))
// users[2]{id,name,role}:
//   1,Ada,admin
//   2,Bob,user</code></pre>
<p><strong>Streaming large datasets:</strong></p>
<pre><code class="language-ts">import { encodeLines } from '@toon-format/toon'

const largeData = await fetchThousandsOfRecords()

// Memory-efficient streaming for large data
for (const line of encodeLines(largeData)) {
  process.stdout.write(`${line}\n`)
}</code></pre>
<blockquote>
<p>[!TIP]<br />
For streaming decode APIs, see <a href="https://toonformat.dev/reference/api#decodefromlines-lines-options"><code>decodeFromLines()</code></a> and <a href="https://toonformat.dev/reference/api#decodestream-source-options"><code>decodeStream()</code></a>.</p>
</blockquote>
<p><strong>Transforming values with replacer:</strong></p>
<pre><code class="language-ts">import { encode } from '@toon-format/toon'
</code></pre>
<blockquote>
<p>README 内容已截断, 请前往 GitHub 查看完整内容。</p>
</blockquote>]]></description>
    <pubDate>Tue, 15 Sep 2026 17:19:56 +0800</pubDate>
    <dc:creator>OTO</dc:creator>
    <guid>https://cn121.com/cli/toon-format-toon.html</guid>
</item>
<item>
    <title>haystack - 用于构建上下文工程</title>
    <link>https://cn121.com/llm/deepset-ai-haystack.html</link>
    <description><![CDATA[<div class="dsh-center">
<p><a href="https://haystack.deepset.ai/"></a></p>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>持续集成/持续交付</td>
<td><a href="https://github.com/deepset-ai/haystack/actions/workflows/tests.yml"></a> <a href="https://github.com/python/mypy"></a> <a href="https://htmlpreview.github.io/?https://github.com/deepset-ai/haystack/blob/python-coverage-comment-action-data/htmlcov/index.html"></a> <a href="https://github.com/astral-sh/ruff"></a></td>
</tr>
<tr>
<td>文档</td>
<td><a href="https://docs.haystack.deepset.ai"></a></td>
</tr>
<tr>
<td>包裹</td>
<td><a href="https://pypi.org/project/haystack-ai/"></a>   <a href="https://anaconda.org/conda-forge/haystack-ai"></a> <a href="https://github.com/deepset-ai/haystack/blob/main/LICENSE"></a> <a href="https://github.com/deepset-ai/haystack/actions/workflows/license_compliance.yml"></a> <a href="https://hvtracker.net/agents/haystack/"></a> <a href="https://hvtracker.net/agents/haystack/"></a> <a href="https://www.bestpractices.dev/projects/13067"></a></td>
</tr>
<tr>
<td>元数据</td>
<td><a href="https://discord.com/invite/qZxjM4bAHU"></a> <a href="https://twitter.com/haystack_ai"></a></td>
</tr>
</tbody>
</table>
</div>
<div class="dsh-center">
<h1>🎉🎊✨ &nbsp; Haystack 3.0 已发布！ &nbsp; ✨🎊🎉</h1>
<h3>在<a href="https://haystack.deepset.ai/blog/haystack-3-release">这里</a>阅读公告！</h3>
<h2>🥳 🎈 🎆 🪅 🎇 🍾 🥂 🎁 🌈</h2>
</div>
<p><a href="https://haystack.deepset.ai/">Haystack</a> 是一个开源的 AI 编排框架，用于在 Python 中构建可投入生产的 LLM 应用。</p>
<p>设计模块化管道和代理工作流程，并对检索、路由、记忆和生成进行明确控制。构建可扩展的 RAG 系统、多模态应用、语义搜索、问答系统和自主代理，所有这些都在一个透明的架构中，让您可以进行实验、深度定制并自信部署。</p>
<h2>安装</h2>
<p>获取 Haystack 的最简单方法是通过 pip：</p>
<pre><code class="language-sh">pip install haystack-ai</code></pre>
<p>安装夜间预发布版本以尝试最新功能：</p>
<pre><code class="language-sh">pip install --pre haystack-ai</code></pre>
<p>Haystack 支持多种安装方式，包括 Docker 镜像。有关详细指南，请参阅 <a href="https://docs.haystack.deepset.ai/docs/installation">文档</a>。</p>
<h2>文档</h2>
<p>如果你是这个项目的新手，请查看 <a href="https://haystack.deepset.ai/overview/intro">&quot;Haystack 是什么？&quot;</a>，然后浏览 <a href="https://haystack.deepset.ai/overview/quick-start">&quot;入门指南&quot;</a>，并在几分钟内构建你的第一个 LLM 应用程序。继续通过 <a href="https://haystack.deepset.ai/tutorials">教程</a> 学习。对于更高级的使用场景，或者仅仅是为了获取一些灵感，你可以在 <a href="https://haystack.deepset.ai/cookbook">Cookbook</a> 中浏览我们的 Haystack 配方。</p>
<p>在任何时候，点击 <a href="https://docs.haystack.deepset.ai/docs/intro">文档</a> 以了解更多关于 Haystack 的信息，它能为你做什么，以及背后的技术。</p>
<h2>功能</h2>
<p><strong>为生产环境构建的智能代理</strong>   通过生命周期钩子（<code>before_llm</code>、<code>before_tool</code>、<code>on_exit</code> 等）扩展代理行为以实现安全控制和自定义逻辑，并开箱即用地跟踪 <code>step_count</code>、<code>token_usage</code> 和工具调用，用于监控和成本控制。通过 <a href="https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/agent_pack">Agent Pack</a> 现成代理快速上手（例如，一个深度研究代理，或一个高级 RAG 代理），或者通过 <code>SkillToolset</code> 给你的代理渐进式技能发现，使技能描述仅在需要时进入上下文。</p>
<p><strong>为上下文工程而构建</strong>   设计灵活的系统，明确控制信息在达到模型之前如何被检索、排序、过滤、组合、结构化和路由。定义管道和代理工作流，使检索、记忆、工具和生成过程透明且可追踪。</p>
<p><strong>原生异步支持</strong>   一个 <code>Pipeline</code> 可以同步或异步运行，并逐个令牌流式处理。<code>Agent</code> 可以并行运行工具调用。</p>
<p><strong>模块化且可定制</strong>   使用内置组件进行检索、索引、工具调用、记忆及评估，或者创建自己的组件。添加循环、分支和条件逻辑，以精确控制上下文在管道和代理工作流中的流动方式。</p>
<p><strong>模型和供应商无关</strong>   与 OpenAI、Mistral、Anthropic、Cohere、Hugging Face、Google、Azure OpenAI、AWS Bedrock、本地模型及其他众多平台集成。无需重写系统即可更换模型或基础设施组件。</p>
<p><strong>可扩展的生态系统</strong>   通过一致的接口构建并共享自定义组件，使社区和第三方能够轻松扩展 Haystack 并为开放生态系统做出贡献。</p>
<blockquote>
<p>[!提示]</p>
<p>您想将 Haystack 流水线部署并作为 <strong>REST API</strong> 还是 <strong>MCP 服务器</strong> 提供服务？<a href="https://github.com/deepset-ai/hayhooks">Hayhooks</a> 为您提供了一种简单的方法，可以将流水线和代理与自定义逻辑结合，并通过 HTTP 端点或 MCP 进行暴露。它还支持兼容 OpenAI 的聊天完成端点，并可与 <a href="https://openwebui.com/">open-webui</a> 等聊天界面一起使用。</p>
</blockquote>
<h2>Haystack Enterprise：支持与平台</h2>
<p>通过 <strong>Haystack Enterprise Starter</strong> 获得 Haystack 团队的专家支持，使用企业级模板更快地构建，并通过云端和本地环境的部署指南安全地扩展。在<a href="https://haystack.deepset.ai/blog/announcing-haystack-enterprise">公告文章</a>中了解更多信息。</p>
<p>👉 <a href="https://www.deepset.ai/products-and-services/haystack-enterprise-starter?utm_source=github.com&amp;utm_medium=referral&amp;utm_campaign=haystack_enterprise">获取 Haystack 企业入门版</a></p>
<p>需要Haystack托管生产配置吗？<strong>Haystack企业平台</strong>帮助您构建、测试、部署和运营Haystack流水线，并具备内置的可观察性、协作、治理和访问控制功能。它可作为托管云服务或自托管解决方案提供。</p>
<p>👉 了解更多关于 <a href="https://www.deepset.ai/products-and-services/haystack-enterprise-platform?utm_campaign=developer-relations&amp;utm_source=haystack&amp;utm_medium=readme">Haystack 企业平台</a> 的信息，或 <a href="https://www.deepset.ai/haystack-enterprise-platform-trial?utm_campaign=developer-relations&amp;utm_source=haystack&amp;utm_medium=readme">免费试用</a></p>
<h2>遥测</h2>
<p>Haystack 收集管道组件的<strong>匿名</strong>使用统计数据。每次这些组件初始化时，我们都会收到事件。这样，我们就能知道哪些组件对我们的社区最相关。</p>
<p>阅读更多关于 Haystack 中遥测的信息，或了解如何在 <a href="https://docs.haystack.deepset.ai/docs/telemetry">Haystack 文档</a> 中选择退出。</p>
<h2>🖖 社区</h2>
<p>如果您有功能请求或错误报告，请随时在 <a href="https://github.com/deepset-ai/haystack/issues">GitHub 上提交 issue</a>。我们会定期查看这些，因此您可以期待快速的回复。如果您想讨论某个主题或获得有关如何使 Haystack 在您的项目中发挥作用的一般建议，您可以在 <a href="https://github.com/deepset-ai/haystack/discussions">GitHub Discussions</a> 或我们的 <a href="https://discord.com/invite/VBpFzsgRVF">Discord 频道</a> 中发起一个讨论。我们也会查看 <a href="https://twitter.com/haystack_ai">𝕏 (Twitter)</a> 和 <a href="https://stackoverflow.com/questions/tagged/haystack">Stack Overflow</a>。</p>
<h2>为《干草堆》贡献</h2>
<p>我们非常欢迎社区的贡献——无论是快速修正一个拼写错误，还是添加一个全新的功能！你不需要成为 Haystack 专家也能提供有意义的改进。想了解如何开始，请先查看我们的<a href="https://github.com/deepset-ai/haystack/blob/main/CONTRIBUTING.md">贡献者指南</a>。</p>
<p>您可以通过以下几种方式为Haystack做出贡献：</p>
<ul>
<li>为主干草堆项目贡献力量</li>
<li>在 <a href="https://github.com/deepset-ai/haystack-core-integrations">haystack-core-integrations</a> 上贡献一个集成</li>
<li>为 <a href="https://github.com/deepset-ai/haystack/tree/main/docs-website">haystack/docs-website</a> 的文档做贡献</li>
</ul>
<blockquote>
<p>[!提示]<br />
👉 <strong><a href="https://github.com/orgs/deepset-ai/projects/14">查看所有开放贡献的问题列表</a></strong></p>
</blockquote>
<h2>使用 Haystack 的组织</h2>
<p>Haystack 被成千上万的团队用于在各行业构建生产级 AI 系统，包括：</p>
<ul>
<li><strong>技术与 AI 基础设施</strong>: <a href="https://www.apple.com/">苹果</a>、<a href="https://www.meta.com/about">Meta</a>、<a href="https://www.databricks.com/">Databricks</a>、<a href="https://developer.nvidia.com/blog/reducing-development-time-for-intelligent-virtual-assistants-in-contact-centers/">NVIDIA</a>、<a href="https://github.com/intel/open-domain-question-and-answer#readme">英特尔</a></li>
<li><strong>公共部门 AI 项目</strong>: <a href="https://commission.europa.eu/index_en">欧盟委员会</a>、<a href="https://www.deepset.ai/case-studies/german-federal-ministry-research-technology-space-bmftr">德国联邦研究技术与空间部 (BMFTR)</a>、<a href="https://www.pd-g.de/">巴登-符腾堡州 PD</a></li>
<li><strong>企业与工业 AI 应用</strong>: <a href="https://www.deepset.ai/case-studies/airbus">空客</a>、<a href="https://haystack.deepset.ai/blog/lufthansa-user-story">汉莎工业解决方案</a>、<a href="https://www.infineon.com/">英飞凌</a>、<a href="https://github.com/larsbaunwall/bricky#readme">乐高</a>、<a href="https://arxiv.org/html/2405.00801v2">康卡斯特</a>、<a href="https://www.accenture.com/">埃森哲</a>、<a href="https://www.telus.com/agcg/en">TELUS 农业与消费品</a></li>
<li><strong>知识与内容平台</strong>: <a href="https://netflix.com">Netflix</a>、<a href="https://www.deepset.ai/case-studies/zeit-online">ZEIT Online</a>、<a href="https://www.rakuten.com/">乐天</a>、<a href="https://corp.oup.com/">牛津大学出版社</a>、<a href="https://www.deepset.ai/case-studies/manz">曼兹</a>、<a href="https://www.deepset.ai/case-studies/ypulse">YPulse</a></li>
</ul>
<p>你也在使用 Haystack 吗？开一个 PR 或 <a href="https://forms.gle/Mm3G1aEST3GAH2rn8">告诉我们你的故事</a></p>]]></description>
    <pubDate>Tue, 15 Sep 2026 04:39:12 +0800</pubDate>
    <dc:creator>OTO</dc:creator>
    <guid>https://cn121.com/llm/deepset-ai-haystack.html</guid>
</item>
<item>
    <title>TencentDB-Agent-Memory - TencentDB Agent Memory是AI</title>
    <link>https://cn121.com/wiki/tencentcloud-tencentdb-agent-memory.html</link>
    <description><![CDATA[<div class="dsh-center">
<h3>让 Agent 沉淀经验，让人专注创造。</h3>
<p><a href="https://trendshift.io/repositories/29310?utm_source=repository-badge&amp;utm_medium=badge&amp;utm_campaign=badge-repository-29310" target="_blank" rel="noopener noreferrer"></a></p>
<p><a href="https://www.npmjs.com/package/@tencentdb-agent-memory/memory-tencentdb"></a> <a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/LICENSE"></a> <a href="https://nodejs.org/"></a> <a href="https://github.com/openclaw/openclaw"></a> <a href="https://hermes-agent.nousresearch.com/docs/"></a> <a href="https://discord.gg/dJQM6mKMF"></a></p>
<p><a href="#安装">安装</a> · <a href="#所有-agent-共享同一个-memory-server">支持的 Agent</a> · <a href="#tencentdb-agent-memory-是什么">项目简介</a> · <a href="#一种玩法给一个人的公司组一支会成长的-agent-队伍">团队玩法</a> · <a href="#技术实现">技术实现</a> · <a href="#benchmark">Benchmark</a> · <a href="#roadmap">Roadmap</a></p>
<p><a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/README.md">English</a> · <a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/README_CN.md"><strong>简体中文</strong></a></p>
</div>
<hr />
<blockquote>
<p><strong>最新：</strong> Team Memory Beta 版本正在快速迭代，简单安装就能玩。</p>
</blockquote>
<td>

</td>
<h1>安装</h1>
<p>一次拉起完整三件套（<code>memory-core</code> + <code>memory-hub</code> + <code>proxy</code>）：</p>
<pre><code class="language-bash">git clone https://github.com/Tencent/TencentDB-Agent-Memory.git
cd TencentDB-Agent-Memory/deploy/global-images
cp .env.example .env
$EDITOR .env       # 填入两组 LLM 参数（memory 组 + proxy 组）
./start-all.sh     # 一键起；结束会打印 claude 可直接复制的一行命令</code></pre>
<p>打开 Panel：<a href="http://localhost:8125">http://localhost:8125</a>。</p>
<p>完整安装文档（Memory Hub 单独部署 / Proxy + Claude Code / CodeBuddy 用法 / 停止清理 / 端口 说明等）见 <a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/INSTALL_CN.md"><strong>INSTALL_CN.md</strong></a>（English: <a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/INSTALL.md">INSTALL.md</a>）。 MongoDB 存储后端为<strong>试验特性</strong>（默认关闭），见 <a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/INSTALL_CN.md#可选能力mongodb-存储后端试验特性默认关闭">INSTALL_CN.md · MongoDB 存储后端</a>。</p>
<h3>从旧版本迁移数据</h3>
<p>如果你已经在用旧版（v1.x / v0.x），希望把存量数据迁到 v2.0.0+，我们提供了一个数据迁移工具： 用法和参数详见 <a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/MemoryCore/scripts/migrate-v2-to-v3/README_CN.md"><strong>数据迁移工具（v2 → v3）</strong></a>。全新安装可跳过。</p>
<h2>所有 Agent 共享同一个 Memory Server</h2>
<p>一套 Proxy，协议不变，零代码接入——把 Agent 的 base URL 指向 Proxy 即可，不需要插件、Hook 或 MCP Server。</p>
<table>
<tr>
<td align="center" width="140"><a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/INSTALL_CN.md#通过-proxy-使用-deepseek-harness-dsh"><br /><sub><b>DeepSeek Harness</b></sub></a></td>
<td align="center" width="140"><a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/INSTALL_CN.md#通过-proxy-使用-claude-code"><br /><sub><b>Claude Code</b></sub></a></td>
<td align="center" width="140"><a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/INSTALL_CN.md#通过-proxy-使用-codex"><br /><sub><b>Codex</b></sub></a></td>
<td align="center" width="140"><a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/INSTALL_CN.md#通过-proxy-使用-codebuddy"><br /><sub><b>CodeBuddy</b></sub></a></td>
</tr>
<tr>
<td align="center" width="140"><a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/INSTALL_CN.md#通过-proxy-使用-workbuddy"><br /><sub><b>WorkBuddy</b></sub></a></td>
<td align="center" width="140"><a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/INSTALL_CN.md#通过-proxy-使用-hermes"><br /><sub><b>Hermes</b></sub></a></td>
<td align="center" width="140"><a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/INSTALL_CN.md#通过-proxy-使用-openclaw"><br /><sub><b>OpenClaw</b></sub></a></td>
<td align="center" width="140"><a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/INSTALL_CN.md#其他平台接入通用"><sub><b>更多框架适配中...</b></sub></a></td>
</tr>
</table>
<p>各客户端具体配置步骤见 <a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/INSTALL_CN.md"><strong>INSTALL_CN.md</strong></a>。</p>
<p>没看到你常用的 Agent？<a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/INSTALL_CN.md#其他平台接入通用">通用接入指南</a> 可以试试自己动手适配——也欢迎直接提 PR 为它加上原生支持，参见 <a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/CONTRIBUTING_CN.md"><strong>CONTRIBUTING_CN.md</strong></a>。</p>
<h1>TencentDB Agent Memory 是什么？</h1>
<p>我们从一个很实际的问题出发：<strong>怎样减少使用 Agent 时的重复工作？</strong></p>
<p>项目背景讲过了，不该换个 Session 再讲。文档读过了，不该每个 Agent 从第一页重读。一套做法已经跑通，不该下次再摸索一遍。</p>
<p>所以这里的 Memory 不只是“记住对话”。<strong>凡是能让下一个 Agent 少走弯路的信息，都应该被保存、组织并复用。</strong></p>
<pre><code class="language-text">已有信息 → 可复用记忆资产 → 更少 Turns → 更少返工 → 更稳定的结果和更高的效率</code></pre>
<h3>让经验沉淀、流动，然后被下一位 Agent 直接继承</h3>
<p>面向 Agent 团队的 <strong>Memory Hub</strong>，让经验完成一个完整循环：工作中产生资产，资产在团队中流动，新成员进来直接读档。</p>
<ol>
<li><strong>自动沉淀资产</strong>：从对话和任务中生成 Chat Memory 与 Skill，把文档和代码变成 Wiki 与 CodeGraph，再统一管理、审核和路由。</li>
<li><strong>可迁移、兼容多Agent</strong>：记忆资产与 Agent 框架解耦，可以跨框架迁移，也可以由 Team 内的多个 Agent、多个成员共享和维护。</li>
<li><strong>冷启动友好</strong>：导入已有文档、代码库和 Agent 对话 Session，新 Agent Team 从现有经验开始工作，不必先从头学习一遍。</li>
</ol>
<h3>🧠 一个能记住人和事的大脑</h3>
<ul>
<li><strong>Chat Memory</strong> 保留偏好、事实、决策和交互历史。</li>
<li>每个 Agent 创建时自动获得独立记忆，下次对话不必从自我介绍开始。</li>
<li>L0 Conversation → L1 Atom → L2 Scenario → L3 Persona，从原始对话逐层沉淀。</li>
</ul>
<blockquote>
<p>“别重构旧鉴权模块，移动端还在用。”——这种代价很高的上下文，不应该靠人每次提醒。</p>
</blockquote>
<h3>⚡ 一个会积累经验的 Skill 库</h3>
<ul>
<li>Agent 做完复杂工作后，可以从对话和工具调用中提炼和管理可复用 Skill。并在需要时导入到指定Agent的上下文。</li>
<li>Skill 不只是一段 Prompt：它有版本、资源文件、触发边界、执行步骤和验证规则。</li>
<li>个人 Skill 默认私有；审核后可分享给团队，再配装给其他 Agent。</li>
</ul>
<blockquote>
<p>排障、Review、上线检查——练会一次，全队可用。</p>
</blockquote>
<h3>📖 一张同时看懂文档和代码的知识地图</h3>
<ul>
<li>
<p><strong>Wiki</strong> 把产品文档、设计方案和运维手册生成结构化页面与链接图谱。(灵感来源于 Karpathy 的 LLM 知识库)</p>
</li>
<li>
<p><strong>CodeGraph</strong> 索引代码符号、文件、调用关系和影响路径。</p>
</li>
<li>
<p>Agent 可以搜索、阅读、查 callers / callees，也可以在改代码前先做 impact analysis。</p>
</li>
</ul>
<blockquote>
<p>Wiki 不让 Agent 先读完所有文件目录再开工。CodeGraph 不只告诉它“代码在这”，还告诉它“改了可能影响哪”。</p>
</blockquote>
<h3>🛡️ 一个由人掌握的团队记忆面板</h3>
<ul>
<li>在 Memory Hub 里创建 Team 和 Agent，审核、分享并配装记忆资产。</li>
<li>统一管理 Owner、版本、状态、可见性、使用次数与 Agent 绑定。</li>
<li><code>private</code> 严格属于 Owner；<code>team</code> 面向全队；<code>restricted</code> 通过 User / Role / Agent ACL 精确授权。</li>
<li>角色分两层：<strong>全局 System Admin</strong> 管理用户与团队（建团队、录入成员），也可使用 Wiki、CodeGraph、Skill 等资产管理功能；<strong>Team 内角色</strong> 分为 Admin（团队管理员）和 Member（普通成员），负责团队内的资产协作与权限控制。资产归属通过 Owner 标记，Owner 自动获得对应资产的管理权限。 </li>
</ul>
<h2>冷启动：先读档，再开工</h2>
<p>多数 Agent 的第一件工作，是重新学习你的项目，TencentDB Agent Memory 把你已经付过的学习成本变成存档：</p>
<p>具体来说，这些已有资产可以直接在面板导入和自动被处理：</p>
<ul>
<li><strong>代码库</strong>：导入已有代码库，<strong>CodeGraph</strong> 自动索引符号、文件、调用关系与影响路径。</li>
<li><strong>文档与文件</strong>：导入相关文档和文件，<strong>Wiki</strong> 自动生成结构化页面与链接图谱。</li>
<li><strong>对话 Session</strong>：导入过去和 Agent 的对话 Session，<strong>Skill 与 Chat Memory</strong> 自动提取可复用 Skill 与记忆资产。</li>
</ul>
<blockquote>
<p>不再重新训练每一个 Agent。给它读档。</p>
</blockquote>
<h2>一种玩法：给一个人的公司组一支会成长的 Agent 队伍</h2>
<p>打开 Memory Hub，建一个 Team：</p>
<pre><code class="language-text">Tiny but Serious Inc.
├── 👤 You · 定目标 / 做判断
├── 🔭 Scout · 查资料 / 找机会
├── 🛠 Builder · 写代码 / 做产品
├── 🧪 Reviewer · 测试 / 挑毛病
└── 🧠 Agent Memory · 让经验留在队伍里</code></pre>
<p>你不是在开四个彼此失联的聊天窗口，而是在组一支角色不同、能够继承团队经验的 Agent 小队。</p>
<h3>先招人，然后配装备</h3>
<pre><code class="language-text">🔭 Scout
   ├── 用户访谈 Chat Memory
   ├── 市场研究 Wiki
   └── 竞品分析 Skill

🛠 Builder
   ├── 产品 Wiki
   ├── 项目 CodeGraph
   └── Feature Delivery Skill

🧪 Reviewer
   ├── 历史事故 Chat Memory
   ├── 项目 CodeGraph
   └── Release Checklist Skill</code></pre>
<p>不同角色，不同 Loadout。少给噪音，多给它完成工作真正需要的记忆。</p>
<p><strong>公司可以很小，经验可以一直复利。</strong></p>
<h2>记忆资产，不是聊天记录仓库</h2>
<p>RAG 解决“能查到什么”。Team Memory 还要解决“谁可以用、哪个版本有效、应该给哪个 Agent”。</p>
<table>
<thead>
<tr>
<th style="text-align: left;"></th>
<th style="text-align: center;">聊天历史</th>
<th style="text-align: center;">普通 RAG</th>
<th style="text-align: center;">TencentDB Agent Memory</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">跨会话理解用户</td>
<td style="text-align: center;">△</td>
<td style="text-align: center;">△</td>
<td style="text-align: center;">✅ Chat Memory</td>
</tr>
<tr>
<td style="text-align: left;">沉淀可执行经验</td>
<td style="text-align: center;">—</td>
<td style="text-align: center;">—</td>
<td style="text-align: center;">✅ Skill</td>
</tr>
<tr>
<td style="text-align: left;">文档结构与关系</td>
<td style="text-align: center;">—</td>
<td style="text-align: center;">△ 切片检索</td>
<td style="text-align: center;">✅ Wiki + Link Graph</td>
</tr>
<tr>
<td style="text-align: left;">代码调用与影响范围</td>
<td style="text-align: center;">—</td>
<td style="text-align: center;">△ 文本命中</td>
<td style="text-align: center;">✅ CodeGraph</td>
</tr>
<tr>
<td style="text-align: left;">Owner / 版本 / 状态</td>
<td style="text-align: center;">—</td>
<td style="text-align: center;">—</td>
<td style="text-align: center;">✅</td>
</tr>
<tr>
<td style="text-align: left;">团队分享与 Agent 配装</td>
<td style="text-align: center;">—</td>
<td style="text-align: center;">—</td>
<td style="text-align: center;">✅</td>
</tr>
<tr>
<td style="text-align: left;">私有 / 团队 / ACL</td>
<td style="text-align: center;">—</td>
<td style="text-align: center;">△</td>
<td style="text-align: center;">✅</td>
</tr>
</tbody>
</table>
<h2>Memory Hub 不是展板，是操作台</h2>
<table>
<thead>
<tr>
<th style="text-align: left;">玩法</th>
<th style="text-align: left;">在 Hub 里做什么</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong>组队</strong></td>
<td style="text-align: left;">建立 Team，加入人和 Agent，确定共享边界</td>
</tr>
<tr>
<td style="text-align: left;"><strong>资产背包</strong></td>
<td style="text-align: left;">打开、搜索、审核和管理 Chat Memory、Skill、Wiki 与 CodeGraph</td>
</tr>
<tr>
<td style="text-align: left;"><strong>Agent Loadout</strong></td>
<td style="text-align: left;">给不同 Agent 绑定不同记忆，调整优先级与使用方式</td>
</tr>
<tr>
<td style="text-align: left;"><strong>Knowledge 工坊</strong></td>
<td style="text-align: left;">构建 Wiki 和 CodeGraph，查看处理状态和资产信息</td>
</tr>
<tr>
<td style="text-align: left;"><strong>权限控制</strong></td>
<td style="text-align: left;">在私有、团队与 ACL 授权之间切换，必要时收回共享</td>
</tr>
</tbody>
</table>
<p>点开一条资产，关心的不只是“它写了什么”，还有“它从哪来、是哪个版本、分给了谁、最近是否被使用”。</p>
<h2>给每次 Loop 加一条经验值</h2>
<p>这里的 Memory 不负责替 Agent 跑 Loop，它负责让下一轮继承上一轮的成果：有价值的交互留在 Chat Memory，跑通的做法可以提炼为 Skill，文档和代码变化则通过 Wiki ingest 与 CodeGraph sync 更新。</p>
<p><strong>没有 Memory，Loop 可能只是更快地重复。能继承记忆，每一轮才有机会比上一轮更好。</strong></p>
<h2>一支 Agent 团队，共享经验，不共享隐私</h2>
<p>新 Chat Memory 和 Skill 默认私有。分享是一个明确动作，不是默认泄漏。</p>
<table>
<thead>
<tr>
<th style="text-align: left;">可见性</th>
<th style="text-align: left;">语义</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><code>private</code></td>
<td style="text-align: left;">只有 Owner 可读，团队管理员也不例外</td>
</tr>
<tr>
<td style="text-align: left;"><code>team</code></td>
<td style="text-align: left;">团队成员可读，Owner / Admin 负责管理</td>
</tr>
<tr>
<td style="text-align: left;"><code>restricted</code></td>
<td style="text-align: left;">通过 User / Role / Agent ACL 精确授权</td>
</tr>
<tr>
<td style="text-align: left;"><code>agent</code></td>
<td style="text-align: left;">用于同团队 Agent 的定向装配</td>
</tr>
</tbody>
</table>
<p>你可以把“发布 Skill”给 Release Agent，把“架构 Wiki”给所有开发 Agent，把 CodeGraph 给 Coder 和 Reviewer。</p>
<h2>技术实现</h2>
<p>TencentDB Agent Memory 不追求“存下所有东西”，而是解决三个问题：<strong>什么值得留下、谁可以使用、下一次怎样少拿但拿对。</strong></p>
<h3>1. 记忆不是平铺记录，而是逐层生长</h3>
<p>对话首先作为 L0 保存，再由异步 Pipeline 提炼为不同粒度的记忆：</p>
<table>
<thead>
<tr>
<th style="text-align: left;">层级</th>
<th style="text-align: left;">保存什么</th>
<th style="text-align: left;">主要用途</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong>L0 Conversation</strong></td>
<td style="text-align: left;">原始对话与完整上下文</td>
<td style="text-align: left;">核对原话、时间和来源</td>
</tr>
<tr>
<td style="text-align: left;"><strong>L1 Atom</strong></td>
<td style="text-align: left;">从对话提取的事实、偏好、约束与事件</td>
<td style="text-align: left;">精确召回可执行信息</td>
</tr>
<tr>
<td style="text-align: left;"><strong>L2 Scenario</strong></td>
<td style="text-align: left;">围绕项目或场景组织的知识块</td>
<td style="text-align: left;">快速恢复一个工作场景</td>
</tr>
<tr>
<td style="text-align: left;"><strong>L3 Core / Persona</strong></td>
<td style="text-align: left;">长期画像、稳定模式与高层认知</td>
<td style="text-align: left;">让 Agent 迅速进入用户和团队语境</td>
</tr>
</tbody>
</table>
<p>生成和召回都分层：平时用 L2 / L3 快速进入语境，需要具体事实时通过 BM25、向量检索与 RRF 回到 L1 / L0。结果还会经过条数、字符预算和超时限制，避免记忆反过来占满上下文。</p>
<h3>2. 记忆不是全局 Prompt，而是 Agent 的 Loadout</h3>
<p>Chat Memory、Skill、Wiki 和 CodeGraph 都被统一登记为 Memory Asset。Memory Hub 通过 <strong>Fixed Binding + ACL</strong> 决定某个 Agent 能带走哪些资产：先按 Team、User、Agent 和可见性缩小权限范围，再按当前问题召回。</p>
<p>因此团队可以共享经验，却不必共享全部隐私；换 Agent 或换框架，也只需重新装配，不必重新训练。</p>
<h3>3. 知识不整库注入，而是按需调用</h3>
<p>文档被整理为可搜索、可沿链接下钻的 Wiki；代码库被索引为包含文件、符号和调用关系的 CodeGraph。Agent 先通过 <code>/v3/tools/list</code> 发现能力，再用 <code>/v3/tools/call</code> 读取相关页面、源码或影响路径。</p>
<p>这让文档和代码也成为记忆，但它们平时只是可用的工具，只有真正需要时才进入上下文。</p>
<h2>Benchmark</h2>
<table>
<thead>
<tr>
<th style="text-align: left;">Benchmark</th>
<th style="text-align: center;">无 TencentDB Agent Memory</th>
<th style="text-align: center;">启用后</th>
<th style="text-align: center;">相对提升</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong>PersonaMem</strong></td>
<td style="text-align: center;">48%</td>
<td style="text-align: center;"><strong>76%</strong></td>
<td style="text-align: center;"><strong>+59%</strong></td>
</tr>
</tbody>
</table>
<p>PersonaMem 检验Agent 能否在长期交互后正确理解和运用用户信息。</p>
<h2>注意事项</h2>
<ul>
<li>Wiki 和 CodeGraph 异步构建，需要等待一定时间处理才能 <code>ready</code>。</li>
<li>CodeGraph 当前首先支持公开 HTTPS 仓库；私有仓库和 SSH 凭证接入仍在完善。</li>
<li>Hub 已支持人工绑定资产；全自动记忆路由仍在迭代。</li>
</ul>
<h2>相关文档</h2>
<ul>
<li><a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/ROADMAP_CN.md">路线图</a>（接下来要做什么）</li>
<li><a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/INSTALL_CN.md">完整安装指南</a>（Memory Core + Hub + Proxy 一键部署）</li>
<li><a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/ROADMAP_CN.md">Roadmap</a>（我们接下来在做什么；English: <a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/ROADMAP.md">ROADMAP.md</a>）</li>
<li><a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/MemoryCore/scripts/migrate-v2-to-v3/README_CN.md">数据迁移工具（v2 → v3）</a>（如果在用旧版并想迁移存量数据）</li>
<li><a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/MemoryKnowledge/openapi.yaml">Knowledge OpenAPI</a></li>
<li><strong>API 文档</strong>：
<ul>
<li><a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/MemoryCore/v3-api-memorycore-doc.md">Memory Core v3 API</a></li>
<li><a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/MemoryKnowledge/v3-api-memoryknowledge-doc.md">Memory Knowledge v3 API</a></li>
<li><a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/MemoryProxy/v3-api-memoryproxy-doc.md">Memory Proxy v3 API</a></li>
<li><a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/MemoryPanel/panel-api-doc.md">Memory Panel API</a></li>
</ul></li>
<li><a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/CONTRIBUTING_CN.md">贡献指南</a></li>
</ul>
<p>Agent Memory 还没有标准答案。Bug、文档、Benchmark、新框架适配，或者一个你觉得更好玩的 Memory Hub 用法，都欢迎。</p>
<hr />
<h2>Roadmap</h2>
<p>当前版本 <strong>v2.0.0</strong>。下个版本（<strong>v2.0.1</strong>）的重点：零配置冷启动、更快的 Wiki 生成、用户 / 团队自定义 Prompt、Skill 导出，以及 Codex（IDE Plan 模式）接入。</p>
<p>👉 完整计划见 <a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/ROADMAP_CN.md"><strong>ROADMAP_CN.md</strong></a>（English: <a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/ROADMAP.md">ROADMAP.md</a>）。</p>
<hr />
<h2>致谢</h2>
<p>TencentDB Agent Memory 的设计站在开源社区的肩膀上：</p>
<ul>
<li><a href="https://github.com/colbymchenry/codegraph"><strong>CodeGraph</strong></a>：我们的 CodeGraph 资产模块<strong>复用了该项目的代码</strong>。其&quot;预索引的代码图谱&quot;的设计，是我们该模块实现的基础。</li>
<li><a href="https://github.com/nousresearch/hermes-agent"><strong>Hermes Agent</strong></a>（Nous Research）：我们的 Skill 资产管理<strong>复用了 Hermes Agent 中部分 Skill 相关代码，并在此基础上做了进一步优化</strong>。</li>
<li><a href="https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f"><strong>Andrej Karpathy 的 &quot;LLM Wiki&quot;</strong></a>：将文档视为由 LLM 增量维护、可持续复利的知识产物的思路，直接影响了我们 Wiki 层的构建与维护方式。</li>
</ul>
<p>在此向以上项目的作者与贡献者致以谢意。</p>
<hr />
<h2>社区与贡献</h2>
<p>我们欢迎一切形式的贡献——Bug 反馈、功能建议、文档勘误、Benchmark 复现、生态集成，或者一个 Pull Request 都可以。Agent 记忆这件事远未有定论，希望和大家一起把它做出来。</p>
<ul>
<li>🐞 <strong>发现 Bug 或有疑问？</strong> 欢迎到 <a href="https://github.com/Tencent/TencentDB-Agent-Memory/issues">GitHub Issues</a> 提交，我们会在 24 小时内响应。</li>
<li>💡 <strong>有想法想交流？</strong> 欢迎在 <a href="https://github.com/Tencent/TencentDB-Agent-Memory/discussions">GitHub Discussions</a> 发起讨论。</li>
<li>🛠️ <strong>想贡献代码？</strong> 请先阅读 <a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/CONTRIBUTING_CN.md">CONTRIBUTING.md</a>。</li>
<li>
<h2>💬 <strong>想加入交流群？</strong> 扫码加入 <strong>Agent Memory 微信社群</strong>，与早期开发者直接对话。</h2>
</li>
</ul>
<p align="center">
  让团队走过的路，成为下一个 Agent 的起点.
</p>
<hr />
<h2>Star 趋势</h2>
<p align="center">
  <a href="https://www.star-history.com/#Tencent/TencentDB-Agent-Memory&Date">

  </a>
</p>
<hr />
<p><a href="https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/feat/server_team/LICENSE">MIT</a> © TencentDB Agent Memory Team</p>]]></description>
    <pubDate>Tue, 15 Sep 2026 04:39:06 +0800</pubDate>
    <dc:creator>OTO</dc:creator>
    <guid>https://cn121.com/wiki/tencentcloud-tencentdb-agent-memory.html</guid>
</item>
<item>
    <title>ai - TypeScript的AI工具包</title>
    <link>https://cn121.com/llm/vercel-ai.html</link>
    <description><![CDATA[<h1>人工智能 SDK</h1>
<p><a href="https://ai-sdk.dev/docs">人工智能 SDK</a> 是一个与提供商无关的 TypeScript 工具包，旨在帮助您使用流行的 UI 框架（如 Next.js、React、Svelte、Vue、Angular）以及 Node.js 等运行时构建人工智能驱动的应用程序和代理。</p>
<p>要了解有关如何使用人工智能 SDK 的更多信息，请查看我们的 <a href="https://ai-sdk.dev/docs/reference">API 参考</a> 和 <a href="https://ai-sdk.dev/docs">文档</a>。</p>
<h2>安装</h2>
<p>您需要在本地开发机器上安装 Node.js 22 及 npm（或其他包管理器）。</p>
<pre><code class="language-shell">npm install ai</code></pre>
<h2>编码代理技能</h2>
<p>如果您使用诸如 Claude Code 或 Cursor 这样的编码代理，我们强烈建议将 AI SDK 技能添加到您的代码库中：</p>
<pre><code class="language-shell">npx skills add vercel/ai</code></pre>
<h2>统一提供者架构</h2>
<p>AI SDK 提供了一个 <a href="https://ai-sdk.dev/docs/foundations/providers-and-models">统一 API</a>，可以与模型提供者进行交互，例如 <a href="https://ai-sdk.dev/providers/ai-sdk-providers/openai">OpenAI</a>、<a href="https://ai-sdk.dev/providers/ai-sdk-providers/anthropic">Anthropic</a>、<a href="https://ai-sdk.dev/providers/ai-sdk-providers/google">Google</a> 以及 <a href="https://ai-sdk.dev/providers/ai-sdk-providers">更多</a>。</p>
<p>默认情况下，AI SDK 使用 <a href="https://vercel.com/docs/ai-gateway">Vercel AI 网关</a>，让您开箱即可访问所有主要提供者。只需为任何支持的模型传入模型字符串:</p>
<pre><code class="language-ts">const result = await generateText({
  model: 'anthropic/claude-opus-4.6', // or 'openai/gpt-5.4', 'google/gemini-3-flash', etc.
  prompt: 'Hello!',
});</code></pre>
<p>你也可以使用他们的 SDK 包直接连接到供应商：</p>
<pre><code class="language-shell">npm install @ai-sdk/openai @ai-sdk/anthropic @ai-sdk/google</code></pre>
<pre><code class="language-ts">import { anthropic } from '@ai-sdk/anthropic';

const result = await generateText({
  model: anthropic('claude-opus-4-6'), // or openai('gpt-5.4'), google('gemini-3-flash'), etc.
  prompt: 'Hello!',
});</code></pre>
<h2>使用</h2>
<h3>生成文本</h3>
<pre><code class="language-ts">import { generateText } from 'ai';

const { text } = await generateText({
  model: 'openai/gpt-5.4', // use Vercel AI Gateway
  prompt: 'What is an agent?',
});</code></pre>
<h3>生成结构化数据</h3>
<pre><code class="language-ts">import { generateText, Output } from 'ai';
import { z } from 'zod';

const { output } = await generateText({
  model: 'openai/gpt-5.4',
  output: Output.object({
    schema: z.object({
      recipe: z.object({
        name: z.string(),
        ingredients: z.array(
          z.object({ name: z.string(), amount: z.string() }),
        ),
        steps: z.array(z.string()),
      }),
    }),
  }),
  prompt: 'Generate a lasagna recipe.',
});</code></pre>
<h3>代理人</h3>
<pre><code class="language-ts">import { ToolLoopAgent } from 'ai';

const sandboxAgent = new ToolLoopAgent({
  model: 'openai/gpt-5.4',
  system: 'You are an agent with access to a shell environment.',
  tools: {
    shell: openai.tools.localShell({
      execute: async ({ action }) =&gt; {
        const [cmd, ...args] = action.command;
        const sandbox = await getSandbox(); // Vercel Sandbox
        const command = await sandbox.runCommand({ cmd, args });
        return { output: await command.stdout() };
      },
    }),
  },
});</code></pre>
<h3>UI 集成</h3>
<p><a href="https://ai-sdk.dev/docs/ai-sdk-ui/overview">AI SDK UI</a> 模块提供了一组钩子，帮助你构建聊天机器人和生成式用户界面。这些钩子与框架无关，因此可以在 Next.js、React、Svelte 和 Vue 中使用。</p>
<p>你需要为你的框架安装该包，例如：</p>
<pre><code class="language-shell">npm install @ai-sdk/react</code></pre>
<h4>代理 @/agent/image-generation-agent.ts</h4>
<pre><code class="language-ts">import { openai } from '@ai-sdk/openai';
import { ToolLoopAgent, InferAgentUIMessage } from 'ai';

export const imageGenerationAgent = new ToolLoopAgent({
  model: 'openai/gpt-5.4',
  tools: {
    generateImage: openai.tools.imageGeneration({
      partialImages: 3,
    }),
  },
});

export type ImageGenerationAgentMessage = InferAgentUIMessage&lt;
  typeof imageGenerationAgent
&gt;;</code></pre>
<h4>路由（Next.js 应用路由器）@/app/api/chat/route.ts</h4>
<pre><code class="language-tsx">import { imageGenerationAgent } from '@/agent/image-generation-agent';
import { createAgentUIStreamResponse } from 'ai';

export async function POST(req: Request) {
  const { messages } = await req.json();

  return createAgentUIStreamResponse({
    agent: imageGenerationAgent,
    messages,
  });
}</code></pre>
<h4>工具的 UI 组件 @/component/image-generation-view.tsx</h4>
<pre><code class="language-tsx">import { openai } from '@ai-sdk/openai';
import { UIToolInvocation } from 'ai';

export default function ImageGenerationView({
  invocation,
}: {
  invocation: UIToolInvocation&lt;ReturnType&lt;typeof openai.tools.imageGeneration&gt;&gt;;
}) {
  switch (invocation.state) {
    case 'input-available':
      return &lt;div&gt;Generating image...&lt;/div&gt;;
    case 'output-available':
      return ;
  }
}</code></pre>
<h4>页面 @/app/page.tsx</h4>
<pre><code class="language-tsx">'use client';

import { ImageGenerationAgentMessage } from '@/agent/image-generation-agent';
import ImageGenerationView from '@/component/image-generation-view';
import { useChat } from '@ai-sdk/react';

export default function Page() {
  const { messages, status, sendMessage } =
    useChat&lt;ImageGenerationAgentMessage&gt;();

  const [input, setInput] = useState('');
  const handleSubmit = e =&gt; {
    e.preventDefault();
    sendMessage({ text: input });
    setInput('');
  };

  return (
    &lt;div&gt;
      {messages.map(message =&gt; (
        &lt;div key={message.id}&gt;
          &lt;strong&gt;{`${message.role}: `}&lt;/strong&gt;
          {message.parts.map((part, index) =&gt; {
            switch (part.type) {
              case 'text':
                return &lt;div key={index}&gt;{part.text}&lt;/div&gt;;
              case 'tool-generateImage':
                return &lt;ImageGenerationView key={index} invocation={part} /&gt;;
            }
          })}
        &lt;/div&gt;
      ))}

      &lt;form onSubmit={handleSubmit}&gt;
        &lt;input
          value={input}
          onChange={e =&gt; setInput(e.target.value)}
          disabled={status !== 'ready'}
        /&gt;
      &lt;/form&gt;
    &lt;/div&gt;
  );
}</code></pre>
<h2>模板</h2>
<p>我们已经创建了包含针对不同用例、提供商和框架的 AI SDK 集成的<a href="https://ai-sdk.dev/docs/introduction#templates">模板</a>。你可以使用这些模板来开始你的 AI 驱动应用程序。</p>
<h2>社区</h2>
<p>AI SDK 社区可以在 <a href="https://community.vercel.com/c/ai-sdk/62">Vercel 社区</a> 上找到，你可以在这里提问、提出想法，并与其他人分享你的项目。</p>
<h2>参与贡献</h2>
<p>非常欢迎并高度赞赏对 AI SDK 的贡献。然而，在你直接开始之前，我们希望你先查看我们的<a href="https://github.com/vercel/ai/blob/main/CONTRIBUTING.md">贡献指南</a>，以确保你参与 AI SDK 贡献时有顺畅的体验。</p>
<h2>作者</h2>
<p>此库由 <a href="https://vercel.com">Vercel</a> 和 <a href="https://nextjs.org">Next.js</a> 团队成员创建，并得到 <a href="https://github.com/vercel/ai/graphs/contributors">开源社区</a> 的贡献。</p>]]></description>
    <pubDate>Tue, 15 Sep 2026 04:38:59 +0800</pubDate>
    <dc:creator>OTO</dc:creator>
    <guid>https://cn121.com/llm/vercel-ai.html</guid>
</item>
<item>
    <title>agenticSeek - 完全本地化的Manus AI</title>
    <link>https://cn121.com/llm/fosowl-agenticseek.html</link>
    <description><![CDATA[<h1>AgenticSeek：私有、本地的 Manus 替代方案</h1>
<p><em>一个<strong>100%本地运行的 Manus AI 替代品</strong>，支持语音的 AI 助手，可自主浏览网页、编写代码、规划任务，所有数据仅保存在你的设备上。专为本地推理模型设计，完全在你的硬件上运行，确保隐私无忧，无需云端依赖。</em></p>
<p><a href="https://fosowl.github.io/agenticSeek.html"></a>  <a href="https://discord.gg/8hGDaME3TC"></a> <a href="https://x.com/Martin993886460"></a> <a href="https://github.com/Fosowl/agenticSeek/stargazers"></a></p>
<h3>为什么选择 AgenticSeek？</h3>
<ul>
<li>
<p>🔒 完全本地 &amp; 私有 —— 所有内容都在你的电脑上运行，无云端、无数据共享。你的文件、对话和搜索都保持私密。</p>
</li>
<li>
<p>🌐 智能网页浏览 —— AgenticSeek 可自主浏览互联网：搜索、阅读、提取信息、填写网页表单，全程免手动。</p>
</li>
<li>
<p>💻 自动化编程助手 —— 需要代码？它能编写、调试并运行 Python、C、Go、Java 等程序，无需监督。</p>
</li>
<li>
<p>🧠 智能代理选择 —— 你提问，它自动判断最合适的代理来完成任务。就像有一支专家团队随时待命。</p>
</li>
<li>
<p>📋 规划并执行复杂任务 —— 从旅行规划到复杂项目，可将大任务拆分为步骤，调用多个 AI 代理协作完成。</p>
</li>
<li>
<p>🎙️ 语音支持 —— 干净、快速、未来感的语音与语音转文本功能，让你像科幻电影中的 AI 一样与它对话。（开发中）</p>
</li>
</ul>
<h3><strong>演示</strong></h3>
<blockquote>
<p><em>你能搜索 agenticSeek 项目，了解需要哪些技能，然后打开 CV_candidates.zip 并告诉我哪些最匹配该项目吗？</em></p>
</blockquote>
<p><a href="https://github.com/user-attachments/assets/b8ca60e9-7b3b-4533-840e-08f9ac426316">https://github.com/user-attachments/assets/b8ca60e9-7b3b-4533-840e-08f9ac426316</a></p>
<p>免责声明：本演示及出现的所有文件（如 CV_candidates.zip）均为虚构。我们不是公司，只寻求开源贡献者而非候选人。</p>
<blockquote>
<p>🛠⚠️️ <strong>项目正在积极开发中</strong></p>
<p>🙏 本项目起初只是一个副业，没有路线图也没有资金支持。它意外地登上了 GitHub Trending。非常感谢大家的贡献、反馈与耐心。</p>
</blockquote>
<h2>前置条件</h2>
<p>开始前，请确保已安装以下软件：</p>
<ul>
<li><strong>Git:</strong> 用于克隆仓库。<a href="https://git-scm.com/downloads">下载 Git</a></li>
<li><strong>Python 3.10.x:</strong> 强烈推荐使用 Python 3.10.x 版本。使用其他版本可能导致依赖错误。<a href="https://www.python.org/downloads/release/python-3100/">下载 Python 3.10</a>（选择 3.10.x 版本）。</li>
<li><strong>Docker Engine &amp; Docker Compose:</strong> 用于运行捆绑服务如 SearxNG。
<ul>
<li>安装 Docker Desktop（包含 Docker Compose V2）：<a href="https://docs.docker.com/desktop/install/windows-install/">Windows</a> | <a href="https://docs.docker.com/desktop/install/mac-install/">Mac</a> | <a href="https://docs.docker.com/desktop/install/linux-install/">Linux</a></li>
<li>或者在 Linux 上分别安装 Docker Engine 和 Docker Compose：<a href="https://docs.docker.com/engine/install/">Docker Engine</a> | <a href="https://docs.docker.com/compose/install/">Docker Compose</a>（确保安装 Compose V2，例如 <code>sudo apt-get install docker-compose-plugin</code>）。</li>
</ul></li>
</ul>
<h3>1. <strong>克隆仓库并设置</strong></h3>
<pre><code class="language-sh">git clone https://github.com/Fosowl/agenticSeek.git
cd agenticSeek
mv .env.example .env</code></pre>
<h3>2. 修改 .env 文件内容</h3>
<pre><code class="language-sh">SEARXNG_BASE_URL="http://searxng:8080" # 取值取决于后端在哪里运行 — 参见下方的 SEARXNG 说明
SEARXNG_PORT=8080
REDIS_BASE_URL="redis://redis:6379/0"
WORK_DIR="/Users/mlg/Documents/workspace_for_ai"
OLLAMA_PORT="11434"
LM_STUDIO_PORT="1234"
CUSTOM_ADDITIONAL_LLM_PORT="11435"
OPENAI_API_KEY='optional'
DEEPSEEK_API_KEY='optional'
OPENROUTER_API_KEY='optional'
TOGETHER_API_KEY='optional'
GOOGLE_API_KEY='optional'
ANTHROPIC_API_KEY='optional'</code></pre>
<p>根据需要更新 <code>.env</code> 文件：</p>
<ul>
<li><strong>SEARXNG_PORT</strong>: Docker 将 SearXNG 发布到<strong>主机</strong>上的端口。如果您机器上的端口 <code>8080</code> 已被占用，请设置为其他端口（例如 <code>8001</code>）。在 Docker 内部，容器始终监听 <code>8080</code> — 该变量永远不会改变这一点。</li>
<li><strong>SEARXNG_BASE_URL</strong>: <strong>后端</strong>用来访问 SearXNG 的地址。它在 <code>.env</code> 中设置（而不是在 <code>config.ini</code> 中），并且只取决于后端在哪里运行：</li>
</ul>
<table>
<thead>
<tr>
<th>AgenticSeek 的运行方式</th>
<th><code>SEARXNG_BASE_URL</code></th>
</tr>
</thead>
<tbody>
<tr>
<td>Web 界面 — 后端在 Docker 中（<code>./start_services.sh full</code>）</td>
<td><code>http://searxng:8080</code> — 始终是端口 <code>8080</code>，即使您修改了 <code>SEARXNG_PORT</code></td>
</tr>
<tr>
<td>CLI 模式 — 后端在主机上（<code>uv run cli.py</code>）</td>
<td><code>http://localhost:8080</code> — 如果您修改了 <code>SEARXNG_PORT</code>，请改用该端口（例如 <code>http://localhost:8001</code>）。<code>http://searxng:...</code> 在这里<strong>不</strong>可用：该主机名只存在于 Docker 内部</td>
</tr>
</tbody>
</table>
<blockquote>
<p>要在浏览器中检查 SearXNG，请始终使用主机端口：<code>http://localhost:&lt;SEARXNG_PORT&gt;</code>。修改 <code>.env</code> 后请重启后端 — 该文件只在进程启动时读取。</p>
<ul>
<li><strong>REDIS_BASE_URL</strong>: 保持不变 </li>
<li><strong>WORK_DIR</strong>: 本地工作目录路径。AgenticSeek 可读取和操作这些文件。</li>
<li><strong>OLLAMA_PORT</strong>: Ollama 服务端口号。</li>
<li><strong>LM_STUDIO_PORT</strong>: LM Studio 服务端口号。</li>
<li><strong>CUSTOM_ADDITIONAL_LLM_PORT</strong>: 任何额外自定义 LLM 服务的端口。</li>
</ul>
</blockquote>
<p><strong>API 密钥对于选择本地运行 LLM 的用户完全可选，这也是本项目的主要目的。如果硬件足够，请留空。</strong></p>
<h3>3. <strong>启动 Docker</strong></h3>
<p>确保 Docker 已安装并在系统上运行。可以使用以下命令启动 Docker：</p>
<ul>
<li>
<p><strong>Linux/macOS:</strong><br />
打开终端运行：</p>
<pre><code class="language-sh">sudo systemctl start docker</code></pre>
<p>或者如果已安装，从应用程序菜单启动 Docker Desktop。</p>
</li>
<li>
<p><strong>Windows:</strong><br />
从开始菜单启动 Docker Desktop。</p>
</li>
</ul>
<p>可以通过执行以下命令验证 Docker 是否运行：</p>
<pre><code class="language-sh">docker info</code></pre>
<p>如果看到 Docker 安装信息，则表示运行正常。</p>
<p>请参阅下面的<a href="#本地提供商列表">本地提供商列表</a>了解摘要。</p>
<p>下一步：<a href="#启动服务并运行">本地运行 AgenticSeek</a></p>
<p><em>如果遇到问题，请参阅<a href="#故障排除">故障排除</a>部分。</em> <em>如果硬件无法本地运行 LLM，请参阅<a href="#使用-api-运行设置">使用 API 运行设置</a>。</em> <em>有关详细 <code>config.ini</code> 说明，请参阅<a href="#配置">配置部分</a>。</em></p>
<hr />
<h2>在您的机器上本地运行 LLM 的设置</h2>
<p><strong>硬件要求：</strong></p>
<p>要本地运行 LLM，您需要足够的硬件。至少需要能够运行 Magistral、Qwen 或 Deepseek 14B 的 GPU。有关详细的模型/性能建议，请参阅 FAQ。</p>
<p><strong>设置您的本地提供商</strong>  </p>
<p>启动您的本地提供商，例如使用 ollama：</p>
<pre><code class="language-sh">ollama serve</code></pre>
<p>请参阅下面的本地支持提供商列表。</p>
<p><strong>更新 config.ini</strong></p>
<p>更改 config.ini 文件，将 provider_name 设置为支持的提供商，provider_model 设置为您的提供商支持的 LLM。我们推荐推理模型，如 <em>Magistral</em> 或 <em>Deepseek</em>。</p>
<p>有关所需硬件，请参阅 README 末尾的 <strong>FAQ</strong>。</p>
<pre><code class="language-sh">[MAIN]
is_local = True # 无论您是本地运行还是使用远程提供商。
provider_name = ollama # 或 lm-studio、openai 等。
provider_model = deepseek-r1:14b # 选择适合您硬件的模型
provider_server_address = 127.0.0.1:11434
agent_name = Jarvis # 您的 AI 名称
recover_last_session = True # 是否恢复上一个会话
save_session = True # 是否记住当前会话
speak = False # 文本转语音
listen = False # 语音转文本，仅限 CLI，实验性
jarvis_personality = False # 是否使用更"Jarvis"风格的性格（实验性）
languages = en zh # 语言列表，文本转语音将默认使用列表中的第一种语言
[BROWSER]
headless_browser = True # 除非在主机上使用 CLI，否则保持不变。
stealth_mode = True # 使用不可检测的 selenium 减少浏览器检测</code></pre>
<p><strong>警告</strong>：</p>
<ul>
<li>
<p><code>config.ini</code> 文件格式不支持注释。 不要直接复制粘贴示例配置，因为注释会导致错误。相反，手动修改 <code>config.ini</code> 文件，使用您所需的设置，排除任何注释。</p>
</li>
<li>
<p>如果使用 LM-studio 运行 LLM，请<em>不要</em>将 provider_name 设置为 <code>openai</code>。将其设置为 <code>lm-studio</code>。</p>
</li>
<li>
<p>某些提供商（例如：lm-studio）要求您在 IP 前加上 <code>http://</code>。例如 <code>http://127.0.0.1:1234</code></p>
</li>
</ul>
<p><strong>本地提供商列表</strong></p>
<table>
<thead>
<tr>
<th>提供商</th>
<th>本地？</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>ollama</td>
<td>是</td>
<td>使用 ollama 作为 LLM 提供商轻松本地运行 LLM</td>
</tr>
<tr>
<td>lm-studio</td>
<td>是</td>
<td>使用 LM studio 本地运行 LLM（将 <code>provider_name</code> 设置为 <code>lm-studio</code>）</td>
</tr>
<tr>
<td>openai</td>
<td>是</td>
<td>使用 openai 兼容 API（例如：llama.cpp 服务器）</td>
</tr>
</tbody>
</table>
<p>下一步：<a href="#启动服务并运行">启动服务并运行 AgenticSeek</a>  </p>
<p><em>如果遇到问题，请参阅<a href="#故障排除">故障排除</a>部分。</em> <em>如果硬件无法本地运行 LLM，请参阅<a href="#使用-api-运行设置">使用 API 运行设置</a>。</em> <em>有关详细 <code>config.ini</code> 说明，请参阅<a href="#配置">配置部分</a>。</em></p>
<h2>使用 API 运行设置</h2>
<p>此设置使用外部、基于云的 LLM 提供商。您需要从所选服务获取 API 密钥。</p>
<p><strong>1. 选择 API 提供商并获取 API 密钥：</strong></p>
<p>请参阅下面的<a href="#api-提供商列表">API 提供商列表</a>。访问他们的网站注册并获取 API 密钥。</p>
<p><strong>2. 将您的 API 密钥设置为环境变量：</strong></p>
<ul>
<li><strong>Linux/macOS:</strong><br />
打开终端并使用 <code>export</code> 命令。最好将其添加到 shell 的配置文件中（例如 <code>~/.bashrc</code>、<code>~/.zshrc</code>）以保持持久性。
<pre><code class="language-sh">export PROVIDER_API_KEY="your_api_key_here" 
# 将 PROVIDER_API_KEY 替换为特定的变量名，例如 OPENAI_API_KEY、GOOGLE_API_KEY</code></pre>
<p>TogetherAI 示例：</p>
<pre><code class="language-sh">export TOGETHER_API_KEY="xxxxxxxxxxxxxxxxxxxxxx"</code></pre></li>
<li>
<p><strong>Windows:</strong></p>
<ul>
<li><strong>命令提示符（当前会话临时）：</strong>
<pre><code class="language-cmd">set PROVIDER_API_KEY=your_api_key_here</code></pre></li>
<li><strong>PowerShell（当前会话临时）：</strong>
<pre><code class="language-powershell">$env:PROVIDER_API_KEY="your_api_key_here"</code></pre></li>
<li><strong>永久性：</strong> 在 Windows 搜索栏中搜索&quot;环境变量&quot;，点击&quot;编辑系统环境变量&quot;，然后点击&quot;环境变量...&quot;按钮。添加一个新的用户变量，使用适当的名称（例如 <code>OPENAI_API_KEY</code>）和您的密钥作为值。</li>
</ul>
<p><em>(有关更多详细信息，请参阅 FAQ：<a href="#如何设置-api-密钥">如何设置 API 密钥？</a>)。</em></p>
</li>
</ul>
<p><strong>3. 更新 <code>config.ini</code>：</strong></p>
<pre><code class="language-ini">[MAIN]
is_local = False
provider_name = openai # 或 google、deepseek、togetherAI、huggingface
provider_model = gpt-3.5-turbo # 或 gemini-1.5-flash、deepseek-chat、mistralai/Mixtral-8x7B-Instruct-v0.1 等。
provider_server_address = # 当 is_local = False 时，对于大多数 API 通常被忽略或可以留空
# ... 其他设置 ...</code></pre>
<p><em>警告：</em> 确保 <code>config.ini</code> 值中没有尾随空格。</p>
<p><strong>API 提供商列表</strong></p>
<table>
<thead>
<tr>
<th>提供商</th>
<th><code>provider_name</code></th>
<th>本地？</th>
<th>描述</th>
<th>API 密钥链接（示例）</th>
</tr>
</thead>
<tbody>
<tr>
<td>OpenAI</td>
<td><code>openai</code></td>
<td>否</td>
<td>通过 OpenAI 的 API 使用 ChatGPT 模型。</td>
<td><a href="https://platform.openai.com/signup">platform.openai.com/signup</a></td>
</tr>
<tr>
<td>Google Gemini</td>
<td><code>google</code></td>
<td>否</td>
<td>通过 Google AI Studio 使用 Google Gemini 模型。</td>
<td><a href="https://aistudio.google.com/keys">aistudio.google.com/keys</a></td>
</tr>
<tr>
<td>Deepseek</td>
<td><code>deepseek</code></td>
<td>否</td>
<td>通过他们的 API 使用 Deepseek 模型。</td>
<td><a href="https://platform.deepseek.com">platform.deepseek.com</a></td>
</tr>
<tr>
<td>Hugging Face</td>
<td><code>huggingface</code></td>
<td>否</td>
<td>使用 Hugging Face Inference API 中的模型。</td>
<td><a href="https://huggingface.co/settings/tokens">huggingface.co/settings/tokens</a></td>
</tr>
<tr>
<td>TogetherAI</td>
<td><code>togetherAI</code></td>
<td>否</td>
<td>通过 TogetherAI API 使用各种开源模型。</td>
<td><a href="https://api.together.ai/settings/api-keys">api.together.ai/settings/api-keys</a></td>
</tr>
<tr>
<td>OpenRouter</td>
<td><code>openrouter</code></td>
<td>No</td>
<td>通过 OpenRouter 使用各种开源模型</td>
<td><a href="https://openrouter.ai/">https://openrouter.ai/</a></td>
</tr>
<tr>
<td>MiniMax</td>
<td><code>minimax</code></td>
<td>否</td>
<td>使用 MiniMax 模型（如 MiniMax-M3、MiniMax-M2.7）。</td>
<td><a href="https://platform.minimax.io/user-center/basic-information">platform.minimax.io</a></td>
</tr>
</tbody>
</table>
<p><em>注意：</em></p>
<ul>
<li>我们不建议将 <code>gpt-4o</code> 或其他 OpenAI 模型用于复杂的网页浏览和任务规划，因为当前的提示优化针对 Deepseek 等模型。</li>
<li>编码/bash 任务可能会遇到 Gemini 的问题，因为它可能不严格遵循针对 Deepseek 优化的格式化提示。</li>
<li>当 <code>is_local = False</code> 时，<code>config.ini</code> 中的 <code>provider_server_address</code> 通常不使用，因为 API 端点通常在相应提供商的库中硬编码。</li>
</ul>
<p>下一步：<a href="#启动服务并运行">启动服务并运行 AgenticSeek</a></p>
<p><em>如果遇到问题，请参阅<strong>已知问题</strong>部分</em></p>
<p><em>有关详细配置文件说明，请参阅<strong>配置</strong>部分。</em></p>
<hr />
<h2>启动服务并运行</h2>
<p>默认情况下，AgenticSeek 完全在 Docker 中运行。</p>
<p><strong>选项 1:</strong> 在 Docker 中运行，使用 Web 界面：</p>
<p>启动所需服务。这将启动 docker-compose.yml 中的所有服务，包括：</p>
<ul>
<li>searxng</li>
<li>redis（searxng 所需）</li>
<li>frontend</li>
<li>backend（如果使用 Web 界面时使用 <code>full</code>）</li>
</ul>
<pre><code class="language-sh">./start_services.sh full # MacOS
start start_services.cmd full # Windows</code></pre>
<p><strong>警告：</strong> 此步骤将下载并加载所有 Docker 镜像，可能需要长达 30 分钟。启动服务后，请等待后端服务完全运行（您应该在日志中看到 <strong>backend: &quot;GET /health HTTP/1.1&quot; 200 OK</strong>）后再发送任何消息。首次运行时，后端服务可能需要 5 分钟才能启动。</p>
<p>转到 <code>http://localhost:3000/</code>，您应该会看到 Web 界面。</p>
<p><em>服务启动故障排除：</em> 如果这些脚本失败，请确保 Docker Engine 正在运行并且 Docker Compose（V2，<code>docker compose</code>）已正确安装。检查终端输出中的错误消息。请参阅 <a href="#faq-故障排除">FAQ：帮助！运行 AgenticSeek 或其脚本时出现错误。</a></p>
<p><strong>选项 2:</strong> CLI 模式：</p>
<p>要使用 CLI 界面运行，您必须在主机上安装软件包：</p>
<pre><code class="language-sh">./install.sh
./install.bat # windows</code></pre>
<p>然后您必须将 <code>.env</code> 文件（<strong>不是</strong> <code>config.ini</code>）中的 SEARXNG_BASE_URL 更改为主机映射地址，因为在 CLI 模式下后端运行在您的机器上、Docker 之外：</p>
<pre><code class="language-sh">SEARXNG_BASE_URL="http://localhost:8080"</code></pre>
<blockquote>
<p>如果您在 <code>.env</code> 中修改了 <code>SEARXNG_PORT</code>，请在这里改用该端口（例如 <code>http://localhost:8001</code>）。编辑 <code>.env</code> 后请重启 <code>cli.py</code> — 该值在启动时读取。</p>
</blockquote>
<p>启动所需服务。这将启动 docker-compose.yml 中的一些服务，包括：</p>
<ul>
<li>searxng</li>
<li>redis（searxng 所需）</li>
<li>frontend</li>
</ul>
<pre><code class="language-sh">./start_services.sh # MacOS
start start_services.cmd # Windows</code></pre>
<p>运行：uv run: <code>uv run python -m ensurepip</code> 以确保 uv 已启用 pip。</p>
<p>使用 CLI：<code>uv run cli.py</code></p>
<hr />
<h2>使用方法</h2>
<p>确保服务已通过 <code>./start_services.sh full</code> 启动并运行，然后转到 <code>localhost:3000</code> 使用 Web 界面。</p>
<p>您也可以通过设置 <code>listen = True</code> 来使用语音转文本。仅限 CLI 模式。</p>
<p>要退出，只需说/输入 <code>goodbye</code>。</p>
<p>以下是一些使用示例：</p>
<blockquote>
<p><em>用 python 写一个贪吃蛇游戏！</em></p>
<p><em>搜索法国雷恩的最佳咖啡馆，并将三家及其地址保存到 rennes_cafes.txt。</em></p>
<p><em>写一个 Go 程序计算阶乘，保存为 factorial.go 到你的工作区</em></p>
<p><em>在 summer_pictures 文件夹中查找所有 JPG 文件，用今天日期重命名，并将重命名文件列表保存到 photos_list.txt</em></p>
<p><em>在线搜索 2024 年热门科幻电影，挑选三部今晚观看，保存到 movie_night.txt。</em></p>
<p><em>搜索 2025 年最新 AI 新闻文章，选三篇，写 Python 脚本抓取标题和摘要，脚本保存为 news_scraper.py，摘要保存到 ai_news.txt（/home/projects）</em></p>
<p><em>周五，搜索免费股票价格 API，用 supersuper7434567@gmail.com 注册，然后写 Python 脚本每日获取特斯拉股价，结果保存到 stock_prices.csv</em></p>
</blockquote>
<p><em>请注意，表单填写功能仍为实验性，可能失败。</em></p>
<p>输入查询后，AgenticSeek 将分配最佳代理执行任务。</p>
<p>由于这是早期原型，代理路由系统可能无法总是根据您的查询分配正确的代理。</p>
<p>因此，您应该非常明确地表达您想要什么以及 AI 可能如何进行，例如如果您希望它进行网页搜索，不要说：</p>
<p><code>你知道哪些适合独自旅行的国家吗？</code></p>
<p>而应说：</p>
<p><code>进行网页搜索，找出最适合独自旅行的国家</code></p>
<hr />
<h2><strong>在自己的服务器上运行 LLM 的设置</strong></h2>
<p>如果您有功能强大的计算机或可以使用的服务器，但想从笔记本电脑使用它，您可以选择使用我们的自定义 llm 服务器在远程服务器上运行 LLM。</p>
<p>在将运行 AI 模型的&quot;服务器&quot;上，获取 IP 地址</p>
<pre><code class="language-sh">ip a | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 # 本地 IP
curl https://ipinfo.io/ip # 公共 IP</code></pre>
<p>注意：对于 Windows 或 macOS，分别使用 ipconfig 或 ifconfig 查找 IP 地址。</p>
<p>克隆仓库并进入 <code>server/</code> 文件夹。</p>
<pre><code class="language-sh">git clone --depth 1 https://github.com/Fosowl/agenticSeek.git
cd agenticSeek/llm_server/</code></pre>
<p>安装服务器特定要求：</p>
<pre><code class="language-sh">pip3 install -r requirements.txt</code></pre>
<p>运行服务器脚本。</p>
<pre><code class="language-sh">python3 app.py --provider ollama --port 3333</code></pre>
<p>您可以选择使用 <code>ollama</code> 和 <code>llamacpp</code> 作为 LLM 服务。</p>
<p>现在在您的个人计算机上：</p>
<p>更改 <code>config.ini</code> 文件，将 <code>provider_name</code> 设置为 <code>server</code>，<code>provider_model</code> 设置为 <code>deepseek-r1:xxb</code>。 将 <code>provider_server_address</code> 设置为将运行模型的机器的 IP 地址。</p>
<pre><code class="language-sh">[MAIN]
is_local = False
provider_name = server
provider_model = deepseek-r1:70b
provider_server_address = http://x.x.x.x:3333</code></pre>
<p>下一步：<a href="#启动服务并运行">启动服务并运行 AgenticSeek</a>  </p>
<hr />
<h2>语音转文本</h2>
<p>警告：目前语音转文本仅适用于 CLI 模式。</p>
<p>请注意，目前语音转文本仅适用于英语。</p>
<p>语音转文本功能默认禁用。要启用它，请在 config.ini 文件中将 listen 选项设置为 True：</p>
<pre><code>listen = True</code></pre>
<p>启用后，语音转文本功能会监听触发关键字，即代理的名称，然后开始处理您的输入。您可以通过更新 <em>config.ini</em> 文件中的 <code>agent_name</code> 值来自定义代理的名称：</p>
<pre><code>agent_name = Friday</code></pre>
<p>为了获得最佳识别效果，我们建议使用常见的英文名称，如 &quot;John&quot; 或 &quot;Emma&quot; 作为代理名称。</p>
<p>一旦您看到转录开始出现，请大声说出代理的名称以唤醒它（例如，&quot;Friday&quot;）。</p>
<p>清晰地说出您的查询。</p>
<p>用确认短语结束您的请求，以指示系统继续。确认短语的示例包括：</p>
<pre><code>"do it", "go ahead", "execute", "run", "start", "thanks", "would ya", "please", "okay?", "proceed", "continue", "go on", "do that", "go it", "do you understand?"</code></pre>
<h2>配置</h2>
<p>配置示例：</p>
<pre><code>[MAIN]
is_local = True
provider_name = ollama
provider_model = deepseek-r1:32b
provider_server_address = http://127.0.0.1:11434 # Ollama 示例；LM-Studio 使用 http://127.0.0.1:1234
agent_name = Friday
recover_last_session = False
save_session = False
speak = False
listen = False

jarvis_personality = False
languages = en zh # TTS 和潜在路由的语言列表。
[BROWSER]
headless_browser = False
stealth_mode = False</code></pre>
<p><strong><code>config.ini</code> 设置说明</strong>：</p>
<ul>
<li><strong><code>[MAIN]</code> 部分：</strong>
<ul>
<li><code>is_local</code>: 如果使用本地 LLM 提供商（Ollama、LM-Studio、本地 OpenAI 兼容服务器）或自托管服务器选项，则为 <code>True</code>。如果使用基于云的 API（OpenAI、Google 等），则为 <code>False</code>。</li>
<li><code>provider_name</code>: 指定 LLM 提供商。
<ul>
<li>本地选项：<code>ollama</code>、<code>lm-studio</code>、<code>openai</code>（用于本地 OpenAI 兼容服务器）、<code>server</code>（用于自托管服务器设置）。</li>
<li>API 选项：<code>openai</code>、<code>google</code>、<code>deepseek</code>、<code>huggingface</code>、<code>togetherAI</code>。</li>
</ul></li>
<li><code>provider_model</code>: 所选提供商的特定模型名称或 ID（例如，Ollama 的 <code>deepseekcoder:6.7b</code>，OpenAI API 的 <code>gpt-3.5-turbo</code>，TogetherAI 的 <code>mistralai/Mixtral-8x7B-Instruct-v0.1</code>）。</li>
<li><code>provider_server_address</code>: 您的 LLM 提供商的地址。
<ul>
<li>对于本地提供商：例如，Ollama 的 <code>http://127.0.0.1:11434</code>，LM-Studio 的 <code>http://127.0.0.1:1234</code>。</li>
<li>对于 <code>server</code> 提供商类型：您的自托管 LLM 服务器的地址（例如 <code>http://your_server_ip:3333</code>）。</li>
<li>对于云 API（<code>is_local = False</code>）：这通常被忽略或可以留空，因为 API 端点通常由客户端库处理。</li>
</ul></li>
<li><code>agent_name</code>: AI 助手的名称（例如 Friday）。如果启用，用作语音转文本的触发词。</li>
<li><code>recover_last_session</code>: <code>True</code> 尝试恢复上一个会话的状态，<code>False</code> 重新开始。</li>
<li><code>save_session</code>: <code>True</code> 保存当前会话的状态以供潜在恢复，<code>False</code> 否则。</li>
<li><code>speak</code>: <code>True</code> 启用文本转语音语音输出，<code>False</code> 禁用。</li>
<li><code>listen</code>: <code>True</code> 启用语音转文本语音输入（仅限 CLI 模式），<code>False</code> 禁用。</li>
<li><code>work_dir</code>: <strong>关键：</strong> AgenticSeek 将读取/写入文件的目录。<strong>确保此路径在您的系统上有效且可访问。</strong></li>
<li><code>jarvis_personality</code>: <code>True</code> 使用更&quot;Jarvis-like&quot;的系统提示（实验性），<code>False</code> 使用标准提示。</li>
<li><code>languages</code>: 逗号分隔的语言列表（例如 <code>en, zh, fr</code>）。用于 TTS 语音选择（默认为第一个），并可以协助 LLM 路由器。为避免路由器效率低下，避免使用过多或非常相似的语言。</li>
</ul></li>
<li><strong><code>[BROWSER]</code> 部分：</strong>
<ul>
<li><code>headless_browser</code>: <code>True</code> 在没有可见窗口的情况下运行自动化浏览器（推荐用于 Web 界面或非交互式使用）。<code>False</code> 显示浏览器窗口（对于 CLI 模式或调试有用）。</li>
<li><code>stealth_mode</code>: <code>True</code> 启用使浏览器自动化更难检测的措施。可能需要手动安装浏览器扩展，如 anticaptcha。</li>
</ul></li>
</ul>
<p>本节总结了支持的 LLM 提供商类型。在 <code>config.ini</code> 中配置它们。</p>
<p><strong>本地提供商（在您自己的硬件上运行）：</strong></p>
<table>
<thead>
<tr>
<th>config.ini 中的提供商名称</th>
<th><code>is_local</code></th>
<th>描述</th>
<th>设置部分</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>ollama</code></td>
<td><code>True</code></td>
<td>使用 Ollama 轻松提供本地 LLM。</td>
<td><a href="#在您的机器上本地运行-llm-的设置">在您的机器上本地运行 LLM 的设置</a></td>
</tr>
<tr>
<td><code>lm-studio</code></td>
<td><code>True</code></td>
<td>使用 LM-Studio 提供本地 LLM。</td>
<td><a href="#在您的机器上本地运行-llm-的设置">在您的机器上本地运行 LLM 的设置</a></td>
</tr>
<tr>
<td><code>openai</code>（用于本地服务器）</td>
<td><code>True</code></td>
<td>连接到暴露 OpenAI 兼容 API 的本地服务器（例如，llama.cpp）。</td>
<td><a href="#在您的机器上本地运行-llm-的设置">在您的机器上本地运行 LLM 的设置</a></td>
</tr>
<tr>
<td><code>server</code></td>
<td><code>False</code></td>
<td>连接到在另一台机器上运行的 AgenticSeek 自托管 LLM 服务器。</td>
<td><a href="#在自己的服务器上运行-llm-的设置">在自己的服务器上运行 LLM 的设置</a></td>
</tr>
</tbody>
</table>
<p><strong>API 提供商（基于云）：</strong></p>
<table>
<thead>
<tr>
<th>config.ini 中的提供商名称</th>
<th><code>is_local</code></th>
<th>描述</th>
<th>设置部分</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>openai</code></td>
<td><code>False</code></td>
<td>使用 OpenAI 的官方 API（例如，GPT-3.5、GPT-4）。</td>
<td><a href="#使用-api-运行设置">使用 API 运行设置</a></td>
</tr>
<tr>
<td><code>google</code></td>
<td><code>False</code></td>
<td>通过 API 使用 Google 的 Gemini 模型。</td>
<td><a href="#使用-api-运行设置">使用 API 运行设置</a></td>
</tr>
<tr>
<td><code>deepseek</code></td>
<td><code>False</code></td>
<td>使用 Deepseek 的官方 API。</td>
<td><a href="#使用-api-运行设置">使用 API 运行设置</a></td>
</tr>
<tr>
<td><code>huggingface</code></td>
<td><code>False</code></td>
<td>使用 Hugging Face Inference API。</td>
<td><a href="#使用-api-运行设置">使用 API 运行设置</a></td>
</tr>
<tr>
<td><code>togetherAI</code></td>
<td><code>False</code></td>
<td>使用 TogetherAI 的 API 获取各种开放模型。</td>
<td><a href="#使用-api-运行设置">使用 API 运行设置</a></td>
</tr>
</tbody>
</table>
<hr />
<h2>故障排除</h2>
<p>如果遇到问题，本节提供指导。</p>
<h1>已知问题</h1>
<h2>ChromeDriver 问题</h2>
<p><strong>错误示例：</strong> <code>SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version XXX</code></p>
<h3>根本原因</h3>
<p>ChromeDriver 版本不兼容发生在：</p>
<ol>
<li>您安装的 ChromeDriver 版本与 Chrome 浏览器版本不匹配</li>
<li>在 Docker 环境中，<code>undetected_chromedriver</code> 可能会下载自己的 ChromeDriver 版本，绕过挂载的二进制文件</li>
</ol>
<h3>解决步骤</h3>
<h4>1. 检查您的 Chrome 版本</h4>
<p>打开 Google Chrome → <code>设置 &gt; 关于 Chrome</code> 查找您的版本（例如，&quot;版本 134.0.6998.88&quot;）</p>
<h4>2. 下载匹配的 ChromeDriver</h4>
<p><strong>对于 Chrome 115 及更新版本：</strong> 使用 <a href="https://googlechromelabs.github.io/chrome-for-testing/">Chrome for Testing API</a></p>
<ul>
<li>访问 Chrome for Testing 可用性仪表板</li>
<li>找到您的 Chrome 版本或最接近的可用匹配</li>
<li>为您的操作系统下载 ChromeDriver（Docker 环境使用 Linux64）</li>
</ul>
<p><strong>对于旧版 Chrome：</strong> 使用 <a href="https://chromedriver.chromium.org/downloads">旧版 ChromeDriver 下载</a></p>
<h4>3. 安装 ChromeDriver（选择一种方法）</h4>
<p><strong>方法 A：项目根目录（Docker 推荐）</strong></p>
<pre><code class="language-bash"># 将下载的 chromedriver 二进制文件放在项目根目录
cp path/to/downloaded/chromedriver ./chromedriver
chmod +x ./chromedriver  # 在 Linux/macOS 上使其可执行</code></pre>
<p><strong>方法 B：系统 PATH</strong></p>
<pre><code class="language-bash"># Linux/macOS
sudo mv chromedriver /usr/local/bin/
sudo chmod +x /usr/local/bin/chromedriver

# Windows：将 chromedriver.exe 放在 PATH 中的文件夹中</code></pre>
<h4>4. 验证安装</h4>
<pre><code class="language-bash"># 测试 ChromeDriver 版本
./chromedriver --version
# 或者在 PATH 中：
chromedriver --version</code></pre>
<h3>Docker 特定说明</h3>
<p>⚠️ <strong>Docker 用户重要：</strong></p>
<ul>
<li>Docker 卷挂载方法可能不适用于隐身模式（<code>undetected_chromedriver</code>）</li>
<li><strong>解决方案：</strong> 将 ChromeDriver 放在项目根目录中作为 <code>./chromedriver</code></li>
<li>应用程序将自动检测并使用此二进制文件</li>
<li>您应该在日志中看到：<code>"Using ChromeDriver from project root: ./chromedriver"</code></li>
</ul>
<h3>故障排除提示</h3>
<ol>
<li>
<p><strong>仍然遇到版本不匹配？</strong></p>
<ul>
<li>验证 ChromeDriver 是否可执行：<code>ls -la ./chromedriver</code></li>
<li>检查 ChromeDriver 版本：<code>./chromedriver --version</code></li>
<li>确保它与您的 Chrome 浏览器版本匹配</li>
</ul>
</li>
<li>
<p><strong>Docker 容器问题？</strong></p>
<ul>
<li>检查后端日志：<code>docker logs backend</code></li>
<li>查找消息：<code>"Using ChromeDriver from project root"</code></li>
<li>如果未找到，请验证文件是否存在且可执行</li>
</ul>
</li>
<li>
<p><strong>Chrome for Testing 版本</strong></p>
<ul>
<li>尽可能使用完全匹配的版本</li>
<li>对于版本 134.0.6998.88，使用 ChromeDriver 134.0.6998.165（最接近的可用版本）</li>
<li>主要版本号必须匹配（134 = 134）</li>
</ul>
</li>
</ol>
<h3>版本兼容性矩阵</h3>
<table>
<thead>
<tr>
<th>Chrome 版本</th>
<th>ChromeDriver 版本</th>
<th>状态</th>
</tr>
</thead>
<tbody>
<tr>
<td>134.0.6998.x</td>
<td>134.0.6998.165</td>
<td>✅ 可用</td>
</tr>
<tr>
<td>133.0.6943.x</td>
<td>133.0.6943.141</td>
<td>✅ 可用</td>
</tr>
<tr>
<td>132.0.6834.x</td>
<td>132.0.6834.159</td>
<td>✅ 可用</td>
</tr>
</tbody>
</table>
<p><em>有关最新兼容性，请查看 <a href="https://googlechromelabs.github.io/chrome-for-testing/">Chrome for Testing 仪表板</a></em></p>
<p><code>Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113 Current browser version is 134.0.6998.89 with binary path</code></p>
<p>如果您的浏览器和 chromedriver 版本不匹配，会发生这种情况。</p>
<p>您需要导航到下载最新版本：</p>
<p><a href="https://developer.chrome.com/docs/chromedriver/downloads">https://developer.chrome.com/docs/chromedriver/downloads</a></p>
<p>如果您使用 Chrome 版本 115 或更新版本，请转到：</p>
<p><a href="https://googlechromelabs.github.io/chrome-for-testing/">https://googlechromelabs.github.io/chrome-for-testing/</a></p>
<p>并下载与您的操作系统匹配的 chromedriver 版本。</p>
<p>如果此部分不完整，请提出问题。</p>
<h2>连接适配器问题</h2>
<pre><code>Exception: Provider lm-studio failed: HTTP request failed: No connection adapters were found for '127.0.0.1:1234/v1/chat/completions'`（注意：端口可能不同）</code></pre>
<ul>
<li><strong>原因：</strong> <code>config.ini</code> 中 <code>lm-studio</code>（或其他类似的本地 OpenAI 兼容服务器）的 <code>provider_server_address</code> 缺少 <code>http://</code> 前缀或指向错误的端口。</li>
<li><strong>解决方案：</strong>
<ul>
<li>确保地址包含 <code>http://</code>。LM-Studio 通常默认为 <code>http://127.0.0.1:1234</code>。</li>
<li>正确的 <code>config.ini</code>：<code>provider_server_address = http://127.0.0.1:1234</code>（或您的实际 LM-Studio 服务器端口）。</li>
</ul></li>
</ul>
<h2>SearxNG 基本 URL 未提供</h2>
<pre><code>raise ValueError("SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.")
ValueError: SearxNG base U
</code></pre>
<blockquote>
<p>README 内容已截断, 请前往 GitHub 查看完整内容。</p>
</blockquote>]]></description>
    <pubDate>Tue, 15 Sep 2026 04:38:53 +0800</pubDate>
    <dc:creator>OTO</dc:creator>
    <guid>https://cn121.com/llm/fosowl-agenticseek.html</guid>
</item>
<item>
    <title>qwen-code - 位于您终端的开源AI编码代理</title>
    <link>https://cn121.com/cli/qwenlm-qwen-code.html</link>
    <description><![CDATA[<div class="dsh-center">
<p><a href="https://www.npmjs.com/package/@qwen-code/qwen-code"></a> <a href="https://github.com/QwenLM/qwen-code/blob/main/LICENSE"></a> <a href="https://nodejs.org/"></a> <a href="https://www.npmjs.com/package/@qwen-code/qwen-code"></a></p>
<p><a href="https://trendshift.io/repositories/15287" target="_blank"></a></p>
<p><strong>适用于您的终端、编辑器、桌面、浏览器和聊天的开源 AI 编码代理。</strong></p>
</div>
<h2>为什么选择 Qwen Code？</h2>
<ul>
<li><strong>开箱即用的智能代理</strong> — 自动记忆、自动技能、子代理、代理团队和 MCP。动态工作流，无需设置。</li>
<li><strong>开源，内外兼顾</strong> — 框架和 Qwen 模型都是开源的。它们共同进化。无供应商锁定。</li>
<li><strong>多协议</strong> — 支持 OpenAI、Anthropic、Gemini 和 Qwen API。任何第三方提供者或本地模型（Ollama / vLLM）。运行时切换。</li>
<li><strong>超越终端</strong> — IDE 插件、桌面应用、网页界面、SDK 和聊天集成（Telegram / 钉钉 / 微信 / 飞书）。</li>
</ul>
<blockquote>
<p>[!提示]<br />
Qwen Code 正在主动自我迭代 — 使用自身的代理和模型提交问题、提交 PR、审查代码并运行测试。由社区驱动，由 AI 推动。</p>
</blockquote>
<h2>安装</h2>
<p><strong>Linux / macOS：</strong></p>
<pre><code class="language-bash">curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.sh | bash</code></pre>
<p><strong>Windows：</strong></p>
<pre><code class="language-powershell">irm https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.ps1 | iex</code></pre>
<blockquote>
<p>安装后请重启终端以确保环境变量生效。</p>
</blockquote>
<details class="dsh-details"><summary class="dsh-details-summary">NPM / Homebrew</summary><div class="dsh-details-body">
<p><strong>NPM</strong>（需要 <a href="https://nodejs.org/">Node.js 22</a>）：</p>
<pre><code class="language-bash">npm install -g @qwen-code/qwen-code@latest</code></pre>
<p><strong>Homebrew</strong>（macOS / Linux）：</p>
<pre><code class="language-bash">酿造安装 qwen-code</code></pre>
</div></details>
<h2>快速开始</h2>
<p>在您的项目中打开终端并启动 Qwen 代码：</p>
<pre><code class="language-bash">cd /path/to/your-project
qwen</code></pre>
<p>在会话中，运行 <code>/auth</code> 来配置您的提供者和 API 密钥。然后尝试：</p>
<pre><code class="language-text">Explain this repository and show me where to start.</code></pre>
<p>请参阅<a href="https://qwenlm.github.io/qwen-code-docs/en/users/configuration/auth/">认证指南</a>和<a href="https://qwenlm.github.io/qwen-code-docs/en/users/configuration/settings/">设置参考</a>了解详细设置。</p>
<details class="dsh-details"><summary class="dsh-details-summary">查看终端界面</summary><div class="dsh-details-body">

</div></details>
<h2>如何使用 Qwen 代码</h2>
<p>选择适合您工作流程的界面：</p>
<table>
<thead>
<tr>
<th>界面</th>
<th>入门指南</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>终端</strong></td>
<td>在你的项目中运行 <code>qwen</code> — 参见 <a href="#quick-start">快速开始</a>。</td>
</tr>
<tr>
<td><strong>桌面</strong></td>
<td><a href="https://github.com/QwenLM/qwen-code/releases/tag/desktop-latest">下载 Qwen Code Desktop</a>，适用于 macOS、Windows 和 Linux。</td>
</tr>
<tr>
<td><strong>网页</strong></td>
<td>运行 <code>qwen serve --open</code> 在浏览器中打开 <a href="https://qwenlm.github.io/qwen-code-docs/en/users/qwen-serve/">Web UI</a>。<em>(实验性)</em></td>
</tr>
<tr>
<td><strong>编辑器</strong></td>
<td>设置 <a href="https://qwenlm.github.io/qwen-code-docs/en/users/integration-vscode/">VS Code</a>、<a href="https://qwenlm.github.io/qwen-code-docs/en/users/integration-zed/">Zed</a> 或 <a href="https://qwenlm.github.io/qwen-code-docs/en/users/integration-jetbrains/">JetBrains</a>。</td>
</tr>
<tr>
<td><strong>聊天</strong></td>
<td>连接 <a href="https://qwenlm.github.io/qwen-code-docs/en/users/features/channels/telegram/">Telegram</a>、<a href="https://qwenlm.github.io/qwen-code-docs/en/users/features/channels/dingtalk/">钉钉</a>、<a href="https://qwenlm.github.io/qwen-code-docs/en/users/features/channels/weixin/">微信</a> 或 <a href="https://qwenlm.github.io/qwen-code-docs/en/users/features/channels/feishu/">飞书</a>，然后运行 <code>qwen channel start</code>。</td>
</tr>
</tbody>
</table>
<p>用于自动化和自定义集成：</p>
<ul>
<li><strong>无头模式</strong> — 在脚本、CI/CD 或批处理任务中运行 <code>qwen -p "..."</code>。</li>
<li><strong>SDK</strong> — 使用 <a href="https://github.com/QwenLM/qwen-code/blob/main/packages/sdk-typescript/README.md">TypeScript</a>、<a href="https://github.com/QwenLM/qwen-code/blob/main/packages/sdk-python/README.md">Python</a> 或 <a href="https://github.com/QwenLM/qwen-code/blob/main/packages/sdk-java/qwencode/README.md">Java</a> 构建。</li>
<li><strong>守护进程</strong> — 运行 <code>qwen serve</code> 通过 HTTP SSE (ACP) 连接客户端。<em>(实验性)</em> <a href="https://qwenlm.github.io/qwen-code-docs/en/users/qwen-serve/">守护进程指南</a>。</li>
</ul>
<details class="dsh-details"><summary class="dsh-details-summary">SDK 示例（Python）</summary><div class="dsh-details-body">
<pre><code class="language-python">import asyncio

从 qwen_code_sdk 导入 is_sdk_result_message, query

async def main() -&gt; None:
    result = query(
        "Summarize the repository layout.",
        {
            "cwd": "/path/to/project",
            "path_to_qwen_executable": "qwen",
        },
    )

    异步地对结果中的消息进行遍历:
        if is_sdk_result_message(message):
            print(message["result"])

asyncio.run(main())</code></pre>
</div></details>
<h2>功能</h2>
<p>如果你熟悉Claude Code，你也已经了解Qwen Code——而且更进一步。我们投入了大量精力<a href="https://github.com/wenshao/codeagents/blob/main/docs/comparison/qwen-code-improvement-report.md">使Qwen Code与Claude Code功能达到一致</a>，在各方面提升了其广度和可靠性。</p>
<table>
<thead>
<tr>
<th>功能</th>
<th style="text-align: center;">Qwen 代码</th>
<th style="text-align: center;">Claude 代码</th>
</tr>
</thead>
<tbody>
<tr>
<td>子代理, 代理团队, 动态工作流</td>
<td style="text-align: center;">✓</td>
<td style="text-align: center;">✓</td>
</tr>
<tr>
<td>自动记忆, 自动技能, 钩子</td>
<td style="text-align: center;">✓</td>
<td style="text-align: center;">✓</td>
</tr>
<tr>
<td>内置技能 (/review, /batch, /loop, /bugfix…)</td>
<td style="text-align: center;">✓</td>
<td style="text-align: center;">✓</td>
</tr>
<tr>
<td>MCP, 计划模式, LSP 集成</td>
<td style="text-align: center;">✓</td>
<td style="text-align: center;">✓</td>
</tr>
<tr>
<td>自动模式, 沙盒, Git 工作树</td>
<td style="text-align: center;">✓</td>
<td style="text-align: center;">✓</td>
</tr>
<tr>
<td>计算机使用 (桌面自动化)</td>
<td style="text-align: center;">✓</td>
<td style="text-align: center;">✓</td>
</tr>
<tr>
<td>IDE 插件 (VS Code / JetBrains / Zed)</td>
<td style="text-align: center;">✓</td>
<td style="text-align: center;">✓</td>
</tr>
<tr>
<td>SDK</td>
<td style="text-align: center;">✓</td>
<td style="text-align: center;">✓</td>
</tr>
<tr>
<td>无界面模式, 会话管理</td>
<td style="text-align: center;">✓</td>
<td style="text-align: center;">✓</td>
</tr>
<tr>
<td>开源 — 模型和框架</td>
<td style="text-align: center;">✓</td>
<td style="text-align: center;">—</td>
</tr>
<tr>
<td>多协议 (OpenAI / Anthropic / Gemini / Qwen 任意提供者)</td>
<td style="text-align: center;">✓</td>
<td style="text-align: center;">—</td>
</tr>
<tr>
<td>代理竞技场 (同一任务的多模型对决)</td>
<td style="text-align: center;">✓</td>
<td style="text-align: center;">—</td>
</tr>
<tr>
<td>守护进程模式 — <code>qwen serve</code> (多客户端共享代理)</td>
<td style="text-align: center;">✓</td>
<td style="text-align: center;">—</td>
</tr>
<tr>
<td>即时消息渠道 (Telegram / 钉钉 / 微信 / 飞书)</td>
<td style="text-align: center;">✓</td>
<td style="text-align: center;">—</td>
</tr>
</tbody>
</table>
<h2>Qwen 代码评估</h2>
<h3>评估配置</h3>
<table>
<thead>
<tr>
<th>配置</th>
<th>值</th>
</tr>
</thead>
<tbody>
<tr>
<td>数据集</td>
<td><code>princeton-nlp/SWE-bench_Verified</code>，500 个案例</td>
</tr>
<tr>
<td>运行</td>
<td>每个版本 3 次试验，每个版本 1,500 个任务；7 个 Qwen Code 版本</td>
</tr>
<tr>
<td>模型</td>
<td><code>Qwen 3.7 Max</code></td>
</tr>
<tr>
<td>采样</td>
<td><code>temperature=1</code>，<code>top_p=0.95</code></td>
</tr>
<tr>
<td>思考 / 推理</td>
<td><code>interleaved_thinking=true</code>，<code>thinking_type=adaptive</code>，<code>reasoning_effort=high</code></td>
</tr>
<tr>
<td>上下文 / 输出限制</td>
<td><code>context_1m=true</code>，<code>model_context_length=1,000,000</code>，<code>max_tokens=64,000</code>，<code>model_max_tokens=65,535</code></td>
</tr>
<tr>
<td>执行限制</td>
<td><code>max_iterations=500</code>，<code>runtime_timeout_sec=7,200</code>，<code>agent_timeout_multiplier=3.0</code></td>
</tr>
</tbody>
</table>
<h3>按 Qwen Code 版本评分</h3>
<table>
<thead>
<tr>
<th>版本</th>
<th style="text-align: right;">平均分</th>
<th style="text-align: right;">通过率</th>
<th style="text-align: right;">pass@3</th>
<th style="text-align: right;">pass^3</th>
</tr>
</thead>
<tbody>
<tr>
<td>0.0.14</td>
<td style="text-align: right;"><strong>77.80%</strong></td>
<td style="text-align: right;">84.6%</td>
<td style="text-align: right;">84.6%</td>
<td style="text-align: right;">69.2%</td>
</tr>
<tr>
<td>0.1.0</td>
<td style="text-align: right;"><strong>76.73%</strong></td>
<td style="text-align: right;">84.6%</td>
<td style="text-align: right;">84.6%</td>
<td style="text-align: right;">68.0%</td>
</tr>
<tr>
<td>0.5.0</td>
<td style="text-align: right;"><strong>76.60%</strong></td>
<td style="text-align: right;">83.0%</td>
<td style="text-align: right;">83.0%</td>
<td style="text-align: right;">68.4%</td>
</tr>
<tr>
<td>0.10.0</td>
<td style="text-align: right;"><strong>76.47%</strong></td>
<td style="text-align: right;">84.4%</td>
<td style="text-align: right;">84.4%</td>
<td style="text-align: right;">67.4%</td>
</tr>
<tr>
<td>0.15.0</td>
<td style="text-align: right;"><strong>77.67%</strong></td>
<td style="text-align: right;">84.6%</td>
<td style="text-align: right;">84.6%</td>
<td style="text-align: right;">68.6%</td>
</tr>
<tr>
<td>0.19.0</td>
<td style="text-align: right;"><strong>76.40%</strong></td>
<td style="text-align: right;">85.0%</td>
<td style="text-align: right;">85.0%</td>
<td style="text-align: right;">65.8%</td>
</tr>
<tr>
<td>0.22.0</td>
<td style="text-align: right;"><strong>77.33%</strong></td>
<td style="text-align: right;">84.4%</td>
<td style="text-align: right;">84.4%</td>
<td style="text-align: right;">68.0%</td>
</tr>
</tbody>
</table>
<h3>平均分趋势</h3>
<h2>生态系统</h2>
<ul>
<li>
<p><a href="https://github.com/QwenLM/qwen-code/releases/tag/desktop-latest"><strong>Qwen Code 桌面版</strong></a> — 官方 macOS、Windows 和 Linux 桌面应用</p>
</li>
<li>
<p><a href="https://github.com/iOfficeAI/AionUi"><strong>AionUi</strong></a> — 面向命令行 AI 工具（包括 Qwen Code）的现代图形界面</p>
</li>
<li>
<p><a href="https://github.com/Piebald-AI/gemini-cli-desktop"><strong>Gemini CLI 桌面版</strong></a> — Qwen Code 的跨平台桌面/网页/移动端 UI</p>
</li>
<li>
<p><a href="https://github.com/openclaw/acpx"><strong>🦞 Qwen Code Claw</strong></a> — 让其他代理（Claude、Codex 等）通过 ACP 将编码任务委派给 Qwen Code。将此提示粘贴到你的代理中:</p>
</li>
</ul>
<pre><code class="language-text">Use Qwen Code as a coding agent. First, fetch and read this skill reference:
https://raw.githubusercontent.com/QwenLM/qwen-code/refs/heads/main/.qwen/skills/qwen-code-claw/SKILL.md
Then follow the instructions inside to install, authenticate, and use Qwen Code via acpx for all coding tasks.</code></pre>
<ul>
<li><a href="https://github.com/modelstudioai/cli"><strong>阿里云模型工作室 CLI</strong></a> — 阿里云 AI 平台的官方命令行工具（<code>bailian-cli</code>）。扩展了 Qwen Code，支持图像/视频生成、知识检索、应用编排和模型部署。</li>
</ul>
<h2>贡献</h2>
<p>欢迎贡献！请参阅 <a href="https://github.com/QwenLM/qwen-code/blob/main/CONTRIBUTING.md">CONTRIBUTING.md</a> 获取指南。</p>
<h2>致谢</h2>
<p>本项目最初基于 <a href="https://github.com/google-gemini/gemini-cli">Google Gemini CLI</a> v0.8.2。我们衷心感谢 Gemini CLI 团队的出色工作。从 Qwen Code v0.1 开始，我们停止与上游同步，并开始独立开发，作为一个多协议、多平台的代理框架，并与 Qwen 模型及其他功能实现深度集成。</p>]]></description>
    <pubDate>Tue, 15 Sep 2026 04:38:46 +0800</pubDate>
    <dc:creator>OTO</dc:creator>
    <guid>https://cn121.com/cli/qwenlm-qwen-code.html</guid>
</item>
</channel>
</rss>