[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-undreamai--LLMUnity":3,"tool-undreamai--LLMUnity":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 真正成长为懂上",153609,2,"2026-04-13T11:34: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 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[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},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[52,13,15,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":32,"last_commit_at":59,"category_tags":60,"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":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":75,"owner_url":76,"languages":77,"stars":82,"forks":83,"last_commit_at":84,"license":85,"difficulty_score":32,"env_os":86,"env_gpu":87,"env_ram":88,"env_deps":89,"category_tags":95,"github_topics":97,"view_count":32,"oss_zip_url":75,"oss_zip_packed_at":75,"status":17,"created_at":115,"updated_at":116,"faqs":117,"releases":118},7170,"undreamai\u002FLLMUnity","LLMUnity","Create characters in Unity with LLMs!","LLMUnity 是一款专为 Unity 引擎设计的开源插件，旨在让开发者轻松地将大型语言模型（LLM）集成到游戏或互动应用中。它主要解决了传统游戏角色对话生硬、缺乏智能交互的痛点，帮助创作者打造能够理解上下文、进行自然对话的智能 NPC，从而显著提升玩家的沉浸感。\n\n这款工具非常适合 Unity 游戏开发者、互动叙事设计师以及希望探索 AI 在游戏领域应用的研究人员使用。无需深厚的机器学习背景，用户即可在熟悉的 Unity 工作流中快速部署本地运行的 AI 角色。\n\nLLMUnity 的核心技术亮点在于其内置的检索增强生成（RAG）系统。该系统支持语义搜索，允许角色“阅读”并理解开发者提供的自定义数据（如游戏世界观文档或剧本），使回答更加精准且符合设定。此外，其底层后端基于高性能的 llama.cpp 库构建，并以独立的 C++\u002FC# 库形式提供，确保了在本地设备上的高效运行与隐私安全。无论是制作冒险游戏中的智慧向导，还是开发教育类互动应用，LLMUnity 都为实现更生动的虚拟角色提供了强大而便捷的技术支持。","\n\u003Cp align=\"center\">\n\u003Cpicture>\n  \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\".github\u002Flogo_white.png\">\n  \u003Csource media=\"(prefers-color-scheme: light)\" srcset=\".github\u002Flogo.png\">\n  \u003Cimg src=\".github\u002Flogo.png\" height=\"150\"\u002F>\n\u003C\u002Fpicture>\n\u003C\u002Fp>\n\n\u003Ch3 align=\"center\">Create characters in Unity with LLMs!\u003C\u002Fh3>\n\n[![License: Apache](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-Apache_2.0-yellow.svg)](https:\u002F\u002Fopensource.org\u002Flicense\u002Fapache-2-0)\n\u003Ca href=\"https:\u002F\u002Fdiscord.gg\u002FRwXKQb6zdv\">\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fundreamai_LLMUnity_readme_8269212a1bbd.png\"\u002F>\u003C\u002Fa>\n[![Reddit](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FReddit-%23FF4500.svg?style=flat&logo=Reddit&logoColor=white)](https:\u002F\u002Fwww.reddit.com\u002Fuser\u002FUndreamAI)\n[![LinkedIn](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLinkedIn-blue?style=flat&logo=linkedin&labelColor=blue)](https:\u002F\u002Fwww.linkedin.com\u002Fcompany\u002Fundreamai)\n[![Asset Store](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FAsset%20Store-black.svg?style=flat&logo=unity)](https:\u002F\u002Fassetstore.unity.com\u002Fpackages\u002Fslug\u002F273604)\n[![GitHub Repo stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fundreamai\u002FLLMUnity?style=flat&logo=github&color=f5f5f5)](https:\u002F\u002Fgithub.com\u002Fundreamai\u002FLLMUnity)\n[![Documentation](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDocs-white.svg?logo=data:image\u002Fpng;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwEAYAAAAHkiXEAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+\u002FAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAATqSURBVHic7ZtbiE1RGMc349K4M5EwklwjzUhJCMmTJPJAYjQXJJcH8+Blkry4lPJA8aAoJbekDLmUS6E8SHJL5AW5JPf77eHv93C22Wfttc\u002Fee+0zc\u002F4vv+bMXvusvfZa3\u002Fq+b33H80oqqaSSSmqrKnPdgXjUvbvYq5f4+7f486eb\u002FrRajRsn7t4tPngg\u002Fvol\u002Fvkj\u002FvghXr0q7tghzpyZ\u002F\u002F79+on79omXLombNondukXrd9GoSxdx8mSxqUm8eVNkgAvl0aPioEFip07i6dP52z15Ig4fbvVY2VVFhbhokXjrlogJiWvAg\u002FjwoXjqVO73+leUny9eiFVV5mfMlLDRBw+KX76ISQ+0LZ8\u002FF00v4uJFsWPHFh83O+rdWzx3TnQ9wCZ+\u002FSqyl5iux1RmTu3aiYcPi64H1pasALypoOv4\u002F8SJXraEbXc9kLbECxo2TKyuFj9\u002Fzt9u+XIvG8LWv3wpuh5QW86f3\u002FJznT+fv93s2S23C1Z72wbhtH692LdvMvdPSgzkhAkiJhT16ZO\u002FPRPOmcr+Rda4aa5nclTeuZP7PDgRpr1g40bPrQYOFF0PYKHEC+raVVy8OFy7R49EArvURU4mrUAqaTY0iB8\u002F2rXD+XCm5mbR9QAWylevorV7\u002FVpkL0ld06eLpkiyWPj9u93179+LpFZwZ1PXtGnitWui64GMStPmG7SH1NSIJBNHjvTSFZvRvHlise0N9JcBtW1\u002F44Y4dqx45IjnU0JxAGLpklPx+9VZFwPp\u002F9v\u002FeZDGjxcZh7dv4+mXtch+up7Rca+MsJvxiRNi6nvBhg25HWprZMaPGeOlqxEjxGKz+XGRTAAmyJnq6sR370TXA2NLW+8HNjZ62dLOnaLrAQ1r2zmqPH482n0mTfJCKmEvCJHUooNZE\u002F369Elct06kqiKsONRfulTEFDsX8QDlIa5nup9374pE8IiZHPY+ly+LZE\u002F37\u002FcM6mC6IB6Vl4urV6fzfUG6d0\u002Fcsyf37wsXRFInaM4ckTjGdPg+apTYs6dI3RIWwH\u002F\u002F1DV1qkiuxNY2FzrTd+2y6y8z2HQU6efZs+KBAyJZ4v+V0h6ArlwROaQP0uPH4ooV4sqV8Xz\u002F4MF211M2wwoOq1mzRAq5Pnywa5+4KDHE9mI7ly0TO3fOvZ6\u002FeZCoKwB32HS0SMFV1DNtImBKHYstBROoQ4fEQk2RaS+qrxejmj5M7NatIhWARS82xUJfAKahzFcdPnq0GLYgy7Rnbd8e6rGKRyzpuNzPBQty709RcNSZf\u002FKkuHCh2GpMDyKbGNcLYE+YMkVks336NFx7XhTZ3szXiBaqtWvFuAOxM2dEZiyH8UErgc8JLNun7E0aFffSI7RP6owZmz9kSO73HjsmXr8ukppYsybSYyQvBp5QfOjQ3M9tRR496pGgLf1JtLlzRZJzlFzGp4SWDnUxFCrdvy+uWiWa3DJe3N69oj8uSEq8CER88uaNOGBAOv2ILGY69TBBJoM8O0t72zaRoztXBzlLlrT8XARW\u002FIQq82JTMv3mKmv0\u002F9CC4mJMYPwrMSETxAyurRUxQVmXP1fEid7mzeK3b+n2Jzb16CFu2SIWmtNJiriVxANsyq0uoCJfTk4G9y4t24\u002FbSQ0rTkP6gVTG3mz\u002F\u002FuKMGSK\u002FucId5Xe9lZUi5eMMLGUgz56J5Hxu3xZ50Xg3RMIltVn9BRja26PYsBHgAAAAAElFTkSuQmCC)](https:\u002F\u002Fundream.ai\u002FLLMUnity)\n\nLLM for Unity enables seamless integration of Large Language Models (LLMs) within the Unity engine.\u003Cbr>\nIt allows to create intelligent AI characters that players can interact with for an immersive experience.\u003Cbr>\nThe package includes a Retrieval-Augmented Generation (RAG) system for semantic search across your data, which can be used to enhance the character's knowledge.\u003Cbr>\n\nThe LLM backend, [LlamaLib](https:\u002F\u002Fgithub.com\u002Fundreamai\u002FLlamaLib), is built on top of the awesome [llama.cpp](https:\u002F\u002Fgithub.com\u002Fggerganov\u002Fllama.cpp) library and  provided as a standalone C++\u002FC# library.\n\n\u003Csub>\n\u003Ca href=\"#at-a-glance\" style=\"color: black\">At a glance\u003C\u002Fa>&nbsp;&nbsp;•&nbsp;\n\u003Ca href=\"#how-to-help\" style=color: black>How to help\u003C\u002Fa>&nbsp;&nbsp;•&nbsp;\n\u003Ca href=\"#games--projects-using-llm-for-unity\" style=color: black>Games \u002F Projects using LLM for Unity\u003C\u002Fa>&nbsp;&nbsp;•&nbsp;\n\u003Ca href=\"#setup\" style=color: black>Setup\u003C\u002Fa>&nbsp;&nbsp;•&nbsp;\n\u003Ca href=\"#quick-start\" style=color: black>Quick start\u003C\u002Fa>&nbsp;&nbsp;•&nbsp;\n\u003Ca href=\"#advanced-usage\" style=color: black>Advanced usage\u003C\u002Fa>&nbsp;&nbsp;•&nbsp;\n\u003Ca href=\"#semantic-search-with-a-rag-system\" style=color: black>RAG\u003C\u002Fa>&nbsp;&nbsp;•&nbsp;\n\u003Ca href=\"#llm-model-management\" style=color: black>LLM model management\u003C\u002Fa>&nbsp;&nbsp;•&nbsp;\n\u003Ca href=\"#examples\" style=color: black>Examples\u003C\u002Fa>&nbsp;&nbsp;•&nbsp;\n\u003Ca href=\"#license\" style=color: black>License\u003C\u002Fa>\n\u003C\u002Fsub>\n\n## At a glance\n- 💻 Runs anywhere: PC, mobile or VR!\n- ⚡ Blazing fast inference on CPU and GPU (Nvidia, AMD, Apple Metal)\n- 🏠 Runs locally without internet access. No data ever leave your game!\n- 📡 Supports remote server setup\n- 🤗 Supports all major LLM models\n- 🔍 Advanced RAG System (ANN search)\n- 🔧 Easy to setup, call with a single line of code\n- 💰 Free to use for both personal and commercial purposes\n\n🧪 Tested on Unity: 2021 LTS, 2022 LTS, 2023, Unity 6\u003Cbr>\n🚦 [Upcoming Releases](https:\u002F\u002Fgithub.com\u002Forgs\u002Fundreamai\u002Fprojects\u002F2\u002Fviews\u002F10)\n\n\n### Business inquiries\nFor business inquiries you can reach out at hello@undream.ai.\n\n## How to help\n- [⭐ Star](https:\u002F\u002Fgithub.com\u002Fundreamai\u002FLLMUnity) the repo, leave a [review](https:\u002F\u002Fassetstore.unity.com\u002Fpackages\u002Fslug\u002F273604) and spread the word about the project!\n- Join us at [Discord](https:\u002F\u002Fdiscord.gg\u002FRwXKQb6zdv) and say hi.\n- [Contribute](CONTRIBUTING.md) by submitting feature requests, bugs or even your own PR.\n- [![](https:\u002F\u002Fimg.shields.io\u002Fstatic\u002Fv1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https:\u002F\u002Fgithub.com\u002Fsponsors\u002Famakropoulos) this work or buy me a [![Ko-fi](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FKo--fi-FF5E5B?logo=ko-fi&logoColor=white)](https:\u002F\u002Fko-fi.com\u002Famakropoulos) to allow even cooler features!\n\n\n## Games \u002F Projects using LLM for Unity\n- [Verbal Verdict](https:\u002F\u002Fstore.steampowered.com\u002Fapp\u002F2778780\u002FVerbal_Verdict\u002F)\n- [I, Chatbot: AISYLUM](https:\u002F\u002Fstore.epicgames.com\u002Fde\u002Fp\u002Fi-chatbot-aisylum-83b2b5)\n- [Nameless Souls of the Void](https:\u002F\u002Funicorninteractive.itch.io\u002Fnameless-souls-of-the-void)\n- [Murder in Aisle 4](https:\u002F\u002Froadedlich.itch.io\u002Fmurder-in-aisle-4)\n- [Finicky Food Delivery AI](https:\u002F\u002Fhelixngc7293.itch.io\u002Ffinicky-food-delivery-ai)\n- [AI Emotional Girlfriend](https:\u002F\u002Fwhynames.itch.io\u002Faiemotionalgirlfriend)\n- [Case Closed](https:\u002F\u002Fstore.steampowered.com\u002Fapp\u002F2532160\u002FCase_Closed)\n- [MaiMai AI Agent System](https:\u002F\u002Fgithub.com\u002FIhateCreatingUserNames2\u002FMaiMai)\n- [Claria Chat](https:\u002F\u002Fplay.google.com\u002Fstore\u002Fapps\u002Fdetails?id=com.ProLink.ClariaChat)\n- [Endless Casual Drive](https:\u002F\u002Fstore.steampowered.com\u002Fapp\u002F2928500\u002FEndless_Casual_Drive\u002F)\n- [Dating App Simulator](https:\u002F\u002Fstore.steampowered.com\u002Fapp\u002F3415680\u002FDating_App_Simulator\u002F)\n- [Virtual Reality Mock Interview](https:\u002F\u002Fvrmi.vercel.app\u002F)\n- [Velesio AI server](https:\u002F\u002Fgithub.com\u002FVelesio\u002FVelesio-AIServer)\n- [Dungeon Chat](https:\u002F\u002Fwww.meta.com\u002Fexperiences\u002Fdungeonchat\u002F8527310950709276\u002F)\n- [Tomonaka Desk](https:\u002F\u002Fjoycatdev.itch.io\u002Ftomonaka-desk)\n- [Digital Humans](https:\u002F\u002Fstore.steampowered.com\u002Fapp\u002F3089280\u002FDigital_Humans\u002F)\n- [CakeMix](https:\u002F\u002Fripenedpeach.itch.io\u002Fcakemix)\n- [HeyWaifu](https:\u002F\u002Fsquirclegames.itch.io\u002Fhey-waifu-ai)\n- [Love and Lie](https:\u002F\u002Fstore.steampowered.com\u002Fapp\u002F3886140\u002FLove_and_Lie\u002F)\n- [Psycho Simulator](https:\u002F\u002Fstore.steampowered.com\u002Fapp\u002F1244620\u002FPsycho_Simulator\u002F)\n- [False Flame](https:\u002F\u002Fstore.steampowered.com\u002Fapp\u002F4427250\u002FFalse_Flame\u002F)\n\nContact hello@undream.ai to add your project!\n\n## Setup\n_Method 1: Install using the asset store_\n- Open the [LLM for Unity](https:\u002F\u002Fassetstore.unity.com\u002Fpackages\u002Fslug\u002F273604) asset page and click `Add to My Assets`\n- Open the Package Manager in Unity: `Window > Package Manager`\n- Select the `Packages: My Assets` option from the drop-down\n- Select the `LLM for Unity` package, click `Download` and then `Import`\n\n_Method 2: Install using the GitHub repo:_\n- Open the Package Manager in Unity: `Window > Package Manager`\n- Click the `+` button and select `Add package from git URL`\n- Use the repository URL `https:\u002F\u002Fgithub.com\u002Fundreamai\u002FLLMUnity.git` and click `Add`\n\n## Quick start\n\u003Cimg height=\"300\" src=\".github\u002Fcharacter.png\"\u002F>\n\n#### 1. Setup the LLM\n\nFirst you will setup the LLM for your game:\n- Create an empty GameObject.\u003Cbr>In the GameObject Inspector click `Add Component` and select the `LLM` script.\n- Download one of the default models with the `Download Model` button (~GBs).\u003Cbr>Or load your own .gguf model with the `Load model` button (see [LLM model management](#llm-model-management)).\n\n#### 2. Create an AI Character\nThen you can setup each of your characters as follows:\n- Create an empty GameObject for the character.\u003Cbr>In the GameObject Inspector click `Add Component` and select the `LLMAgent` script.\n- Define the role of your AI in the `System Prompt`.\n- (Optional) Select the LLM constructed above in the `LLM` field if you have more than one LLM GameObjects.\n\n#### 3. Use in Your Script\nIn your script you can then use it as follows:\n``` c#\nusing LLMUnity;\n\npublic class MyScript {\n  public LLMAgent llmAgent;\n  \n  void HandleReply(string replySoFar){\n    \u002F\u002F do something with the reply from the model as it is being produced\n    Debug.Log(replySoFar);\n  }\n  \n  void Game(){\n    \u002F\u002F handle the response as it is being produced\n    ...\n    _ = llmAgent.Chat(\"Hello bot!\", HandleReply);\n    ...\n  }\n  \n  async void GameAsync(){\n    \u002F\u002F or handle the entire response in one go\n    ...\n    string reply = await llmAgent.Chat(\"Hello bot!\");\n    Debug.Log(reply);\n    ...\n  }\n}\n```\nYou can also specify a function to call when the model reply has been completed:\n``` c#\n  void ReplyCompleted(){\n    \u002F\u002F do something when the reply from the model is complete\n    Debug.Log(\"The AI has finished replying\");\n  }\n  \n  void Game(){\n    \u002F\u002F your game function\n    ...\n    _ = llmAgent.Chat(\"Hello bot!\", HandleReply, ReplyCompleted);\n    ...\n  }\n```\n\nTo stop the chat without waiting for its completion you can use:\n``` c#\n    llmAgent.CancelRequests();\n```\n\n- Finally, in the Inspector of the GameObject of your script, select the LLMAgent GameObject created above as the llmAgent property.\n\nThat's it! Your AI character is ready to chat! ✨\n\n## Advanced usage\n\n\u003Cdetails>\n\u003Csummary>Build a mobile app\u003C\u002Fsummary>\n\nFor mobile apps you can use models with up to 1-2 billion parameters (\"Tiny models\" in the LLM model manager).\u003Cbr>\nLarger models will typically not work due to the limited mobile hardware.\n\n**iOS**\niOS can be built with the default player settings.\n\n**Android**\nOn Android you need to specify the `IL2CPP` scripting backend and the `ARM64` as the target architecture in the player settings.\u003Cbr>\nThese settings can be accessed from the `Edit > Project Settings` menu within the `Player > Other Settings` section.\u003Cbr>\n\u003Cimg width=\"400\" src=\".github\u002Fandroid.png\">\n\nSince mobile app sizes are typically small, you can download the LLM model the first time the app launches.\nThis functionality is enabled with the `Download on Build` option.\nIn your project you can wait until the model download is complete with:\n``` c#\nawait LLM.WaitUntilModelSetup();\n```\nYou can also receive calls the download progress during the model download:\n``` c#\nawait LLM.WaitUntilModelSetup(SetProgress);\n\nvoid SetProgress(float progress){\n  string progressPercent = ((int)(progress * 100)).ToString() + \"%\";\n  Debug.Log($\"Download progress: {progressPercent}\");\n}\n```\nThis is useful to present e.g. a progress bar.\nThe [MobileDemo](Samples~\u002FMobileDemo) demonstrates an example application for Android \u002F iOS.\n\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>Restrict the output of the LLM \u002F Function calling \u002F Grammar\u003C\u002Fsummary>\n\nTo restrict the output of the LLM you can use a grammar, read more [here](https:\u002F\u002Fgithub.com\u002Fggerganov\u002Fllama.cpp\u002Ftree\u002Fmaster\u002Fgrammars).\u003Cbr>\nThe grammar can edited directly in the `Grammar` field of the LLMAgent or saved in a gbnf \u002F json schema file and loaded with the `Load Grammar` button (Advanced options).\u003Cbr>\nFor instance to receive replies in json format you can use the [json.gbnf](https:\u002F\u002Fgithub.com\u002Fggerganov\u002Fllama.cpp\u002Fblob\u002Fb4218\u002Fgrammars\u002Fjson.gbnf) grammar.\u003Cbr>\n\nAlternatively you can set the grammar directly in your script:\n``` c#\nllmAgent.grammar = \"your grammar here\";\n```\n\nFor function calling you can define similarly a grammar that allows only the function names as output, and then call the respective function.\u003Cbr>\nYou can look into the [FunctionCalling](Samples~\u002FFunctionCalling) sample for an example implementation.\n\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>Access \u002F Save \u002F Load your chat history\u003C\u002Fsummary>\nThe chat history of a `LLMAgent` is retained in the `chat` variable that is a list of `ChatMessage` objects.\u003Cbr>\nThe ChatMessage is a class that defines the `role` of the message and the `content`.\u003Cbr>\nThe list contains alternating messages with the player prompt and the AI reply.\u003Cbr>\nYou can modify the chat history and then set it to your LLMAgent GameObject:\n``` c#\nList\u003CChatMessage> newChat = new List\u003CChatMessage>();\n...\nllmAgent.chat = newChat;\n```\n\nTo add new messages you can do:\n``` c#\n_ = llmAgent.AddUserMessage(\"your user message\");\n_ = llmAgent.AddAssistantMessage(\"your assistant reply\");\n```\n\nTo automatically save \u002F load your chat history, you can specify the `Save` parameter of the LLMAgent to the filename (or relative path) of your choice.\nThe chat history is saved in the [persistentDataPath folder of Unity](https:\u002F\u002Fdocs.unity3d.com\u002FScriptReference\u002FApplication-persistentDataPath.html) as a json object.\n\nTo manually save your chat history, you can use:\n``` c#\n    _ = llmAgent.SaveHistory();\n```\nand to load the history:\n``` c#\n    _ = llmAgent.Loadistory();\n```\n\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>Process the prompt at the beginning of your app for faster initial processing time\u003C\u002Fsummary>\n\n``` c#\n  void WarmupCompleted(){\n    \u002F\u002F do something when the warmup is complete\n    Debug.Log(\"The AI is nice and ready\");\n  }\n\n  void Game(){\n    \u002F\u002F your game function\n    ...\n    _ = llmAgent.Warmup(WarmupCompleted);\n    ...\n  }\n```\n\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>Decide whether or not to add the message to the chat\u002Fprompt history\u003C\u002Fsummary>\n\n  The last argument of the `Chat` function is a boolean that specifies whether to add the message to the history (default: true):\n``` c#\n  void Game(){\n    \u002F\u002F your game function\n    ...\n    string message = \"Hello bot!\";\n    _ = llmAgent.Chat(message, HandleReply, ReplyCompleted, false);\n    ...\n  }\n```\n\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>Use pure text completion\u003C\u002Fsummary>\n\n``` c#\n  void Game(){\n    \u002F\u002F your game function\n    ...\n    string message = \"The cat is away\";\n    _ = llmAgent.Completion(message, HandleReply, ReplyCompleted);\n    ...\n  }\n```\n\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>Add a LLM \u002F LLMAgent component programmatically\u003C\u002Fsummary>\n\n``` c#\nusing UnityEngine;\nusing LLMUnity;\n\npublic class MyScript : MonoBehaviour\n{\n    LLM llm;\n    LLMAgent llmAgent;\n\n    async void Start()\n    {\n        \u002F\u002F disable gameObject so that theAwake is not called immediately\n        gameObject.SetActive(false);\n\n        \u002F\u002F Add an LLM object\n        llm = gameObject.AddComponent\u003CLLM>();\n        \u002F\u002F set the model using the filename of the model.\n        \u002F\u002F The model needs to be added to the LLM model manager (see LLM model management) by loading or downloading it.\n        \u002F\u002F Otherwise the model file can be copied directly inside the StreamingAssets folder.\n        llm.model = \"Qwen3-4B-Q4_K_M.gguf\";\n        \u002F\u002F optional: you can also set loras in a similar fashion and set their weights (if needed)\n        llm.AddLora(\"my-lora.gguf\");\n        llm.AddLora(\"my-lora-2.gguf\", 0.5f);\n        \u002F\u002F optional: set number of threads\n        llm.numThreads = -1;\n        \u002F\u002F optional: enable GPU by setting the number of model layers to offload to it\n        llm.numGPULayers = 10;\n\n        \u002F\u002F Add an LLMAgent object\n        llmAgent = gameObject.AddComponent\u003CLLMAgent>();\n        \u002F\u002F set the LLM object that handles the model\n        llmAgent.llm = llm;\n        \u002F\u002F set the character prompt\n        llmAgent.systemPrompt = \"A chat between a curious human and an artificial intelligence assistant.\";\n        \u002F\u002F set the AI and player name\n        llmAgent.assistantRole = \"AI\";\n        llmAgent.userRole = \"Human\";\n        \u002F\u002F optional: set a save path\n        llmAgent.save = \"AICharacter1.json\";\n        \u002F\u002F optional: set a grammar\n        llmAgent.grammar = \"your grammar here\";\n\n        \u002F\u002F re-enable gameObject\n        gameObject.SetActive(true);\n    }\n}\n```\n\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>Use a remote server\u003C\u002Fsummary>\n\nYou can use a remote server to carry out the processing and implement characters that interact with it.\n\n**Create the server**\u003Cbr>\nTo create the server:\n- Create a project with a GameObject using the `LLM` script as described above\n- Enable the `Remote` option of the `LLM` and optionally configure the server port and API key\n- Enable 'Allow Downloads Over HTTP' in the project settings\n- Build and run to start the server\n\nAlternatively you can use a server binary for easier deployment:\n- Run the above scene from the Editor and copy the command from the Debug messages (starting with \"Deploy server command:\")\n- Download and extract the [LlamaLib binaries](https:\u002F\u002Fgithub.com\u002Fundreamai\u002FLlamaLib\u002Freleases\u002Fdownload\u002Fv2.0.0\u002FLlamaLib-v2.0.0.zip)\n- From command line change directory to the `servers` folder selected and start the server by running the command copied from above.\n\n**Create the characters**\u003Cbr>\nCreate a second project with the game characters using the `LLMAgent` script as described above.\nEnable the `Remote` option and configure the host with the IP address (starting with \"http:\u002F\u002F\") and port \u002F API key of the server.\n\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>Compute embeddings using a LLM\u003C\u002Fsummary>\n\nThe `Embeddings` function can be used to obtain the emdeddings of a phrase:\n``` c#\n    List\u003Cfloat> embeddings = await llmAgent.Embeddings(\"hi, how are you?\");\n```\n\n\u003C\u002Fdetails>\n\nA \u003Cb>detailed documentation\u003C\u002Fb> on function level can be found here:\n\u003Ca href=\"https:\u002F\u002Fundream.ai\u002FLLMUnity\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDocumentation-white.svg?logo=data:image\u002Fpng;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwEAYAAAAHkiXEAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+\u002FAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAATqSURBVHic7ZtbiE1RGMc349K4M5EwklwjzUhJCMmTJPJAYjQXJJcH8+Blkry4lPJA8aAoJbekDLmUS6E8SHJL5AW5JPf77eHv93C22Wfttc\u002Fee+0zc\u002F4vv+bMXvusvfZa3\u002Fq+b33H80oqqaSSSmqrKnPdgXjUvbvYq5f4+7f486eb\u002FrRajRsn7t4tPngg\u002Fvol\u002Fvkj\u002FvghXr0q7tghzpyZ\u002F\u002F79+on79omXLombNondukXrd9GoSxdx8mSxqUm8eVNkgAvl0aPioEFip07i6dP52z15Ig4fbvVY2VVFhbhokXjrlogJiWvAg\u002FjwoXjqVO73+leUny9eiFVV5mfMlLDRBw+KX76ISQ+0LZ8\u002FF00v4uJFsWPHFh83O+rdWzx3TnQ9wCZ+\u002FSqyl5iux1RmTu3aiYcPi64H1pasALypoOv4\u002F8SJXraEbXc9kLbECxo2TKyuFj9\u002Fzt9u+XIvG8LWv3wpuh5QW86f3\u002FJznT+fv93s2S23C1Z72wbhtH692LdvMvdPSgzkhAkiJhT16ZO\u002FPRPOmcr+Rda4aa5nclTeuZP7PDgRpr1g40bPrQYOFF0PYKHEC+raVVy8OFy7R49EArvURU4mrUAqaTY0iB8\u002F2rXD+XCm5mbR9QAWylevorV7\u002FVpkL0ld06eLpkiyWPj9u93179+LpFZwZ1PXtGnitWui64GMStPmG7SH1NSIJBNHjvTSFZvRvHlise0N9JcBtW1\u002F44Y4dqx45IjnU0JxAGLpklPx+9VZFwPp\u002F9v\u002FeZDGjxcZh7dv4+mXtch+up7Rca+MsJvxiRNi6nvBhg25HWprZMaPGeOlqxEjxGKz+XGRTAAmyJnq6sR370TXA2NLW+8HNjZ62dLOnaLrAQ1r2zmqPH482n0mTfJCKmEvCJHUooNZE\u002F369Elct06kqiKsONRfulTEFDsX8QDlIa5nup9374pE8IiZHPY+ly+LZE\u002F37\u002FcM6mC6IB6Vl4urV6fzfUG6d0\u002Fcsyf37wsXRFInaM4ckTjGdPg+apTYs6dI3RIWwH\u002F\u002F1DV1qkiuxNY2FzrTd+2y6y8z2HQU6efZs+KBAyJZ4v+V0h6ArlwROaQP0uPH4ooV4sqV8Xz\u002F4MF211M2wwoOq1mzRAq5Pnywa5+4KDHE9mI7ly0TO3fOvZ6\u002FeZCoKwB32HS0SMFV1DNtImBKHYstBROoQ4fEQk2RaS+qrxejmj5M7NatIhWARS82xUJfAKahzFcdPnq0GLYgy7Rnbd8e6rGKRyzpuNzPBQty709RcNSZf\u002FKkuHCh2GpMDyKbGNcLYE+YMkVks336NFx7XhTZ3szXiBaqtWvFuAOxM2dEZiyH8UErgc8JLNun7E0aFffSI7RP6owZmz9kSO73HjsmXr8ukppYsybSYyQvBp5QfOjQ3M9tRR496pGgLf1JtLlzRZJzlFzGp4SWDnUxFCrdvy+uWiWa3DJe3N69oj8uSEq8CER88uaNOGBAOv2ILGY69TBBJoM8O0t72zaRoztXBzlLlrT8XARW\u002FIQq82JTMv3mKmv0\u002F9CC4mJMYPwrMSETxAyurRUxQVmXP1fEid7mzeK3b+n2Jzb16CFu2SIWmtNJiriVxANsyq0uoCJfTk4G9y4t24\u002FbSQ0rTkP6gVTG3mz\u002F\u002FuKMGSK\u002FucId5Xe9lZUi5eMMLGUgz56J5Hxu3xZ50Xg3RMIltVn9BRja26PYsBHgAAAAAElFTkSuQmCC\"\u002F>\u003C\u002Fa>\n\n## Semantic search with a RAG system\nLLM for Unity implements a super-fast similarity search functionality with a Retrieval-Augmented Generation (RAG) system.\u003Cbr>\nIt is based on the LLM embeddings, and the Approximate Nearest Neighbors (ANN) search from the [usearch](https:\u002F\u002Fgithub.com\u002Funum-cloud\u002Fusearch) library.\u003Cbr>\nSemantic search works as follows.\n\n**Building the data** You provide text inputs (a phrase, paragraph, document) to add to the data.\u003Cbr>\nEach input is split into chunks (optional) and encoded into embeddings with a LLM.\n\n**Searching** You can then search for a query text input. \u003Cbr>\nThe input is again encoded and the most similar text inputs or chunks in the data are retrieved.\n\nTo use semantic serch:\n- create a GameObject for the LLM as described above. Download one of the provided RAG models or load your own (good options can be found at the [MTEB leaderboard](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fmteb\u002Fleaderboard)).\n- create an empty GameObject. In the GameObject Inspector click `Add Component` and select the `RAG` script.\n- In the Search Type dropdown of the RAG select your preferred search method. `SimpleSearch` is a simple brute-force search, while`DBSearch` is a fast ANN method that should be preferred in most cases.\n- In the Chunking Type dropdown of the RAG you can select a method for splitting the inputs into chunks. This is useful to have a more consistent meaning within each data part. Chunking methods for splitting according to tokens, words and sentences are provided.\n\nAlternatively, you can create the RAG from code (where llm is your LLM):\n``` c#\n  RAG rag = gameObject.AddComponent\u003CRAG>();\n  rag.Init(SearchMethods.DBSearch, ChunkingMethods.SentenceSplitter, llm);\n```\n\nIn your script you can then use it as follows :unicorn::\n``` c#\nusing LLMUnity;\n\npublic class MyScript : MonoBehaviour\n{\n  RAG rag;\n\n  async void Game(){\n    ...\n    string[] inputs = new string[]{\n      \"Hi! I'm a search system.\",\n      \"the weather is nice. I like it.\",\n      \"I'm a RAG system\"\n    };\n    \u002F\u002F add the inputs to the RAG\n    foreach (string input in inputs) await rag.Add(input);\n    \u002F\u002F get the 2 most similar inputs and their distance (dissimilarity) to the search query\n    (string[] results, float[] distances) = await rag.Search(\"hello!\", 2);\n    \u002F\u002F to get the most similar text parts (chunks), instead of full input, you can enable the returnChunks option\n    rag.ReturnChunks(true);\n    (results, distances) = await rag.Search(\"hello!\", 2);\n    ...\n  }\n}\n```\n\nYou can also add \u002F search text inputs for groups of data e.g. for a specific character or scene:\n``` c#\n    \u002F\u002F add the inputs to the RAG for a group of data e.g. an orc character\n    foreach (string input in inputs) await rag.Add(input, \"orc\");\n    \u002F\u002F get the 2 most similar inputs for the group of data e.g. the orc character\n    (string[] results, float[] distances) = await rag.Search(\"how do you feel?\", 2, \"orc\");\n...\n\nYou can save the RAG state (stored in the `Assets\u002FStreamingAssets` folder):\n``` c#\nrag.Save(\"rag.zip\");\n```\nand load it from disk:\n``` c#\nawait rag.Load(\"rag.zip\");\n```\n\nYou can use the RAG to feed relevant data to the LLM based on a user message:\n``` c#\n  string message = \"How is the weather?\";\n  (string[] similarPhrases, float[] distances) = await rag.Search(message, 3);\n\n  string prompt = \"Answer the user query based on the provided data.\\n\\n\";\n  prompt += $\"User query: {message}\\n\\n\";\n  prompt += $\"Data:\\n\";\n  foreach (string similarPhrase in similarPhrases) prompt += $\"\\n- {similarPhrase}\";\n\n  _ = llmAgent.Chat(prompt, HandleReply, ReplyCompleted);\n```\n\nThe `RAG` sample includes an example RAG implementation as well as an example RAG-LLM integration.\n\nThat's all :sparkles:!\n\n## LLM model management\nLLM for Unity includes a built-in model manager for easy model handling.\u003Cbr>\nThe model manager allows to load or download LLMs and can be found as part of the LLM GameObject:\u003Cbr>\n\u003Cimg width=\"360\" src=\".github\u002FLLM_manager.png\">\n\nYou can download models with the `Download model` button.\u003Cbr>\nLLM for Unity includes different state of the art models built-in for different model sizes, quantised with the Q4_K_M method.\u003Cbr>\nAlternative models can be downloaded from [HuggingFace](https:\u002F\u002Fhuggingface.co\u002Fmodels?library=gguf&sort=downloads) in .gguf format.\u003Cbr>\nYou can download a model locally and load it with the `Load model` button, or copy the URL in the `Download model > Custom URL` field to directly download it.\u003Cbr>\nIf a HuggingFace model does not provide a gguf file, it can be converted to gguf with this [online converter](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fggml-org\u002Fgguf-my-repo).\u003Cbr>\n\n\u003Cbr>\n\u003Cbr>\nModels added in the model manager are copied to the game during the building process.\u003Cbr>\nYou can omit a model by deselecting the \"Build\" checkbox.\u003Cbr>\nTo remove the model (but not delete it from disk) you can click the bin button.\u003Cbr>\nThe path and URL of models can be diplayed in the expanded view of the model manager with the `>>` button:\u003Cbr>\n\u003Cimg width=\"600\" src=\".github\u002FLLM_manager_expanded.png\">\n\nYou can create lighter builds by selecting the `Download on Build` option.\u003Cbr>\nThe models will be downloaded the first time the game starts instead of bundled in the build.\u003Cbr>\nIf you have loaded a model locally you need to set its URL through the expanded view, otherwise it will be copied in the build.\u003Cbr>\n\n❕ Before using any model make sure you **check their license** ❕\n\n## Examples\nThe [Samples~](Samples~) folder contains several examples of interaction 🤖:\n- [SimpleInteraction](Samples~\u002FSimpleInteraction): Simple interaction with an AI character\n- [MultipleCharacters](Samples~\u002FMultipleCharacters): Simple interaction using multiple AI characters\n- [FunctionCalling](Samples~\u002FFunctionCalling): Function calling sample with structured output from the LLM\n- [RAG](Samples~\u002FRAG): Semantic search using a Retrieval Augmented Generation (RAG) system. Includes example using a RAG to feed information to a LLM\n- [MobileDemo](Samples~\u002FMobileDemo): Example mobile app for Android \u002F iOS with an initial screen displaying the model download progress\n- [ChatBot](Samples~\u002FChatBot): Interaction between a player and a AI with a UI similar to a messaging app (see image below)\n- [KnowledgeBaseGame](Samples~\u002FKnowledgeBaseGame): Simple detective game using a knowledge base to provide information to the LLM based on [google\u002Fmysteryofthreebots](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fmysteryofthreebots)\n  \n\u003Cimg width=\"400\" src=\".github\u002Fdemo.gif\">\n\nTo install a sample:\n- Open the Package Manager: `Window > Package Manager`\n- Select the `LLM for Unity` Package. From the `Samples` Tab, click `Import` next to the sample you want to install.\n\nThe samples can be run with the `Scene.unity` scene they contain inside their folder.\u003Cbr>\nIn the scene, select the `LLM` GameObject and specify the LLM of your choice (see [LLM model management](#llm-model-management)).\u003Cbr>\nSave the scene, run and enjoy!\n\n## License\nThe license of LLM for Unity is Apache 2.0 ([LICENSE.md](LICENSE.md)) and uses third-party software with MIT and Apache licenses.\nSome models included in the asset define their own license terms, please review them before using each model.\nThird-party licenses can be found in the ([Third Party Notices.md](\u003CThird Party Notices.md>)).\n","\u003Cp align=\"center\">\n\u003Cpicture>\n  \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\".github\u002Flogo_white.png\">\n  \u003Csource media=\"(prefers-color-scheme: light)\" srcset=\".github\u002Flogo.png\">\n  \u003Cimg src=\".github\u002Flogo.png\" height=\"150\"\u002F>\n\u003C\u002Fpicture>\n\u003C\u002Fp>\n\n\u003Ch3 align=\"center\">使用 LLM 在 Unity 中创建角色！\u003C\u002Fh3>\n\n[![许可证：Apache](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-Apache_2.0-yellow.svg)](https:\u002F\u002Fopensource.org\u002Flicense\u002Fapache-2-0)\n\u003Ca href=\"https:\u002F\u002Fdiscord.gg\u002FRwXKQb6zdv\">\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fundreamai_LLMUnity_readme_8269212a1bbd.png\"\u002F>\u003C\u002Fa>\n[![Reddit](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FReddit-%23FF4500.svg?style=flat&logo=Reddit&logoColor=white)](https:\u002F\u002Fwww.reddit.com\u002Fuser\u002FUndreamAI)\n[![LinkedIn](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLinkedIn-blue?style=flat&logo=linkedin&labelColor=blue)](https:\u002F\u002Fwww.linkedin.com\u002Fcompany\u002Fundreamai)\n[![Asset Store](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FAsset%20Store-black.svg?style=flat&logo=unity)](https:\u002F\u002Fassetstore.unity.com\u002Fpackages\u002Fslug\u002F273604)\n[![GitHub 仓库星标](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fundreamai\u002FLLMUnity?style=flat&logo=github&color=f5f5f5)](https:\u002F\u002Fgithub.com\u002Fundreamai\u002FLLMUnity)\n[![文档](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDocs-white.svg?logo=data:image\u002Fpng;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwEAYAAAAHkiXEAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+\u002FAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAATqSURBVHic7ZtbiE1RGMc349K4M5EwklwjzUhJCMmTJPJAYjQXJJcH8+Blkry4lPJA8aAoJbekDLmUS6E8SHJL5AW5JPf7eHv93C2Wfttc\u002Fee+0zc\u002F4vv+bMXvusvfZa3\u002Fq+b33H80oqqaSSSmqrKnPdgXjUvbvYq5f4+7f486eb\u002FrRajRsn7t4tPngg\u002Fvkj\u002FvghXr0q7tajrVohXr0q7tGoSxdx8mSxqUm8eVNkgAvl0aPioEFip07i6dNonukXrd9GoSxdx8mSxqUm8eVNkgAvl0aPioEFip07i6dNonukXrd9GoSxdx8mSxqUm8eVNkgAvl0aPioEFip07i6dNonukXrd9GoSxdx8mSxqUm8eVNkgAvl0aPioEFip07i6dNonukXrd9GoSxdx8mSxqUm8eVNkgAvl0aPioEFip07i6dNonukXrd9GoSxdx8mSxqUm8eVNkgAvl0aPioEFip07i6dNonukXrd9GoSxdx8mSxqUm8eVNkgAvl0aPioEFip07i6dNonukXrd9GoSxdx8mSxqUm8eVNkgAvl0aPioEFip07i6dNonukXrd9GoSxdx8mSxqUm8eVNkgAvl0aP......\u003Cp align=\"center\">\n\u003Cpicture>\n  \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\".github\u002Flogo_white.png\">\n  \u003Csource media=\"(prefers-color-scheme: light)\" srcset=\".github\u002Flogo.png\">\n  \u003Cimg src=\".github\u002Flogo.png\" height=\"150\"\u002F>\n\u003C\u002Fpicture>\n\u003C\u002Fp>\n\n\u003Ch3 align=\"center\">使用 LLM 在 Unity 中创建角色！\u003C\u002Fh3>\n\n[![许可证：Apache](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-Apache_2.0-yellow.svg)](https:\u002F\u002Fopensource.org\u002Flicense\u002Fapache-2-0)\n\u003Ca href=\"https:\u002F\u002Fdiscord.gg\u002FRwXKQb6zdv\">\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fundreamai_LLMUnity_readme_8269212a1bbd.png\"\u002F>\u003C\u002Fa>\n[![Reddit](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FReddit-%23FF4500.svg?style=flat&logo=Reddit&logoColor=white)](https:\u002F\u002Fwww.reddit.com\u002Fuser\u002FUndreamAI)\n[![LinkedIn](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLinkedIn-blue?style=flat&logo=linkedin&labelColor=blue)](https:\u002F\u002Fwww.linkedin.com\u002Fcompany\u002Fundreamai)\n[![Asset Store](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FAsset%20Store-black.svg?style=flat&logo=unity)](https:\u002F\u002Fassetstore.unity.com\u002Fpackages\u002Fslug\u002F273604)\n[![GitHub 仓库星标数](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fundreamai\u002FLLMUnity?style=flat&logo=github&color=f5f5f5)](https:\u002F\u002Fgithub.com\u002Fundreamai\u002FLLMUnity)\n[![文档](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDocs-white.svg?logo=data:image\u002Fpng;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwEAYAAAAHkiXEAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+\u002FAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAATqSURBVHic7ZtbiE1RGMc349K4M5EwklwjzUhJCMmTJPJAYjQXJJcH8+Blkry4lPJA8aAoJbekDLmUS6E8SHJL5AW5JPf7eHv93C2Wfttc\u002Fee+0zc\u002F4vv+bMXvusvfZa3\u002Fq+b33H80oqqaSSSmqrKnPdgXjUvbvYq5f4+7f486eb\u002FrRajRsn7t4tPngg\u002Fvkj\u002FvghXr0q7tajrV4tPngg\u002Fvkj\u002FvghXr0q7tajrV4tPngg\u002Fvkj\u002FvghXr0q7tajrV4tPngg\u002Fvkj\u002FvghXr0q7tajrV4tPngg\u002Fvkj\u002FvghXr0q7tajrV4tPngg\u002Fvkj\u002FvghXr0q7tajrV4tPngg\u002Fvkj\u002FvghXr0q7tajrV4tPngg\u002Fvkj\u002FvghXr0q7tajrV4tPngg\u002Fvkj\u002FvghXr0q7tajrV4tPngg\u002Fvkj\u002FvghXr0q7tajrV4tPngg\u002Fvkj\u002FvghXr0q7tajrV4tPngg\u002Fvkj\u002FvghXr0q7tajrV4tPngg\u002Fvkj\u002FvghXr0q7tajrV4tPngg\u002Fvkj\u002FvghXr0q7tajrV4tPngg\u002Fvkj\u002FvghXr0q7tajrV4tPngg\u002Fvkj\u002FvghXr0q7tajrV4tPngg\u002Fvkj\u002FvghXr0q7tajrV4tPngg\u002Fvkj\u002FvghXr0q7tajrV4tPngg\u002Fvkj\u002FvghXr0q7tajrV4tPngg\u002Fvkj......\n\n## 使用 LLM 的 Unity 游戏\u002F项目\n- [Verbal Verdict](https:\u002F\u002Fstore.steampowered.com\u002Fapp\u002F2778780\u002FVerbal_Verdict\u002F)\n- [I, Chatbot: AISYLUM](https:\u002F\u002Fstore.epicgames.com\u002Fde\u002Fp\u002Fi-chatbot-aisylum-83b2b5)\n- [Nameless Souls of the Void](https:\u002F\u002Funicorninteractive.itch.io\u002Fnameless-souls-of-the-void)\n- [Murder in Aisle 4](https:\u002F\u002Froadedlich.itch.io\u002Fmurder-in-aisle-4)\n- [Finicky Food Delivery AI](https:\u002F\u002Fhelixngc7293.itch.io\u002Ffinicky-food-delivery-ai)\n- [AI Emotional Girlfriend](https:\u002F\u002Fwhynames.itch.io\u002Faiemotionalgirlfriend)\n- [Case Closed](https:\u002F\u002Fstore.steampowered.com\u002Fapp\u002F2532160\u002FCase_Closed)\n- [MaiMai AI Agent System](https:\u002F\u002Fgithub.com\u002FIhateCreatingUserNames2\u002FMaiMai)\n- [Claria Chat](https:\u002F\u002Fplay.google.com\u002Fstore\u002Fapps\u002Fdetails?id=com.ProLink.ClariaChat)\n- [Endless Casual Drive](https:\u002F\u002Fstore.steampowered.com\u002Fapp\u002F2928500\u002FEndless_Casual_Drive\u002F)\n- [Dating App Simulator](https:\u002F\u002Fstore.steampowered.com\u002Fapp\u002F3415680\u002FDating_App_Simulator\u002F)\n- [Virtual Reality Mock Interview](https:\u002F\u002Fvrmi.vercel.app\u002F)\n- [Velesio AI server](https:\u002F\u002Fgithub.com\u002FVelesio\u002FVelesio-AIServer)\n- [Dungeon Chat](https:\u002F\u002Fwww.meta.com\u002Fexperiences\u002Fdungeonchat\u002F8527310950709276\u002F)\n- [Tomonaka Desk](https:\u002F\u002Fjoycatdev.itch.io\u002Ftomonaka-desk)\n- [Digital Humans](https:\u002F\u002Fstore.steampowered.com\u002Fapp\u002F3089280\u002FDigital_Humans\u002F)\n- [CakeMix](https:\u002F\u002Fripenedpeach.itch.io\u002Fcakemix)\n- [HeyWaifu](https:\u002F\u002Fsquirclegames.itch.io\u002Fhey-waifu-ai)\n- [Love and Lie](https:\u002F\u002Fstore.steampowered.com\u002Fapp\u002F3886140\u002FLove_and_Lie\u002F)\n- [Psycho Simulator](https:\u002F\u002Fstore.steampowered.com\u002Fapp\u002F1244620\u002FPsycho_Simulator\u002F)\n- [False Flame](https:\u002F\u002Fstore.steampowered.com\u002Fapp\u002F4427250\u002FFalse_Flame\u002F)\n\n如需添加您的项目，请联系 hello@undream.ai！\n\n## 设置方法\n_方法 1：通过 Asset Store 安装_\n- 打开 [LLM for Unity](https:\u002F\u002Fassetstore.unity.com\u002Fpackages\u002Fslug\u002F273604) 资产页面，点击 `Add to My Assets`。\n- 在 Unity 中打开 Package Manager：`Window > Package Manager`。\n- 从下拉菜单中选择 `Packages: My Assets` 选项。\n- 选择 `LLM for Unity` 包，点击 `Download` 后再点击 `Import`。\n\n_方法 2：通过 GitHub 仓库安装：_\n- 在 Unity 中打开 Package Manager：`Window > Package Manager`。\n- 点击 `+` 按钮，选择 `Add package from git URL`。\n- 使用仓库地址 `https:\u002F\u002Fgithub.com\u002Fundreamai\u002FLLMUnity.git` 并点击 `Add`。\n\n## 快速入门\n\u003Cimg height=\"300\" src=\".github\u002Fcharacter.png\"\u002F>\n\n#### 1. 设置 LLM\n\n首先为您的游戏设置 LLM：\n- 创建一个空的 GameObject。\u003Cbr>在 GameObject 的 Inspector 中点击 `Add Component`，然后选择 `LLM` 脚本。\n- 使用 `Download Model` 按钮下载默认模型之一（约 GB 级）。\u003Cbr>或者使用 `Load model` 按钮加载您自己的 .gguf 模型（参见 [LLM 模型管理](#llm-model-management)）。\n\n#### 2. 创建 AI 角色\n然后您可以按照以下步骤设置每个角色：\n- 为该角色创建一个空的 GameObject。\u003Cbr>在 GameObject 的 Inspector 中点击 `Add Component`，然后选择 `LLMAgent` 脚本。\n- 在 `System Prompt` 中定义 AI 的角色。\n- （可选）如果您有多个 LLM GameObject，则在 `LLM` 字段中选择上面构建的 LLM。\n\n#### 3. 在脚本中使用\n在您的脚本中，您可以按如下方式使用它：\n``` c#\nusing LLMUnity;\n\npublic class MyScript {\n  public LLMAgent llmAgent;\n  \n  void HandleReply(string replySoFar){\n    \u002F\u002F 对模型生成的回复进行处理\n    Debug.Log(replySoFar);\n  }\n  \n  void Game(){\n    \u002F\u002F 处理正在生成的回复\n    ...\n    _ = llmAgent.Chat(\"Hello bot!\", HandleReply);\n    ...\n  }\n  \n  async void GameAsync(){\n    \u002F\u002F 或一次性处理完整回复\n    ...\n    string reply = await llmAgent.Chat(\"Hello bot!\");\n    Debug.Log(reply);\n    ...\n  }\n}\n```\n您还可以指定在模型回复完成后调用的函数：\n``` c#\n  void ReplyCompleted(){\n    \u002F\u002F 当模型回复完成时执行的操作\n    Debug.Log(\"AI 回复已完成\");\n  }\n  \n  void Game(){\n    \u002F\u002F 您的游戏函数\n    ...\n    _ = llmAgent.Chat(\"Hello bot!\", HandleReply, ReplyCompleted);\n    ...\n  }\n```\n\n若需在回复完成前停止聊天，可以使用：\n``` c#\n    llmAgent.CancelRequests();\n```\n\n- 最后，在您脚本的 GameObject 的 Inspector 中，将上面创建的 LLMAgent GameObject 作为 llmAgent 属性选择。\n\n这样就完成了！您的 AI 角色已经准备好聊天了！✨\n\n## 高级用法\n\n\u003Cdetails>\n\u003Csummary>构建移动应用\u003C\u002Fsummary>\n\n对于移动应用，您可以使用参数量最多为 1-20 亿的模型（LLM 模型管理器中的“Tiny 模型”）。\u003Cbr>\n由于移动设备硬件资源有限，更大的模型通常无法运行。\n\n**iOS**\niOS 可以使用默认的播放器设置进行构建。\n\n**Android**\n在 Android 上，您需要在播放器设置中指定 `IL2CPP` 脚本后端和 `ARM64` 目标架构。\u003Cbr>\n这些设置可以在 `Edit > Project Settings` 菜单下的 `Player > Other Settings` 部分找到。\u003Cbr>\n\u003Cimg width=\"400\" src=\".github\u002Fandroid.png\">\n\n由于移动应用的体积通常较小，您可以在应用首次启动时下载 LLM 模型。\u003Cbr>\n此功能可通过 `Download on Build` 选项启用。\u003Cbr>\n在您的项目中，您可以等待模型下载完成：\n``` c#\nawait LLM.WaitUntilModelSetup();\n```\n您还可以在模型下载过程中接收下载进度通知：\n``` c#\nawait LLM.WaitUntilModelSetup(SetProgress);\n\nvoid SetProgress(float progress){\n  string progressPercent = ((int)(progress * 100)).ToString() + \"%\";\n  Debug.Log($\"下载进度：{progressPercent}\");\n}\n```\n这有助于显示进度条等界面元素。\u003Cbr>\n[MobileDemo](Samples~\u002FMobileDemo) 示例演示了一个适用于 Android \u002F iOS 的应用。\n\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>限制 LLM 输出 \u002F 函数调用 \u002F 语法\u003C\u002Fsummary>\n\n要限制 LLM 的输出，您可以使用语法，更多信息请参见 [这里](https:\u002F\u002Fgithub.com\u002Fggerganov\u002Fllama.cpp\u002Ftree\u002Fmaster\u002Fgrammars)。\u003Cbr>\n语法可以直接在 LLMAgent 的 `Grammar` 字段中编辑，也可以保存为 gbnf \u002F json schema 文件，并通过 `Load Grammar` 按钮加载（高级选项）。\u003Cbr>\n例如，要获得 JSON 格式的回复，可以使用 [json.gbnf](https:\u002F\u002Fgithub.com\u002Fggerganov\u002Fllama.cpp\u002Fblob\u002Fb4218\u002Fgrammars\u002Fjson.gbnf) 语法。\u003Cbr>\n\n或者您也可以直接在脚本中设置语法：\n``` c#\nllmAgent.grammar = \"您的语法在此\";\n```\n\n对于函数调用，您可以定义一种仅允许函数名称作为输出的语法，然后调用相应的函数。\u003Cbr>\n您可以查看 [FunctionCalling](Samples~\u002FFunctionCalling) 示例以了解实现方法。\n\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>访问\u002F保存\u002F加载聊天记录\u003C\u002Fsummary>\n`LLMAgent` 的聊天记录保存在 `chat` 变量中，它是一个由 `ChatMessage` 对象组成的列表。\u003Cbr>\n`ChatMessage` 是一个类，用于定义消息的 `role`（角色）和 `content`（内容）。\u003Cbr>\n该列表交替包含玩家的提示和 AI 的回复。\u003Cbr>\n您可以修改聊天记录，然后将其设置到您的 LLMAgent GameObject 上：\n``` c#\nList\u003CChatMessage> newChat = new List\u003CChatMessage>();\n...\nllmAgent.chat = newChat;\n```\n\n要添加新消息，可以这样做：\n``` c#\n_ = llmAgent.AddUserMessage(\"您的用户消息\");\n_ = llmAgent.AddAssistantMessage(\"您的助手回复\");\n```\n\n要自动保存\u002F加载聊天记录，您可以将 LLMAgent 的 `Save` 参数指定为您选择的文件名（或相对路径）。\n聊天记录会以 JSON 对象的形式保存在 Unity 的 [persistentDataPath 文件夹](https:\u002F\u002Fdocs.unity3d.com\u002FScriptReference\u002FApplication-persistentDataPath.html) 中。\n\n要手动保存聊天记录，可以使用：\n``` c#\n    _ = llmAgent.SaveHistory();\n```\n而要加载记录，则可以使用：\n``` c#\n    _ = llmAgent.Loadistory();\n```\n\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>在应用启动时处理提示，以加快初始处理时间\u003C\u002Fsummary>\n\n``` c#\n  void WarmupCompleted(){\n    \u002F\u002F 温暖化完成时执行的操作\n    Debug.Log(\"AI 已准备就绪\");\n  }\n\n  void Game(){\n    \u002F\u002F 您的游戏函数\n    ...\n    _ = llmAgent.Warmup(WarmupCompleted);\n    ...\n  }\n```\n\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>决定是否将消息添加到聊天\u002F提示历史中\u003C\u002Fsummary>\n\n`Chat` 函数的最后一个参数是一个布尔值，用于指定是否将消息添加到历史中（默认为 true）：\n``` c#\n  void Game(){\n    \u002F\u002F 您的游戏函数\n    ...\n    string message = \"你好机器人！\";\n    _ = llmAgent.Chat(message, HandleReply, ReplyCompleted, false);\n    ...\n  }\n```\n\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>使用纯文本补全\u003C\u002Fsummary>\n\n``` c#\n  void Game(){\n    \u002F\u002F 您的游戏函数\n    ...\n    string message = \"猫不在了\";\n    _ = llmAgent.Completion(message, HandleReply, ReplyCompleted);\n    ...\n  }\n```\n\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>以编程方式添加 LLM \u002F LLMAgent 组件\u003C\u002Fsummary>\n\n``` c#\nusing UnityEngine;\nusing LLMUnity;\n\npublic class MyScript : MonoBehaviour\n{\n    LLM llm;\n    LLMAgent llmAgent;\n\n    async void Start()\n    {\n        \u002F\u002F 禁用 GameObject，以便 Awake 不会立即被调用\n        gameObject.SetActive(false);\n\n        \u002F\u002F 添加 LLM 对象\n        llm = gameObject.AddComponent\u003CLLM>();\n        \u002F\u002F 使用模型文件名设置模型。\n        \u002F\u002F 模型需要通过加载或下载的方式添加到 LLM 模型管理器中（参见 LLM 模型管理）。\n        \u002F\u002F 否则，可以将模型文件直接复制到 StreamingAssets 文件夹内。\n        llm.model = \"Qwen3-4B-Q4_K_M.gguf\";\n        \u002F\u002F 可选：您也可以以类似的方式设置 LoRA，并根据需要设置其权重。\n        llm.AddLora(\"my-lora.gguf\");\n        llm.AddLora(\"my-lora-2.gguf\", 0.5f);\n        \u002F\u002F 可选：设置线程数\n        llm.numThreads = -1;\n        \u002F\u002F 可选：启用 GPU，通过设置要卸载到 GPU 的模型层数来实现\n        llm.numGPULayers = 10;\n\n        \u002F\u002F 添加 LLMAgent 对象\n        llmAgent = gameObject.AddComponent\u003CLLMAgent>();\n        \u002F\u002F 设置负责模型的 LLM 对象\n        llmAgent.llm = llm;\n        \u002F\u002F 设置角色提示\n        llmAgent.systemPrompt = \"一位好奇的人类与人工智能助手之间的对话。\";\n        \u002F\u002F 设置 AI 和玩家的角色名称\n        llmAgent.assistantRole = \"AI\";\n        llmAgent.userRole = \"人类\";\n        \u002F\u002F 可选：设置保存路径\n        llmAgent.save = \"AICharacter1.json\";\n        \u002F\u002F 可选：设置语法\n        llmAgent.grammar = \"您的语法在此\";\n\n        \u002F\u002F 重新启用 GameObject\n        gameObject.SetActive(true);\n    }\n}\n```\n\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>使用远程服务器\u003C\u002Fsummary>\n\n您可以使用远程服务器来进行处理，并实现与之交互的角色。\n\n**创建服务器**\u003Cbr>\n要创建服务器：\n- 按照上述说明，使用 `LLM` 脚本创建一个带有 GameObject 的项目\n- 启用 `LLM` 的 `Remote` 选项，并可选配置服务器端口和 API 密钥\n- 在项目设置中启用“允许通过 HTTP 下载”\n- 构建并运行以启动服务器\n\n或者，您也可以使用服务器二进制文件以简化部署：\n- 从编辑器中运行上述场景，并从调试信息中复制命令（以“Deploy server command:”开头）\n- 下载并解压 [LlamaLib 二进制文件](https:\u002F\u002Fgithub.com\u002Fundreamai\u002FLlamaLib\u002Freleases\u002Fdownload\u002Fv2.0.0\u002FLlamaLib-v2.0.0.zip)\n- 在命令行中切换到选定的 `servers` 文件夹，并运行之前复制的命令来启动服务器。\n\n**创建角色**\u003Cbr>\n使用上述说明中的 `LLMAgent` 脚本，创建第二个包含游戏角色的项目。\n启用 `Remote` 选项，并使用服务器的 IP 地址（以“http:\u002F\u002F”开头）、端口和 API 密钥配置主机。\n\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>使用 LLM 计算嵌入向量\u003C\u002Fsummary>\n\n`Embeddings` 函数可用于获取短语的嵌入向量：\n``` c#\n    List\u003Cfloat> embeddings = await llmAgent.Embeddings(\"你好，最近怎么样？\");\n```\n\n\u003C\u002Fdetails>\n\n关于函数级别的\u003Cb>详细文档\u003C\u002Fb>可以在这里找到：\n\u003Ca href=\"https:\u002F\u002Fundream.ai\u002FLLMUnity\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDocumentation-white.svg?logo=data:image\u002Fpng;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwEAYAAAAHkiXEAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+\u002FAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAATqSURBVHic7ZtbiE1RGMc349K4M5EwklwjzUhJCMmTJPJAYjQXJJcH8+Blkry4lPJA8aAoJbekDLmUS6E8SHJL5AW5JPf7eHv93C2Wfttc\u002Fee+0zc\u002F4vv+bMXvusvfZa3\u002Fq+b33H80oqqaSSSmqrKnPdgXjUvbvYq5f4+7f486eb\u002FrRajRsn7t4tPngg\u002Fvkj\u002FvghXr0q7tghzpyZ\u002F\u002F79+on79omXLomb\u002F\u002FiFV68SN24UHz0qdugkzp0Td+0Sb90Sb90qtm0Tb90qtm0Tr14V27eLHTuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVuKLVu......关于函数级别的\u003Cb>详细文档\u003C\u002Fb>可以在这里找到：\n\u003Ca href=\"https:\u002F\u002Fundream.ai\u002FLLMUnity\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDocumentation-white.svg?logo=data:image\u002Fpng;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwEAYAAAAHkiXEAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+\u002FAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAATqSURBVHic7ZtbiE1RGMc349K4M5EwklwjzUhJCMmTJPJAYjQXJJcH8+Blkry4lPJA8aAoJbekDLmUS6E8SHJL5AW5JPf7eHv93C22Wfttc\u002Fee+0zc\u002F4vv+bMXvusvfZa3\u002Fq+b33H80oqqaSSSmqrKnPdgXjUvbvYq5f4+7f486eb\u002FrRajRsn7t4tPngg\u002Fvkj\u002FvghXr0q7tghzpyZ\u002F\u002F79+on79omXLomb92odV9GoSxdx8mSxqUm8eVNkgAvl0aPioEFip07i6dP52z15Ig4fbvVY2VVFhbhokXjrlogJiWvAg\u002FjwoXjqVO53+leUny9eiFVV5mfMlLDRBw+KX76ISQ+0LZ8\u002FF00P4uJFsWPHFh83O+rdWzx3TnQ9kLbECxo2TKyuFj9\u002Fzt9u+XIvG8LWv3wpuh5QW86f3\u002FJznT+fv93s2S23C1Z72wbhtH692LdvMvdPSgzkhAkiJhT16ZO\u002FPRPOmcr+Rda4aa5nclTeuZP7PDgRpr1g40bPrQYOFF0PYKHECxo2TKyuFj9\u002F9v\u002FeZDGjxcZh7dv4+mXtch+up7Rca+MsJvxiRNi6npBhw4iGxT16ZO\u002FPRPOmcr+Rda4aa5nclTeuZP7PDgRpr1g40bPrQYOFF0PYKHECxo2TKyuFj9\u002F9v\u002FeZDGjxcZh7dv4+mXtch+up7Rca+MsJvxiRNi6npBhw44oqqaSSSmqrKnPdgXjUvbvYq5f4+7f486eb\u002FrRajRsn7t4tPngg\u002Fvkj\u002FvghXr0q7tghzpyZ\u002F\u002F79+on79omXLomb92odV9GoSxdx8mSxqUm8eVNkgAvl0aPioEFip07i6dP52z15Ig4fbvVY2VVFhbhokXjrlogJiWvAg\u002FjwoXjqVO53+leUny9eiFVV5mfMlLDRBw+TKuqZNo0kUTuypUrceBA7vcHB4uHDolE8IiZHPY+apTYs6dI3RIWwH\u002F\u002F1NSZf\u002FKkuHCh2GpMDyKbGNcLYE+YMkVks3\u002F6NFx7XhTZ3szXiBaqtWvFuAOxM2dEZiyH8UErgc8JLNun7E0aFffSI7RP6owZm3\u002FkSH5\u002FL14UXrxejmj5M7NatIhWARS82xUJfAKahzFcdPnq0GLYgy7Rnbd8e6rGKRyzpuNzPBty4Idf71Kl211M2wwoOq1mzRAq5Pnywa5+4KDHE9mI7ly0TO3bMvZ6\u002FeJE4dqx45IjnU0JxAGLpklPx+9VZFwPp\u002F9v\u002FeZDGjxcZh7dv4+mXtch+up7Rca+MsJvxiRNi6npBhw44oqqaSSSmqrKnPdgXjUvbvYq5f4+7f486eb\u002FrRajRsn7t4tPngg\u002Fvkj\u002FvghXr0q7tghzpyZ\u002F\u002F79+on79omXLomb92odV9GoSxdx8mSxqUm8eVNkgAvl0aPioEFip07i6dP52z15Ig4fbvVY2VVFhbhokXjrlogJiWvAg\u002FjwoXjqVO53+leUny9eiFVV5mfMlLDRBw+TKuqZNo0kUTiV1NTMvd5DQ0iuxRYuKJHJ4e\u002FfEdevEajYnA4lNvXqJZDKuWiWa3DJe3N69oj8uSEq8CER88uaNOGBAOv2ILGY69TBBJoM8O0t72zaRoztXBzlLlrT8XARW\u002FIQq82JTMv0mKmv0\u002F9CC4mJMYPwrMSETxAyurRUxQVmXP1fEOd7Ny5GLYgy7Rnbd8e6rGKRyzpuNzPBty4Idf71Kl211M2wwoOq1mzRAq5Pnywa5+4KDHE9mI7ly0TO3bMvZ6\u002FeJE4db8uHCh2GpMDyKbGNcLYE+YMkVks3\u002F6NFx7XhTZ3szXiBaqtWvFuAOxM2dEZiyH8UErgc8JLNun7E0aFffSI7RP6owZm3\u002FkSH5\u002FL14UXrxejmj5M7NatIhWARS82xUJfAKahzFcdPnq0GLYgy7Rnbd8e6rGKRyzpuNzPBty4Idf71Kl211M2wwoOq1mzRAq5Pnywa5+4KDHE9mI7ly0TO3bMvZ6\u002FeJE4db8uHCh2GpMDyKbGNcLYE+YMkVks3\u002F6NFx7XhTZ3szXiBaqtWvFuAOxM2dEZiyH8UErgc8JLNun7E0aFffSI7RP6owZm3\u002FkSH5\u002FL14UXrxejmj5M7NatIhWARS82xUJfAKahzFcdPnq0GLYgy7Rnbd8e6rGKRyzpuNzPBty4Idf71Kl211M2wwoOq1mzRAq5Pnywa5+4KDHE9mI7ly0TO3bMvZ6\u002FeJE4db8uHCh2GpMDyKbGNcLYE+YMkVks3\u002F6NFx7XhTZ3szXiBaqtWvFuAOxM2dEZiyH8UErgc8JLNun7E0aFffSI7RP6owZm3\u002FkSH5\u002FL14UXrxejmj5M7NatIhWARS82xUJfAKahzFcdPnq0GLYgy7Rnbd8e6rGKRyzpuNzPBty4Idf71Kl211M2wwoOq1mzRAq5Pnywa5+4KDHE9mI7ly0TO3bMvZ6\u002FeJE4db8uHCh2GpMDyKbGNcLYE+YMkVks3\u002F6NFx7XhTZ3szXiBaqtWvFuAOxM2dEZiyH8UErgc8JLNun7E0aFffSI7RP6owZm3\u002FkSH5\u002FL14UXrxejmj5M7NatIhWARS82xUJfAKahzFcdPnq0GLYgy7Rnbd8e6rGKRyzpuNzPBty4Idf71Kl211M2wwoOq1mzRAq5Pnywa5+4KDHE9mI7ly0TO3bMvZ6\u002FeJE4db8uHCh2GpMDyKbGNcLYE+YMkVks3\u002F6NFx7XhTZ3szXiBaqtWvFuAOxM2dEZiyH8UErgc8JLNun7E0aFffSI7RP6owZm3\u002FkSH5\u002FL14UXrxejmj5M7NatIhWARS82xUJfAKahzFcdPnq0GLYgy7Rnbd8e6rGKRyzpuNzPBty4Idf71Kl211M2wwoOq1mzRAq5Pnywa5+4KDHE9mI7ly0TO3bMvZ6\u002FeJE4db8uHCh2GpMDyKbGNcLYE+YMkVks3\u002F6NFx7XhTZ3szXiBaqtWvFuAOxM2dEZiyH8UErgc8JLNun7E0aFffSI7RP6owZm3\u002FkSH5\u002FL14UXrxejmj5M7NatIhWARS82xUJfAKahzFcdPnq0GLYgy7Rnbd8e6rGKRyzpuNzPBty4Idf71Kl211M2wwoOq1mzRAq5Pnywa5+4KDHE9mI7ly0TO3bMvZ6\u002FeJE4db8uHCh2GpMDyKbGNcLYE+YMkVks3\u002F......\n\n## LLM 模型管理\nLLM for Unity 内置了一个模型管理器，方便用户轻松管理模型。\u003Cbr>\n模型管理器可用于加载或下载 LLM 模型，它位于 LLM GameObject 中：\u003Cbr>\n\u003Cimg width=\"360\" src=\".github\u002FLLM_manager.png\">\n\n您可以通过“Download model”按钮下载模型。\u003Cbr>\nLLM for Unity 内置了多种不同规模的先进模型，并采用 Q4_K_M 方法进行量化。\u003Cbr>\n您也可以从 [HuggingFace](https:\u002F\u002Fhuggingface.co\u002Fmodels?library=gguf&sort=downloads) 下载其他 .gguf 格式的模型。\u003Cbr>\n您可以将模型下载到本地并通过“Load model”按钮加载，或者将 URL 复制到“Download model > Custom URL”字段中直接下载。\u003Cbr>\n如果 HuggingFace 上的模型没有提供 gguf 文件，可以使用此 [在线转换工具](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fggml-org\u002Fgguf-my-repo)将其转换为 gguf 格式。\u003Cbr>\n\n\u003Cbr>\n\u003Cbr>\n添加到模型管理器中的模型会在构建过程中复制到游戏中。\u003Cbr>\n您可以通过取消选中“Build”复选框来排除某个模型。\u003Cbr>\n要移除模型（但不从磁盘中删除），可以点击垃圾桶按钮。\u003Cbr>\n通过模型管理器展开视图中的 `>>` 按钮，可以显示模型的路径和 URL：\u003Cbr>\n\u003Cimg width=\"600\" src=\".github\u002FLLM_manager_expanded.png\">\n\n您可以通过选择“Download on Build”选项来创建更轻量级的构建版本。\u003Cbr>\n这样，模型将在游戏首次启动时下载，而不是打包在构建中。\u003Cbr>\n如果您已本地加载模型，则需要通过展开视图设置其 URL，否则该模型仍会被复制到构建中。\u003Cbr>\n\n❕ 在使用任何模型之前，请务必 **检查其许可证** ❕\n\n## 示例\n[Samples~](Samples~) 文件夹包含多个 AI 交互示例 🤖：\n- [SimpleInteraction](Samples~\u002FSimpleInteraction)：与 AI 角色的简单交互\n- [MultipleCharacters](Samples~\u002FMultipleCharacters)：使用多个 AI 角色的简单交互\n- [FunctionCalling](Samples~\u002FFunctionCalling)：带有 LLM 结构化输出的函数调用示例\n- [RAG](Samples~\u002FRAG)：使用检索增强生成（RAG）系统的语义搜索。包含使用 RAG 向 LLM 提供信息的示例\n- [MobileDemo](Samples~\u002FMobileDemo)：适用于 Android \u002F iOS 的移动应用示例，初始界面显示模型下载进度\n- [ChatBot](Samples~\u002FChatBot)：玩家与 AI 之间的交互，界面类似于消息应用（见下图）\n- [KnowledgeBaseGame](Samples~\u002FKnowledgeBaseGame)：基于 [google\u002Fmysteryofthreebots](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fmysteryofthreebots) 的简单侦探游戏，利用知识库向 LLM 提供信息\n\n\u003Cimg width=\"400\" src=\".github\u002Fdemo.gif\">\n\n安装示例的方法：\n- 打开包管理器：`Window > Package Manager`\n- 选择“LLM for Unity”包，在“Samples”选项卡中，点击您想要安装的示例旁边的“Import”。\n\n这些示例可以直接在其文件夹内包含的 `Scene.unity` 场景中运行。\u003Cbr>\n在场景中，选择“LLM”GameObject，并指定您选择的 LLM（参见 [LLM 模型管理](#llm-model-management)）。\u003Cbr>\n保存场景并运行，尽情体验吧！\n\n## 许可证\nLLM for Unity 的许可证为 Apache 2.0 ([LICENSE.md](LICENSE.md))，并使用了采用 MIT 和 Apache 许可证的第三方软件。\n资源中包含的部分模型有各自的许可条款，请在使用前仔细阅读。\n第三方许可证可在 ([Third Party Notices.md](\u003CThird Party Notices.md>)) 中找到。","# LLMUnity 快速上手指南\n\nLLMUnity 是一个用于在 Unity 引擎中无缝集成大型语言模型（LLM）的开源工具。它允许开发者创建可与玩家互动的智能 AI 角色，支持本地运行（无需联网），并内置了检索增强生成（RAG）系统以增强角色知识库。后端基于 `llama.cpp`，支持 CPU 及多种 GPU 加速。\n\n## 环境准备\n\n*   **Unity 版本**：推荐 Unity 2021 LTS, 2022 LTS, 2023 或 Unity 6。\n*   **操作系统**：Windows, macOS, Linux。\n*   **硬件要求**：\n    *   **PC\u002FVR**：支持 CPU 推理；推荐使用 Nvidia (CUDA), AMD 或 Apple Metal GPU 以获得更快速度。\n    *   **移动端 (iOS\u002FAndroid)**：仅支持小型模型（参数量 10-20 亿，即 \"Tiny models\"）。Android 构建需设置脚本后端为 `IL2CPP` 且架构为 `ARM64`。\n*   **前置依赖**：无需额外安装外部依赖，插件内部已包含必要的 C++\u002FC# 库 (`LlamaLib`)。\n\n## 安装步骤\n\n你可以通过以下两种方式之一将 LLMUnity 安装到 Unity 项目中：\n\n### 方法一：通过 Unity Asset Store 安装（推荐国内网络环境）\n\n1.  访问 [LLM for Unity Asset Store 页面](https:\u002F\u002Fassetstore.unity.com\u002Fpackages\u002Fslug\u002F273604)。\n2.  点击 `Add to My Assets` 将其添加到你的资产库。\n3.  打开 Unity 编辑器，进入菜单 `Window > Package Manager`。\n4.  在下拉菜单中选择 `Packages: My Assets`。\n5.  找到 `LLM for Unity` 包，点击 `Download`，下载完成后点击 `Import`。\n\n### 方法二：通过 Git URL 安装\n\n1.  打开 Unity 编辑器，进入菜单 `Window > Package Manager`。\n2.  点击左上角的 `+` 按钮，选择 `Add package from git URL`。\n3.  输入以下仓库地址并点击 `Add`：\n    ```text\n    https:\u002F\u002Fgithub.com\u002Fundreamai\u002FLLMUnity.git\n    ```\n\n## 基本使用\n\n安装完成后，只需三个步骤即可让 AI 角色开始对话。\n\n### 1. 配置 LLM 后端\n\n首先需要在场景中设置大模型服务：\n\n1.  在 Hierarchy 中创建一个空 GameObject（例如命名为 `LLMManager`）。\n2.  在 Inspector 面板中点击 `Add Component`，搜索并添加 `LLM` 脚本。\n3.  **加载模型**：\n    *   点击组件上的 `Download Model` 按钮下载默认模型（文件大小通常为几 GB）。\n    *   或者，如果你已有 `.gguf` 格式的模型文件，点击 `Load model` 按钮进行加载。\n\n### 2. 创建 AI 角色\n\n接下来为具体的角色配置行为：\n\n1.  在场景中创建一个代表角色的空 GameObject（或关联到你的角色模型上）。\n2.  在 Inspector 面板中点击 `Add Component`，搜索并添加 `LLMAgent` 脚本。\n3.  **设置人设**：在 `System Prompt` 字段中输入角色的系统提示词（例如：“你是一个友好的冒险向导”）。\n4.  **关联模型**：如果场景中有多个 LLM 组件，请在 `LLM` 字段中指定步骤 1 创建的 `LLMManager` 对象（通常会自动识别）。\n\n### 3. 编写代码进行交互\n\n在你的游戏脚本中调用 AI 接口。以下是两种常用的调用方式：\n\n```csharp\nusing LLMUnity;\nusing UnityEngine;\n\npublic class MyScript : MonoBehaviour {\n    \u002F\u002F 在 Inspector 中拖入带有 LLMAgent 组件的游戏对象\n    public LLMAgent llmAgent;\n  \n    \u002F\u002F 处理流式回复（每生成一个字就调用一次）\n    void HandleReply(string replySoFar){\n        Debug.Log(\"AI 正在回复：\" + replySoFar);\n    }\n    \n    \u002F\u002F 处理完整回复（一次性获取结果）\n    async void GameAsync(){\n        string reply = await llmAgent.Chat(\"你好，机器人！\");\n        Debug.Log(\"AI 完整回复：\" + reply);\n    }\n    \n    \u002F\u002F 带回调的流式调用\n    void Game(){\n        \u002F\u002F 参数依次为：用户输入、流式回调函数、完成回调函数\n        _ = llmAgent.Chat(\"Hello bot!\", HandleReply, () => {\n            Debug.Log(\"AI 回复完毕\");\n        });\n    }\n    \n    \u002F\u002F 取消当前正在进行的请求\n    void StopChat(){\n        llmAgent.CancelRequests();\n    }\n}\n```\n\n**最后一步**：选中挂载了 `MyScript` 的游戏对象，在 Inspector 中将 `llmAgent` 属性指向步骤 2 中创建的带有 `LLMAgent` 组件的游戏对象。\n\n现在运行游戏，你的 AI 角色即可进行对话！","一家独立游戏工作室正在开发一款开放世界 RPG，希望游戏中的 NPC 能根据玩家的历史行为和当前语境进行动态对话，而非重复固定台词。\n\n### 没有 LLMUnity 时\n- 开发者必须手动编写成千上万条分支对话树，不仅耗时耗力，还难以覆盖玩家所有可能的提问。\n- NPC 无法记忆之前的互动细节，每次对话都像“失忆”一样重新开始，严重破坏沉浸感。\n- 若想让玩家查询游戏内的百科知识（如怪物弱点、任务线索），只能硬编码简单的关键词匹配，灵活性极差。\n- 调整角色性格或语气需要修改大量脚本逻辑，迭代成本极高，难以快速测试不同风格。\n\n### 使用 LLMUnity 后\n- 借助内置的大语言模型，NPC 能实时生成符合语境的自然回复，无需预设海量台词，大幅减少美术与策划的工作量。\n- 利用 RAG（检索增强生成）系统，NPC 可自动检索游戏数据库中的背景设定，准确回答玩家关于世界观的复杂问题。\n- 角色具备短期记忆能力，能结合上下文连续对话，甚至根据玩家之前的选择改变态度，显著提升代入感。\n- 开发者只需在 Unity 编辑器中调整提示词（Prompt）参数，即可瞬间改变 NPC 的性格设定，实现快速原型验证。\n\nLLMUnity 将静态的脚本对话转化为动态的智能交互，让游戏角色真正“活”了起来。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fundreamai_LLMUnity_af18ade7.png","undreamai","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fundreamai_43cbd22f.png","Undreaming the future of gaming. We are on a mission to democratise AI for immersive storytelling.",null,"https:\u002F\u002Fgithub.com\u002Fundreamai",[78],{"name":79,"color":80,"percentage":81},"C#","#178600",100,1579,177,"2026-04-13T10:32:34","Apache-2.0","Windows, macOS, Linux, Android, iOS","非必需。支持 CPU 推理。若使用 GPU，支持 Nvidia (CUDA)、AMD 和 Apple Metal。未指定具体显存大小，移动端建议使用 10-20 亿参数的小模型。","未说明（取决于所选 LLM 模型大小，移动端需适配小模型）",{"notes":90,"python":91,"dependencies":92},"该工具是 Unity 插件，无需 Python 环境。后端基于 llama.cpp，支持本地离线运行（无网络也可用）。默认模型需在首次运行时下载（约几 GB）。Android 构建需设置脚本后端为 IL2CPP 且架构为 ARM64。支持通过 RAG 系统进行语义搜索。","不适用 (基于 Unity\u002FC++\u002FC#)",[93,94],"Unity 2021 LTS \u002F 2022 LTS \u002F 2023 \u002F Unity 6","LlamaLib (基于 llama.cpp)",[96,14,15,13,35],"其他",[98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114],"ai","chat","chatbot","conversational-ai","dialogue","generative-ai","llama","llm","npc","unity","unity2d","unity3d","character","game-development","gamedev","llama-cpp","rag","2026-03-27T02:49:30.150509","2026-04-14T00:09:36.003722",[],[119,124,129,134,139,144,149,154,159,164,169,174,179,184,189,194,199,204,209,214],{"id":120,"version":121,"summary_zh":122,"released_at":123},243712,"v3.0.3","### 🚀 功能特性\n\n- 支持通义千问 3.5 模型（PR：#391）\n- 将 LlamaLib 升级至 v2.0.5（llama.cpp b8209）（PR：#391）\n- 增加重新下载 LlamaLib 的按钮（PR：#393）","2026-03-08T21:18:18",{"id":125,"version":126,"summary_zh":127,"released_at":128},243713,"v3.0.2","### 🚀 功能\n\n- 缓存 LlamaLib，以防止重复下载（PR：#386）\n- 实现上下文溢出的处理策略（聊天截断、聊天摘要）（PR：#384）\n- 将 LlamaLib 升级至 v2.0.4 版本（PR：#384）\n- 重新引入用于选择调试信息级别 的 UI 下拉菜单（PR：#384）\n\n### 🐛 修复\n\n- 通过缓存和溢出策略修复上下文溢出问题（PR：#384）\n- 确保 macOS 构建包含所需的运行时库（PR：#382）\n- 修复使用 Vulkan 的 AMD 显卡上的推理问题（PR：#384）","2026-02-27T14:05:10",{"id":130,"version":131,"summary_zh":132,"released_at":133},243714,"v3.0.1","### 🚀 功能\n\n- 在程序集定义中添加 Unity.Nuget.Newtonsoft-Json（PR：#379）\n- 将 LlamaLib 更新至 v2.0.2（llama.cpp b7777）（PR：#380）\n\n### 🐛 修复\n\n- 修复在编辑器中选择 Android\u002FiOS 平台时无法运行的问题（PR：#378）","2026-01-28T14:26:28",{"id":135,"version":136,"summary_zh":137,"released_at":138},243715,"v3.0.0","将 LLM 后端 LlamaLib 重写为独立的 C++\u002FC# 库，并适配 LLMUnity。\n\n### 🚀 功能特性\n- 将 LlamaLib 实现为面向对象的 C++\u002FC# 库\n- 将 llama.cpp 更新至 [b7664](https:\u002F\u002Fgithub.com\u002Fggml-org\u002Fllama.cpp\u002Freleases\u002Ftag\u002Fb7664)\n- 修复 Vulkan GPU 后端\n- 支持 Android 16KB 模型\n- 修复 iOS 的 Xcode 构建问题\n- 修复 iOS 上的 RAG 功能\n- 优化示例代码\n- 优化流式传输功能，并在 C++ 端实现回调机制\n- 从 LLMUnity 中移除聊天模板，改用 llama.cpp 的模板系统\n- 实现属性检查\n- 对 JSON 和 GBNF 文法进行统一处理\n- 简化 tinyBLAS（Nvidia GPU 的轻量级 GPU 后端）的集成\n- 在 LlamaLib 中实现客户端\u002F服务器功能的过渡\n","2026-01-12T22:19:20",{"id":140,"version":141,"summary_zh":142,"released_at":143},243716,"v2.5.2","### 🚀 功能\n\n- 支持 Android x86-64 架构（Magic Leap 2）（PR：#344）\n- 合并 macOS 的 ARM 和 Intel 架构（PR：#345）","2025-05-29T18:31:42",{"id":145,"version":146,"summary_zh":147,"released_at":148},243717,"v2.5.1","### 🚀 功能\n\n- 允许使用 JSON Schema 语法（PR：#333）\n- 增加对 Qwen3 模型的支持（PR：#335）\n- 增加对 BitNet 模型的支持（PR：#334）\n- 将 LlamaLib 升级至 v1.2.5（llama.cpp b5261）（PR：#335）\n\n### 🐛 修复\n\n- 修复在停止补全并重新启动场景后 Unity 编辑器卡死的问题（PR：#335）\n","2025-05-05T12:15:40",{"id":150,"version":151,"summary_zh":152,"released_at":153},243718,"v2.5.0","### 🚀 功能特性\n\n- 支持 VisionOS（PR：#299）\n- 新增对 Gemma 3 和 Phi 4 模型的支持（PR：#327）\n- 修复旧款 Android 设备的支持问题（改用 ARMv8-A 架构，而非 ARMv8.4-A）（PR：#325）\n- 将 LlamaLib 升级至 v1.2.4（llama.cpp b4969）（PR：#325）\n- 将默认预测标记数（num_predict）设置为无限大（-1）（PR：#328）","2025-03-28T14:55:24",{"id":155,"version":156,"summary_zh":157,"released_at":158},243719,"v2.4.2","### 🚀 功能\n\n- 集成 DeepSeek 模型（PR：#312）\n- 将 LlamaLib 更新至 v1.2.3（llama.cpp b4688）（PR：#312）\n- 取消对 CUDA 11.7.1 的支持（PR：#312）\n- 为提供的提示添加预热功能（PR：#301）\n- 在 Unity 工具提示中添加文档说明（PR：#302）\n\n### 🐛 修复\n\n- 修复 iOS 上的代码签名问题（PR：#298）\n- 使调试模式和额外资源的使用在构建中保持不变（PR：#304）\n- 修复完整 CUDA 和 Vulkan 架构的依赖项解析问题（PR：#313）","2025-02-19T13:07:22",{"id":160,"version":161,"summary_zh":162,"released_at":163},243720,"v2.4.1","### 🚀 功能\n\n- 移动端静态库链接（修复 iOS 签名问题）（PR：#289）\n\n### 🐛 修复\n\n- 修复对扩展功能的支持（闪光注意力、iQ 量化模型）（PR：#292）","2024-12-18T11:27:08",{"id":165,"version":166,"summary_zh":167,"released_at":168},243721,"v2.4.0","### 🚀 功能\n\n- 支持 iOS 部署（PR：#267）\n- 优化构建流程（PR：#282）\n- 添加结构化输出\u002F函数调用示例（PR：#281）\n- 将 LlamaLib 更新至 v1.2.0（llama.cpp b4218）（PR：#283）\n\n### 🐛 修复\n\n- 在构建前清空临时构建目录（PR：#278）\n\n### 📦 通用\n\n- 移除对附加功能的支持（如 Flash Attention、iQ 量化）（PR：#284）\n- 移除对 LLM 基础提示的支持（PR：#285）","2024-12-02T16:40:37",{"id":170,"version":171,"summary_zh":172,"released_at":173},243722,"v2.3.0","### 🚀 Features\n\n- Implement Retrieval Augmented Generation (RAG) in LLMUnity (PR: #246)\n\n### 🐛 Fixes\n\n- Fixed build conflict, endless import of resources. (PR: #266)\n\n","2024-11-04T13:37:58",{"id":175,"version":176,"summary_zh":177,"released_at":178},243723,"v2.2.4","### 🚀 Features\n\n- Add Phi-3.5 and Llama 3.2 models (PR: #255)\n- Speedup LLMCharacter warmup (PR: #257)\n\n### 🐛 Fixes\n\n- Fix handling of incomplete requests (PR: #251)\n- Fix Unity locking of DLLs during cross-platform build (PR: #252)\n- Allow spaces in lora paths (PR: #254)\n\n### 📦 General\n\n- Set default context size to 8192 and allow to adjust with a UI slider (PR: #258)","2024-09-26T16:08:29",{"id":180,"version":181,"summary_zh":182,"released_at":183},243724,"v2.2.3","### 🚀 Features\n\n- LlamaLib v1.1.12: SSL certificate & API key for server, Support more AMD GPUs (PR: #241)\n- Server security with API key and SSL (PR: #238)\n- Show server command for easier deployment (PR #239)\n\n### 🐛 Fixes\n\n- Fix multiple LLM crash on Windows (PR: #242)\n- Exclude system prompt from saving of chat history (PR: #240)\n","2024-09-12T11:32:24",{"id":185,"version":186,"summary_zh":187,"released_at":188},243725,"v2.2.2","### 🚀 Features\n\n- Allow to set the LLMCharacter slot (PR: #231)\n\n### 🐛 Fixes\n\n- fix adding grammar from StreamingAssets (PR: #229)\n- fix library setup restart when interrupted (PR: #232)\n- Remove unnecessary Android linking in IL2CPP builds (PR: #233)\n\n","2024-09-08T14:16:15",{"id":190,"version":191,"summary_zh":192,"released_at":193},243726,"v2.2.1","### 🐛 Fixes\n\n- Fix naming showing full path when loading model (PR: #224)\n- Fix parallel prompts (PR: #226)\n\n","2024-08-29T04:27:18",{"id":195,"version":196,"summary_zh":197,"released_at":198},243727,"v2.2.0","### 🚀 Features\r\n- Update to latest llama.cpp (b3617) (PR: #210)\r\n- Integrate Llama 3.1 and Gemma2 models in model dropdown\r\n- Implement embedding and lora adapter functionality (PR: #210)\r\n- Read context length and warn if it is very large (PR: #211)\r\n- Setup allowing to use extra features: flash attention and IQ quants (PR: #216)\r\n- Allow HTTP request retries for remote server (PR: #217)\r\n- Allow to set lora weights at startup, add unit test (PR: #219)\r\n- allow relative StreamingAssets paths for models (PR: #221)\r\n\r\n### 🐛 Fixes\r\n\r\n- Fix set template for remote setup (PR: #208)\r\n- fix crash when stopping scene before LLM creation (PR: #214)\r\n\r\n### 📦 General\r\n\r\n- Documentation\u002Fpoint to gguf format for lora (PR: #215)\r\n\r\n","2024-08-27T12:02:05",{"id":200,"version":201,"summary_zh":202,"released_at":203},243728,"v2.1.1","### 🐛 Fixes\n\n- Resolve build directory creation","2024-08-13T10:01:59",{"id":205,"version":206,"summary_zh":207,"released_at":208},243729,"v2.1.0","### 🚀 Features\n\n- Android deployment (PR: #194)\n- Allow to download models on startup with resumable download functionality (PR: #196)\n- LLM model manager (PR: #196)\n- Add Llama 3 7B and Qwen2 0.5B models (PR: #198)\n- Start LLM always asynchronously (PR: #199)\n- Add contributing guidelines (PR: #201)\n","2024-08-08T14:15:19",{"id":210,"version":211,"summary_zh":212,"released_at":213},243730,"v2.0.3","### 🚀 Features\n\n- Add LLM selector in Inspector mode (PR: #182)\n- Allow to save chat history at custom path (PR: #179)\n- Use asynchronous startup by default (PR: #186)\n- Assign LLM if not set according to the scene and hierarchy (PR: #187)\n- Allow to set log level (PR: #189)\n- Allow to add callback functions for error messages (PR: #190)\n- Allow to set a LLM base prompt for all LLMCharacter objects (PR: #192)\n\n### 🐛 Fixes\n\n- set higher priority for mac build with Accelerate than without (PR: #180)\n- Fix duplicate bos warning\n\n","2024-07-11T17:38:20",{"id":215,"version":216,"summary_zh":217,"released_at":218},243731,"v2.0.2","### 🐛 Fixes\n\n- Fix bugs in chat completion (PR: #176)\n- Call DontDestroyOnLoad on root to remove warning (PR: #174)\n\n\n","2024-06-26T12:47:49"]