[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-thmsmlr--instructor_ex":3,"tool-thmsmlr--instructor_ex":64},[4,17,27,35,43,56],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},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,3,"2026-04-05T11:01:52",[13,14,15],"开发框架","图像","Agent","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":23,"last_commit_at":24,"category_tags":25,"status":16},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 真正成长为懂上",138956,2,"2026-04-05T11:33:21",[13,15,26],"语言模型",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":23,"last_commit_at":33,"category_tags":34,"status":16},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 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[13,14,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":23,"last_commit_at":41,"category_tags":42,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,26],{"id":44,"name":45,"github_repo":46,"description_zh":47,"stars":48,"difficulty_score":23,"last_commit_at":49,"category_tags":50,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[14,51,52,53,15,54,26,13,55],"数据工具","视频","插件","其他","音频",{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":10,"last_commit_at":62,"category_tags":63,"status":16},3128,"ragflow","infiniflow\u002Fragflow","RAGFlow 是一款领先的开源检索增强生成（RAG）引擎，旨在为大语言模型构建更精准、可靠的上下文层。它巧妙地将前沿的 RAG 技术与智能体（Agent）能力相结合，不仅支持从各类文档中高效提取知识，还能让模型基于这些知识进行逻辑推理和任务执行。\n\n在大模型应用中，幻觉问题和知识滞后是常见痛点。RAGFlow 通过深度解析复杂文档结构（如表格、图表及混合排版），显著提升了信息检索的准确度，从而有效减少模型“胡编乱造”的现象，确保回答既有据可依又具备时效性。其内置的智能体机制更进一步，使系统不仅能回答问题，还能自主规划步骤解决复杂问题。\n\n这款工具特别适合开发者、企业技术团队以及 AI 研究人员使用。无论是希望快速搭建私有知识库问答系统，还是致力于探索大模型在垂直领域落地的创新者，都能从中受益。RAGFlow 提供了可视化的工作流编排界面和灵活的 API 接口，既降低了非算法背景用户的上手门槛，也满足了专业开发者对系统深度定制的需求。作为基于 Apache 2.0 协议开源的项目，它正成为连接通用大模型与行业专有知识之间的重要桥梁。",77062,"2026-04-04T04:44:48",[15,14,13,26,54],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":70,"readme_en":71,"readme_zh":72,"quickstart_zh":73,"use_case_zh":74,"hero_image_url":75,"owner_login":76,"owner_name":77,"owner_avatar_url":78,"owner_bio":79,"owner_company":80,"owner_location":81,"owner_email":82,"owner_twitter":76,"owner_website":83,"owner_url":84,"languages":85,"stars":90,"forks":91,"last_commit_at":92,"license":79,"difficulty_score":23,"env_os":93,"env_gpu":93,"env_ram":93,"env_deps":94,"category_tags":97,"github_topics":79,"view_count":10,"oss_zip_url":79,"oss_zip_packed_at":79,"status":16,"created_at":98,"updated_at":99,"faqs":100,"releases":136},1011,"thmsmlr\u002Finstructor_ex","instructor_ex","Structured outputs for LLMs in Elixir","instructor_ex 是一个专为 Elixir 开发者设计的开源库，它让大型语言模型（LLMs）的输出变得结构化且可靠。你只需用熟悉的 Ecto 定义数据模型（比如邮件分类结果），就能让 LLM 直接返回符合要求的格式化数据，无需手动编写复杂的 JSON schemas。这解决了 LLM 原始输出杂乱无章、难以直接集成到应用中的痛点——例如，处理用户查询时，确保返回的字段（如分类标签、置信度分数）既结构完整又语义正确。\n\n它特别适合 Elixir 开发者使用，尤其是需要将 LLM 能力嵌入业务逻辑的场景，比如自动审核内容、生成结构化报告或构建智能客服系统。普通用户或非技术角色可能不太适用，因为它需要一定的 Elixir 和 Ecto 基础。\n\n技术亮点在于巧妙复用 Ecto 的验证机制：通过 `@llm_doc` 注解向模型解释字段要求，并自动利用 Ecto changeset 进行数据校验（如限制分数在 0.0-1.0 之间）。还支持 OpenAI、Anthropic 等主流 LLM 服务商，并内置智能重试功能——当输出验证失败时，它会自动引导模型修正错误，大幅提升集成效率。整","instructor_ex 是一个专为 Elixir 开发者设计的开源库，它让大型语言模型（LLMs）的输出变得结构化且可靠。你只需用熟悉的 Ecto 定义数据模型（比如邮件分类结果），就能让 LLM 直接返回符合要求的格式化数据，无需手动编写复杂的 JSON schemas。这解决了 LLM 原始输出杂乱无章、难以直接集成到应用中的痛点——例如，处理用户查询时，确保返回的字段（如分类标签、置信度分数）既结构完整又语义正确。\n\n它特别适合 Elixir 开发者使用，尤其是需要将 LLM 能力嵌入业务逻辑的场景，比如自动审核内容、生成结构化报告或构建智能客服系统。普通用户或非技术角色可能不太适用，因为它需要一定的 Elixir 和 Ecto 基础。\n\n技术亮点在于巧妙复用 Ecto 的验证机制：通过 `@llm_doc` 注解向模型解释字段要求，并自动利用 Ecto changeset 进行数据校验（如限制分数在 0.0-1.0 之间）。还支持 OpenAI、Anthropic 等主流 LLM 服务商，并内置智能重试功能——当输出验证失败时，它会自动引导模型修正错误，大幅提升集成效率。整个过程简洁直观，几分钟就能上手，帮你把 LLM 变成可信赖的数据管道。","# instructor_ex\n\n_Structured, Ecto outputs with OpenAI (and OSS LLMs)_\n\n---\n\n[![Instructor version](https:\u002F\u002Fimg.shields.io\u002Fhexpm\u002Fv\u002Finstructor.svg)](https:\u002F\u002Fhex.pm\u002Fpackages\u002Finstructor)\n[![Hex Docs](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fhex-docs-lightgreen.svg)](https:\u002F\u002Fhexdocs.pm\u002Finstructor\u002F)\n[![Hex Downloads](https:\u002F\u002Fimg.shields.io\u002Fhexpm\u002Fdt\u002Finstructor)](https:\u002F\u002Fhex.pm\u002Fpackages\u002Finstructor)\n[![GitHub stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fthmsmlr\u002Finstructor_ex.svg)](https:\u002F\u002Fgithub.com\u002Fthmsmlr\u002Finstructor_ex\u002Fstargazers)\n[![Twitter Follow](https:\u002F\u002Fimg.shields.io\u002Ftwitter\u002Ffollow\u002Fthmsmlr?style=social)](https:\u002F\u002Ftwitter.com\u002Fthmsmlr)\n[![Discord](https:\u002F\u002Fimg.shields.io\u002Fdiscord\u002F1192334452110659664?label=discord)](https:\u002F\u002Fdiscord.gg\u002FbD9YE9JArw)\n\n\u003C!-- Docs -->\n\nCheck out our [Quickstart Guide](https:\u002F\u002Fhexdocs.pm\u002Finstructor\u002Fquickstart.html) to get up and running with Instructor in minutes.\n\nInstructor provides structured prompting for LLMs. It is a spiritual port of the great [Instructor Python Library](https:\u002F\u002Fgithub.com\u002Fjxnl\u002Finstructor) by [@jxnlco](https:\u002F\u002Ftwitter.com\u002Fjxnlco).\n\nInstructor allows you to get structured output out of an LLM using Ecto.  \nYou don't have to define any JSON schemas.\nYou can just use Ecto as you've always used it.  \nAnd since it's just ecto, you can provide change set validations that you can use to ensure that what you're getting back from the LLM is not only properly structured, but semantically correct.\n\nTo learn more about the philosophy behind Instructor and its motivations, check out this Elixir Denver Meetup talk:\n\n\u003Cdiv style=\"text-align: center\">\n\n[![Instructor: Structured prompting for LLMs](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fthmsmlr_instructor_ex_readme_dfa54b31b5cd.png)](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=RABXu7zqnT0)\n\n\u003C\u002Fdiv>\n\nWhile Instructor is designed to be used with OpenAI, it also supports every major AI lab and open source LLM inference server:\n\n- OpenAI\n- Anthropic\n- Groq\n- Ollama\n- Gemini\n- vLLM\n- llama.cpp\n\nAt its simplest, usage is pretty straightforward: \n\n1. Create an ecto schema, with a `@llm_doc` string that explains the schema definition to the LLM. \n2. Define a `validate_changeset\u002F1` function on the schema, and use the `use Instructor` macro in order for Instructor to know about it.\n2. Make a call to `Instructor.chat_completion\u002F1` with an instruction for the LLM to execute.\n\nYou can use the `max_retries` parameter to automatically, iteratively go back and forth with the LLM to try fixing validation errorswhen they occur.\n\n```elixir\nMix.install([:instructor])\n\ndefmodule SpamPrediction do\n  use Ecto.Schema\n  use Validator\n\n  @llm_doc \"\"\"\n  ## Field Descriptions:\n  - class: Whether or not the email is spam.\n  - reason: A short, less than 10 word rationalization for the classification.\n  - score: A confidence score between 0.0 and 1.0 for the classification.\n  \"\"\"\n  @primary_key false\n  embedded_schema do\n    field(:class, Ecto.Enum, values: [:spam, :not_spam])\n    field(:reason, :string)\n    field(:score, :float)\n  end\n\n  @impl true\n  def validate_changeset(changeset) do\n    changeset\n    |> Ecto.Changeset.validate_number(:score,\n      greater_than_or_equal_to: 0.0,\n      less_than_or_equal_to: 1.0\n    )\n  end\nend\n\nis_spam? = fn text ->\n  Instructor.chat_completion(\n    model: \"gpt-4o-mini\",\n    response_model: SpamPrediction,\n    max_retries: 3,\n    messages: [\n      %{\n        role: \"user\",\n        content: \"\"\"\n        Your purpose is to classify customer support emails as either spam or not.\n        This is for a clothing retail business.\n        They sell all types of clothing.\n\n        Classify the following email: \n\n        \u003Cemail>\n          #{text}\n        \u003C\u002Femail>\n        \"\"\"\n      }\n    ]\n  )\nend\n\nis_spam?.(\"Hello I am a Nigerian prince and I would like to send you money\")\n\n# => {:ok, %SpamPrediction{class: :spam, reason: \"Nigerian prince email scam\", score: 0.98}}\n```\n\n\u003C!-- Docs -->\n\n## Installation\n\nIn your mix.exs,\n\n```elixir\ndef deps do\n  [\n    {:instructor, \"~> 0.1.0\"}\n  ]\nend\n```","# instructor_ex\n\n_使用 OpenAI（及开源大语言模型 LLM，Large Language Model）实现结构化 Ecto（Elixir 的 ORM 框架）输出_\n\n---\n\n[![Instructor version](https:\u002F\u002Fimg.shields.io\u002Fhexpm\u002Fv\u002Finstructor.svg)](https:\u002F\u002Fhex.pm\u002Fpackages\u002Finstructor)\n[![Hex Docs](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fhex-docs-lightgreen.svg)](https:\u002F\u002Fhexdocs.pm\u002Finstructor\u002F)\n[![Hex Downloads](https:\u002F\u002Fimg.shields.io\u002Fhexpm\u002Fdt\u002Finstructor)](https:\u002F\u002Fhex.pm\u002Fpackages\u002Finstructor)\n[![GitHub stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fthmsmlr\u002Finstructor_ex.svg)](https:\u002F\u002Fgithub.com\u002Fthmsmlr\u002Finstructor_ex\u002Fstargazers)\n[![Twitter Follow](https:\u002F\u002Fimg.shields.io\u002Ftwitter\u002Ffollow\u002Fthmsmlr?style=social)](https:\u002F\u002Ftwitter.com\u002Fthmsmlr)\n[![Discord](https:\u002F\u002Fimg.shields.io\u002Fdiscord\u002F1192334452110659664?label=discord)](https:\u002F\u002Fdiscord.gg\u002FbD9YE9JArw)\n\n\u003C!-- Docs -->\n\n查看我们的[快速入门指南](https:\u002F\u002Fhexdocs.pm\u002Finstructor\u002Fquickstart.html)，几分钟内即可开始使用 Instructor。\n\nInstructor 为大语言模型（LLM）提供结构化提示。它是对 [@jxnlco](https:\u002F\u002Ftwitter.com\u002Fjxnlco) 开发的优秀 [Instructor Python 库](https:\u002F\u002Fgithub.com\u002Fjxnl\u002Finstructor) 的精神移植。\n\nInstructor 允许你使用 Ecto 从 LLM 获取结构化输出。  \n你无需定义任何 JSON 模式（schema）。  \n你可以像以往一样使用 Ecto。  \n并且由于它只是 Ecto，你可以提供变更集（changeset）验证，以确保从 LLM 获取的内容不仅结构正确，而且语义正确。\n\n要了解更多关于 Instructor 的设计理念及其动机，请查看这次 Elixir Denver Meetup 演讲：\n\n\u003Cdiv style=\"text-align: center\">\n\n[![Instructor: Structured prompting for LLMs](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fthmsmlr_instructor_ex_readme_dfa54b31b5cd.png)](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=RABXu7zqnT0)\n\n\u003C\u002Fdiv>\n\n虽然 Instructor 是为与 OpenAI 配合使用而设计的，但它也支持所有主要 AI 实验室和开源 LLM 推理服务器：\n\n- OpenAI\n- Anthropic\n- Groq\n- Ollama\n- Gemini\n- vLLM\n- llama.cpp\n\n最简单的使用方式非常直接： \n\n1. 创建一个 ecto 模式（schema），其中包含一个 `@llm_doc` 字符串，用于向 LLM 解释模式定义。 \n2. 在模式上定义 `validate_changeset\u002F1` 函数，并使用 `use Instructor` 宏，以便 Instructor 能够识别它。\n2. 调用 `Instructor.chat_completion\u002F1`，向 LLM 提供执行指令。\n\n你可以使用 `max_retries` 参数自动、迭代地与 LLM 交互，以尝试修复出现的验证错误。\n\n```elixir\nMix.install([:instructor])\n\ndefmodule SpamPrediction do\n  use Ecto.Schema\n  use Validator\n\n  @llm_doc \"\"\"\n  ## Field Descriptions:\n  - class: Whether or not the email is spam.\n  - reason: A short, less than 10 word rationalization for the classification.\n  - score: A confidence score between 0.0 and 1.0 for the classification.\n  \"\"\"\n  @primary_key false\n  embedded_schema do\n    field(:class, Ecto.Enum, values: [:spam, :not_spam])\n    field(:reason, :string)\n    field(:score, :float)\n  end\n\n  @impl true\n  def validate_changeset(changeset) do\n    changeset\n    |> Ecto.Changeset.validate_number(:score,\n      greater_than_or_equal_to: 0.0,\n      less_than_or_equal_to: 1.0\n    )\n  end\nend\n\nis_spam? = fn text ->\n  Instructor.chat_completion(\n    model: \"gpt-4o-mini\",\n    response_model: SpamPrediction,\n    max_retries: 3,\n    messages: [\n      %{\n        role: \"user\",\n        content: \"\"\"\n        Your purpose is to classify customer support emails as either spam or not.\n        This is for a clothing retail business.\n        They sell all types of clothing.\n\n        Classify the following email: \n\n        \u003Cemail>\n          #{text}\n        \u003C\u002Femail>\n        \"\"\"\n      }\n    ]\n  )\nend\n\nis_spam?.(\"Hello I am a Nigerian prince and I would like to send you money\")\n\n# => {:ok, %SpamPrediction{class: :spam, reason: \"Nigerian prince email scam\", score: 0.98}}\n```\n\n\u003C!-- Docs -->\n\n## 安装\n\n在你的 mix.exs 文件中，\n\n```elixir\ndef deps do\n  [\n    {:instructor, \"~> 0.1.0\"}\n  ]\nend\n```","# instructor 快速上手指南\n\n## 环境准备\n- **系统要求**：支持 Elixir 的操作系统（Linux\u002FmacOS 推荐，Windows 需使用 WSL2）\n- **前置依赖**：\n  - Elixir 1.14+ 和 Erlang 25+（通过 `asdf` 或官方安装包配置）\n  - 有效的 LLM 服务 API 密钥（如 OpenAI API Key，需提前在 [OpenAI 平台](https:\u002F\u002Fplatform.openai.com\u002F)申请）\n  - **国内加速推荐**：设置 Hex 中国镜像源（阿里云提供），执行以下命令加速依赖下载：\n    ```bash\n    mix hex.config mirror_url \"https:\u002F\u002Fhex.cn\"\n    ```\n\n## 安装步骤\n在 Elixir 项目中编辑 `mix.exs` 文件，添加依赖项：\n\n```elixir\ndef deps do\n  [\n    {:instructor, \"~> 0.1.0\"}\n  ]\nend\n```\n\n执行依赖安装：\n\n```bash\nmix deps.get\n```\n\n## 基本使用\n以下是最简示例：定义结构化输出 schema 并调用 LLM 生成验证后的数据。\n\n1. 创建 Ecto schema 模块（`spam_prediction.ex`），使用 `@llm_doc` 描述字段要求\n2. 实现 `validate_changeset\u002F1` 确保输出符合业务逻辑\n3. 通过 `Instructor.chat_completion` 发送请求\n\n```elixir\ndefmodule SpamPrediction do\n  use Ecto.Schema\n  use Validator\n\n  @llm_doc \"\"\"\n  ## Field Descriptions:\n  - class: Whether or not the email is spam.\n  - reason: A short, less than 10 word rationalization for the classification.\n  - score: A confidence score between 0.0 and 1.0 for the classification.\n  \"\"\"\n  @primary_key false\n  embedded_schema do\n    field(:class, Ecto.Enum, values: [:spam, :not_spam])\n    field(:reason, :string)\n    field(:score, :float)\n  end\n\n  @impl true\n  def validate_changeset(changeset) do\n    changeset\n    |> Ecto.Changeset.validate_number(:score,\n      greater_than_or_equal_to: 0.0,\n      less_than_or_equal_to: 1.0\n    )\n  end\nend\n\nis_spam? = fn text ->\n  Instructor.chat_completion(\n    model: \"gpt-4o-mini\",\n    response_model: SpamPrediction,\n    max_retries: 3,\n    messages: [\n      %{\n        role: \"user\",\n        content: \"\"\"\n        Your purpose is to classify customer support emails as either spam or not.\n        This is for a clothing retail business.\n        They sell all types of clothing.\n\n        Classify the following email: \n\n        \u003Cemail>\n          #{text}\n        \u003C\u002Femail>\n        \"\"\"\n      }\n    ]\n  )\nend\n\nis_spam?.(\"Hello I am a Nigerian prince and I would like to send you money\")\n```\n\n执行后将返回结构化结果（示例）：\n```elixir\n{:ok, %SpamPrediction{class: :spam, reason: \"Nigerian prince email scam\", score: 0.98}}\n```\n\n> **关键提示**  \n> - 必须设置 `OPENAI_API_KEY` 环境变量（其他 LLM 服务需配置对应凭证）\n> - `model` 参数支持国内可访问的服务（如 `qwen-max` 需通过阿里云百炼平台配置）\n> - 通过 `max_retries` 自动修复验证错误，无需手动处理 JSON 解析","某电商公司开发实时用户评论分析系统，需自动分类评论情感并提取关键主题，以优化产品推荐和客服响应。\n\n### 没有 instructor_ex 时\n- 手动编写正则表达式解析LLM返回的纯文本输出，面对“正面\u002F负面”情感值或置信度数字时频繁出错，导致数据入库失败。\n- 额外添加验证逻辑确保情感字段仅限`[:positive, :negative, :neutral]`，需在业务层反复检查，代码冗余且易漏边界情况。\n- 当LLM输出格式混乱（如置信度超出0-1范围）时，只能人工调整提示词并重新测试，单次调试耗时30分钟以上。\n- 多人协作时输出结构不一致（如主题字段有时是列表有时是字符串），引发下游推荐系统崩溃，每周平均修复3次生产事故。\n- 新增“紧急程度”字段需重写整个解析模块，迭代周期从2天延长至5天，拖累产品上线进度。\n\n### 使用 instructor_ex 后\n- 直接用Ecto schema定义`ReviewAnalysis`结构，LLM输出自动映射为合规数据，彻底消除手动解析错误。\n- 通过`validate_changeset`内置验证情感枚举值和置信度范围，数据合规性在调用层即时保障，无需额外校验代码。\n- 设置`max_retries: 2`后，LLM自动修正无效输出（如置信度0.99→0.95），调试时间缩短至5分钟内。\n- 输出严格遵循schema格式，主题字段始终为字符串列表，下游系统稳定性提升90%，生产事故归零。\n- 添加新字段只需扩展schema并更新`@llm_doc`说明，迭代周期压缩到1天，开发效率翻倍。\n\ninstructor_ex 让Elixir团队以声明式方式驾驭LLM结构化输出，在保障数据质量的同时将AI集成速度提升3倍。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fthmsmlr_instructor_ex_4a6358a4.png","thmsmlr","Thomas Millar","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fthmsmlr_c4c70a70.jpg",null,"@anthropics ","San Francisco, California","millar.thomas@gmail.com","http:\u002F\u002Fthmsmlr.com","https:\u002F\u002Fgithub.com\u002Fthmsmlr",[86],{"name":87,"color":88,"percentage":89},"Elixir","#6e4a7e",100,776,98,"2026-04-02T19:30:55","未说明",{"notes":95,"python":93,"dependencies":96},"本工具为Elixir语言开发的库，需Elixir 1.12+环境；通过API调用外部LLM服务（如OpenAI\u002FGemini等），无需本地GPU或模型文件；安装依赖仅需添加{:instructor, \"~> 0.1.0\"}到mix.exs；实际运行消耗取决于调用的远程LLM服务",[],[26,13],"2026-03-27T02:49:30.150509","2026-04-06T05:35:37.051443",[101,106,111,116,121,126,131],{"id":102,"question_zh":103,"answer_zh":104,"source_url":105},4508,"如何启用Claude模型支持？","Claude模型支持已在v0.1.0版本中实现。请将依赖更新为：`{:instructor, \"~> 0.1.0\"}`。维护者确认该功能已通过最新发布版本解决。","https:\u002F\u002Fgithub.com\u002Fthmsmlr\u002Finstructor_ex\u002Fissues\u002F33",{"id":107,"question_zh":108,"answer_zh":109,"source_url":110},4509,"添加instructor依赖时出现版本冲突错误如何解决？","错误源于swoosh与req版本不兼容。解决方案：执行`mix deps.unlock swoosh`后将swoosh版本锁定为1.16（如果使用更高版本），或直接升级instructor到v0.1.0：`{:instructor, \"~> 0.1.0\"}`。维护者确认该问题已在v0.1.0版本修复。","https:\u002F\u002Fgithub.com\u002Fthmsmlr\u002Finstructor_ex\u002Fissues\u002F73",{"id":112,"question_zh":113,"answer_zh":114,"source_url":115},4510,"使用GPT-4-Vision时遇到'Invalid JSON returned from LLM'错误怎么办？","该问题已在代码提交75f1a23中修复。请拉取最新代码或升级到包含此修复的版本。评论者确认示例已通过此提交解决。","https:\u002F\u002Fgithub.com\u002Fthmsmlr\u002Finstructor_ex\u002Fissues\u002F36",{"id":117,"question_zh":118,"answer_zh":119,"source_url":120},4511,"为什么无法将instructor作为Hex包依赖发布？","旧版本仅支持GitHub源依赖，Hex包发布要求依赖必须来自Hex仓库。v0.1.0已发布至Hex，使用`{:instructor, \"~> 0.1.0\"}`即可解决。维护者确认该问题已在v0.1.0版本修复。","https:\u002F\u002Fgithub.com\u002Fthmsmlr\u002Finstructor_ex\u002Fissues\u002F88",{"id":122,"question_zh":123,"answer_zh":124,"source_url":125},4512,"发送大请求时出现Mint.HTTPError 'the given data exceeds the request window size'错误如何处理？","此错误可通过配置Mint HTTP客户端参数解决。具体方案：在应用配置中增加请求窗口大小，例如设置`window_size: 131070`。评论者确认通过此配置调整已修复问题。","https:\u002F\u002Fgithub.com\u002Fthmsmlr\u002Finstructor_ex\u002Fissues\u002F31",{"id":127,"question_zh":128,"answer_zh":129,"source_url":130},4513,"调用时出现'1st argument is not an atom'参数错误如何修复？","此错误已在v0.1.0版本中修复。请将依赖更新为：`{:instructor, \"~> 0.1.0\"}`。维护者及多位用户确认升级后问题解决。","https:\u002F\u002Fgithub.com\u002Fthmsmlr\u002Finstructor_ex\u002Fissues\u002F89",{"id":132,"question_zh":133,"answer_zh":134,"source_url":135},4514,"Instructor.echo_response函数出现子句匹配错误如何解决？","在v0.1.0版本中，该函数已被移除，逻辑转移至各适配器实现。请升级到最新版本，并确保使用正确的适配器配置。维护者说明内部重构已解决此问题。","https:\u002F\u002Fgithub.com\u002Fthmsmlr\u002Finstructor_ex\u002Fissues\u002F32",[137,140,143,146,149,152,155],{"id":138,"version":139,"summary_zh":79,"released_at":79},103958,"v0.1.0",{"id":141,"version":142,"summary_zh":79,"released_at":79},103959,"v0.0.5",{"id":144,"version":145,"summary_zh":79,"released_at":79},103960,"v0.0.4",{"id":147,"version":148,"summary_zh":79,"released_at":79},103961,"v0.0.3",{"id":150,"version":151,"summary_zh":79,"released_at":79},103962,"v0.0.2",{"id":153,"version":154,"summary_zh":79,"released_at":79},103963,"v0.0.1",{"id":156,"version":157,"summary_zh":79,"released_at":79},103964,"0.0.1"]