[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-tidyverse--ellmer":3,"tool-tidyverse--ellmer":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",145895,2,"2026-04-08T11:32:59",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108111,"2026-04-08T11:23:26",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":10,"last_commit_at":59,"category_tags":60,"status":17},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,"2026-04-06T11:19:32",[35,15,13,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":72,"owner_avatar_url":73,"owner_bio":74,"owner_company":75,"owner_location":75,"owner_email":75,"owner_twitter":75,"owner_website":76,"owner_url":77,"languages":78,"stars":83,"forks":84,"last_commit_at":85,"license":86,"difficulty_score":32,"env_os":87,"env_gpu":88,"env_ram":87,"env_deps":89,"category_tags":95,"github_topics":75,"view_count":32,"oss_zip_url":75,"oss_zip_packed_at":75,"status":17,"created_at":96,"updated_at":97,"faqs":98,"releases":132},5614,"tidyverse\u002Fellmer","ellmer","Call LLM APIs from R","ellmer 是一款专为 R 语言开发者设计的开源工具，旨在让调用大型语言模型（LLM）变得简单高效。它解决了 R 用户在集成各类 AI 模型时面临的接口复杂、提供商支持分散等痛点，提供了一套统一且易用的编程接口。\n\n无论是数据科学家、统计研究人员，还是希望将 AI 能力融入数据分析流程的 R 开发者，都能通过 ellmer 轻松上手。该工具不仅支持 OpenAI、Anthropic、Google Gemini 等主流云服务，还兼容 AWS Bedrock、Azure 以及本地运行的 Ollama 等多种部署环境，充分满足不同场景下的合规与成本需求。\n\nellmer 的技术亮点在于其丰富的功能集：支持流式输出以实时查看生成内容，具备工具调用（Function Calling）能力以执行复杂任务，并能直接提取结构化数据以便后续分析。作为 Posit 生态中专注于 LLM 交互的核心组件，ellmer 让 R 语言用户无需切换编程环境，即可在熟悉的数据分析工作流中无缝集成前沿的大模型能力，极大地拓展了 R 在智能应用开发中的可能性。","\n\u003C!-- README.md is generated from README.Rmd. Please edit that file -->\n\n# ellmer \u003Ca href=\"https:\u002F\u002Fellmer.tidyverse.org\">\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ftidyverse_ellmer_readme_07f75a37a929.png\" align=\"right\" height=\"138\" alt=\"ellmer website\" \u002F>\u003C\u002Fa>\n\n\u003C!-- badges: start -->\n\n[![Lifecycle:\nexperimental](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flifecycle-experimental-orange.svg)](https:\u002F\u002Flifecycle.r-lib.org\u002Farticles\u002Fstages.html#experimental)\n[![R-CMD-check](https:\u002F\u002Fgithub.com\u002Ftidyverse\u002Fellmer\u002Factions\u002Fworkflows\u002FR-CMD-check.yaml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Ftidyverse\u002Fellmer\u002Factions\u002Fworkflows\u002FR-CMD-check.yaml)\n\u003C!-- badges: end -->\n\nellmer makes it easy to use large language models (LLM) from R. It\nsupports a wide variety of LLM providers and implements a rich set of\nfeatures including streaming outputs, tool\u002Ffunction calling, structured\ndata extraction, and more.\n\nellmer is one of a number of LLM-related packages created by Posit:\n\n- Looking for something similar in python? Check out\n  [chatlas](https:\u002F\u002Fgithub.com\u002Fposit-dev\u002Fchatlas)!\n- Want to evaluate your LLMs? Try\n  [vitals](https:\u002F\u002Fvitals.tidyverse.org).\n- Need RAG? Take a look at [ragnar](https:\u002F\u002Fragnar.tidyverse.org).\n- Want to make a beautiful LLM powered chatbot? Consider\n  [shinychat](https:\u002F\u002Fposit-dev.github.io\u002Fshinychat\u002F).\n- Working with MCP? Check out\n  [mcptools](https:\u002F\u002Fposit-dev.github.io\u002Fmcptools\u002F).\n\n## Installation\n\nYou can install ellmer from CRAN with:\n\n``` r\ninstall.packages(\"ellmer\")\n```\n\n## Providers\n\nellmer supports a wide variety of model providers:\n\n- Anthropic’s Claude: `chat_anthropic()`.\n- AWS Bedrock: `chat_aws_bedrock()`.\n- Azure OpenAI: `chat_azure_openai()`.\n- Cloudflare: `chat_cloudflare()`.\n- Databricks: `chat_databricks()`.\n- DeepSeek: `chat_deepseek()`.\n- GitHub model marketplace: `chat_github()`.\n- Google Gemini\u002FVertex AI: `chat_google_gemini()`,\n  `chat_google_vertex()`.\n- Groq: `chat_groq()`.\n- Hugging Face: `chat_huggingface()`.\n- Mistral: `chat_mistral()`.\n- Ollama: `chat_ollama()`.\n- OpenAI: `chat_openai()`.\n- OpenRouter: `chat_openrouter()`.\n- perplexity.ai: `chat_perplexity()`.\n- Snowflake Cortex: `chat_snowflake()` and `chat_cortex_analyst()`.\n- VLLM: `chat_vllm()`.\n\n### Provider\u002Fmodel choice\n\nIf you’re using ellmer inside an organisation, you may have internal\npolicies that limit you to models from big cloud providers,\ne.g. `chat_azure_openai()`, `chat_aws_bedrock()`, `chat_databricks()`,\nor `chat_snowflake()`.\n\nIf you’re using ellmer for your own exploration, you’ll have a lot more\nfreedom, so we have a few recommendations to help you get started:\n\n- `chat_openai()` or `chat_anthropic()` are good places to start.\n  `chat_openai()` defaults to **GPT-4.1**, but you can use\n  `model = \"gpt-4-1-nano\"` for a cheaper, faster model, or\n  `model = \"o3\"` for more complex reasoning. `chat_anthropic()` is also\n  good; it defaults to **Claude 4.0 Sonnet**, which we have found to be\n  particularly good at writing R code.\n\n- `chat_google_gemini()` is a strong model with generous free tier (with\n  the downside that [your data is\n  used](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fterms#unpaid-services) to\n  improve the model), making it a great place to start if you don’t want\n  to spend any money.\n\n- `chat_ollama()`, which uses [Ollama](https:\u002F\u002Follama.com), allows you\n  to run models on your own computer. While the biggest models you can\n  run locally aren’t as good as the state of the art hosted models, they\n  don’t share your data and are effectively free.\n\n### Authentication\n\nAuthentication works a little differently depending on the provider. A\nfew popular ones (including OpenAI and Anthropic) require you to obtain\nan API key. We recommend you save it in an environment variable rather\nthan using it directly in your code, and if you deploy an app or report\nthat uses ellmer to another system, you’ll need to ensure that this\nenvironment variable is available there, too.\n\nellmer also automatically detects many of the OAuth or IAM-based\ncredentials used by the big cloud providers (currently\n`chat_azure_openai()`, `chat_aws_bedrock()`, `chat_databricks()`,\n`chat_snowflake()`). That includes credentials for these platforms\nmanaged by [Posit\nWorkbench](https:\u002F\u002Fdocs.posit.co\u002Fide\u002Fserver-pro\u002Fuser\u002Fposit-workbench\u002Fmanaged-credentials\u002Fmanaged-credentials.html)\nand [Posit\nConnect](https:\u002F\u002Fdocs.posit.co\u002Fconnect\u002Fuser\u002Foauth-integrations\u002F#adding-oauth-integrations-to-deployed-content).\n\nIf you find cases where ellmer cannot detect credentials from one of\nthese cloud providers, feel free to open an issue; we’re happy to add\nmore auth mechanisms if needed.\n\n## Using ellmer\n\nYou can work with ellmer in several different ways, depending on whether\nyou are working interactively or programmatically. They all start with\ncreating a new chat object:\n\n``` r\nlibrary(ellmer)\n\nchat \u003C- chat_openai(\"Be terse\", model = \"gpt-4o-mini\")\n```\n\nChat objects are stateful [R6 objects](https:\u002F\u002Fr6.r-lib.org): they\nretain the context of the conversation, so each new query builds on the\nprevious ones. You call their methods with `$`.\n\n### Interactive chat console\n\nThe most interactive and least programmatic way of using ellmer is to\nchat directly in your R console or browser with `live_console(chat)` or\n`live_browser()`:\n\n``` r\nlive_console(chat)\n#> ╔════════════════════════════════════════════════════════╗\n#> ║  Entering chat console. Use \"\"\" for multi-line input.  ║\n#> ║  Press Ctrl+C to quit.                                 ║\n#> ╚════════════════════════════════════════════════════════╝\n#> >>> Who were the original creators of R?\n#> R was originally created by Ross Ihaka and Robert Gentleman at the University of\n#> Auckland, New Zealand.\n#>\n#> >>> When was that?\n#> R was initially released in 1995. Development began a few years prior to that,\n#> in the early 1990s.\n```\n\nKeep in mind that the chat object retains state, so when you enter the\nchat console, any previous interactions with that chat object are still\npart of the conversation, and any interactions you have in the chat\nconsole will persist after you exit back to the R prompt. This is true\nregardless of which chat function you use.\n\n### Interactive method call\n\nThe second most interactive way to chat is to call the `chat()` method:\n\n``` r\nchat$chat(\"What preceding languages most influenced R?\")\n#> R was primarily influenced by S, a language developed at Bell Laboratories. \n#> Other notable influences include:\n#> \n#> 1. **Scheme** - For functional programming concepts.\n#> 2. **LISP** - For its powerful data manipulation features.\n#> 3. **C** - For performance and system-level access.\n#> 4. **Fortran** - For numerical and statistical computations.\n#> \n#> These languages contributed to R's syntax, data structures, and functional \n#> programming capabilities.\n```\n\nIf you initialize the chat object in the global environment, the `chat`\nmethod will stream the response to the console. When the entire response\nis received, it’s also (invisibly) returned as a character vector. This\nis useful when you want to see the response as it arrives, but you don’t\nwant to enter the chat console.\n\nIf you want to ask a question about an image, you can pass one or more\nadditional input arguments using `content_image_file()` and\u002For\n`content_image_url()`:\n\n``` r\nchat$chat(\n  content_image_url(\"https:\u002F\u002Fwww.r-project.org\u002FRlogo.png\"),\n  \"Can you explain this logo?\"\n)\n#> The logo consists of a stylized letter \"R\" in blue, surrounded by a gray oval \n#> shape. The design reflects the programming language R, which is widely used for\n#> statistical computing and graphics. The color choice often symbolizes clarity \n#> and professionalism, aligning with R's use in data analysis and research. The \n#> logo encapsulates the language's focus on data visualization and statistical \n#> methods.\n```\n\n### Streaming vs capturing\n\nIn most circumstances, ellmer will stream the output to the console. You\ncan take control of this by setting the `echo` argument either when\ncreating the chat object or when calling `$chat()`. Set `echo = \"none\"`\nto return a string instead:\n\n``` r\nmy_function \u003C- function() {\n  chat \u003C- chat_openai(\"Be terse\", model = \"gpt-4o-mini\", echo = \"none\")\n  chat$chat(\"What is 6 times 7?\")\n}\nstr(my_function())\n#>  'ellmer_output' chr \"6 times 7 is 42.\"\n```\n\nIf needed, you can manually control this behaviour with the `echo`\nargument. This is useful for programming with ellmer when the result is\neither not intended for human consumption or when you want to process\nthe response before displaying it.\n\n## Learning more\n\nellmer comes with a bunch of vignettes to help you learn more:\n\n- Learn key vocabulary and see example use cases in\n  `vignette(\"ellmer\")`.\n- Learn how to design your prompt in `vignette(\"prompt-design\")`.\n- Learn about tool\u002Ffunction calling in `vignette(\"tool-calling\")`.\n- Learn how to extract structured data in `vignette(\"structured-data\")`.\n- Learn about streaming and async APIs in `vignette(\"streaming-async\")`.\n","\u003C!-- README.md 由 README.Rmd 生成。请编辑该文件 -->\n\n# ellmer \u003Ca href=\"https:\u002F\u002Fellmer.tidyverse.org\">\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ftidyverse_ellmer_readme_07f75a37a929.png\" align=\"right\" height=\"138\" alt=\"ellmer 网站\" \u002F>\u003C\u002Fa>\n\n\u003C!-- badges: start -->\n\n[![生命周期：\n实验性](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flifecycle-experimental-orange.svg)](https:\u002F\u002Flifecycle.r-lib.org\u002Farticles\u002Fstages.html#experimental)\n[![R-CMD-check](https:\u002F\u002Fgithub.com\u002Ftidyverse\u002Fellmer\u002Factions\u002Fworkflows\u002FR-CMD-check.yaml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Ftidyverse\u002Fellmer\u002Factions\u002Fworkflows\u002FR-CMD-check.yaml)\n\u003C!-- badges: end -->\n\nellmer 让在 R 中使用大型语言模型（LLM）变得简单易行。它支持多种 LLM 提供商，并实现了丰富的功能，包括流式输出、工具\u002F函数调用、结构化数据提取等。\n\nellmer 是 Posit 公司开发的多个 LLM 相关包之一：\n\n- 如果您正在寻找 Python 中类似的功能，请查看\n  [chatlas](https:\u002F\u002Fgithub.com\u002Fposit-dev\u002Fchatlas)！\n- 想评估您的 LLM 吗？试试\n  [vitals](https:\u002F\u002Fvitals.tidyverse.org)。\n- 需要 RAG 技术吗？可以看看 [ragnar](https:\u002F\u002Fragnar.tidyverse.org)。\n- 想构建一个美观的 LLM 驱动聊天机器人吗？不妨考虑\n  [shinychat](https:\u002F\u002Fposit-dev.github.io\u002Fshinychat\u002F)。\n- 如果您正在使用 MCP，可以查看\n  [mcptools](https:\u002F\u002Fposit-dev.github.io\u002Fmcptools\u002F)。\n\n## 安装\n\n您可以从 CRAN 安装 ellmer：\n\n``` r\ninstall.packages(\"ellmer\")\n```\n\n## 支持的提供商\n\nellmer 支持多种模型提供商：\n\n- Anthropic 的 Claude：`chat_anthropic()`。\n- AWS Bedrock：`chat_aws_bedrock()`。\n- Azure OpenAI：`chat_azure_openai()`。\n- Cloudflare：`chat_cloudflare()`。\n- Databricks：`chat_databricks()`。\n- DeepSeek：`chat_deepseek()`。\n- GitHub 模型市场：`chat_github()`。\n- Google Gemini\u002FVertex AI：`chat_google_gemini()`、\n  `chat_google_vertex()`。\n- Groq：`chat_groq()`。\n- Hugging Face：`chat_huggingface()`。\n- Mistral：`chat_mistral()`。\n- Ollama：`chat_ollama()`。\n- OpenAI：`chat_openai()`。\n- OpenRouter：`chat_openrouter()`。\n- perplexity.ai：`chat_perplexity()`。\n- Snowflake Cortex：`chat_snowflake()` 和\n  `chat_cortex_analyst()`。\n- VLLM：`chat_vllm()`。\n\n### 提供商与模型选择\n\n如果您在组织内部使用 ellmer，可能会受到公司政策限制，只能使用大型云服务商提供的模型，例如\n`chat_azure_openai()`、`chat_aws_bedrock()`、`chat_databricks()` 或\n`chat_snowflake()`。\n\n如果您是出于个人探索目的使用 ellmer，则有更大的自由度。以下是一些建议，帮助您快速上手：\n\n- 可以从 `chat_openai()` 或 `chat_anthropic()` 开始。`chat_openai()` 默认使用 **GPT-4.1**，但您也可以选择更便宜、更快的模型，如\n  `model = \"gpt-4-1-nano\"`，或者使用 `model = \"o3\"` 进行更复杂的推理。`chat_anthropic()` 也是一个不错的选择，默认使用 **Claude 4.0 Sonnet**，我们发现它在编写 R 代码方面表现尤为出色。\n\n- `chat_google_gemini()` 是一款强大的模型，且提供慷慨的免费额度（缺点是您的数据会被用于改进模型），因此如果您不想花钱，这是一个很好的起点。\n\n- `chat_ollama()` 使用 [Ollama](https:\u002F\u002Follama.com)，允许您在本地运行模型。虽然本地运行的最大模型性能不如云端最先进的模型，但它不会共享您的数据，而且几乎是免费的。\n\n### 身份验证\n\n不同提供商的身份验证方式略有不同。一些主流提供商（如 OpenAI 和 Anthropic）需要您获取 API 密钥。我们建议将密钥保存在环境变量中，而不是直接写入代码中。此外，如果您将使用 ellmer 的应用程序或报告部署到其他系统，也需要确保这些环境变量在目标系统中可用。\n\nellmer 还能自动检测许多基于 OAuth 或 IAM 的凭据，这些凭据通常由大型云服务商使用（目前支持\n`chat_azure_openai()`、`chat_aws_bedrock()`、`chat_databricks()` 和\n`chat_snowflake()`）。这包括由 [Posit Workbench](https:\u002F\u002Fdocs.posit.co\u002Fide\u002Fserver-pro\u002Fuser\u002Fposit-workbench\u002Fmanaged-credentials\u002Fmanaged-credentials.html) 和 [Posit Connect](https:\u002F\u002Fdocs.posit.co\u002Fconnect\u002Fuser\u002Foauth-integrations\u002F#adding-oauth-integrations-to-deployed-content) 管理的平台凭据。\n\n如果您发现 ellmer 无法检测到某些云服务商的凭据，请随时提交问题，我们很乐意根据需要添加更多身份验证机制。\n\n## 使用 ellmer\n\n根据您是以交互式还是编程方式使用 ellmer，可以采用不同的方法。所有操作都始于创建一个新的聊天对象：\n\n``` r\nlibrary(ellmer)\n\nchat \u003C- chat_openai(\"保持简洁\", model = \"gpt-4o-mini\")\n```\n\n聊天对象是具有状态的 [R6 对象](https:\u002F\u002Fr6.r-lib.org)：它们会保留对话上下文，因此每次新的查询都会基于之前的对话内容。您可以通过 `$` 调用其方法。\n\n### 交互式聊天控制台\n\n使用 ellmer 最具交互性、最不需编程的方式，就是在 R 控制台或浏览器中直接与模型对话，只需调用 `live_console(chat)` 或 `live_browser()` 即可：\n\n``` r\nlive_console(chat)\n#> ╔════════════════════════════════════════════════════════╗\n#> ║  进入聊天控制台。多行输入请使用 \"\"\"。  ║\n#> ║  按 Ctrl+C 退出。                                 ║\n#> ╚════════════════════════════════════════════════════════╝\n#> >>> R 的最初创造者是谁？\n#> R 最初是由新西兰奥克兰大学的 Ross Ihaka 和 Robert Gentleman 创建的。\n#>\n#> >>> 那是什么时候？\n#> R 最早于 1995 年发布。其开发工作则开始于再往前几年，即 20 世纪 90 年代初。\n```\n\n请注意，聊天对象会保留状态。因此，当您进入聊天控制台时，之前与该聊天对象的所有交互仍然属于当前对话的一部分；而您在聊天控制台中的任何互动，在返回 R 提示符后也会继续存在。无论您使用哪种聊天函数，情况都是如此。\n\n### 交互式方法调用\n\n第二种最交互式的聊天方式是调用 `chat()` 方法：\n\n``` r\nchat$chat(\"哪些早期语言对 R 影响最大？\")\n#> R 主要受到 S 语言的影响，S 语言是由贝尔实验室开发的。 \n#> 其他值得注意的影响还包括：\n#> \n#> 1. **Scheme** - 提供了函数式编程的概念。\n#> 2. **LISP** - 拥有强大的数据操作特性。\n#> 3. **C** - 提升了性能并提供了系统级访问能力。\n#> 4. **Fortran** - 在数值和统计计算方面发挥了重要作用。\n#> \n#> 这些语言共同塑造了 R 的语法、数据结构以及函数式编程能力。\n```\n\n如果你在全局环境中初始化聊天对象，`chat` 方法会将响应流式输出到控制台。当整个响应接收完毕后，它还会以字符向量的形式（不可见地）返回。这在你希望实时查看响应内容，但又不想进入聊天控制台时非常有用。\n\n如果你想就一张图片提问，可以使用 `content_image_file()` 和\u002F或 `content_image_url()` 传递一个或多个额外的输入参数：\n\n``` r\nchat$chat(\n  content_image_url(\"https:\u002F\u002Fwww.r-project.org\u002FRlogo.png\"),\n  \"你能解释一下这个标志吗？\"\n)\n#> 该标志由一个蓝色的风格化字母“R”组成，周围环绕着灰色的椭圆形。 \n#> 设计体现了 R 编程语言的特点，R 广泛用于统计计算和图形绘制。 \n#> 颜色的选择通常象征着清晰与专业性，这也符合 R 在数据分析和研究中的应用。 \n#> 整体标志传达了该语言专注于数据可视化和统计方法的核心理念。\n```\n\n### 流式输出与捕获\n\n在大多数情况下，ellmer 会将输出流式显示在控制台上。你可以通过在创建聊天对象时或调用 `$chat()` 时设置 `echo` 参数来控制这一行为。将 `echo = \"none\"` 设置为返回字符串：\n\n``` r\nmy_function \u003C- function() {\n  chat \u003C- chat_openai(\"尽量简洁\", model = \"gpt-4o-mini\", echo = \"none\")\n  chat$chat(\"6 乘以 7 等于多少？\")\n}\nstr(my_function())\n#>  'ellmer_output' chr \"6 乘以 7 等于 42。\"\n```\n\n如果需要，你也可以手动通过 `echo` 参数控制这一行为。这在使用 ellmer 进行编程时非常有用，尤其是在结果并非 intended for human consumption，或者你希望在显示之前先处理响应的情况下。\n\n## 学习更多\n\nellmer 自带一系列 vignette，帮助你进一步学习：\n\n- 在 `vignette(\"ellmer\")` 中学习关键术语并查看示例用法。\n- 在 `vignette(\"prompt-design\")` 中学习如何设计提示词。\n- 在 `vignette(\"tool-calling\")` 中了解工具\u002F函数调用。\n- 在 `vignette(\"structured-data\")` 中学习如何提取结构化数据。\n- 在 `vignette(\"streaming-async\")` 中了解流式传输和异步 API。","# ellmer 快速上手指南\n\nellmer 是一个专为 R 语言设计的开源包，旨在简化大语言模型（LLM）的集成与使用。它支持包括 OpenAI、Anthropic、Azure、AWS 在内的众多主流模型提供商，并提供流式输出、工具调用及结构化数据提取等丰富功能。\n\n## 环境准备\n\n*   **系统要求**：需安装 R (建议版本 4.1+) 和 RStudio（推荐）。\n*   **前置依赖**：\n    *   确保已配置好网络连接，能够访问所选 LLM 提供商的 API 服务。\n    *   **认证凭证**：大多数提供商（如 OpenAI, Anthropic）需要 API Key。建议将其设置为环境变量（例如 `OPENAI_API_KEY`），而非硬编码在脚本中。\n    *   若使用国内云厂商或特定代理网络，请确保环境变量中已配置相应的代理设置。\n\n## 安装步骤\n\n你可以直接从 CRAN 安装稳定版：\n\n```r\ninstall.packages(\"ellmer\")\n```\n\n若需体验最新开发特性，也可从 GitHub 安装（需先安装 `remotes` 包）：\n\n```r\n# install.packages(\"remotes\")\nremotes::install_github(\"tidyverse\u002Fellmer\")\n```\n\n## 基本使用\n\n### 1. 初始化聊天对象\n\n加载库并创建一个聊天对象。以下示例以 OpenAI 为例（需确保环境变量中已设置 `OPENAI_API_KEY`）：\n\n```r\nlibrary(ellmer)\n\n# 创建聊天对象，指定系统提示词和模型\nchat \u003C- chat_openai(\"Be terse\", model = \"gpt-4o-mini\")\n```\n\n> **提示**：ellmer 支持多种提供商，只需替换函数名即可，例如 `chat_anthropic()`, `chat_azure_openai()`, `chat_ollama()` 等。\n\n### 2. 交互式对话\n\n最直接的方式是在控制台进行实时对话。输入 `live_console(chat)` 即可进入交互模式：\n\n```r\nlive_console(chat)\n# 进入后直接输入问题，输入 \"\"\" 可进行多行输入，Ctrl+C 退出\n```\n\n### 3. 编程式调用\n\n在脚本中通过 `$chat()` 方法发送消息。默认情况下，回复会流式打印到控制台，并隐形返回结果字符串：\n\n```r\nresponse \u003C- chat$chat(\"R 语言的主要前身是什么？\")\n# 输出将直接显示在控制台，同时结果存储在 response 变量中\n```\n\n**处理图片输入**：\n你可以结合 `content_image_url()` 或 `content_image_file()` 发送包含图片的请求：\n\n```r\nchat$chat(\n  content_image_url(\"https:\u002F\u002Fwww.r-project.org\u002FRlogo.png\"),\n  \"请解释这个 Logo 的含义\"\n)\n```\n\n### 4. 控制输出模式\n\n如果你希望在函数中捕获返回值而不直接打印到控制台（例如用于后续数据处理），可设置 `echo = \"none\"`：\n\n```r\nmy_function \u003C- function() {\n  # 创建时禁止自动打印\n  chat_silent \u003C- chat_openai(\"Be terse\", model = \"gpt-4o-mini\", echo = \"none\")\n  result \u003C- chat_silent$chat(\"6 乘以 7 等于多少？\")\n  return(result)\n}\n\nstr(my_function())\n# 输出：'ellmer_output' chr \"6 times 7 is 42.\"\n```","某金融数据分析师需要在 R 语言环境中，每日自动处理数百份非结构化的英文财报摘要，提取关键财务指标并生成中文简报。\n\n### 没有 ellmer 时\n- **流程割裂严重**：必须先将数据导出为 CSV，切换到 Python 脚本或网页端调用大模型 API，处理完再导回 R，极易出错且耗时。\n- **开发门槛高**：在 R 中手动构建 HTTP 请求来处理流式输出或复杂的函数调用（Function Calling），代码冗长且难以维护。\n- **多云适配困难**：若公司合规要求切换至 Azure OpenAI 或 AWS Bedrock，需重写大量底层认证和接口对接代码。\n- **结构化提取繁琐**：缺乏原生支持，需编写复杂的正则表达式从 LLM 返回的文本中清洗出 JSON 数据，稳定性差。\n\n### 使用 ellmer 后\n- **工作流无缝集成**：直接在 R 脚本中通过 `chat_azure_openai()` 等函数调用模型，实现从数据读取、AI 分析到可视化报告的全链路闭环。\n- **功能开箱即用**：利用内置的流式输出和工具调用功能，几行代码即可实现实时打印分析过程或自动执行 R 函数进行数据验证。\n- **供应商灵活切换**：仅需更改一行代码（如从 `chat_openai()` 改为 `chat_anthropic()`），即可在不同云服务商间迁移，完美适配企业合规策略。\n- **数据提取精准高效**：原生支持结构化数据提取，可直接将非结构化财报文本转换为标准的 R 数据框（Data Frame），无需额外清洗。\n\nellmer 让 R 语言用户无需离开熟悉的生态，即可像调用本地函数一样轻松驾驭全球主流大模型，极大提升了数据智能处理的效率与灵活性。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ftidyverse_ellmer_07f75a37.png","tidyverse","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Ftidyverse_2356785a.png","The tidyverse is a collection of R packages that share common principles and are designed to work together seamlessly",null,"http:\u002F\u002Ftidyverse.org","https:\u002F\u002Fgithub.com\u002Ftidyverse",[79],{"name":80,"color":81,"percentage":82},"R","#198CE7",100,595,126,"2026-04-07T16:37:59","NOASSERTION","未说明","非必需（主要调用云端 API；若使用 Ollama 本地运行模型，则取决于所选具体模型的需求）",{"notes":90,"python":91,"dependencies":92},"这是一个 R 语言包，而非 Python 工具。主要通过 API 调用各大云服务商（如 OpenAI, Anthropic, AWS 等）的大模型，因此本地硬件要求极低。若选择使用 'chat_ollama()' 在本地运行模型，则硬件需求取决于用户自行安装的 Ollama 及所加载的具体模型大小。使用前需配置相应服务提供商的 API 密钥或云凭证（支持环境变量自动检测）。","不适用（此为 R 语言包）",[93,94],"R (基础环境)","R6 (用于状态管理)",[35,14],"2026-03-27T02:49:30.150509","2026-04-09T01:30:27.388551",[99,104,109,114,119,123,128],{"id":100,"question_zh":101,"answer_zh":102,"source_url":103},25503,"ellmer 是否支持嵌入（Embedding）模型 API？","ellmer 本身不提供嵌入 API 的封装，因为开发重点在其他功能上。对于嵌入需求，推荐使用 tidyverse 旗下的另一个包 'ragnar'，它提供了一系列嵌入函数。","https:\u002F\u002Fgithub.com\u002Ftidyverse\u002Fellmer\u002Fissues\u002F171",{"id":105,"question_zh":106,"answer_zh":107,"source_url":108},25504,"如何配置 ellmer 以连接 Azure 托管的 OpenAI 模型？","可以使用 `chat_azure()` 函数进行配置。需要指定 `api_version`、`endpoint` 和 `deployment_id`。示例代码如下：\n\nlibrary(ellmer)\nchat \u003C- chat_azure(\n  api_version = \"2024-02-01\",\n  endpoint = \"https:\u002F\u002F\u003Cyour-endpoint>.openai.azure.com\u002F\",\n  deployment_id = \"\u003Cyour-deployment>\",\n  system_prompt = \"You are a friendly assistant.\"\n)\nchat$chat(\"What is the capital of France?\")","https:\u002F\u002Fgithub.com\u002Ftidyverse\u002Fellmer\u002Fissues\u002F76",{"id":110,"question_zh":111,"answer_zh":112,"source_url":113},25505,"在使用 `parallel_chat_structured` 时，为什么提示词（prompts）必须是列表（list）而不能是字符向量？","这是为了正确处理非矩形输入与输出之间的关系，特别是当结果包含数组时。如果传入字符向量，函数可能会将每个字符（或行）视为独立的提示，导致输出数量异常（例如输入 1 段文本却产生多行输出）。正确的做法是使用 `as.list(text)` 将字符向量转换为列表，或者直接使用 `list(text)` 包裹整个文本，以确保输入输出的结构对应正确。","https:\u002F\u002Fgithub.com\u002Ftidyverse\u002Fellmer\u002Fissues\u002F628",{"id":115,"question_zh":116,"answer_zh":117,"source_url":118},25506,"如何在 ellmer 中实现批量处理（Batch Processing）以提高效率？","ellmer 已支持批量处理功能（通过 PR #496 修复）。使用并行处理（parallel）通常比顺序处理快两倍。用户可以利用 `parallel_chat` 等相关函数，通过设置多个 worker（例如 30 个）来处理大量提示（如 200 个），这在保持内存占用较低的同时能显著提升性能。","https:\u002F\u002Fgithub.com\u002Ftidyverse\u002Fellmer\u002Fissues\u002F143",{"id":120,"question_zh":121,"answer_zh":122,"source_url":113},25507,"当批量请求中部分提示因内容过滤策略失败时，如何处理错误以避免整个任务中断？","建议在调用 `parallel_chat` 时利用底层的 `httr2::req_perform_parallel` 的错误处理机制。可以通过传递 `on_error` 参数（如设置为 \"continue\" 或 \"return\"）来确保单个请求的失败不会导致整个批次停止。社区贡献者已提出增强方案，允许在结构化批量聊天中忽略错误并继续处理，默认行为可配置为遇到错误时停止或继续。",{"id":124,"question_zh":125,"answer_zh":126,"source_url":127},25508,"使用 `batch_chat_structured` 时，如果 OpenAI 返回了错误文件但状态码为 0 或解析失败，ellmer 是如何处理结果的？","这种情况通常是由于 OpenAI 返回了无效的 JSON。ellmer 在处理时会尝试解析，如果遇到无效 JSON，计划通过正则表达式回退机制来处理。虽然 Web UI 可能显示部分失败，但 ellmer 在 R 中重新获取结果时，会尝试匹配输入顺序并填充数据框。若遇到频繁的 JSON 解析错误，建议检查 OpenAI 的结构化输出稳定性，后续版本将增加更防御性的 JSON 验证。","https:\u002F\u002Fgithub.com\u002Ftidyverse\u002Fellmer\u002Fissues\u002F830",{"id":129,"question_zh":130,"answer_zh":131,"source_url":103},25509,"是否有在 R 中使用 ellmer 构建本地 RAG（检索增强生成）应用的示例？","有的。社区用户已经编写了使用 ellmer 包结合 Ollama 和 ChromaDB 在 R 中构建本地 RAG 应用的完整教程。你可以参考 freeCodeCamp 上的相关文章来获取具体的实现步骤和代码示例。",[133,138,143,148,153,158,163,168],{"id":134,"version":135,"summary_zh":136,"released_at":137},162816,"v0.4.0","## 生命周期变更\n\n* `chat_claude()` 不再被弃用，而是 `chat_anthropic()` 的别名，以反映 Anthropic 近期将开发者工具重新品牌化为 Claude 品牌（#758）。`models_claude()` 现在是 `models_anthropic()` 的别名。\n* `parallel_chat()` 和 `batch_chat()` 不再处于实验阶段。\n* 以下已弃用的函数\u002F参数\u002F方法现已移除：\n  * `Chat$extract_data()` -> `chat$chat_structured()`（0.2.0）\n  * `Chat$extract_data_async()` -> `chat$chat_structured_async()`（0.2.0）\n  * `chat_anthropic(max_tokens)` -> `chat_anthropic(params)`（0.2.0）\n  * `chat_azure()` -> `chat_azure_openai()`（0.2.0）\n  * `chat_azure_openai(token)`（0.1.1）\n  * `chat_bedrock()` -> `chat_aws_bedrock()`（0.2.0）\n  * `chat_claude()` -> `chat_anthropic()`（0.2.0）\n  * `chat_cortex()` -> `chat_snowflake()`（0.2.0）\n  * `chat_gemini()` -> `chat_google_gemini()`（0.2.0）\n  * `chat_openai(seed)` -> `chat_openai(params)`（0.2.0）\n  * `create_tool_def(model)` -> `create_tool_def(chat)`（0.2.0）\n\n## 新特性\n\n* `batch_*()` 现在不再对提供者的属性进行哈希处理，仅保留 `name`、`model` 和 `base_url`。这可以在一定程度上防止意外地在不同提供商之间重复使用相同的 `.json` 文件，同时仍允许你在不同版本的 ellmer 中使用同一份批处理文件。此外，新增了 `ignore_hash` 参数，如果你确信差异仅源于 ellmer 自身的变化，可以选择禁用此检查。\n* `chat_claude()` 新增 `cache` 参数，用于控制缓存行为。默认设置为“5m”。这应能（平均而言）降低聊天成本（#584）。\n* `chat_openai()` 现在使用 OpenAI 的 responses API 端点（#365、#801）。这是 OpenAI 推荐的端点，能够提供更多对内置工具的访问权限。\n* `chat_openai_compatible()` 取代 `chat_openai()` 成为与 OpenAI 兼容 API 的接口，而 `chat_openai()` 则专门用于官方 OpenAI API。与之前版本的 `chat_openai()` 不同，`base_url` 参数现在是必需的（#801）。\n* `chat_*()` 函数现在使用 `credentials` 函数代替 `api_key` 参数（#613）。这意味着 API 密钥不会存储在可能保存到磁盘的聊天对象中，而是在需要时按需获取。通常情况下，你无需显式使用 `credentials` 参数，但在必要时，应通过它从其他来源动态获取 API 密钥（即切勿将密钥直接硬编码到函数调用中）。\n* 新增一组 `claude_file_()` 函数，用于管理与 Claude 的文件上传操作（@dcomputing，#761）。\n* ellmer 现在支持多种内置的网页搜索和抓取工具（#578）：\n  - 适用于 Claude 的 `claude_tool_web_search()` 和 `claude_tool_web_fetch()`。\n  - 适用于 Gemini 的 `google_tool_web_search()` 和 `google_tool_web_fetch()`。\n  - 适用于 OpenAI 的 `openai_tool_web_search()`。\n  如果你需要为其他提供商执行网页抓取，可以使用 `btw::btw_tool_web_read_url()`。\n* `parallel_chat()` 及其相关功能","2025-11-18T06:34:32",{"id":139,"version":140,"summary_zh":141,"released_at":142},162817,"v0.3.2","* `chat()` 现在与大多数 `chat_` 函数兼容 (#699)。\n  * `chat_aws_bedrock()`、`chat_databricks()`、`chat_deepseek()`、`chat_github()`、`chat_groq()`、`chat_ollama()`、`chat_openrouter()`、`chat_perplexity()` 和 `chat_vllm()` 现在支持 `params` 参数，该参数可接受来自 `params()` 的通用模型参数。\n  * `chat_azure_openai()` 中的 `deployment_id` 参数已被弃用，并替换为 `model`，以更好地与其他提供商保持一致。\n\n* `chat_openai()` 现在会将 `params()` 中的 `max_tokens` 和 `top_k` 正确映射到 OpenAI API 参数 (#699)。\n","2025-09-03T22:51:01",{"id":144,"version":145,"summary_zh":146,"released_at":147},162818,"v0.3.1","* `chat_anthropic()` 会丢弃空的助手回复，以避免 API 错误 (#710)。\n\n* `chat_github()` 现在使用 `https:\u002F\u002Fmodels.github.ai\u002Finference` 端点，并且 `chat()` 支持 GitHub 模型，格式为 `chat(\"github\u002Fopenai\u002Fgpt-4.1\")` (#726)。\n\n* 修复了 `chat_google_vertex()` 的认证问题，采用了更宽泛的权限范围 (#704, @netique)。\n\n* `chat_google_vertex()` 现在可以使用全局项目位置设置 (#704, @netique)。\n\n* `chat_openai()` 现在如果设置了 `OPENAI_BASE_URL`，就会将其用作 `base_url`。同样地，`chat_ollama()` 如果设置了 `OLLAMA_BASE_URL`，也会使用该值 (#713)。\n\n* `contents_record()` 和 `contents_replay()` 现在可以记录和回放继承自 ellmer 的 `Turn` 或 `Content` 类的自定义类实例 (#689)。此外，`contents_replay()` 现在还会恢复 `ContentToolResult` 对象中的工具定义（位于 `@request@tool` 中）(#693)。\n\n* `chat_snowflake()` 现在支持 Privatelink 账户 (#694, @robert-norberg)，并且已适配 Snowflake 的最新 API 变更 (#692, @robert-norberg)。\n\n* 修复了 `models_google_vertex()` 函数，参数 `project_id` 现已废弃 (#704, @netique)。\n\n* 在 OpenAI 提供商的 `value_turn()` 方法中，在记录 token 使用量之前会检查 `usage` 是否为 `NULL`，以避免在使用某些兼容 OpenAI 的服务进行流式传输时出现错误 (#706, @stevegbrooks)。\n","2025-08-27T13:34:31",{"id":149,"version":150,"summary_zh":151,"released_at":152},162819,"v0.3.0","## 新特性\n\n* 新增 `chat()` 函数，允许您使用类似 `chat(\"anthropic\")` 或 `chat(\"openai\u002Fgpt-4.1-nano\")` 的字符串与任何提供商进行对话 (#361)。\n  \n* `tool()` 的规范更加简化：现在只需指定 `name`、`description` 和 `arguments`。我已尽力弃用旧的用法并提供清晰的错误提示，但可能仍有一些边缘情况未被覆盖。对于由此带来的不便，我深表歉意，但我相信从长远来看，这将使工具的使用更加简单明了。如果您有许多需要转换的调用，可以使用 `?tool` 中提供的提示，借助大语言模型来完成转换 (#603)。此外，它现在会返回一个函数，以便您可以直接调用（或将其导出到您的包中）(#602)。\n\n* `type_array()` 和 `type_enum()` 现在将描述作为第二个参数，而将 `items`\u002F`values` 作为第一个参数。这样在通常不需要描述的情况下，使用起来更加方便 (#610)。\n\n* ellmer 现在会重试请求最多 3 次，可通过 `option(ellmer_max_tries)` 进行控制；并且不仅在请求本身返回临时性错误时会重试，还会在连接失败时重试。默认超时时间由 `option(ellmer_timeout_s)` 控制，现在适用于初始连接阶段。这些改进应能显著提高 ellmer 请求的成功率。\n\n* 新增 `parallel_chat_text()` 和 `batch_chat_text()`，可更轻松地从多个提示中获取纯文本响应 (#510)。\n\n* ellmer 的成本估算得到了大幅改进。`chat_openai()`、`chat_google_gemini()` 和 `chat_anthropic()` 现在会记录缓存的输入 token 数量。这一点对 OpenAI 和 Gemini 尤其有用，因为两者都提供自动缓存功能，从而提高了成本估算的准确性 (#466)。此外，我们还引入了更好的定价数据来源——LiteLLM，这大大扩展了包含成本信息的提供商和模型数量 (#659)。\n\n## 错误修复及小幅改进\n\n* 新增 `ellmer_echo` 选项，用于控制 `echo` 的默认值。\n* `batch_chat_structured()` 在提示、路径或提供商不匹配时会给出清晰的提示信息 (#599)。\n* `chat_aws_bedrock()` 允许设置 `base_url()` (#441)。\n* `chat_aws_bedrock()`、`chat_google_gemini()`、`chat_ollama()` 和 `chat_vllm()` 使用更为稳健的方法，根据 `base_url` 生成模型 URL (#593, @benyake)。\n* `chat_cortex_analyst()` 已弃用，请改用 `chat_snowflake()` (#640)。\n* `chat_github()`（以及其他 OpenAI 扩展）不再对 `seed` 发出警告 (#574)。\n* `chat_google_gemini()` 和 `chat_google_vertex()` 现已默认使用 Gemini 2.5 flash (#576)。\n* `chat_huggingface()` 的性能有了显著提升。\n* `chat_openai()` 现在支持 `content_pdf_()` (#650)。\n* `chat_portkey()` 已恢复正常运行，并从环境变量 `PORTKEY_VIRTUAL_KEY` 中读取虚拟 API 密钥 (#588)。\n* `chat_snowflake()` 现已支持工具调用 (#557, @atheriel)。\n* `Chat$chat_structured()` 及其相关函数不再为 `chat_openai()` 不必要地包装 `type_object()` (#671)。\n* `Chat$chat_structured()` su","2025-07-25T13:22:20",{"id":154,"version":155,"summary_zh":156,"released_at":157},162820,"v0.2.1","* 当你将 `Chat` 对象保存到磁盘时，API 密钥会自动被遮盖。这意味着你将无法再轻松地从磁盘恢复之前保存的聊天（我们将在未来的版本中解决这个问题），但这样可以确保你永远不会不小心将密钥保存到 RDS 文件中（#534）。\n  \n* `chat_anthropic()` 现在默认使用 Claude Sonnet 4，并且我添加了最新一代 Claude 模型的价格信息。\n\n* `chat_databricks()` 现在会读取配置文件中设置的 Databricks 工作区 URL，这应该能提高与 Databricks CLI 的兼容性（#521，@atheriel）。\n\n* `chat_snowflake()` 不再输出带有神秘 `list(type = \"text\", text = \"\")` 尾部的流式响应（#533，@atheriel）。现在它可以正确地将流式输出解析为多轮对话（#542），并支持结构化输出（#544）、工具调用（#548）以及标准模型参数（#545，@atheriel）。\n\n* `chat_snowflake()` 和 `chat_databricks()` 现在都默认使用 Claude Sonnet 3.7，与 `chat_anthropic()` 的默认设置一致（#539 和 #546，@atheriel）。\n\n* `type_from_schema()` 允许你在结构化聊天中使用现有的 JSON 模式（#133，@hafen）。","2025-06-03T15:08:36",{"id":159,"version":160,"summary_zh":161,"released_at":162},162821,"v0.2.0","## 破坏性变更\n\n* 我们对 ellmer 将 JSON 转换为 R 数据结构的方式进行了多项改进。这些属于破坏性变更，不过我们预计不会对现有代码造成太大影响。最重要的是，工具现在会以强制转换为标准 R 数据结构的输入来调用（#461）；若需禁用此行为，可在 `tool()` 中设置 `convert = FALSE`。\n\n  此外，ellmer 现在会将 `NULL` 值转换为 `NA`，适用于 `type_boolean()`、`type_integer()`、`type_number()` 和 `type_string()` 函数（#445），并且在 `required = FALSE` 时对数组的处理也更加完善（#384）。\n\n* `chat_` 函数不再接受 `turn` 参数。如果需要设置轮次，现在可以使用 `Chat$set_turns()` 方法（#427）。此外，`Chat$tokens()` 已更名为 `Chat$get_tokens()`，并返回一个按各轮次正确对齐的令牌数据框。打印方法现利用这一信息显示每一轮分别使用了多少输入和输出令牌（#354）。\n\n## 新特性\n\n* 新增两个接口，帮助您通过一次函数调用同时进行多轮对话：\n\n  * `batch_chat()` 和 `batch_chat_structured()` 允许您将多轮对话提交至 OpenAI 和 Anthropic 的批量接口。此类请求仅保证在 24 小时内获得响应，但费用仅为常规请求的一半（#143）。\n\n  * `parallel_chat()` 和 `parallel_chat_structured()` 可与任何提供商配合使用，支持并行提交多轮对话（#143）。虽然这种方式无法节省成本，但速度通常会快得多。\n\n  这组新函数目前仍处于实验阶段，因为我尚不确定用户界面的设计是否合理，尤其是在错误处理方面。\n\n* `google_upload()` 允许您将文件上传至 Google Gemini 或 Vertex AI（#310）。这使您能够使用 Gemini 处理视频、PDF 等大型文件。\n\n* `models_google_gemini()`、`models_anthropic()`、`models_openai()`、`models_aws_bedrock()`、`models_ollama()` 和 `models_vllm()` 分别列出 Google Gemini、Anthropic、OpenAI、AWS Bedrock、Ollama 和 VLLM 提供的可用模型。不同提供商返回的元数据格式可能有所不同，因此仅保证返回包含至少一个 `id` 列的数据框（#296）。在条件允许的情况下（目前适用于 Gemini、Anthropic 和 OpenAI），我们会一并提供已知的每百万令牌价格。\n\n* `interpolate()` 等函数现已实现向量化，因此您可以为（例如）一个包含输入数据的数据框生成多个提示。它们现在还会返回一种特殊类的对象，并配备自定义打印方法（#445）。新增的 `interpolate_package()` 函数则简化了从软件包内部 `inst\u002Fprompts` 目录中存储的提示模板中进行插值的操作（#164）。\n\n* `chat_anthropic()`、`chat_azure()`、`chat_openai()` 和 `chat_gemini()` 现在新增了 `params` 参数，结合 `params()` 辅助函数，可轻松跨不同提供商指定常见的模型参数（如 `seed` 和 `temperature`）。对其他提供商的支持将","2025-05-18T14:11:59",{"id":164,"version":165,"summary_zh":166,"released_at":167},162822,"v0.1.1","## 生命周期变更\n\n* `option(ellmer_verbosity)` 已不再支持；请改用标准的 httr2 详细级别函数，如 `httr2::with_verbosity()`；这些函数现在支持流式数据。\n\n* `chat_cortex()` 已更名为 `chat_cortex_analyst()`，以更好地将其与 `chat_snowflake()`（同样使用“Cortex”）区分开来（#275，@atheriel）。\n\n## 新特性\n\n* 所有提供商现在会等待最多 60 秒以获取完整响应。您可以通过设置例如 `option(ellmer_timeout_s = 120)` 来延长此时间（#213，#300）。\n\n* `chat_azure()`、`chat_databricks()`、`chat_snowflake()` 和 `chat_cortex_analyst()` 现在能够在 Posit Connect 上运行时检测基于查看器的凭据（#285，@atheriel）。\n\n* `chat_deepseek()` 提供对 DeepSeek 模型的支持（#242）。\n\n* `chat_openrouter()` 提供对 OpenRouter 托管模型的支持（#212）。\n\n* `chat_snowflake()` 允许与通过 Snowflake 的 [Cortex LLM REST API](https:\u002F\u002Fdocs.snowflake.com\u002Fen\u002Fuser-guide\u002Fsnowflake-cortex\u002Fcortex-llm-rest-api) 托管的模型进行对话（#258，@atheriel）。\n\n* `content_pdf_file()` 和 `content_pdf_url()` 允许您将 PDF 文件上传至受支持的模型。目前支持 PDF 的模型包括 Google Gemini 和 Claude Anthropic。感谢 @walkerke 和 @andrie 的帮助（#265）。\n\n## Bug 修复及小幅改进\n\n* `Chat$get_model()` 现在会返回模型名称（#299）。\n\n* `chat_azure()` 对 Azure Entra ID 的支持得到了极大提升。API 密钥现为可选项，系统可以自动从 Azure 服务主体中获取环境凭据，或在可能的情况下尝试进行交互式 Entra ID 身份验证。原本设计就有缺陷的 `token` 参数已被弃用（因为它无法正确处理令牌刷新），取而代之的是新的 `credentials` 参数，可在需要时用于自定义 Entra ID 支持（例如，当您尝试使用 `AzureAuth` 包生成的令牌时）（#248，#263，#273，#257，@atheriel）。\n\n* `chat_azure()` 在底层 HTTP 请求失败时会报告更清晰的错误信息（#269，@atheriel）。它现在默认使用 `api_version = \"2024-10-21\"`，该版本包含结构化数据提取的相关功能（#271）。\n\n* `chat_bedrock()` 现在能更好地处理临时 IAM 凭据（#261，@atheriel），并且新增了 `api_args` 参数（@billsanto，#295）。\n\n* `chat_databricks()` 现在能够正确处理 `DATABRICKS_HOST` 环境变量，无论其是否包含 HTTPS 前缀（#252，@atheriel）。此外，在发送请求时也会尊重 `SPARK_CONNECT_USER_AGENT` 环境变量（#254，@atheriel）。\n\n* `chat_gemini()` 现在默认使用 gemini-2.0-flash 模型。\n\n* `print(Chat)` 不再对长行进行换行，从而使代码和项目符号列表更易于阅读（#246）。\n","2025-02-07T03:18:33",{"id":169,"version":170,"summary_zh":171,"released_at":172},162823,"v0.1.0","* 新增 `chat_vllm()`，用于与由 vLLM 提供服务的模型进行对话 (#140)。\n\n* 默认的 `chat_openai()` 模型现已更新为 GPT-4o。\n\n* 新增 `Chat$set_turns()` 方法用于设置对话轮次。`Chat$turns()` 现已更名为 `Chat$get_turns()`。`Chat$system_prompt()` 已被替换为 `Chat$set_system_prompt()` 和 `Chat$get_system_prompt()`。\n\n* 异步及流式异步对话现采用事件驱动方式，并使用 `later::later_fd()` 高效等待 cURL 套接字活动 (#157)。\n\n* 新增 `chat_bedrock()`，用于与 AWS Bedrock 上的模型进行对话 (#50)。\n\n* 新增 `chat$extract_data()` 方法，在可用时使用结构化数据 API（否则使用工具调用），以提取符合已知类型规范的结构化数据。您可以使用 `type_boolean()`、`type_integer()`、`type_number()`、`type_string()`、`type_enum()`、`type_array()` 和 `type_object()` 函数来创建规范 (#31)。\n\n* 通用的 `ToolArg()` 已被更具体的 `type_*()` 函数取代。`ToolDef()` 已更名为 `tool`。\n\n* `content_image_url()` 现在会在传入 data URL 时创建内联图片 (#110)。\n\n* 流式 Ollama 结果再次恢复正常工作 (#117)。\n\n* 流式 OpenAI 结果现在能够捕获更多内容，包括 `logprops` (#115)。\n\n* 新增 `interpolate()` 和 `prompt_file()`，使创建混合静态文本与动态值的提示更加便捷。\n\n* 您可以通过调用 `token_usage()` 查看当前会话中已使用的 token 数量。\n\n* `chat_browser()` 和 `chat_console()` 现已更名为 `live_browser()` 和 `live_console()`。\n\n* 参数 `echo` 现在可以取三个值：“none”、“text”或“all”。若设置为“all”，您将同时看到用户和助手的发言，并且所有内容类型都会被打印出来，而不仅仅是文本。在全局环境中运行时，`echo` 的默认值为“text”；而在函数内部运行时，则默认为“none”。\n\n* 您现在可以通过设置 `options(ellmer_verbosity = 2)` 来记录低级别的 JSON 请求\u002F响应信息。\n\n* `chat$register_tool()` 现在接收由 `Tool()` 创建的对象，这使得工具定义的复用更加方便 (#32)。\n\n* `new_chat_openai()` 现已更名为 `chat_openai()`。\n\n* 现已支持 Claude 和 Gemini，分别通过 `chat_claude()` 和 `chat_gemini()` 实现。\n\n* 现已支持 Snowflake Cortex Analyst，通过 `chat_cortex()` 实现 (#56)。\n\n* 现已支持 Databricks，通过 `chat_databricks()` 实现 (#152)。\n","2025-01-09T18:06:27"]