[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-stoyan-stoyanov--llmflows":3,"tool-stoyan-stoyanov--llmflows":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 真正成长为懂上",140436,2,"2026-04-05T23:32:43",[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":69,"readme_en":70,"readme_zh":71,"quickstart_zh":72,"use_case_zh":73,"hero_image_url":74,"owner_login":75,"owner_name":76,"owner_avatar_url":77,"owner_bio":78,"owner_company":78,"owner_location":78,"owner_email":78,"owner_twitter":78,"owner_website":78,"owner_url":79,"languages":80,"stars":85,"forks":86,"last_commit_at":87,"license":88,"difficulty_score":23,"env_os":89,"env_gpu":89,"env_ram":89,"env_deps":90,"category_tags":93,"github_topics":94,"view_count":23,"oss_zip_url":78,"oss_zip_packed_at":78,"status":16,"created_at":108,"updated_at":109,"faqs":110,"releases":146},4056,"stoyan-stoyanov\u002Fllmflows","llmflows","LLMFlows - Simple, Explicit and Transparent LLM Apps","LLMFlows 是一个专为构建大语言模型（LLM）应用而设计的开源框架，旨在帮助开发者打造简单、明确且透明的聊天机器人、问答系统及智能体。在当前的 LLM 开发中，许多框架往往隐藏了关键的提示词（Prompt）或模型调用逻辑，导致应用内部像“黑盒”一样，难以监控和调试。LLMFlows 正是为了解决这一痛点而生，它拒绝隐藏任何细节，确保每一个组件、每一次调用都清晰可见，让开发者能完全掌控应用流程。\n\n这款工具非常适合希望深入理解并精细控制 LLM 行为的软件开发者和研究人员。如果你厌倦了复杂的抽象层，渴望编写干净、可读性高且易于维护的代码，LLMFlows 将是理想选择。其核心技术亮点在于极简的抽象设计：通过封装主流 LLM API 提供便捷的调用与重试机制，并利用“提示词模板”动态管理输入变量。更重要的是，它支持可追踪的执行流，让应用的每一步交互都有据可查，极大地降低了故障排查和系统维护的难度。无论是构建简单的单轮对话，还是设计复杂的多模型协作流程，LLMFlows 都能让你在保持代码灵活性的同时，拥有前所未有的透明度。","\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fstoyan-stoyanov_llmflows_readme_c4e66f2a1fae.png\"\u002F>\n\u003C\u002Fp>\n\n\n[![Twitter](https:\u002F\u002Fimg.shields.io\u002Ftwitter\u002Ffollow\u002FLLMFlows?style=social)](https:\u002F\u002Ftwitter.com\u002FLLMFlows)\n![Pylint workflow](https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Factions\u002Fworkflows\u002Fpylint.yml\u002Fbadge.svg)\n![License](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Fstoyan-stoyanov\u002Fllmflows)\n![PyPi](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fllmflows)\n![Stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fstoyan-stoyanov\u002Fllmflows?style=social)\n![Release date](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Frelease-date\u002Fstoyan-stoyanov\u002Fllmflows?style=social)\n\nDocumentation: \u003Ca href=\"https:\u002F\u002Fllmflows.readthedocs.io\u002F\" target=\"_blank\">https:\u002F\u002Fllmflows.readthedocs.io\u003C\u002Fa>\u003C\u002Fbr>\nPyPI: \u003Ca href=\"https:\u002F\u002Fpypi.org\u002Fproject\u002Fllmflows\u002F\" target=\"_blank\">https:\u002F\u002Fpypi.org\u002Fproject\u002Fllmflows\u003C\u002Fa>\u003C\u002Fbr>\nTwitter: \u003Ca href=\"https:\u002F\u002Ftwitter.com\u002FLLMFlows\u002F\" target=\"_blank\">https:\u002F\u002Ftwitter.com\u002FLLMFlows\u003C\u002Fa>\u003C\u002Fbr>\nSubstack: \u003Ca href=\"https:\u002F\u002Fllmflows.substack.com\u002F\" target=\"_blank\">https:\u002F\u002Fllmflows.substack.com\u003C\u002Fa>\u003C\u002Fbr>\n\n## 🤖 About LLM Flows\nLLMFlows is a framework for building simple, explicit, and transparent LLM(Large Language Model) applications such as chatbots, question-answering systems, and agents.\n\nAt its core, LLMFlows provides a minimalistic set of abstractions that allow you to utilize LLMs and vector stores and build well-structured and explicit apps that don't have hidden prompts or LLM calls. LLM Flows ensures complete transparency for each component, making monitoring, maintenance, and debugging easy. \n\n\n## 📦 Installation\n```\npip install llmflows\n```\n\n## 🧭 Philosophy\n\n### **Simple**\nOur goal is to build a simple, well-documented framework with minimal abstractions that \nallow users to build flexible LLM-powered apps without compromising on capabilities.\n\n### **Explicit**\nWe want to create an explicit API enabling users to write clean and readable code while \neasily creating complex flows of LLMs interacting with each other. LLMFlows' classes \ngive users full control and do not have any hidden prompts or LLM calls. \n\n### **Transparent**\nWe aim to help users have full transparency on their LLM-powered apps by providing \ntraceable flows and complete information for each app component, making it easy to \nmonitor, maintain, and debug.\n\n## ▶️ Live Demo\nCheck out [LLM-99](https:\u002F\u002Fllm-99.vercel.app\u002F) - a demo app that uses LLMs to explain \nsuperconductors in simple terms. The app is built with LLMFlows, and FastAPI and uses \nPinecone to store document embeddings created from Wikipedia articles. You can find \nthe source code for this demo app and other examples in our \n[examples folder](https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Ftree\u002Fmain\u002Fexamples\u002Fllmflows_in_fastapi\u002Fsuperconductor).\n\n![LLM-99](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fstoyan-stoyanov_llmflows_readme_d915b59dac9a.gif)\n\n## 🧪 Getting Started\n### LLMs\nLLMs are one of the main abstractions in LLMFlows. LLM classes are wrappers around LLM \nAPIs such as OpenAI's APIs. They provide methods for configuring and calling these APIs, \nretrying failed calls, and formatting the responses.\n\n```python\nfrom llmflows.llms import OpenAI\n\nllm = OpenAI(api_key=\"\u003Cyour-openai-api-key>\")\n\nresult, call_data, model_config = llm.generate(\n   prompt=\"Generate a cool title for an 80s rock song\"\n)\n```\n\n\n### PromptTemplates\nThe `PromptTemplate` class allows us to create strings with variables that we can fill \nin dynamically later on. Once a prompt template object is created an actual prompt can \nbe generated by providing the required variables.\n\n```python\nfrom llmflows.llms import OpenAI\nfrom llmflows.prompts import PromptTemplate\n\n\nprompt_template = PromptTemplate(\n    prompt=\"Generate a title for a 90s hip-hop song about {topic}.\"\n)\nllm_prompt = prompt_template.get_prompt(topic=\"friendship\")\n\nprint(llm_prompt)\n\nllm = OpenAI(api_key=\"\u003Cyour-openai-api-key>\")\nsong_title = llm.generate(llm_prompt)\n\nprint(song_title)\n```\n\n### Chat LLMs\nUnlike regular LLMs that only require a prompt to generate text, chat LLMs require a \nconversation history. The conversation history is represented \nas a list of messages between a user and an assistant. This conversation history is \nsent to the model, and a new message is generated based on it.\n\nLLMFlows provides a `MessageHistory` class to manage the required conversation history \nfor chat LLMs.\n\nYou can build a simple chatbot by using the `OpenAIChat` and `MessageHistory` classes:\n\n```python\nfrom llmflows.llms import OpenAIChat, MessageHistory\n\nllm = OpenAIChat(api_key=\"\u003Cyour-openai-api-key>\")\nmessage_history = MessageHistory()\n\nwhile True:\n    user_message = input(\"You:\")\n    message_history.add_user_message(user_message)\n\n    llm_response, call_data, model_config = llm.generate(message_history)\n    message_history.add_ai_message(llm_response)\n\n    print(f\"LLM: {llm_response}\")\n```\n\n### LLM Flows\nOften times, real-world applications can be more complex and can have dependencies \nbetween prompts and LLM calls. For example:\n\n![Complex flow](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fstoyan-stoyanov_llmflows_readme_cbaed9f0614e.png)\n\nWhen you want to build apps with complex dependencies you can use the `Flow` and \n`Flowstep` classes. LLMFlows will figure out the dependencies and make sure each \nflowstep runs only when all its dependencies are met:\n\n```python\nfrom llmflows.flows import Flow, FlowStep\nfrom llmflows.llms import OpenAI\nfrom llmflows.prompts import PromptTemplate\n\nopenai_llm = OpenAI(api_key=\"\u003Cyour-openai-api-key>\")\n\n# Create prompt templates\ntitle_template = PromptTemplate(\"What is a good title of a movie about {topic}?\")\nsong_template = PromptTemplate(\n    \"What is a good song title of a soundtrack for a movie called {movie_title}?\"\n)\ncharacters_template = PromptTemplate(\n    \"What are two main characters for a movie called {movie_title}?\"\n)\nlyrics_template = PromptTemplate(\n    \"Write lyrics of a movie song called {song_title}. The main characters are \"\n    \"{main_characters}\"\n)\n\n# Create flowsteps\nmovie_title_flowstep = FlowStep(\n    name=\"Movie Title Flowstep\",\n    llm=openai_llm,\n    prompt_template=title_template,\n    output_key=\"movie_title\",\n)\n\nsong_title_flowstep = FlowStep(\n    name=\"Song Title Flowstep\",\n    llm=openai_llm,\n    prompt_template=song_template,\n    output_key=\"song_title\",\n)\n\ncharacters_flowstep = FlowStep(\n    name=\"Characters Flowstep\",\n    llm=openai_llm,\n    prompt_template=characters_template,\n    output_key=\"main_characters\",\n)\n\nsong_lyrics_flowstep = FlowStep(\n    name=\"Song Lyrics Flowstep\",\n    llm=openai_llm,\n    prompt_template=lyrics_template,\n    output_key=\"song_lyrics\",\n)\n\n# Connect flowsteps\nmovie_title_flowstep.connect(song_title_flowstep, characters_flowstep, song_lyrics_flowstep)\nsong_title_flowstep.connect(song_lyrics_flowstep)\ncharacters_flowstep.connect(song_lyrics_flowstep)\n\n# Create and run Flow\nsoundtrack_flow = Flow(movie_title_flowstep)\nresults = soundtrack_flow.start(topic=\"friendship\", verbose=True)\n```\n\n### Async Flows\nSometimes multiple flow steps can run in parallel if all their dependencies are met. \nFor cases like this, LLMFlows provides async classes to improve the runtime of any \ncomplex flow by running flow steps that already have all their required inputs in \nparallel.\n\n```python\n\n...\n\nmovie_title_flowstep = AsyncFlowStep(\n    name=\"Movie Title Flowstep\",\n    llm=openai_llm,\n    prompt_template=title_template,\n    output_key=\"movie_title\",\n)\n\nsong_title_flowstep = FlowStep(\n    name=\"Song Title Flowstep\",\n    llm=openai_llm,\n    prompt_template=song_template,\n    output_key=\"song_title\",\n)\n\ncharacters_flowstep = AsyncFlowStep(\n    name=\"Characters Flowstep\",\n    llm=openai_llm,\n    prompt_template=characters_template,\n    output_key=\"main_characters\",\n)\n\nsong_lyrics_flowstep = AsyncFlowStep(\n    name=\"Song Lyrics Flowstep\",\n    llm=openai_llm,\n    prompt_template=lyrics_template,\n    output_key=\"song_lyrics\",\n)\n\n...\n\n```\n\nFor more examples, such as integrating vector databases, creating question-answering \napps, agents, and web applications visit our \n[documentation](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002F) or check out the \n[examples folder](https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Ftree\u002Fmain\u002Fexamples) of the repository.\n\n## 🛠️ Features\n\n### **LLMs**\n- Utilize LLMs such as OpenAI's ChatGPT to generate natural language text.\n- Configure LLM classes easily, choosing specific models, parameters, and settings.\n- Benefit from automatic retries when model calls fail, ensuring reliable LLM \n  interactions.\n\n### **Prompt Templates**\n- Create dynamic prompts using Prompt Templates, providing flexible and customizable \n  text generation.\n- Define variables within prompts to generate prompt strings tailored to specific \n  inputs.\n\n### **Flows and FlowSteps**\n- Structure LLM applications using Flows and FlowSteps, providing a clear and organized framework for executing LLM interactions.\n- Connect flow steps to pass outputs as inputs, facilitating seamless data flow and\n    maintaining a transparent LLM pipeline.\n- Leverage Async Flows to run LLMs in parallel when all their inputs are available, \n  optimizing performance and efficiency.\n- Incorporate custom string manipulation functions directly into flows, allowing \n  specialized text transformations without relying solely on LLM calls.\n\n### **VectorStore Integrations**\n- Integrate with vector databases like Pinecone using the VectorStoreFlowStep, \n  empowering efficient and scalable storage and retrieval of vector embeddings.\n- Leverage vector databases for seamless storage and querying of vectors, enabling straightforward integration with LLM-powered applications.\n\n### **Callbacks**\n- Execute callback functions at different stages within flow steps, enabling enhanced customization, logging, tracing, or other specific integrations.\n- Utilize callbacks to comprehensively control and monitor LLM-powered apps, ensuring \n  clear visibility into the execution process.\n\n### **Explicit API and Full Transparency**\nWith LLMFlows you have the full control to create explicit applications without any hidden prompts or predefined behaviors.\n\nIn addition LLMFlows allows you to answer questions such as:\n\n- When was a particular flowstep run?\n- How much time did it take?\n- What were the input variables?\n- What was the prompt template?\n- What did the prompt look like?\n- What was the exact configuration of the model?\n- How many times did we retry the request?\n- What was the raw data the API returned?\n- How many tokens were used?\n- What was the final result?\n\n## 📚 User Guide\n[Introduction](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002Fuser_guide\u002FIntroduction\u002F)\u003Cbr\u002F>\n[LLM Flows](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002Fuser_guide\u002FLLM%20Flows\u002F)\u003Cbr\u002F>\n[Async Flows](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002Fuser_guide\u002FAsync%20Flows\u002F)\u003Cbr\u002F>\n[Vector Stores](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002Fuser_guide\u002FVector%20Stores\u002F)\u003Cbr\u002F>\n[Question Answering](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002Fuser_guide\u002FQuestion%20Answering\u002F)\u003Cbr\u002F>\n[Vector Stores in Flows](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002Fuser_guide\u002FVector%20Stores%20in%20Flows\u002F)\u003Cbr\u002F>\n[Functional FlowSteps](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002Fuser_guide\u002FFunctional%20FlowSteps\u002F)\u003Cbr\u002F>\n[Callbacks](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002Fuser_guide\u002FCallbacks\u002F)\u003Cbr\u002F>\n[LLM Flows with FastAPI](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002Fuser_guide\u002FLLMFlows%20with%20FastAPI\u002F)\u003Cbr\u002F>\n[Agents](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002Fuser_guide\u002FAgents\u002F)\u003Cbr\u002F>\n\n## ▶️ Examples\nYou can find all examples used in the User Guide in the [examples folder](https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Ftree\u002Fmain\u002Fexamples) of the repository.\n\n## 📃 License\nLLMFlows is covered by the MIT license. For more information, check [`LICENCE`](https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fblob\u002Fmain\u002FLICENSE).\n\n## ❤️ How you can help?\nThank you for spending time going over our README! \n\nIf you like the project please consider giving it a star, sharing it with friends or on social media.\n\nIf you've tried LLMFlows and have some issues, feedback or ideas feel free to open an issue or reach out!\n\nIf you find LLMFlows exciting and you are considering contributing, please check [`CONTRIBUTING.md`](https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fblob\u002Fmain\u002FCONTRIBUTING.md).\n\n## ✉️ Contact\nIf you want to reach out please don't hesitate to connect on the following social media:\n\n[Threads](https:\u002F\u002Fwww.threads.net\u002F@sptstoyanov)\u003Cbr\u002F>\n[LinkedIn](https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Fspstoyanov\u002F)\u003Cbr\u002F>\n[Twitter](https:\u002F\u002Ftwitter.com\u002Fstoyanpstoyanov)\u003Cbr\u002F>\n\nI would love to hear from you!\n\n\n\n\n\n\n\n","\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fstoyan-stoyanov_llmflows_readme_c4e66f2a1fae.png\"\u002F>\n\u003C\u002Fp>\n\n\n[![Twitter](https:\u002F\u002Fimg.shields.io\u002Ftwitter\u002Ffollow\u002FLLMFlows?style=social)](https:\u002F\u002Ftwitter.com\u002FLLMFlows)\n![Pylint 工作流](https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Factions\u002Fworkflows\u002Fpylint.yml\u002Fbadge.svg)\n![许可证](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Fstoyan-stoyanov\u002Fllmflows)\n![PyPI](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fllmflows)\n![星标数](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fstoyan-stoyanov\u002Fllmflows?style=social)\n![发布日期](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Frelease-date\u002Fstoyan-stoyanov\u002Fllmflows?style=social)\n\n文档： \u003Ca href=\"https:\u002F\u002Fllmflows.readthedocs.io\u002F\" target=\"_blank\">https:\u002F\u002Fllmflows.readthedocs.io\u003C\u002Fa>\u003C\u002Fbr>\nPyPI： \u003Ca href=\"https:\u002F\u002Fpypi.org\u002Fproject\u002Fllmflows\u002F\" target=\"_blank\">https:\u002F\u002Fpypi.org\u002Fproject\u002Fllmflows\u003C\u002Fa>\u003C\u002Fbr>\nTwitter： \u003Ca href=\"https:\u002F\u002Ftwitter.com\u002FLLMFlows\u002F\" target=\"_blank\">https:\u002F\u002Ftwitter.com\u002FLLMFlows\u003C\u002Fa>\u003C\u002Fbr>\nSubstack： \u003Ca href=\"https:\u002F\u002Fllmflows.substack.com\u002F\" target=\"_blank\">https:\u002F\u002Fllmflows.substack.com\u003C\u002Fa>\u003C\u002Fbr>\n\n## 🤖 关于 LLM Flows\nLLMFlows 是一个用于构建简单、明确且透明的大型语言模型（LLM）应用的框架，例如聊天机器人、问答系统和智能代理。\n\n其核心提供了一组极简的抽象层，使您能够利用 LLM 和向量存储，构建结构良好、清晰明确的应用程序，而不会出现隐藏的提示或 LLM 调用。LLM Flows 确保每个组件都完全透明，从而简化了监控、维护和调试工作。\n\n\n## 📦 安装\n```\npip install llmflows\n```\n\n## 🧭 理念\n\n### **简单**\n我们的目标是构建一个简单、文档完善且抽象层次最少的框架，让用户能够在不牺牲功能性的前提下，轻松构建灵活的 LLM 驱动应用。\n\n### **明确**\n我们希望创建一个明确的 API，使用户能够编写整洁易读的代码，同时轻松实现复杂的 LLM 流程交互。LLMFlows 的类赋予用户完全的控制权，不存在任何隐藏的提示或 LLM 调用。\n\n### **透明**\n我们致力于帮助用户对其 LLM 驱动的应用程序拥有完全的透明度，通过提供可追踪的流程和每个组件的完整信息，从而便于监控、维护和调试。\n\n## ▶️ 实时演示\n请查看 [LLM-99](https:\u002F\u002Fllm-99.vercel.app\u002F)——一个使用 LLM 以通俗易懂的语言解释超导体的演示应用。该应用基于 LLMFlows 和 FastAPI 构建，并使用 Pinecone 存储从维基百科文章中生成的文档嵌入。您可以在我们的 [示例文件夹](https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Ftree\u002Fmain\u002Fexamples\u002Fllmflows_in_fastapi\u002Fsuperconductor) 中找到此演示应用及其他示例的源代码。\n\n![LLM-99](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fstoyan-stoyanov_llmflows_readme_d915b59dac9a.gif)\n\n## 🧪 入门指南\n### LLMs\nLLMs 是 LLMFlows 中的主要抽象之一。LLM 类是对 OpenAI 等 LLM API 的封装，提供了配置和调用这些 API 的方法、失败重试机制以及响应格式化功能。\n\n```python\nfrom llmflows.llms import OpenAI\n\nllm = OpenAI(api_key=\"\u003Cyour-openai-api-key>\")\n\nresult, call_data, model_config = llm.generate(\n   prompt=\"为一首80年代摇滚歌曲生成一个酷炫的标题\"\n)\n```\n\n\n### PromptTemplates\n`PromptTemplate` 类允许我们创建包含变量的字符串，这些变量可以在稍后动态填充。一旦创建了提示模板对象，只需提供所需的变量即可生成实际的提示。\n\n```python\nfrom llmflows.llms import OpenAI\nfrom llmflows.prompts import PromptTemplate\n\n\nprompt_template = PromptTemplate(\n    prompt=\"为一首关于{topic}的90年代嘻哈歌曲生成一个标题。\"\n)\nllm_prompt = prompt_template.get_prompt(topic=\"友谊\")\n\nprint(llm_prompt)\n\nllm = OpenAI(api_key=\"\u003Cyour-openai-api-key>\")\nsong_title = llm.generate(llm_prompt)\n\nprint(song_title)\n```\n\n### Chat LLMs\n与仅需提示即可生成文本的普通 LLM 不同，聊天 LLM 需要会话历史记录。会话历史记录以用户和助手之间消息列表的形式表示。该历史记录会被发送给模型，并基于此生成新消息。\n\nLLMFlows 提供 `MessageHistory` 类来管理聊天 LLM 所需的会话历史记录。\n\n您可以使用 `OpenAIChat` 和 `MessageHistory` 类构建一个简单的聊天机器人：\n\n```python\nfrom llmflows.llms import OpenAIChat, MessageHistory\n\nllm = OpenAIChat(api_key=\"\u003Cyour-openai-api-key>\")\nmessage_history = MessageHistory()\n\nwhile True:\n    user_message = input(\"你：\")\n    message_history.add_user_message(user_message)\n\n    llm_response, call_data, model_config = llm.generate(message_history)\n    message_history.add_ai_message(llm_response)\n\n    print(f\"LLM：{llm_response}\")\n```\n\n### LLM Flows\n在现实世界中，许多应用程序往往更为复杂，提示和 LLM 调用之间可能存在依赖关系。例如：\n\n![复杂流程](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fstoyan-stoyanov_llmflows_readme_cbaed9f0614e.png)\n\n当您需要构建具有复杂依赖关系的应用程序时，可以使用 `Flow` 和 `Flowstep` 类。LLMFlows 会自动解析依赖关系，并确保每个流程步骤仅在其所有依赖项满足时才会执行：\n\n```python\nfrom llmflows.flows import Flow, FlowStep\nfrom llmflows.llms import OpenAI\nfrom llmflows.prompts import PromptTemplate\n\nopenai_llm = OpenAI(api_key=\"\u003Cyour-openai-api-key>\")\n\n# 创建提示模板\ntitle_template = PromptTemplate(\"关于{topic}的好电影标题是什么？\")\nsong_template = PromptTemplate(\n    \"名为{movie_title}的电影配乐中，一个好的歌名是什么？\"\n)\ncharacters_template = PromptTemplate(\n    \"名为{movie_title}的电影中有哪两位主要角色？\"\n)\nlyrics_template = PromptTemplate(\n    \"请为名为{song_title}的电影歌曲创作歌词。主要角色是{main_characters}。\"\n)\n\n# 创建流程步骤\nmovie_title_flowstep = FlowStep(\n    name=\"电影标题流程步骤\",\n    llm=openai_llm,\n    prompt_template=title_template,\n    output_key=\"movie_title\",\n)\n\nsong_title_flowstep = FlowStep(\n    name=\"歌曲标题流程步骤\",\n    llm=openai_llm,\n    prompt_template=song_template,\n    output_key=\"song_title\",\n)\n\ncharacters_flowstep = FlowStep(\n    name=\"角色流程步骤\",\n    llm=openai_llm,\n    prompt_template=characters_template,\n    output_key=\"main_characters\",\n)\n\nsong_lyrics_flowstep = FlowStep(\n    name=\"歌曲歌词流程步骤\",\n    llm=openai_llm,\n    prompt_template=lyrics_template,\n    output_key=\"song_lyrics\",\n)\n\n# 连接流程步骤\nmovie_title_flowstep.connect(song_title_flowstep, characters_flowstep, song_lyrics_flowstep)\nsong_title_flowstep.connect(song_lyrics_flowstep)\ncharacters_flowstep.connect(song_lyrics_flowstep)\n\n# 创建并运行流程\nsoundtrack_flow = Flow(movie_title_flowstep)\nresults = soundtrack_flow.start(topic=\"友谊\", verbose=True)\n```\n\n### 异步流程\n有时，如果所有依赖项都已满足，多个流程步骤可以并行运行。针对这种情况，LLMFlows 提供了异步类，通过并行执行那些已经具备所有必要输入的流程步骤，从而提升复杂流程的运行效率。\n\n```python\n\n...\n\nmovie_title_flowstep = AsyncFlowStep(\n    name=\"电影标题流程步骤\",\n    llm=openai_llm,\n    prompt_template=title_template,\n    output_key=\"movie_title\",\n)\n\nsong_title_flowstep = FlowStep(\n    name=\"歌曲标题流程步骤\",\n    llm=openai_llm,\n    prompt_template=song_template,\n    output_key=\"song_title\",\n)\n\ncharacters_flowstep = AsyncFlowStep(\n    name=\"角色流程步骤\",\n    llm=openai_llm,\n    prompt_template=characters_template,\n    output_key=\"main_characters\",\n)\n\nsong_lyrics_flowstep = AsyncFlowStep(\n    name=\"歌曲歌词流程步骤\",\n    llm=openai_llm,\n    prompt_template=lyrics_template,\n    output_key=\"song_lyrics\",\n)\n\n...\n\n```\n\n如需更多示例，例如集成向量数据库、构建问答应用、智能体和 Web 应用程序，请访问我们的 [文档](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002F) 或查看仓库中的 [示例文件夹](https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Ftree\u002Fmain\u002Fexamples)。\n\n## 🛠️ 功能特性\n\n### **大语言模型**\n- 使用 OpenAI 的 ChatGPT 等大语言模型生成自然语言文本。\n- 轻松配置 LLM 类，选择特定的模型、参数和设置。\n- 在模型调用失败时自动重试，确保与 LLM 的交互可靠稳定。\n\n### **提示模板**\n- 使用提示模板创建动态提示，实现灵活且可定制的文本生成。\n- 在提示中定义变量，以根据具体输入生成定制化的提示字符串。\n\n### **流程与流程步骤**\n- 通过流程和流程步骤组织 LLM 应用程序，为 LLM 交互提供清晰、有序的框架。\n- 连接各个流程步骤，将输出作为输入传递，实现无缝的数据流动，并保持 LLM 流程的透明性。\n- 利用异步流程，在所有输入可用时并行运行 LLM，优化性能和效率。\n- 将自定义字符串处理函数直接嵌入到流程中，无需完全依赖 LLM 调用即可实现专门的文本转换。\n\n### **向量存储集成**\n- 使用 VectorStoreFlowStep 集成 Pinecone 等向量数据库，实现高效、可扩展的向量嵌入存储与检索。\n- 利用向量数据库无缝存储和查询向量数据，轻松与基于 LLM 的应用程序集成。\n\n### **回调函数**\n- 在流程步骤的不同阶段执行回调函数，支持更高级的自定义、日志记录、追踪或其他特定集成。\n- 通过回调全面控制和监控基于 LLM 的应用程序，确保对执行过程有清晰的了解。\n\n### **明确的 API 与完全透明**\n借助 LLMFlows，您可以完全掌控应用程序的构建过程，不存在任何隐藏的提示或预设行为。\n\n此外，LLMFlows 还可以帮助您回答以下问题：\n\n- 某个特定的流程步骤是什么时候运行的？\n- 它花费了多少时间？\n- 输入变量有哪些？\n- 提示模板是什么？\n- 实际的提示内容是什么样的？\n- 模型的具体配置是怎样的？\n- 请求重试了多少次？\n- API 返回的原始数据是什么？\n- 使用了多少个 token？\n- 最终结果是什么？\n\n## 📚 用户指南\n[简介](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002Fuser_guide\u002FIntroduction\u002F)\u003Cbr\u002F>\n[LLM 流程](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002Fuser_guide\u002FLLM%20Flows\u002F)\u003Cbr\u002F>\n[异步流程](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002Fuser_guide\u002FAsync%20Flows\u002F)\u003Cbr\u002F>\n[向量存储](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002Fuser_guide\u002FVector%20Stores\u002F)\u003Cbr\u002F>\n[问答系统](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002Fuser_guide\u002FQuestion%20Answering\u002F)\u003Cbr\u002F>\n[流程中的向量存储](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002Fuser_guide\u002FVector%20Stores%20in%20Flows\u002F)\u003Cbr\u002F>\n[功能型流程步骤](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002Fuser_guide\u002FFunctional%20FlowSteps\u002F)\u003Cbr\u002F>\n[回调函数](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002Fuser_guide\u002FCallbacks\u002F)\u003Cbr\u002F>\n[结合 FastAPI 的 LLM 流程](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002Fuser_guide\u002FLLMFlows%20with%20FastAPI\u002F)\u003Cbr\u002F>\n[智能体](https:\u002F\u002Fllmflows.readthedocs.io\u002Fen\u002Flatest\u002Fuser_guide\u002FAgents\u002F)\u003Cbr\u002F>\n\n## ▶️ 示例\n用户指南中使用的所有示例都可以在仓库的 [examples 文件夹](https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Ftree\u002Fmain\u002Fexamples) 中找到。\n\n## 📃 许可证\nLLMFlows 采用 MIT 许可证。更多信息请参阅 [`LICENCE`](https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fblob\u002Fmain\u002FLICENSE)。\n\n## ❤️ 您能如何帮助我们？\n感谢您花时间阅读我们的 README！如果您喜欢这个项目，请考虑给它点个赞、分享给朋友或在社交媒体上推广。\n\n如果您已经尝试过 LLMFlows 并遇到任何问题、提出宝贵意见或建议，欢迎随时提交 issue 或与我们联系。\n\n如果您觉得 LLMFlows 很有趣，并有意参与贡献，请查阅 [`CONTRIBUTING.md`](https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fblob\u002Fmain\u002FCONTRIBUTING.md)。\n\n## ✉️ 联系方式\n如果您想与我们取得联系，请随时通过以下社交媒体平台联系我们：\n\n[Threads](https:\u002F\u002Fwww.threads.net\u002F@sptstoyanov)\u003Cbr\u002F>\n[LinkedIn](https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Fspstoyanov\u002F)\u003Cbr\u002F>\n[Twitter](https:\u002F\u002Ftwitter.com\u002Fstoyanpstoyanov)\u003Cbr\u002F>\n\n我非常期待您的来信！","# LLMFlows 快速上手指南\n\nLLMFlows 是一个用于构建简单、显式且透明的 LLM（大语言模型）应用的框架。它通过最小化的抽象层，帮助开发者轻松创建聊天机器人、问答系统及智能体，同时确保所有提示词（Prompt）和模型调用完全可见，便于监控与调试。\n\n## 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**：Linux, macOS 或 Windows\n*   **Python 版本**：Python 3.8 或更高版本\n*   **前置依赖**：\n    *   `pip` 包管理工具\n    *   OpenAI API Key（用于调用大模型）\n\n> **国内加速建议**：\n> 如果直接访问 PyPI 速度较慢，推荐使用国内镜像源进行安装。\n> *   清华大学镜像源：`https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple`\n> *   阿里云镜像源：`https:\u002F\u002Fmirrors.aliyun.com\u002Fpypi\u002Fsimple\u002F`\n\n## 安装步骤\n\n使用 `pip` 安装 LLMFlows。\n\n**标准安装：**\n```bash\npip install llmflows\n```\n\n**使用国内镜像源安装（推荐）：**\n```bash\npip install llmflows -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n## 基本使用\n\n以下是三个最核心的使用场景，帮助您快速入门。\n\n### 1. 基础文本生成 (LLMs)\n\n使用 `OpenAI` 类包装器调用大模型生成文本。\n\n```python\nfrom llmflows.llms import OpenAI\n\n# 初始化 LLM，请替换为您的真实 API Key\nllm = OpenAI(api_key=\"\u003Cyour-openai-api-key>\")\n\n# 生成内容\nresult, call_data, model_config = llm.generate(\n   prompt=\"Generate a cool title for an 80s rock song\"\n)\n\nprint(result)\n```\n\n### 2. 动态提示词模板 (PromptTemplates)\n\n使用 `PromptTemplate` 创建包含变量的动态提示词，便于灵活控制输入。\n\n```python\nfrom llmflows.llms import OpenAI\nfrom llmflows.prompts import PromptTemplate\n\n# 定义模板\nprompt_template = PromptTemplate(\n    prompt=\"Generate a title for a 90s hip-hop song about {topic}.\"\n)\n\n# 填充变量生成实际提示词\nllm_prompt = prompt_template.get_prompt(topic=\"friendship\")\n\n# 调用 LLM\nllm = OpenAI(api_key=\"\u003Cyour-openai-api-key>\")\nsong_title = llm.generate(llm_prompt)\n\nprint(song_title)\n```\n\n### 3. 构建多步骤工作流 (LLM Flows)\n\n对于复杂的应用场景，可以使用 `Flow` 和 `FlowStep` 将多个 LLM 调用串联起来。框架会自动处理依赖关系，确保按顺序执行。\n\n以下示例展示了一个生成电影标题、角色、歌曲名及歌词的完整流程：\n\n```python\nfrom llmflows.flows import Flow, FlowStep\nfrom llmflows.llms import OpenAI\nfrom llmflows.prompts import PromptTemplate\n\nopenai_llm = OpenAI(api_key=\"\u003Cyour-openai-api-key>\")\n\n# 1. 创建提示词模板\ntitle_template = PromptTemplate(\"What is a good title of a movie about {topic}?\")\nsong_template = PromptTemplate(\n    \"What is a good song title of a soundtrack for a movie called {movie_title}?\"\n)\ncharacters_template = PromptTemplate(\n    \"What are two main characters for a movie called {movie_title}?\"\n)\nlyrics_template = PromptTemplate(\n    \"Write lyrics of a movie song called {song_title}. The main characters are \"\n    \"{main_characters}\"\n)\n\n# 2. 创建流程步骤 (FlowSteps)\nmovie_title_flowstep = FlowStep(\n    name=\"Movie Title Flowstep\",\n    llm=openai_llm,\n    prompt_template=title_template,\n    output_key=\"movie_title\",\n)\n\nsong_title_flowstep = FlowStep(\n    name=\"Song Title Flowstep\",\n    llm=openai_llm,\n    prompt_template=song_template,\n    output_key=\"song_title\",\n)\n\ncharacters_flowstep = FlowStep(\n    name=\"Characters Flowstep\",\n    llm=openai_llm,\n    prompt_template=characters_template,\n    output_key=\"main_characters\",\n)\n\nsong_lyrics_flowstep = FlowStep(\n    name=\"Song Lyrics Flowstep\",\n    llm=openai_llm,\n    prompt_template=lyrics_template,\n    output_key=\"song_lyrics\",\n)\n\n# 3. 连接步骤以定义依赖关系\n# 电影标题是后续所有步骤的依赖\nmovie_title_flowstep.connect(song_title_flowstep, characters_flowstep, song_lyrics_flowstep)\n# 歌曲标题和角色是歌词步骤的依赖\nsong_title_flowstep.connect(song_lyrics_flowstep)\ncharacters_flowstep.connect(song_lyrics_flowstep)\n\n# 4. 创建并运行工作流\nsoundtrack_flow = Flow(movie_title_flowstep)\n\n# 启动流程，传入初始变量 topic\nresults = soundtrack_flow.start(topic=\"friendship\", verbose=True)\n\n# 查看最终结果\nprint(results)\n```\n\n通过以上步骤，您即可利用 LLMFlows 构建结构清晰、可追踪的 LLM 应用。更多高级功能（如异步流、向量数据库集成等）请参考官方文档。","某初创团队正在开发一款基于维基百科数据的“复杂概念通俗解释器”，旨在将晦涩的学术术语转化为大众易懂的语言。\n\n### 没有 llmflows 时\n- **流程黑盒难调试**：多个 LLM 调用串联时，中间提示词和输出结果被隐藏在复杂的回调函数中，一旦生成内容出错，开发者难以定位具体是哪个环节出了问题。\n- **代码耦合度高**：提示词模板硬编码在业务逻辑里，修改文案需要深入代码底层，缺乏灵活的变量管理机制，维护成本极高。\n- **监控与追踪缺失**：无法清晰看到每个步骤的输入输出及耗时，导致优化模型参数或排查延迟问题时只能靠猜，缺乏可追溯的执行链路。\n\n### 使用 llmflows 后\n- **全链路透明可视**：llmflows 将每个 LLM 调用和向量检索步骤显式定义为独立节点，开发者能清晰追踪数据流向，快速锁定错误源头。\n- **提示词管理规范化**：利用 `PromptTemplate` 类动态管理变量，将提示词与逻辑解耦，非技术人员也能轻松调整文案而不必改动核心代码。\n- **结构化易于维护**：通过极简的抽象构建出清晰的执行流，天然支持对每个组件进行监控和日志记录，让系统迭代和性能调优变得有据可依。\n\nllmflows 通过极致的显式化和透明度，让复杂的 LLM 应用开发从“玄学调试”变成了可控的工程实践。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fstoyan-stoyanov_llmflows_d739e81c.png","stoyan-stoyanov","Stoyan","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fstoyan-stoyanov_3e14d266.jpg",null,"https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov",[81],{"name":82,"color":83,"percentage":84},"Python","#3572A5",100,707,35,"2026-04-01T17:16:45","MIT","未说明",{"notes":91,"python":89,"dependencies":92},"该工具是一个用于构建 LLM 应用的框架，本身不包含模型，主要通过 API 调用外部大模型（如 OpenAI）。运行需配置对应 LLM 的 API Key。支持集成向量数据库（如 Pinecone）。由于是基于 API 的轻量级框架，对本地 GPU 和内存无特殊高要求，具体取决于所调用的外部模型服务及是否本地部署向量库。",[67],[14,15,13,26,51],[95,96,97,98,99,100,101,102,103,104,105,106,107],"ai","llm","llm-inference","llmops","llms","machine-learning","openai","prompt-engineering","question-answering","vector-database","chatgpt","gpt-4","python","2026-03-27T02:49:30.150509","2026-04-06T09:25:55.423090",[111,116,121,126,131,136,141],{"id":112,"question_zh":113,"answer_zh":114,"source_url":115},18465,"为什么不同 LLM 实现的方法签名与接口定义不匹配？这是否违反了设计原则？","这是因为不同的 LLM 需要不同的参数（例如普通 LLM 只需要 prompt 字符串，而 ChatLLM 需要对话历史）。维护者指出，虽然这看起来违反了接口一致性，但在实际应用中，不同模型 API 的参数差异是不可避免的。建议参考策略模式（Strategy Pattern）来理解这种设计，即通过组合而非继承来处理行为差异，而不是强制所有实现拥有完全相同的函数签名。","https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fissues\u002F17",{"id":117,"question_zh":118,"answer_zh":119,"source_url":120},18466,"初始化类时参数过多，是否应该使用配置类（如 dataclass 或 Pydantic）来替代？","这取决于参数的数量和性质。如果参数超过 5-6 个，使用 dataclass 或 Pydantic BaseModel 是合理的，这样可以获得开箱即用的验证功能以及配置文件的序列化\u002F反序列化支持。如果参数较少，直接使用输入参数可能更直观易读。维护者倾向于在参数较多时采用配置类以增强代码的健壮性。","https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fissues\u002F7",{"id":122,"question_zh":123,"answer_zh":124,"source_url":125},18467,"OpenAI api_key 参数传递不一致，无法通过环境变量自动加载怎么办？","该问题已在版本 0.0.10 中修复。修复后的逻辑是：默认 api_key=None，如果未提供值，底层库将尝试使用环境变量；如果提供了非 None 值，则直接传递给 openai.api_key。此前代码存在缺陷，即使设置了环境变量，传入 None 也会报错，且无法正确透传参数。","https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fissues\u002F33",{"id":127,"question_zh":128,"answer_zh":129,"source_url":130},18468,"是否应该将类中的静态方法移动到模块级别或工具模块中？","对于仅在类内部使用的静态方法，保留在类中是可以接受的。但如果方法具有通用性，移动到模块级别会更易于复用和测试。维护者曾幽默地表示反对创建通用的 'utils' 模块（\"STOP UTILS MODULES\"），建议根据方法的实际归属（如消息管理逻辑归属于 MessageHistory 类）来决定位置，避免滥用工具模块。","https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fissues\u002F25",{"id":132,"question_zh":133,"answer_zh":134,"source_url":135},18469,"为什么代码中既有 setter 装饰器又有独立的方法来设置对话历史，且类型不一致？","维护者已重构代码，将消息管理逻辑从 OpenAIChat 类中提取出来，放入独立的 MessageHistory 类中。这一改动解决了类型不一致（dict vs str）和职责混淆的问题。新的设计旨在更好地支持 ChatFlowStep 和对话历史的持久化需求。","https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fissues\u002F13",{"id":137,"question_zh":138,"answer_zh":139,"source_url":140},18470,"项目中应该使用相对导入还是绝对导入？","建议始终使用绝对导入（例如 `from llmflows.llms.llm import BaseLLM`）。维护者确认已采纳此建议，因为绝对导入使代码结构更清晰，减少了因文件移动导致的导入错误，提高了代码的可读性和可维护性。","https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fissues\u002F11",{"id":142,"question_zh":143,"answer_zh":144,"source_url":145},18471,"遇到 API Key 缺失时，应该抛出通用 ValueError 还是自定义异常？","建议创建更具体的异常类（如 `APIKeyNotFoundError`），以便调用方能更精确地捕获和处理错误。此外，关于是否允许用户选择通过参数或环境变量提供 Key，社区讨论倾向于明确性，但在实际修复中（见 Issue #33），最终实现了优先使用传入参数，缺失时回退到环境变量的灵活策略。","https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fissues\u002F8",[147,152,157,162,167,172,177,182,186,190,194,198,202],{"id":148,"version":149,"summary_zh":150,"released_at":151},109015,"0.2.1","* 对 LLM 类进行小幅重构\n* 更新了 urllib3 版本\n* 增加了对 Azure OpenAI 模型的支持\n* 增加了对 Google PaLM 模型的支持\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fcompare\u002F0.1.2...0.2.1","2023-10-08T01:39:01",{"id":153,"version":154,"summary_zh":155,"released_at":156},109016,"0.1.2","## 变更内容\n* 修复了 `Introduction.md` 中的一个拼写错误，由 @bweber-rebellion 在 https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fpull\u002F45 中完成\n* 在 `pyproject.toml` 中添加了缺失的依赖包\n* 对 LLM 类的方法进行了小幅重构，以实现方法签名的标准化\n\n## 新贡献者\n* @bweber-rebellion 在 https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fpull\u002F45 中完成了首次贡献\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fcompare\u002F0.1.1...0.1.2","2023-09-24T23:48:59",{"id":158,"version":159,"summary_zh":160,"released_at":161},109017,"0.1.1","## 变更内容\n* @stoyan-stoyanov 在 https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fpull\u002F44 中添加了对 Claude 的支持\n* LLM 基类重构\n\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fcompare\u002F0.0.12...0.1.1","2023-09-16T21:39:37",{"id":163,"version":164,"summary_zh":165,"released_at":166},109018,"0.0.12","- 修复了 VectorDoc 中的一个 bug，在某些情况下元数据中的文本会显示错误。\n\n**完整更新日志**：https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fcompare\u002F0.0.11...0.0.12","2023-08-07T20:47:52",{"id":168,"version":169,"summary_zh":170,"released_at":171},109019,"0.0.11","## 变更内容\n* 修复了在使用 `top_k` 参数时 `VecroStoreFlowStep` 的一个 bug\n* @dylanjsa 在 https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fpull\u002F39 中修正了介绍页面中的一个错别字\n\n## 新贡献者\n* @dylanjsa 在 https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fpull\u002F39 中完成了首次贡献\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fcompare\u002F0.0.10...0.0.11","2023-08-06T20:24:05",{"id":173,"version":174,"summary_zh":175,"released_at":176},109020,"0.0.10","## 变更内容\n* 由 @tavisrudd 在 https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fpull\u002F34 中修复了 README.md 流程步骤示例中的拼写错误。\n* 修复了 LLM 类中 `api_key` 的问题：此前只有当 API 密钥存储在环境变量中时才能使用，这与预期行为不符。现已解决该问题。\n* 对示例和 README 进行了小幅更新。\n\n## 新贡献者\n* @tavisrudd 在 https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fpull\u002F34 中完成了首次贡献。\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002Fstoyan-stoyanov\u002Fllmflows\u002Fcompare\u002F0.0.9...0.0.10","2023-07-26T03:50:11",{"id":178,"version":179,"summary_zh":180,"released_at":181},109021,"0.0.9","项目公开后的首次发布","2023-07-23T16:09:24",{"id":183,"version":184,"summary_zh":78,"released_at":185},109022,"0.0.8","2023-07-22T23:41:22",{"id":187,"version":188,"summary_zh":78,"released_at":189},109023,"0.0.7","2023-07-16T16:28:42",{"id":191,"version":192,"summary_zh":78,"released_at":193},109024,"0.0.6","2023-07-09T17:55:30",{"id":195,"version":196,"summary_zh":78,"released_at":197},109025,"0.0.5","2023-07-06T06:01:49",{"id":199,"version":200,"summary_zh":78,"released_at":201},109026,"0.0.4","2023-07-04T05:41:03",{"id":203,"version":204,"summary_zh":205,"released_at":206},109027,"0.0.3","初始发布","2023-06-26T01:38:29"]