[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-mistralai--cookbook":3,"tool-mistralai--cookbook":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":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":74,"owner_company":65,"owner_location":65,"owner_email":76,"owner_twitter":65,"owner_website":77,"owner_url":78,"languages":79,"stars":92,"forks":93,"last_commit_at":94,"license":95,"difficulty_score":96,"env_os":97,"env_gpu":98,"env_ram":98,"env_deps":99,"category_tags":102,"github_topics":65,"view_count":32,"oss_zip_url":65,"oss_zip_packed_at":65,"status":17,"created_at":103,"updated_at":104,"faqs":105,"releases":131},7180,"mistralai\u002Fcookbook","cookbook",null,"Cookbook 是 Mistral AI 官方推出的开源示例合集，旨在为开发者提供一套全面、实用的模型应用指南。它汇集了来自 Mistral 团队、社区伙伴贡献的高质量代码案例，涵盖了从快速入门到高级架构设计的完整开发路径。\n\n针对开发者在落地大模型时面临的“如何起步”、“如何构建复杂应用”等痛点，Cookbook 提供了可直接运行的 Jupyter Notebook 和 Markdown 文档。内容不仅包含基础的聊天对话、文本嵌入和提示词工程，还深入讲解了检索增强生成（RAG）、函数调用（Function Calling）、多表 Text-to-SQL、模型微调及效果评估等进阶技术。特别值得一提的是，其中展示了如何利用 Prefix 特性优化长上下文处理，以及如何结合函数调用构建智能路由和多源数据搜索引擎，为构建生产级应用提供了清晰的技术参考。\n\n这套资源非常适合人工智能工程师、研究人员以及希望快速掌握 Mistral 模型能力的技术爱好者使用。所有示例均注重可复现性，明确标注了依赖包版本，并尽可能支持在 Google Colab 上直接运行，帮助用户零门槛验证想法。无论你是想探索","Cookbook 是 Mistral AI 官方推出的开源示例合集，旨在为开发者提供一套全面、实用的模型应用指南。它汇集了来自 Mistral 团队、社区伙伴贡献的高质量代码案例，涵盖了从快速入门到高级架构设计的完整开发路径。\n\n针对开发者在落地大模型时面临的“如何起步”、“如何构建复杂应用”等痛点，Cookbook 提供了可直接运行的 Jupyter Notebook 和 Markdown 文档。内容不仅包含基础的聊天对话、文本嵌入和提示词工程，还深入讲解了检索增强生成（RAG）、函数调用（Function Calling）、多表 Text-to-SQL、模型微调及效果评估等进阶技术。特别值得一提的是，其中展示了如何利用 Prefix 特性优化长上下文处理，以及如何结合函数调用构建智能路由和多源数据搜索引擎，为构建生产级应用提供了清晰的技术参考。\n\n这套资源非常适合人工智能工程师、研究人员以及希望快速掌握 Mistral 模型能力的技术爱好者使用。所有示例均注重可复现性，明确标注了依赖包版本，并尽可能支持在 Google Colab 上直接运行，帮助用户零门槛验证想法。无论你是想探索模型潜力，还是寻求具体的工程实现方案，Cookbook 都能提供结构清晰、价值丰富的实践指引。","# Mistral Cookbook\n\nThe Mistral Cookbook features examples contributed by Mistralers and our community, as well as our partners. If you have cool examples showcasing Mistral models, feel free to share them by submitting a PR to this repo.\n\n## Submission Guidelines:\n\n- File Format: Please submit your example in the .md or .ipynb format.\n- Runnable on Colab: If you're sharing a notebook example, try to make sure it's runnable on Google Colab.\n- Authorship: Kindly include your name, your Github handle, and affiliation at the beginning of the file.\n- Descriptions: Please include your notebook along with its category and descriptions in the table below.\n- Tone: Kindly maintain a neutral tone and minimize any excessive marketing materials.\n- Reproducibility: To ensure others can reproduce your work, kindly tag package versions in your code.\n- Image size: If you have images, please make sure each image's size is below 500KB.\n- Copyright: Always respect copyright and intellectual property laws.\n\nDisclaimer: Examples contributed by the community and partners do not represent Mistral's views and opinions.\n\n## Content Guidelines:\n\n- Originality: Is your content original and offering a fresh perspective?\n- Clear: Is your content well-structured and clearly written?\n- Value: Is your content valuable to the community? Does the community need it?\n\n## Main Notebooks\n\n| Notebook                                                                       | Category                     | Description                                                                      |\n|--------------------------------------------------------------------------------|-----------------------------|----------------------------------------------------------------------------------|\n| [quickstart.ipynb](quickstart.ipynb)                                           | chat, embeddings             | Basic quickstart with chat and embeddings with Mistral AI API                    |\n| [prompting_capabilities.ipynb](mistral\u002Fprompting\u002Fprompting_capabilities.ipynb) | prompting                    | Write prompts for classification, summarization, personalization, and evaluation |\n| [basic_RAG.ipynb](mistral\u002Frag\u002Fbasic_RAG.ipynb)                                 | RAG                          | RAG from scratch with Mistral AI API                                             |\n| [embeddings.ipynb](mistral\u002Fembeddings\u002Fembeddings.ipynb)                        | embeddings                   | Use Mistral embeddings API for classification and clustering                     |                                           |\n| [function_calling.ipynb](mistral\u002Ffunction_calling\u002Ffunction_calling.ipynb)      | function calling             | Use Mistral API for function calling                                             |\n| [text_to_SQL.ipynb](mistral\u002Ffunction_calling\u002Ftext_to_SQL.ipynb)      | function calling             | Use Mistral API for function calling on a multi tables text to SQL usecase                                             |\n| [evaluation.ipynb](mistral\u002Fevaluation\u002Fevaluation.ipynb)                        | evaluation                   | Evaluate models with Mistral API                                                 |\n| [mistral_finetune_api.ipynb](mistral\u002Ffine_tune\u002Fmistral_finetune_api.ipynb)     | fine-tuning                  | Finetune a model with Mistral fine-tuning API                                    |\n| [mistral-search-engine.ipynb](mistral\u002Frag\u002Fmistral-search-engine.ipynb)         | RAG, function calling        | Search engine built with Mistral API, function calling and RAG                   |\n| [rag_via_function_calling.ipynb](mistral\u002Frag\u002FRAG_via_function_calling.ipynb)         | RAG, function calling        | Use function calling as a router for a RAG based on multiple data sources                   |\n| [prefix_use_cases.ipynb](mistral\u002Fprompting\u002Fprefix_use_cases.ipynb)             | prefix, prompting            | Cool examples with Mistral's prefix feature                                      |\n| [synthetic_data_gen_and_finetune.ipynb](mistral\u002Fdata_generation\u002Fsynthetic_data_gen_and_finetune.ipynb) | data generation, fine-tuning | Simple data generation and fine-tuning guide        |\n| [data_generation_refining_news.ipynb](mistral\u002Fdata_generation\u002Fdata_generation_refining_news.ipynb) | data generation | Simple data generation to refine news articles                                |\n| [image_description_extraction_pixtral.ipynb](mistral\u002Fimage_understanding\u002Fimage_description_extraction_pixtral.ipynb) | image processing, prompting  | Extract structured image descriptions using Mistral's Pixtral model and JSON response formatting |\n| [multimodality meets function calling.ipynb](mistral\u002Fimage_understanding\u002Fmultimodality_meets_function_calling.ipynb) | image processing, function calling  | Extract table from image using Mistral's Pixtral model and use for function calling |\n| [mistral-reference-rag.ipynb](mistral\u002Frag\u002Fmistral-reference-rag.ipynb) | RAG, function calling, references | Reference RAG with Mistral API |\n| [moderation-explored.ipynb](mistral\u002Fmoderation\u002Fmoderation-explored.ipynb) | moderation | Quick exploration on safeguarding and Mistral's moderation API |\n| [system-level-guardrails.ipynb](mistral\u002Fmoderation\u002Fsystem-level-guardrails.ipynb) | moderation | How to implement System Level Guardrails with Mistral API |\n| [document_understanding.ipynb](mistral\u002Focr\u002Fdocument_understanding.ipynb) | OCR, function calling | Document Understanding and Tool Usage with OCR |\n| [batch_ocr.ipynb](mistral\u002Focr\u002Fbatch_ocr.ipynb) | OCR, batch | Using OCR to extract text data from datasets. |\n| [structured_ocr.ipynb](mistral\u002Focr\u002Fstructured_ocr.ipynb) | OCR, structured outputs | Extracting structured outputs from documents. |\n| [RAG_evaluation.ipynb](mistral\u002Fevaluation\u002FRAG_evaluation.ipynb) | evaluation, structured outputs, LLM As a Judge | Evaluate RAG with LLM as a Judge and structured outputs |\n| [product_classification.ipynb](mistral\u002Fclassifier_factory\u002Fproduct_classification.ipynb) | fine-tuning, classifier | Fine-tuning a classifier for food classification. |\n| [intent_classification.ipynb](mistral\u002Fclassifier_factory\u002Fintent_classification.ipynb) | fine-tuning, classifier | Fine-tuning a classifier for intent classification. |\n| [moderation_classifier.ipynb](mistral\u002Fclassifier_factory\u002Fmoderation_classifier.ipynb) | fine-tuning, classifier | Fine-tuning a classifier for moderation. |\n| [pixtral_finetune_on_satellite_data.ipynb](mistral\u002Ffine_tune\u002Fpixtral_finetune_on_satellite_data.ipynb) | fine-tuning, image processing, batch | Fine-tuning a Pixtral-12B for satellite images classification. |\n| [sts_demo.py](mistral\u002Ftts\u002Fsts_demo.py) | chat, tts | STT -> LLM -> TTS Demo. |\n\n\n\n## Third Party Tools\n\n| Tools                                                                                                                 | Category                        | Party      |\n|:----------------------------------------------------------------------------------------------------------------------|:--------------------------------| :--------- |\n| [adaptive_rag_mistral.ipynb](third_party\u002Flangchain\u002Fadaptive_rag_mistral.ipynb)                                        | RAG                             | Langchain  |\n| [Adaptive_RAG.ipynb](third_party\u002FLlamaIndex\u002FAdaptive_RAG.ipynb)                                                       | RAG                             | LLamaIndex |\n| [Agents_Tools.ipynb](third_party\u002FLlamaIndex\u002FAgents_Tools.ipynb)                                                       | agent                           | LLamaIndex |\n| [arize_phoenix_tracing.ipynb](third_party\u002FPhoenix\u002Farize_phoenix_tracing.ipynb)                                        | tracing data                    | Arize Phoenix  |\n| [arize_phoenix_evaluate_rag.ipynb](third_party\u002FPhoenix\u002Farize_phoenix_evaluate_rag.ipynb)                              | evaluation                      | Arize Phoenix  |\n| [azure_ai_search_rag.ipynb](third_party\u002FAzure_AI_Search\u002Fazure_ai_search_rag.ipynb)                                    | RAG, embeddings                 | Azure      |\n| [CAMEL Graph RAG with Mistral Models](third_party\u002FCAMEL_AI\u002Fcamel_graph_rag.ipynb)                                     | multi-agent, tool, data gen     | CAMEL-AI.org|\n| [CAMEL Role-Playing Scraper](third_party\u002FCAMEL_AI\u002Fcamel_roleplaying_scraper.ipynb)                                    | multi-agent, tool, data gen     | CAMEL-AI.org|\n| [Chainlit - Mistral reasoning.ipynb](third_party\u002FChainlit\u002FChainlit_Mistral_reasoning.ipynb)                           | UI chat, tool calling           | Chainlit   |\n| [chroma_mistral_embed_fn.ipynb](third_party\u002FChromaDB\u002Fchroma_mistral_embed_fn.ipynb)                              | embeddings, vector DB | Chroma\n| [corrective_rag_mistral.ipynb](third_party\u002Flangchain\u002Fcorrective_rag_mistral.ipynb)                                    | RAG                             | Langchain  |\n| [distilabel_synthetic_dpo_dataset.ipynb](third_party\u002Fargilla\u002Fdistilabel_synthetic_dpo_dataset.ipynb)                  | synthetic data                  | Argilla    |\n| [E2B Code Interpreter SDK with Codestral](third_party\u002FE2B_Code_Interpreting)                                          | tool, agent                     | E2B        |\n| [function_calling_local.ipynb](third_party\u002FOllama\u002Ffunction_calling_local.ipynb)                                       | tool call                       | Ollama     |\n| [Gradio Integration - Chat with PDF](third_party\u002Fgradio\u002FREADME.md)                                                    | UI chat, demo, RAG              | Gradio     |\n| [haystack_chat_with_docs.ipynb](third_party\u002FHaystack\u002Fhaystack_chat_with_docs.ipynb)                                   | RAG, embeddings                 | Haystack   |\n| [Indexify Integration - PDF Entity Extraction](third_party\u002FIndexify\u002Fpdf-entity-extraction)                            | entity extraction, PDF          | Indexify   |\n| [Indexify Integration - PDF Summarization](third_party\u002FIndexify\u002Fpdf-summarization)                                    | summarization, PDF              | Indexify   |\n| [langgraph_code_assistant_mistral.ipynb](third_party\u002Flangchain\u002Flanggraph_code_assistant_mistral.ipynb)                | code                            | Langchain  |\n| [langgraph_crag_mistral.ipynb](third_party\u002Flangchain\u002Flanggraph_crag_mistral.ipynb)                                    | RAG                             | Langchain  |\n| [langtrace_mistral.ipynb](third_party\u002Flangtrace\u002Flangtrace_mistral.ipynb)                                              | OTEL Observability              | Langtrace  |\n| [llamaindex_agentic_rag.ipynb](third_party\u002FLlamaIndex\u002Fllamaindex_agentic_rag.ipynb)                                   | RAG, agent                      | LLamaIndex |\n| [llamaindex_arxiv_agentic_rag.ipynb](third_party\u002FLlamaIndex\u002Fllamaindex_arxiv_agentic_rag.ipynb)                       | RAG, agent, Arxiv summarization | LLamaIndex |\n| [llamaindex_mistralai_finetuning.ipynb](third_party\u002FLlamaIndex\u002Fllamaindex_mistralai_finetuning.ipynb)                 | fine-tuning                     | LLamaIndex |\n| [llamaindex_mistral_multi_modal.ipynb](third_party\u002FLlamaIndex\u002Fllamaindex_mistral_multi_modal.ipynb)                   | MultiModalLLM-Pixtral           | LLamaIndex |\n| [Maxim AI - Observability ](third_party\u002FMaxim\u002Fcookbook_maxim_mistral_integration.ipynb) | Observability, Evaluation           | Maxim AI |\n| [Microsoft Autogen - Function calling a pgsql db ](third_party\u002FMS_Autogen_pgsql\u002Fmistral_pgsql_function_calling.ipynb) | Tool call, agent, RAG           | Ms Autogen |\n| [Mesop Integration - Chat with PDF](third_party\u002Fmesop\u002FREADME.md)                                                      | UI chat, demo, RAG              | Mesop      |\n| [Monitoring Mistral AI using OpenTelemetry](third_party\u002Fopenlit\u002Fcookbook_mistral_opentelemetry.ipynb)                 | AI Observability                | OpenLIT    |\n| [neon_text_to_sql.ipynb](third_party\u002FNeon\u002Fneon_text_to_sql.ipynb)                                                     | code                            | Neon       |\n| [ollama_mistral_llamaindex.ipynb](third_party\u002FLlamaIndex\u002Follama_mistral_llamaindex.ipynb)                             | RAG                             | LLamaIndex |\n| [Ollama Meetup Demo](third_party\u002FOllama\u002F20240321_ollama_meetup)                                                       | demo                            | Ollama     |\n| [Open-source LLM engineering](third_party\u002FLangfuse)                                                                   | LLM Observability               | Langfuse   |\n| [Panel Integration - Chat with PDF](third_party\u002Fpanel\u002FREADME.md)                                                      | UI chat, demo, RAG              | Panel      |\n| [phospho integration](third_party\u002Fphospho\u002Fcookbook_phospho_mistral_integration.ipynb)                                 | Evaluation, Analytics           | phospho    |\n| [pinecone_rag.ipynb](third_party\u002FPinecone\u002Fpinecone_rag.ipynb)                                                         | RAG                             | Pinecone   |\n| [RAG.ipynb](third_party\u002FLlamaIndex\u002FRAG.ipynb)                                                                         | RAG                             | LLamaIndex |\n| [RouterQueryEngine.ipynb](third_party\u002FLlamaIndex\u002FRouterQueryEngine.ipynb)                                             | agent                           | LLamaIndex |\n| [self_rag_mistral.ipynb](third_party\u002Flangchain\u002Fself_rag_mistral.ipynb)                                                | RAG                             | Langchain  |\n| [Solara Integration - Chat with PDFs](third_party\u002Fsolara\u002FREADME.md)                                                   | UI chat, demo, RAG              | Solara     |\n| [Streamlit Integration - Chat with PDF](third_party\u002Fstreamlit\u002FREADME.md)                                              | UI chat, demo, RAG              | Streamlit  |\n| [Neo4j rag](third_party\u002FNeo4j\u002Fneo4j_rag.ipynb)                                                                        | RAG                             | Neo4j      |\n| [SubQuestionQueryEngine.ipynb](third_party\u002FLlamaIndex\u002FRouterQueryEngine.ipynb)                                        | agent                           | LLamaIndex |\n| [LLM Judge: Detecting hallucinations in language models](third_party\u002Fwandb\u002FREADME.md)                                 | fine-tuning, evaluation         | Weights & Biases |\n| [`x mistral`: CLI & TUI APP Module in X-CMD](third_party\u002Fx-cmd\u002FREADME.md)                                             | CLI, TUI APP, Chat              | x-cmd      |\n| [Incremental Prompt Engineering and Model Comparison](third_party\u002FPixeltable\u002FREADME.md)                               | Prompt Engineering, Evaluation  | Pixeltable |\n| [Build a bank support agent with Pydantic AI and Mistral AI](third_party\u002FPydanticAI\u002Fpydantic_bank_support_agent.ipynb)| Agent                           | Pydantic   |\n| [Mistral and MLflow Tracing](third_party\u002FMLflow\u002Fmistral-mlflow-tracing.ipynb)                                         | Tracing, Observability          | MLflow     |\n| [Mistral OCR with Gradio](third_party\u002Fgradio\u002FMistralOCR.md)                                                           | OCR                             | Gradio     |\n| [prompt_optimization.ipynb](third_party\u002Fmetagpt\u002Fprompt_optimization.ipynb)) |Prompting | Optimizing prompts without any supervision\n","# Mistral  Cookbook\n\nMistral Cookbook 收录了来自 Mistral 团队、社区以及合作伙伴的示例。如果您有展示 Mistral 模型强大功能的精彩示例，欢迎通过向本仓库提交 PR 的方式分享。\n\n## 提交指南：\n\n- 文件格式：请以 .md 或 .ipynb 格式提交您的示例。\n- 可在 Colab 上运行：如果您分享的是 Notebook 示例，请尽量确保其可以在 Google Colab 上运行。\n- 作者信息：请在文件开头注明您的姓名、GitHub 用户名及所属机构。\n- 描述：请将您的 Notebook 连同其所属类别和描述一并填写到下表中。\n- 文风：请保持中立客观的语气，避免过多营销性质的内容。\n- 可复现性：为确保他人能够复现您的工作，请在代码中明确标注所用包的版本。\n- 图片大小：如包含图片，请确保每张图片的大小不超过 500KB。\n- 版权：请始终尊重版权和知识产权相关法律法规。\n\n免责声明：由社区及合作伙伴贡献的示例并不代表 Mistral 的观点和立场。\n\n## 内容指南：\n\n- 原创性：您的内容是否具有原创性，并提供了全新的视角？\n- 清晰度：内容结构是否清晰，表述是否明确？\n- 价值：您的内容对社区是否有实际价值？社区是否需要此类内容？\n\n## 主要 Notebook 列表\n\n| Notebook                                                                       | 类别                     | 描述                                                                      |\n|--------------------------------------------------------------------------------|-------------------------|--------------------------------------------------------------------------|\n| [quickstart.ipynb](quickstart.ipynb)                                           | 对话、嵌入               | 使用 Mistral AI API 的基础对话与嵌入快速入门                             |\n| [prompting_capabilities.ipynb](mistral\u002Fprompting\u002Fprompting_capabilities.ipynb) | 提示工程                 | 编写用于分类、摘要、个性化及评估的提示                                 |\n| [basic_RAG.ipynb](mistral\u002Frag\u002Fbasic_RAG.ipynb)                                 | RAG                      | 使用 Mistral AI API 从零构建 RAG                                         |\n| [embeddings.ipynb](mistral\u002Fembeddings\u002Fembeddings.ipynb)                        | 嵌入                     | 使用 Mistral 嵌入 API 进行分类与聚类                                     |\n| [function_calling.ipynb](mistral\u002Ffunction_calling\u002Ffunction_calling.ipynb)      | 函数调用                 | 使用 Mistral API 进行函数调用                                           |\n| [text_to_SQL.ipynb](mistral\u002Ffunction_calling\u002Ftext_to_SQL.ipynb)                | 函数调用                 | 使用 Mistral API 处理多表文本转 SQL 的用例                               |\n| [evaluation.ipynb](mistral\u002Fevaluation\u002Fevaluation.ipynb)                        | 评估                     | 使用 Mistral API 评估模型                                                 |\n| [mistral_finetune_api.ipynb](mistral\u002Ffine_tune\u002Fmistral_finetune_api.ipynb)     | 微调                     | 使用 Mistral 微调 API 对模型进行微调                                   |\n| [mistral-search-engine.ipynb](mistral\u002Frag\u002Fmistral-search-engine.ipynb)         | RAG、函数调用             | 使用 Mistral API、函数调用及 RAG 构建搜索引擎                           |\n| [rag_via_function_calling.ipynb](mistral\u002Frag\u002FRAG_via_function_calling.ipynb)   | RAG、函数调用             | 使用函数调用作为路由，基于多个数据源构建 RAG                           |\n| [prefix_use_cases.ipynb](mistral\u002Fprompting\u002Fprefix_use_cases.ipynb)             | 前缀、提示工程           | 使用 Mistral 前缀功能的精彩示例                                         |\n| [synthetic_data_gen_and_finetune.ipynb](mistral\u002Fdata_generation\u002Fsynthetic_data_gen_and_finetune.ipynb) | 数据生成、微调           | 简单的数据生成与微调指南                                               |\n| [data_generation_refining_news.ipynb](mistral\u002Fdata_generation\u002Fdata_generation_refining_news.ipynb) | 数据生成                 | 通过简单数据生成来优化新闻文章                                       |\n| [image_description_extraction_pixtral.ipynb](mistral\u002Fimage_understanding\u002Fimage_description_extraction_pixtral.ipynb) | 图像处理、提示工程       | 使用 Mistral 的 Pixtral 模型提取结构化图像描述，并以 JSON 格式输出     |\n| [multimodality_meets_function_calling.ipynb](mistral\u002Fimage_understanding\u002Fmultimodality_meets_function_calling.ipynb) | 图像处理、函数调用       | 使用 Mistral 的 Pixtral 模型从图像中提取表格，并用于函数调用           |\n| [mistral-reference-rag.ipynb](mistral\u002Frag\u002Fmistral-reference-rag.ipynb)          | RAG、函数调用、引用       | 使用 Mistral API 构建引用型 RAG                                          |\n| [moderation-explored.ipynb](mistral\u002Fmoderation\u002Fmoderation-explored.ipynb)       | 内容审核                 | 快速探索安全防护机制及 Mistral 的内容审核 API                           |\n| [system-level-guardrails.ipynb](mistral\u002Fmoderation\u002Fsystem-level-guardrails.ipynb) | 内容审核                 | 如何使用 Mistral API 实现系统级安全防护                                 |\n| [document_understanding.ipynb](mistral\u002Focr\u002Fdocument_understanding.ipynb)       | OCR、函数调用             | 使用 OCR 进行文档理解与工具应用                                        |\n| [batch_ocr.ipynb](mistral\u002Focr\u002Fbatch_ocr.ipynb)                                 | OCR、批量处理             | 使用 OCR 从数据集中提取文本信息                                         |\n| [structured_ocr.ipynb](mistral\u002Focr\u002Fstructured_ocr.ipynb)                       | OCR、结构化输出           | 从文档中提取结构化输出                                                 |\n| [RAG_evaluation.ipynb](mistral\u002Fevaluation\u002FRAG_evaluation.ipynb)                | 评估、结构化输出、LLM 作为裁判 | 使用 LLM 作为裁判评估 RAG，并输出结构化结果                           |\n| [product_classification.ipynb](mistral\u002Fclassifier_factory\u002Fproduct_classification.ipynb) | 微调、分类器             | 针对食品分类任务对分类器进行微调                                      |\n| [intent_classification.ipynb](mistral\u002Fclassifier_factory\u002Fintent_classification.ipynb) | 微调、分类器             | 针对意图分类任务对分类器进行微调                                      |\n| [moderation_classifier.ipynb](mistral\u002Fclassifier_factory\u002Fmoderation_classifier.ipynb) | 微调、分类器             | 针对内容审核任务对分类器进行微调                                      |\n| [pixtral_finetune_on_satellite_data.ipynb](mistral\u002Ffine_tune\u002Fpixtral_finetune_on_satellite_data.ipynb) | 微调、图像处理、批量处理 | 对 Pixtral-12B 模型进行卫星图像分类的微调                              |\n| [sts_demo.py](mistral\u002Ftts\u002Fsts_demo.py)                                         | 对话、TTS                 | STT -> LLM -> TTS 演示                                                   |\n\n\n## 第三方工具\n\n| 工具                                                                                                                 | 类别                        | 提供方      |\n|:----------------------------------------------------------------------------------------------------------------------|:--------------------------------| :--------- |\n| [adaptive_rag_mistral.ipynb](third_party\u002Flangchain\u002Fadaptive_rag_mistral.ipynb)                                        | RAG                             | Langchain  |\n| [Adaptive_RAG.ipynb](third_party\u002FLlamaIndex\u002FAdaptive_RAG.ipynb)                                                       | RAG                             | LLamaIndex |\n| [Agents_Tools.ipynb](third_party\u002FLlamaIndex\u002FAgents_Tools.ipynb)                                                       | 代理                           | LLamaIndex |\n| [arize_phoenix_tracing.ipynb](third_party\u002FPhoenix\u002Farize_phoenix_tracing.ipynb)                                        | 跟踪数据                    | Arize Phoenix  |\n| [arize_phoenix_evaluate_rag.ipynb](third_party\u002FPhoenix\u002Farize_phoenix_evaluate_rag.ipynb)                              | 评估                      | Arize Phoenix  |\n| [azure_ai_search_rag.ipynb](third_party\u002FAzure_AI_Search\u002Fazure_ai_search_rag.ipynb)                                    | RAG, 嵌入                     | Azure      |\n| [CAMEL 图谱 RAG with Mistral 模型](third_party\u002FCAMEL_AI\u002Fcamel_graph_rag.ipynb)                                     | 多智能体、工具、数据生成     | CAMEL-AI.org|\n| [CAMEL 角色扮演爬虫](third_party\u002FCAMEL_AI\u002Fcamel_roleplaying_scraper.ipynb)                                    | 多智能体、工具、数据生成     | CAMEL-AI.org|\n| [Chainlit - Mistral 推理.ipynb](third_party\u002FChainlit\u002FChainlit_Mistral_reasoning.ipynb)                           | UI 聊天、工具调用           | Chainlit   |\n| [chroma_mistral_embed_fn.ipynb](third_party\u002FChromaDB\u002Fchroma_mistral_embed_fn.ipynb)                              | 嵌入、向量数据库 | Chroma\n| [corrective_rag_mistral.ipynb](third_party\u002Flangchain\u002Fcorrective_rag_mistral.ipynb)                                    | RAG                             | Langchain  |\n| [distilabel 合成 DPO 数据集.ipynb](third_party\u002Fargilla\u002Fdistilabel_synthetic_dpo_dataset.ipynb)                  | 合成数据                  | Argilla    |\n| [E2B 代码解释器 SDK with Codestral](third_party\u002FE2B_Code_Interpreting)                                          | 工具、代理                     | E2B        |\n| [function_calling_local.ipynb](third_party\u002FOllama\u002Ffunction_calling_local.ipynb)                                       | 工具调用                       | Ollama     |\n| [Gradio 集成 - PDF 聊天](third_party\u002Fgradio\u002FREADME.md)                                                    | UI 聊天、演示、RAG              | Gradio     |\n| [haystack_chat_with_docs.ipynb](third_party\u002FHaystack\u002Fhaystack_chat_with_docs.ipynb)                                   | RAG、嵌入                 | Haystack   |\n| [Indexify 集成 - PDF 实体抽取](third_party\u002FIndexify\u002Fpdf-entity-extraction)                            | 实体抽取、PDF          | Indexify   |\n| [Indexify 集成 - PDF 总结](third_party\u002FIndexify\u002Fpdf-summarization)                                    | 总结、PDF              | Indexify   |\n| [langgraph_code_assistant_mistral.ipynb](third_party\u002Flangchain\u002Flanggraph_code_assistant_mistral.ipynb)                | 代码                            | Langchain  |\n| [langgraph_crag_mistral.ipynb](third_party\u002Flangchain\u002Flanggraph_crag_mistral.ipynb)                                    | RAG                             | Langchain  |\n| [langtrace_mistral.ipynb](third_party\u002Flangtrace\u002Flangtrace_mistral.ipynb)                                              | OTEL 可观测性              | Langtrace  |\n| [llamaindex_agentic_rag.ipynb](third_party\u002FLlamaIndex\u002Fllamaindex_agentic_rag.ipynb)                                   | RAG、代理                      | LLamaIndex |\n| [llamaindex_arxiv_agentic_rag.ipynb](third_party\u002FLlamaIndex\u002Fllamaindex_arxiv_agentic_rag.ipynb)                       | RAG、代理、Arxiv 摘要         | LLamaIndex |\n| [llamaindex_mistralai_finetuning.ipynb](third_party\u002FLlamaIndex\u002Fllamaindex_mistralai_finetuning.ipynb)                 | 微调                     | LLamaIndex |\n| [llamaindex_mistral_multi_modal.ipynb](third_party\u002FLlamaIndex\u002Fllamaindex_mistral_multi_modal.ipynb)                   | 多模态 LLM - Pixtral           | LLamaIndex |\n| [Maxim AI - 可观测性 ](third_party\u002FMaxim\u002Fcookbook_maxim_mistral_integration.ipynb) | 可观测性、评估           | Maxim AI |\n| [Microsoft Autogen - 调用 pgsql 数据库函数 ](third_party\u002FMS_Autogen_pgsql\u002Fmistral_pgsql_function_calling.ipynb) | 工具调用、代理、RAG           | Ms Autogen |\n| [Mesop 集成 - PDF 聊天](third_party\u002Fmesop\u002FREADME.md)                                                      | UI 聊天、演示、RAG              | Mesop      |\n| [使用 OpenTelemetry 监控 Mistral AI](third_party\u002Fopenlit\u002Fcookbook_mistral_opentelemetry.ipynb)                 | AI 可观测性                | OpenLIT    |\n| [neon_text_to_sql.ipynb](third_party\u002FNeon\u002Fneon_text_to_sql.ipynb)                                                     | 代码                            | Neon       |\n| [ollama_mistral_llamaindex.ipynb](third_party\u002FLlamaIndex\u002Follama_mistral_llamaindex.ipynb)                             | RAG                             | LLamaIndex |\n| [Ollama 聚会演示](third_party\u002FOllama\u002F20240321_ollama_meetup)                                                       | 演示                            | Ollama     |\n| [开源 LLM 工程](third_party\u002FLangfuse)                                                                   | LLM 可观测性               | Langfuse   |\n| [Panel 集成 - PDF 聊天](third_party\u002Fpanel\u002FREADME.md)                                                      | UI 聊天、演示、RAG              | Panel      |\n| [phospho 集成](third_party\u002Fphospho\u002Fcookbook_phospho_mistral_integration.ipynb)                                 | 评估、分析           | phospho    |\n| [pinecone_rag.ipynb](third_party\u002FPinecone\u002Fpinecone_rag.ipynb)                                                         | RAG                             | Pinecone   |\n| [RAG.ipynb](third_party\u002FLlamaIndex\u002FRAG.ipynb)                                                                         | RAG                             | LLamaIndex |\n| [RouterQueryEngine.ipynb](third_party\u002FLlamaIndex\u002FRouterQueryEngine.ipynb)                                             | 代理                           | LLamaIndex |\n| [self_rag_mistral.ipynb](third_party\u002Flangchain\u002Fself_rag_mistral.ipynb)                                                | RAG                             | Langchain  |\n| [Solara 集成 - PDF 聊天](third_party\u002Fsolara\u002FREADME.md)                                                   | UI 聊天、演示、RAG              | Solara     |\n| [Streamlit 集成 - PDF 聊天](third_party\u002Fstreamlit\u002FREADME.md)                                              | UI 聊天、演示、RAG              | Streamlit  |\n| [Neo4j RAG](third_party\u002FNeo4j\u002Fneo4j_rag.ipynb)                                                                        | RAG                             | Neo4j      |\n| [SubQuestionQueryEngine.ipynb](third_party\u002FLlamaIndex\u002FRouterQueryEngine.ipynb)                                        | 代理                           | LLamaIndex |\n| [LLM 判官：检测语言模型中的幻觉](third_party\u002Fwandb\u002FREADME.md)                                 | 微调、评估         | Weights & Biases |\n| [`x mistral`: X-CMD 中的 CLI & TUI APP 模块](third_party\u002Fx-cmd\u002FREADME.md)                                             | CLI、TUI APP、聊天              | x-cmd      |\n| [增量式提示工程与模型比较](third_party\u002FPixeltable\u002FREADME.md)                               | 提示工程、评估  | Pixeltable |\n| [使用 Pydantic AI 和 Mistral AI 构建银行客服代理](third_party\u002FPydanticAI\u002Fpydantic_bank_support_agent.ipynb)| 代理                           | Pydantic   |\n| [Mistral 与 MLflow 跟踪](third_party\u002FMLflow\u002Fmistral-mlflow-tracing.ipynb)                                         | 跟踪、可观测性          | MLflow     |\n| [Mistral OCR with Gradio](third_party\u002Fgradio\u002FMistralOCR.md)                                                           | OCR                             | Gradio     |\n| [prompt_optimization.ipynb](third_party\u002Fmetagpt\u002Fprompt_optimization.ipynb)) |提示工程 | 在无监督的情况下优化提示","# Mistral Cookbook 快速上手指南\n\nMistral Cookbook 是由 Mistral 官方及社区贡献的代码示例集合，涵盖了从基础聊天、嵌入（Embeddings）、检索增强生成（RAG）到微调（Fine-tuning）和多模态处理等多种应用场景。本指南将帮助你快速搭建环境并运行示例。\n\n## 环境准备\n\n在开始之前，请确保你的开发环境满足以下要求：\n\n*   **操作系统**: Linux, macOS 或 Windows (推荐 WSL2)。\n*   **Python 版本**: Python 3.9 或更高版本。\n*   **账户与密钥**: 需要注册 [Mistral AI](https:\u002F\u002Fmistral.ai) 账号并获取 `API Key`。\n*   **运行环境**: 大部分示例为 Jupyter Notebook (`.ipynb`) 格式，推荐使用 **Google Colab** 直接运行，或在本地安装 Jupyter Lab\u002FNotebook。\n*   **网络环境**: 由于需连接 Mistral API，请确保网络通畅。\n\n## 安装步骤\n\n### 1. 克隆仓库\n首先，将 Cookbook 仓库克隆到本地：\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fmistralai\u002Fcookbook.git\ncd cookbook\n```\n\n### 2. 创建虚拟环境\n建议创建一个独立的虚拟环境以避免依赖冲突：\n\n```bash\npython -m venv mistral-env\nsource mistral-env\u002Fbin\u002Factivate  # Windows 用户请使用: mistral-env\\Scripts\\activate\n```\n\n### 3. 安装核心依赖\n安装 Mistral AI 官方客户端库及常用数据科学包。大多数 Notebook 示例需要以下基础包：\n\n```bash\npip install mistralai jupyter pandas numpy matplotlib\n```\n\n> **提示**: 如果你计划运行特定的第三方集成示例（如 LangChain, LlamaIndex），请进入对应的 `third_party\u002F` 目录查看该示例文件夹内的 `requirements.txt` 进行额外安装。例如：\n> ```bash\n> cd third_party\u002Flangchain\n> pip install -r requirements.txt\n> ```\n\n### 4. 配置 API Key\n在运行任何代码前，需设置环境变量。\n\n**Linux\u002FmacOS:**\n```bash\nexport MISTRAL_API_KEY=\"your_api_key_here\"\n```\n\n**Windows (PowerShell):**\n```powershell\n$env:MISTRAL_API_KEY=\"your_api_key_here\"\n```\n\n或者在 Jupyter Notebook 单元格中直接设置：\n```python\nimport os\nos.environ[\"MISTRAL_API_KEY\"] = \"your_api_key_here\"\n```\n\n## 基本使用\n\n以下是一个最简单的示例，演示如何调用 Mistral API 进行对话。你可以参考仓库中的 [`quickstart.ipynb`](quickstart.ipynb) 文件。\n\n### 1. 启动 Jupyter\n在项目根目录下启动 Jupyter：\n\n```bash\njupyter notebook\n```\n\n### 2. 创建测试脚本\n新建一个 Notebook 或 Python 文件，输入以下代码：\n\n```python\nfrom mistralai import Mistral\n\n# 初始化客户端\napi_key = os.environ.get(\"MISTRAL_API_KEY\")\nclient = Mistral(api_key=api_key)\n\n# 定义对话内容\nmessages = [\n    {\n        \"role\": \"user\",\n        \"content\": \"请简要介绍 Mistral AI 的特点。\"\n    }\n]\n\n# 调用模型\nchat_response = client.chat.complete(\n    model=\"mistral-large-latest\",\n    messages=messages,\n)\n\n# 输出结果\nprint(chat_response.choices[0].message.content)\n```\n\n### 3. 探索更多示例\n根据需求浏览 `mistral\u002F` 目录下的分类示例：\n\n*   **RAG 应用**: 运行 `mistral\u002Frag\u002Fbasic_RAG.ipynb` 学习如何构建知识库问答。\n*   **函数调用**: 运行 `mistral\u002Ffunction_calling\u002Ffunction_calling.ipynb` 体验模型调用外部工具的能力。\n*   **微调**: 运行 `mistral\u002Ffine_tune\u002Fmistral_finetune_api.ipynb` 了解如何定制模型。\n*   **多模态**: 运行 `mistral\u002Fimage_understanding\u002F` 下的示例处理图像任务。\n\n对于第三方工具集成（如 LangChain, LlamaIndex），请直接进入 `third_party\u002F` 对应文件夹运行相关 Notebook。","某电商初创公司的数据团队正急需构建一个能理解自然语言并查询多张业务报表的智能分析助手，以替代繁琐的手工 SQL 编写流程。\n\n### 没有 cookbook 时\n- 开发人员需从零摸索 Mistral API 的函数调用（Function Calling）参数结构，常因格式错误导致模型无法正确生成 SQL。\n- 面对多表关联的复杂场景，缺乏现成的路由逻辑参考，难以让模型准确判断该查询哪张数据表。\n- 调试过程耗时极长，团队需反复尝试提示词工程，却找不到针对 Text-to-SQL 场景的最佳实践示例。\n- 代码复现性差，不同成员编写的脚本版本混乱，缺乏统一的依赖包版本标记，导致协作效率低下。\n\n### 使用 cookbook 后\n- 直接复用 `text_to_SQL.ipynb` 中的成熟代码，快速掌握多表场景下的函数定义规范，显著降低 API 调用报错率。\n- 借鉴 `rag_via_function_calling.ipynb` 的路由设计思路，轻松实现根据用户意图自动分发查询至不同数据源的逻辑。\n- 基于 `prompting_capabilities.ipynb` 提供的分类与评估提示词模板，迅速优化模型输出质量，将开发周期从数周缩短至数天。\n- 遵循提交指南中的版本锁定要求，确保团队成员在 Google Colab 或本地环境中均能一键运行并复现相同结果。\n\ncookbook 通过提供经过验证的端到端示例，将团队从重复的底层试错中解放出来，使其能专注于业务逻辑的创新与落地。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmistralai_cookbook_3b3b9be8.png","mistralai","Mistral AI","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fmistralai_7094b1e0.png","contact@mistral.ai","mistral.ai","https:\u002F\u002Fgithub.com\u002Fmistralai",[80,84,88],{"name":81,"color":82,"percentage":83},"Jupyter Notebook","#DA5B0B",98.8,{"name":85,"color":86,"percentage":87},"Python","#3572A5",1.2,{"name":89,"color":90,"percentage":91},"Dockerfile","#384d54",0,2217,495,"2026-04-10T15:20:47","MIT",1,"","未说明",{"notes":100,"python":98,"dependencies":101},"本项目为 Mistral AI 官方提供的示例代码合集（Cookbook），主要包含 Jupyter Notebook (.ipynb) 和 Markdown (.md) 文件。大多数示例设计为在 Google Colab 上运行，通过调用 Mistral AI API 或第三方工具（如 LangChain, LlamaIndex）来使用模型，而非在本地部署大型模型。因此，本地运行通常无需高性能 GPU 或特定显存，仅需能运行 Python 笔记本的环境及有效的 API Key。部分涉及本地推理的示例（如 Ollama 集成）需参考对应第三方工具的文档获取具体硬件需求。",[],[35,14],"2026-03-27T02:49:30.150509","2026-04-14T00:11:56.849409",[106,111,116,121,126],{"id":107,"question_zh":108,"answer_zh":109,"source_url":110},32222,"使用 API 进行模型微调时，应该使用哪种数据集格式？文档中出现了两种不同的格式。","应使用包含 \"messages\" 字段的格式（即第一个示例）。文档中出现的包含 \"prompt\" 和 \"prompt_id\" 的格式是原始数据集的遗留产物，并非 API 所需的标准格式。维护者确认 \"messages\" 部分是关键，后续会修复文档以消除混淆。\n标准格式示例：\n{\n    \"messages\": [\n        {\"role\": \"user\", \"content\": \"用户输入\"},\n        {\"role\": \"assistant\", \"content\": \"助手回复\"}\n    ]\n}","https:\u002F\u002Fgithub.com\u002Fmistralai\u002Fcookbook\u002Fissues\u002F60",{"id":112,"question_zh":113,"answer_zh":114,"source_url":115},32223,"调用 Mistral OCR 功能时报错 'Mistral' object has no attribute 'ocr' 怎么办？","这是因为安装的 Python 包版本过旧。该功能在 mistralai 包的 1.5.1 版本中才可用。请运行以下命令升级包：\npip install --upgrade mistralai\n升级到 1.5.1 或更高版本后，ocr 属性即可正常使用。","https:\u002F\u002Fgithub.com\u002Fmistralai\u002Fcookbook\u002Fissues\u002F139",{"id":117,"question_zh":118,"answer_zh":119,"source_url":120},32224,"安装 Cookbook 依赖时遇到 'Could not find a version that satisfies the requirement mistralai-private' 错误如何解决？","这是一个已修复的依赖项配置错误。`mistralai-private` 不应出现在公开的安装要求中。维护者已更新相关代码，现在只需安装最新版本的 `mistralai` 即可解决此问题。请确保使用最新的 cookbook 代码并运行：\npip install --upgrade mistralai","https:\u002F\u002Fgithub.com\u002Fmistralai\u002Fcookbook\u002Fissues\u002F180",{"id":122,"question_zh":123,"answer_zh":124,"source_url":125},32225,"Mistral OCR 处理图片时返回了裁剪后的图片而不是提取出的文本内容，该如何解决？","模型设计初衷会提取图片并以 base64 格式返回，但在处理扫描不佳或旋转的图片时可能出错。可以通过在调用 `client.ocr.process` 时添加 `include_image_base64=True` 参数来获取更完整的响应数据。示例代码如下：\n\nimport base64\nfrom pathlib import Path\nfrom mistralai import ImageURLChunk\n\nimage_file = Path(\"your_image.png\")\nencoded = base64.b64encode(image_file.read_bytes()).decode()\nbase64_data_url = f\"data:image\u002Fjpeg;base64,{encoded}\"\n\nresponse = client.ocr.process(\n    document=ImageURLChunk(image_url=base64_data_url),\n    model=\"mistral-ocr-latest\",\n    include_image_base64=True\n)","https:\u002F\u002Fgithub.com\u002Fmistralai\u002Fcookbook\u002Fissues\u002F150",{"id":127,"question_zh":128,"answer_zh":129,"source_url":130},32226,"如何在 RAG 应用中限制 LLM 仅根据提供的上下文回答，拒绝回答范围外的问题？","建议使用 Mistral-7B-Instruct 模型支持的 Llama2 格式标签来构建提示词，明确界定系统指令和上下文。有效的提示词模板如下：\n\n\u003Cs>[INST] \u003C\u003CSYS>>\n你是一名助手，仅回答关于 {topic} 的查询。\n仅使用 **Contexts** 下的上下文片段进行回答。不要使用任何外部知识。如果无法从上下文中确定答案，请回复“我没有足够的信息来回答这个问题”。\n\n**Contexts**:\n{contexts}\n\u003C\u003C\u002FSYS>>\n\n{user_message} [\u002FINST]","https:\u002F\u002Fgithub.com\u002Fmistralai\u002Fcookbook\u002Fissues\u002F32",[]]