[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-google--generative-ai-go":3,"tool-google--generative-ai-go":61},[4,18,28,37,45,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":24,"last_commit_at":25,"category_tags":26,"status":17},9989,"n8n","n8n-io\u002Fn8n","n8n 是一款面向技术团队的公平代码（fair-code）工作流自动化平台，旨在让用户在享受低代码快速构建便利的同时，保留编写自定义代码的灵活性。它主要解决了传统自动化工具要么过于封闭难以扩展、要么完全依赖手写代码效率低下的痛点，帮助用户轻松连接 400 多种应用与服务，实现复杂业务流程的自动化。\n\nn8n 特别适合开发者、工程师以及具备一定技术背景的业务人员使用。其核心亮点在于“按需编码”：既可以通过直观的可视化界面拖拽节点搭建流程，也能随时插入 JavaScript 或 Python 代码、调用 npm 包来处理复杂逻辑。此外，n8n 原生集成了基于 LangChain 的 AI 能力，支持用户利用自有数据和模型构建智能体工作流。在部署方面，n8n 提供极高的自由度，支持完全自托管以保障数据隐私和控制权，也提供云端服务选项。凭借活跃的社区生态和数百个现成模板，n8n 让构建强大且可控的自动化系统变得简单高效。",184740,2,"2026-04-19T23:22:26",[16,14,13,15,27],"插件",{"id":29,"name":30,"github_repo":31,"description_zh":32,"stars":33,"difficulty_score":10,"last_commit_at":34,"category_tags":35,"status":17},10095,"AutoGPT","Significant-Gravitas\u002FAutoGPT","AutoGPT 是一个旨在让每个人都能轻松使用和构建 AI 的强大平台，核心功能是帮助用户创建、部署和管理能够自动执行复杂任务的连续型 AI 智能体。它解决了传统 AI 应用中需要频繁人工干预、难以自动化长流程工作的痛点，让用户只需设定目标，AI 即可自主规划步骤、调用工具并持续运行直至完成任务。\n\n无论是开发者、研究人员，还是希望提升工作效率的普通用户，都能从 AutoGPT 中受益。开发者可利用其低代码界面快速定制专属智能体；研究人员能基于开源架构探索多智能体协作机制；而非技术背景用户也可直接选用预置的智能体模板，立即投入实际工作场景。\n\nAutoGPT 的技术亮点在于其模块化“积木式”工作流设计——用户通过连接功能块即可构建复杂逻辑，每个块负责单一动作，灵活且易于调试。同时，平台支持本地自托管与云端部署两种模式，兼顾数据隐私与使用便捷性。配合完善的文档和一键安装脚本，即使是初次接触的用户也能在几分钟内启动自己的第一个 AI 智能体。AutoGPT 正致力于降低 AI 应用门槛，让人人都能成为 AI 的创造者与受益者。",183572,"2026-04-20T04:47:55",[13,36,27,14,15],"语言模型",{"id":38,"name":39,"github_repo":40,"description_zh":41,"stars":42,"difficulty_score":10,"last_commit_at":43,"category_tags":44,"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":46,"name":47,"github_repo":48,"description_zh":49,"stars":50,"difficulty_score":24,"last_commit_at":51,"category_tags":52,"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 真正成长为懂上",161692,"2026-04-20T11:33:57",[14,13,36],{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":24,"last_commit_at":59,"category_tags":60,"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 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",109154,"2026-04-18T11:18:24",[14,15,13],{"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":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":76,"owner_location":76,"owner_email":77,"owner_twitter":78,"owner_website":79,"owner_url":80,"languages":81,"stars":90,"forks":91,"last_commit_at":92,"license":93,"difficulty_score":24,"env_os":94,"env_gpu":95,"env_ram":95,"env_deps":96,"category_tags":101,"github_topics":102,"view_count":24,"oss_zip_url":76,"oss_zip_packed_at":76,"status":17,"created_at":107,"updated_at":108,"faqs":109,"releases":139},10229,"google\u002Fgenerative-ai-go","generative-ai-go","Go SDK for Google Generative AI","generative-ai-go 是谷歌官方推出的 Go 语言开发工具包，旨在帮助开发者便捷地调用 Gemini、Veo、Imagen 等生成式 AI 模型。它通过封装复杂的 API 交互细节，让程序员能够用简洁的 Go 代码快速实现文本生成、图像分析等多模态功能，从而大幅降低接入谷歌前沿 AI 能力的门槛。\n\n这款工具主要面向熟悉 Go 语言的软件工程师和技术研究人员，特别适合需要在后端服务中集成智能对话、内容创作或数据分析功能的团队。其设计初衷是提供一条清晰、简单的开发路径，让技术构建者能专注于业务逻辑而非底层通信协议。\n\n需要特别注意的是，随着谷歌推出统一的新一代 Google Gen AI SDK，generative-ai-go 目前已进入维护模式。虽然它依然稳定可用，但官方将不再为其添加新功能，仅保留关键漏洞修复直至 2025 年 11 月 30 日。因此，对于启动新项目或追求最新特性的用户，建议直接迁移至全新的 go-genai 库以获得持续的性能优化和功能支持；而对于正在使用旧版的用户，现在正是规划平滑过渡的最佳时机。","# [Deprecated] Google AI Go SDK for the Gemini API\n\nWith Gemini 2.0, we took the chance to create a single unified SDK for all developers who want to use Google's GenAI models (Gemini, Veo, Imagen, etc). As part of that process, we took all of the feedback from this SDK and what developers like about other SDKs in the ecosystem to create the [Google Gen AI SDK](https:\u002F\u002Fgithub.com\u002Fgoogleapis\u002Fgo-genai). \n\nThe Gemini API docs are fully updated to show examples of the new Google Gen AI SDK: [Get started](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Fquickstart?lang=go).\n\nWe know how disruptive an SDK change can be and don't take this change lightly, but our goal is to create an extremely simple and clear path for developers to build with our models so it felt necessary to make this change.\n\nThank you for building with Gemini and [let us know](https:\u002F\u002Fdiscuss.ai.google.dev\u002Fc\u002Fgemini-api\u002F4) if you need any help!\n\n**Please be advised that this repository is now considered legacy.** For the latest features, performance improvements, and active development, we strongly recommend migrating to the official **[Google Generative AI SDK for Go](https:\u002F\u002Fgithub.com\u002Fgoogleapis\u002Fgo-genai)**.\n\n**Support Plan for this Repository:**\n\n*   **Limited Maintenance:** Development is now restricted to **critical bug fixes only**. No new features will be added.\n*   **Purpose:** This limited support aims to provide stability for users while they transition to the new SDK.\n*   **End-of-Life Date:** All support for this repository (including bug fixes) will permanently end on **November 30, 2025**.\n\nWe encourage all users to begin planning their migration to the [Google Generative AI SDK](https:\u002F\u002Fgithub.com\u002Fgoogleapis\u002Fgo-genai) to ensure continued access to the latest capabilities and support.\n","# [已弃用] 适用于 Gemini API 的 Google AI Go SDK\n\n随着 Gemini 2.0 的发布，我们抓住机会为所有希望使用 Google GenAI 模型（Gemini、Veo、Imagen 等）的开发者打造了一个统一的 SDK。在此过程中，我们综合了来自本 SDK 的反馈，以及开发者对生态系统中其他 SDK 的好评，从而创建了 [Google Gen AI SDK](https:\u002F\u002Fgithub.com\u002Fgoogleapis\u002Fgo-genai)。\n\nGemini API 文档已全面更新，展示了新版 Google Gen AI SDK 的示例：[快速入门](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Fquickstart?lang=go)。\n\n我们深知 SDK 更改可能带来的影响，并不会轻率做出这一决定。然而，我们的目标是为开发者构建与我们的模型集成的应用程序提供一条极其简单明了的路径，因此我们认为进行此次更改十分必要。\n\n感谢您使用 Gemini 进行开发！如果您需要任何帮助，请随时告诉我们：[点击这里](https:\u002F\u002Fdiscuss.ai.google.dev\u002Fc\u002Fgemini-api\u002F4)。\n\n**请注意，此代码仓库现已被视为遗留项目。** 为了获得最新功能、性能优化及持续的开发支持，我们强烈建议您迁移到官方的 **[Google Generative AI SDK for Go](https:\u002F\u002Fgithub.com\u002Fgoogleapis\u002Fgo-genai)**。\n\n**本仓库的支持计划：**\n\n*   **有限维护：** 目前仅限于修复关键性缺陷，不再添加新功能。\n*   **目的：** 此有限支持旨在为用户提供稳定性保障，以便顺利完成向新 SDK 的迁移。\n*   **终止支持日期：** 本仓库的所有支持工作（包括缺陷修复）将于 **2025年11月30日** 彻底停止。\n\n我们鼓励所有用户尽早规划向 [Google Generative AI SDK](https:\u002F\u002Fgithub.com\u002Fgoogleapis\u002Fgo-genai) 的迁移，以确保能够持续使用最新的功能并获得相应的技术支持。","# generative-ai-go 快速上手指南\n\n> **⚠️ 重要提示：本项目已弃用（Deprecated）**\n>\n> 随着 Gemini 2.0 的发布，Google 推出了统一的 **[Google Gen AI SDK](https:\u002F\u002Fgithub.com\u002Fgoogleapis\u002Fgo-genai)**。\n> - 本仓库 (`generative-ai-go`) 仅进行**关键漏洞修复**，不再添加新功能。\n> - **停止支持日期**：2025 年 11 月 30 日。\n> - **强烈建议**：新开发项目或现有项目迁移请直接使用官方新版 SDK ([go-genai](https:\u002F\u002Fgithub.com\u002Fgoogleapis\u002Fgo-genai))。\n>\n> 以下指南仅供维护旧代码参考。\n\n## 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n- **操作系统**：Linux, macOS, 或 Windows\n- **Go 版本**：Go 1.21 或更高版本\n- **依赖项**：\n  - 已初始化的 Go 模块 (`go mod init`)\n  - 有效的 Google Cloud API Key (需启用 Gemini API)\n\n## 安装步骤\n\n由于网络原因，国内开发者建议使用 `GOPROXY` 加速依赖下载。\n\n1. **配置国内镜像源（可选但推荐）**：\n   ```bash\n   export GOPROXY=https:\u002F\u002Fgoproxy.cn,direct\n   ```\n\n2. **安装旧版 SDK**：\n   在项目目录下运行以下命令安装此弃用版本的库：\n   ```bash\n   go get github.com\u002Fgoogle\u002Fgenerative-ai-go\n   ```\n\n## 基本使用\n\n以下是最简单的文本生成示例。请注意，实际生产中应使用新版 SDK。\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fgenai\"\n\t\"google.golang.org\u002Fapi\u002Foption\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\t\u002F\u002F 从环境变量获取 API Key\n\tapiKey := os.Getenv(\"GEMINI_API_KEY\")\n\tif apiKey == \"\" {\n\t\tlog.Fatal(\"请设置 GEMINI_API_KEY 环境变量\")\n\t}\n\n\t\u002F\u002F 初始化客户端\n\tclient, err := genai.NewClient(ctx, option.WithAPIKey(apiKey))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer client.Close()\n\n\t\u002F\u002F 选择模型\n\tmodel := client.GenerativeModel(\"gemini-pro\")\n\n\t\u002F\u002F 生成内容\n\tresp, err := model.GenerateContent(ctx, genai.Text(\"你好，请简单介绍一下你自己。\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t\u002F\u002F 输出结果\n\tfor _, candidate := range resp.Candidates {\n\t\tfor _, part := range candidate.Content.Parts {\n\t\t\tfmt.Println(part)\n\t\t}\n\t}\n}\n```\n\n**下一步行动**：请尽快查阅 [Google Gen AI SDK for Go](https:\u002F\u002Fgithub.com\u002Fgoogleapis\u002Fgo-genai) 文档以完成迁移，确保持续获得最新功能和安全支持。","某电商初创公司的后端团队正致力于用 Go 语言重构其智能客服系统，希望集成谷歌最新的 Gemini 模型来自动处理用户咨询。\n\n### 没有 generative-ai-go 时\n- 开发人员必须手动构建复杂的 HTTP REST 请求，包括繁琐的鉴权头、JSON 序列化及错误重试逻辑，代码冗余且易出错。\n- 缺乏原生的流式响应（Streaming）支持，导致用户等待完整回复的时间过长，无法实现类似打字机的实时交互体验。\n- 多模态功能（如上传图片让 AI 分析商品瑕疵）需要自行处理二进制编码和 API 协议细节，开发门槛极高。\n- 社区缺乏针对 Go 语言的官方最佳实践参考，团队在参数调优和上下文管理上耗费了大量试错时间。\n\n### 使用 generative-ai-go 后\n- 通过简洁的链式调用即可发起对话，SDK 自动封装了鉴权与网络细节，使核心业务代码行数减少约 60%。\n- 原生支持流式输出接口，轻松实现首字秒级响应，显著提升了终端用户的对话流畅度和满意度。\n- 内置多模态数据类型支持，仅需几行代码即可将图片直接传入模型进行视觉分析，快速上线“拍照识货”功能。\n- 依托官方维护的示例和类型定义，团队能迅速掌握上下文窗口管理及安全过滤设置，大幅缩短研发周期。\n\n*注：鉴于该仓库已标记为遗留版本并将于 2025 年停止支持，建议新项目直接迁移至全新的 `go-genai` SDK 以获取持续的性能优化与新特性。*\n\ngenerative-ai-go 通过将复杂的 API 交互抽象为直观的 Go 惯用代码，让开发者能从底层协议中解放出来，专注于构建高价值的智能应用逻辑。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fgoogle_generative-ai-go_76dc7420.png","google","Google","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fgoogle_c4bedcda.png","Google ❤️ Open Source",null,"opensource@google.com","GoogleOSS","https:\u002F\u002Fopensource.google\u002F","https:\u002F\u002Fgithub.com\u002Fgoogle",[82,86],{"name":83,"color":84,"percentage":85},"Go","#00ADD8",98.7,{"name":87,"color":88,"percentage":89},"Shell","#89e051",1.3,856,101,"2026-04-05T10:51:46","Apache-2.0","","未说明",{"notes":97,"python":98,"dependencies":99},"该仓库已弃用（Legacy），仅进行关键错误修复，支持将于 2025 年 11 月 30 日终止。强烈建议迁移至新的 'Google Generative AI SDK for Go' (github.com\u002Fgoogleapis\u002Fgo-genai)。作为 Go 语言库，其运行依赖于 Go 环境而非 Python，具体系统要求通常跟随标准 Go 工具链。","不适用 (此为 Go 语言 SDK)",[100],"google.golang.org\u002Fapi",[14,36],[103,104,105,106],"go","golang","llm","machine-learning","2026-03-27T02:49:30.150509","2026-04-20T22:36:19.725081",[110,115,120,125,130,135],{"id":111,"question_zh":112,"answer_zh":113,"source_url":114},45885,"调用 StartChat() 或 SendMessage() 时遇到 \"proto: unknown field usageMetadata\" 错误怎么办？","该问题通常是由于服务端更新了协议字段（如 usageMetadata），而客户端 SDK 尚未同步导致的。根据维护者回复，这个问题最终在服务端得到了修复。用户无需重新编译代码，等待服务端更新生效即可解决。如果问题持续，请确保使用的是最新版本的 SDK。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fissues\u002F97",{"id":116,"question_zh":117,"answer_zh":118,"source_url":119},45886,"如何从 GenerateContentResponse 的 Parts 接口中提取文本数据？","Parts 是一个接口类型，包含多种可能的部分（如文本、图片、函数调用等）。要提取文本，需要使用 Go 语言的类型断言（type switch）来判断具体类型。示例代码如下：\nswitch p := part.(type) {\ncase genai.Text:\n    \u002F\u002F p 是文本内容，可以直接使用\n    fmt.Println(string(p))\ncase genai.Blob:\n    \u002F\u002F 处理二进制数据\n...\n}\n不需要使用 fmt.Sprint 或反射，直接通过类型切换即可安全地访问具体内容。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fissues\u002F29",{"id":121,"question_zh":122,"answer_zh":123,"source_url":124},45887,"如何在生成式 AI Go SDK 中配置 HTTP 代理？","不能同时使用 option.WithAPIKey 和 option.WithHTTPClient，因为 WithAPIKey 内部已经实现了自己的 HTTP 客户端配置，两者冲突会导致 API Key 丢失。解决方法是手动创建一个整合了 API Key 和代理设置的 http.Transport。示例思路如下：\n1. 创建自定义 Transport，设置 Proxy 属性。\n2. 在 Transport 的请求头中手动添加 API Key（通常是通过 Authorization 头或查询参数，具体视 API 要求而定）。\n3. 将该 Transport 放入 http.Client。\n4. 仅使用 option.WithHTTPClient(client) 初始化 SDK 客户端，不再传入 WithAPIKey。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fissues\u002F17",{"id":126,"question_zh":127,"answer_zh":128,"source_url":129},45888,"遇到 \"Unsupported MIME type: text\u002Fplain; charset=utf-8\" 错误该如何解决？","该错误通常出现在使用旧版 SDK 尝试执行某些特定操作（如 CreateCachedContent）时。维护者建议切换到新的客户端库 google.golang.org\u002Fgenai 并在其 Issue  tracker 上报错。另外，如果是针对 Vertex AI 的操作，必须使用 cloud.google.com\u002Fgo\u002Fvertexai\u002Fgenai 包，而不是通用的 generative-ai-go 包。请检查你的导入路径是否正确对应了你的使用场景（Google AI API 还是 Vertex AI）。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fissues\u002F198",{"id":131,"question_zh":132,"answer_zh":133,"source_url":134},45889,"调用 ChatSession.SendMessage 时偶尔出现 panic (nil pointer dereference) 是什么原因？","这通常发生在模型没有返回任何内容（即迭代器立即返回 Done）且内部合并结果为 nil 时。虽然社区提出了在 generateContent 方法中增加 nil 检查的修复方案，但维护者认为如果模型没有任何响应，这本身应该被视为一个错误情况，而不是静默处理或返回空值。建议捕获该错误并检查输入提示（prompt）是否合法，或者升级到已修复此逻辑的最新版本 SDK。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fissues\u002F54",{"id":136,"question_zh":137,"answer_zh":138,"source_url":119},45890,"为什么在使用 Part 类型时没有智能提示或直观的方法来获取内容？","Part 是一个接口，设计初衷是为了支持多种不同类型的内容（文本、图片、函数调用等）。Go 语言处理此类多态的标准方式是使用类型断言（type switch），而不是为接口添加 String() 等通用方法（因为这可能导致歧义或性能损失）。虽然不像某些其他语言的库那样有直接的 .Text 属性，但通过 switch p := part.(type) { case genai.Text: ... } 的方式是类型安全且标准的做法。官方可以考虑增加更多示例代码来帮助用户理解这一模式。",[140,145,150,155,160,165,170,175,180,185,190,195,199,204,209],{"id":141,"version":142,"summary_zh":143,"released_at":144},360832,"v0.20.1","修复 godoc 格式化问题。\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fcompare\u002Fv0.20.0...v0.20.1","2025-05-02T16:11:10",{"id":146,"version":147,"summary_zh":148,"released_at":149},360833,"v0.20.0","## 变更内容\n* 在 README 和 doc.go 中添加了弃用标签\n* 修复：@VadirajKranam 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F232 中修改了条件判断中的字符串\n* 构建（依赖）：@dependabot 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F236 中将 go_modules 组中的 golang.org\u002Fx\u002Fcrypto 从 0.24.0 升级到 0.31.0\n\n## 新贡献者\n* @VadirajKranam 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F232 中完成了首次贡献\n* @amirh 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F251 中完成了首次贡献\n* @Annhiluc 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F255 中完成了首次贡献\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fcompare\u002Fv0.19.0...v0.19.1","2025-05-01T18:43:01",{"id":151,"version":152,"summary_zh":153,"released_at":154},360834,"v0.19.0","## 变更内容\n* @pcoet 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F210 中更新了 json_no_schema 片段中的提示信息\n* @windmaple 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F215 中修复了 resumable.go 中的拼写错误\n* genai：@eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F216 中修复了错误消息的文本\n* all：@jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F218 中修复了许可证头，并添加了检查\n* genai：@eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F224 中测试了无效的文本文件编码\n* genai：@jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F226 中从会话历史中省略了空的文本部分\n* genai：@jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F227 中为示例添加了错误检查\n* genai：@eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F228 中添加了一个采用 1251 编码的文件，用于测试错误情况\n* genai：@jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F230 中修复了指向 MIME 类型文档的链接\n* genai：@eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F235 中为 v0.19.0 版本进行了版本号升级\n\n## 新贡献者\n* @pcoet 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F210 中完成了首次贡献\n* @windmaple 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F215 中完成了首次贡献\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fcompare\u002Fv0.18.0...v0.19.0","2024-12-04T14:11:21",{"id":156,"version":157,"summary_zh":158,"released_at":159},360835,"v0.18.0","## 变更内容\n* genai：@eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F195 中更新了一个示例中的注释\n* genai：@eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F189 中调整了示例中 uploadFile 的注释\n* genai：@jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F199 中添加了显式指定 MIME 类型的 CreateCachedContent 示例\n* genai：@eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F200 中更新了示例，为视频文件上传添加了显式文件上传，并改进了注释\n* genai：@eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F202 中添加了基本的 PDF 上传示例\n* genai：@eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F203 中添加了便捷的 client.UploadFileFromPath 方法\n* genai：@eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F206 中添加了更多示例\n* genai：@eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F205 中将所有示例改为使用 client.UploadFileFromPath\n* genai：@eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F207 中增加了额外的图片和音频示例\n* genai：@eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F209 中为 0.18 版本进行了版本号升级\n\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fcompare\u002Fv0.17.0...v0.18.0","2024-09-09T15:42:52",{"id":161,"version":162,"summary_zh":163,"released_at":164},360836,"v0.17.0","## 变更内容\n* 移除不必要的代码行，由 @kasugamirai 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F156 中完成\n* genai：修复工具使用示例及测试，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F163 中完成\n* build(deps)：将 go_modules 组中的 google.golang.org\u002Fgrpc 从 1.64.0 升级至 1.64.1，由 @dependabot 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F165 中完成\n* genai：将 example_test 的源代码统一管理，并添加代码生成器，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F164 中完成\n* genai：添加 WithAttribution 客户端选项，由 @jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F159 中完成\n* genai：修复文档注释中的列表语法错误，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F166 中完成\n* genai：将 gen-examples 流程切换为使用 go:generate，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F168 中完成\n* genai：为 CountTokens 添加更多示例，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F167 中完成\n* genai：调整 CountTokens 示例，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F170 中完成\n* genai：将源代码片段文件重命名为 docs-snippets_test.go，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F171 中完成\n* genai：修复其中一个代码片段的结束标记，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F172 中完成\n* genai：为示例提取 uploadFile 函数，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F173 中完成\n* genai：添加更多文本生成示例，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F175 中完成\n* genai：更新 Discovery 客户端并使测试更具鲁棒性，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F176 中完成\n* genai：添加额外的内容生成示例，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F177 中完成\n* genai：添加请求的调试打印功能，由 @jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F178 中完成\n* genai：添加文件上传\u002F列出\u002F获取的示例，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F179 中完成\n* genai：验证音频文件的 MIME 类型检测，由 @jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F182 中完成\n* genai：改进文件上传相关文档，由 @jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F183 中完成\n* genai：添加视频中计数令牌的示例，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F181 中完成\n* genai：添加音频上传示例，并在 uploadFile 中澄清注释，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F184 中完成\n* genai：添加缓存相关的示例，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F186 中完成\n* genai：在示例中泛化 uploadFile 函数，并添加注释，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F185 中完成\n* 修复区域标签：“START [” > “[START ”，由 @MarkDaoust 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F187 中完成\n* genai：添加辅助函数 NewUserContent，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F188 中完成\n* genai：添加 tokens_tools 示例，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerat","2024-07-19T21:20:10",{"id":166,"version":167,"summary_zh":168,"released_at":169},360837,"v0.16.0","- 新功能：[代码执行](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Fcode-execution?lang=python)","2024-07-01T14:12:51",{"id":171,"version":172,"summary_zh":173,"released_at":174},360838,"v0.15.1","## 变更内容\n* genai：对错误进行包装，以便我们能够了解错误来源，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F150 中完成\n* genai：使自定义 HTTP 客户端重新正常工作，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F152 中完成\n* genai：准备发布 0.15.1 版本，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F153 中完成\n\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fcompare\u002Fv0.15.0...v0.15.1","2024-06-28T14:51:48",{"id":176,"version":177,"summary_zh":178,"released_at":179},360839,"v0.15.0","## 变更内容\n* genai：在需要视觉功能的测试中使用不同的模型，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F135 中实现\n* genai：修复文件元数据转换中的空指针问题，由 @jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F137 中实现\n* genai：正确拼写 HTTP 客户端选项的名称，由 @jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F139 中实现\n* genai：使 Live 测试通过，由 @jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F141 中实现\n* genai：移除支持包，由 @jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F142 中实现\n* genai：更新 Tool 示例，使其更能适应不同模型的差异，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F146 中实现\n* genai：将转换过程中的恐慌改为错误，由 @jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F143 中实现\n* genai：改进代码生成命令，由 @jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F144 中实现\n* genai：将 cloud.google.com\u002Fgo\u002Fai 升级至 v0.7.0，由 @jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F145 中实现\n* genai：添加内容缓存功能，由 @jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F147 中实现\n* genai：在请求中传递缓存内容，由 @jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F149 中实现\n* genai：为 0.15 版本提升版本号，由 @eliben 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F148 中实现\n\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fcompare\u002Fv0.14.0...v0.15.0","2024-06-26T14:39:28",{"id":181,"version":182,"summary_zh":183,"released_at":184},360840,"v0.14.0","## 变更内容\n\n* genai：由 @jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F128 中实现，公开流式传输的合并响应。\n* genai：由 @jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F130 中实现，使用 GenerateContentRequest 填充 CountTokens 请求。\n* genai：由 @jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F131 中实现，添加 File.Error 和 File.Metadata。\n* genai：由 @jba 在 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fpull\u002F132 中改进部分字段的文档。\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fcompare\u002Fv0.13.0...v0.14.0","2024-06-10T17:26:53",{"id":186,"version":187,"summary_zh":188,"released_at":189},360841,"v0.13.0","新功能：\n- 可以提供一个模式来控制响应输出。请参阅[示例](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fblob\u002Fv0.13.0\u002Fgenai\u002Fexample_test.go#L146)。\n- 文件类型现在包含创建时间、更新时间和过期时间。","2024-05-29T12:54:41",{"id":191,"version":192,"summary_zh":193,"released_at":194},360842,"v0.12.0","New features:\r\n\r\n- UsageMetadata: information about a model's token usage\r\n- FileState: information about file uploads\r\n- GenerationConfig.ResponseSchema (not yet implemented by models)\r\n- Improved auth logic","2024-05-10T18:31:47",{"id":196,"version":197,"summary_zh":76,"released_at":198},360843,"v0.11.2","2024-05-07T21:37:31",{"id":200,"version":201,"summary_zh":202,"released_at":203},360844,"v0.11.1","This fixes the bug reported in #97.","2024-05-03T15:39:17",{"id":205,"version":206,"summary_zh":207,"released_at":208},360845,"v0.11.0","This release includes:\r\n- File upload (currently requires model gemini-1.5-pro-eval).\r\n- System instructions(aka \"system prompt\").\r\n- Constrained function calling—see the `ToolConfig` type.","2024-04-15T19:04:01",{"id":210,"version":211,"summary_zh":212,"released_at":213},360846,"v0.10.0","## What's Changed\r\n\r\nTags v0.9.0 and v0.10.0 introduce the _function calling_ feature to the SDK. See an [example here](https:\u002F\u002Fpkg.go.dev\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fgenai#example-Tool)\r\n\r\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgenerative-ai-go\u002Fcompare\u002Fv0.9.0...v0.10.0","2024-03-15T16:52:44"]