[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-ruoccofabrizio--azure-open-ai-embeddings-qna":3,"tool-ruoccofabrizio--azure-open-ai-embeddings-qna":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 真正成长为懂上",144730,2,"2026-04-07T23:26:32",[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 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107888,"2026-04-06T11:32:50",[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},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":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":10,"last_commit_at":59,"category_tags":60,"status":17},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,"2026-04-06T11:19:32",[35,15,13,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":76,"owner_company":77,"owner_location":78,"owner_email":78,"owner_twitter":78,"owner_website":78,"owner_url":79,"languages":80,"stars":89,"forks":90,"last_commit_at":91,"license":92,"difficulty_score":93,"env_os":94,"env_gpu":95,"env_ram":95,"env_deps":96,"category_tags":106,"github_topics":107,"view_count":32,"oss_zip_url":78,"oss_zip_packed_at":78,"status":17,"created_at":109,"updated_at":110,"faqs":111,"releases":142},5284,"ruoccofabrizio\u002Fazure-open-ai-embeddings-qna","azure-open-ai-embeddings-qna","A simple web application for a OpenAI-enabled document search. This repo uses Azure OpenAI Service for creating embeddings vectors from documents. For answering the question of a user, it retrieves the most relevant document and then uses GPT-3, GPT-3.5 or GPT-4 to extract the matching answer for the question.","azure-open-ai-embeddings-qna 是一款基于 Azure OpenAI 服务构建的轻量级 Web 应用，旨在为企业打造智能文档搜索与问答系统。它核心解决了传统关键词搜索难以理解语义、无法从海量文档中精准提取答案的痛点。用户只需上传文档，系统即可利用向量嵌入技术将内容转化为机器可理解的数学表示；当用户提出问题时，它能迅速检索最相关的文档片段，并调用 GPT-3.5 或 GPT-4 等大模型生成自然流畅的精准回答。\n\n这款工具特别适合开发者和技术团队使用，尤其是那些希望在 Azure 云上快速落地“检索增强生成”（RAG）架构的企业用户。其独特亮点在于提供了一套遵循最佳实践的参考架构，不仅支持一键部署，还灵活集成了 Azure Form Recognizer（用于文档解析）、Azure Search 和 Redis 等组件，形成了端到端的解决方案。此外，项目详细记录了从基础概念到 API 调用的学习资源，帮助使用者深入理解 RAG 模式中的向量搜索与提示词编排机制。无论是希望构建内部知识库助手，还是探索大模型在企业数据中的应用场景，azure-open-ai-emb","azure-open-ai-embeddings-qna 是一款基于 Azure OpenAI 服务构建的轻量级 Web 应用，旨在为企业打造智能文档搜索与问答系统。它核心解决了传统关键词搜索难以理解语义、无法从海量文档中精准提取答案的痛点。用户只需上传文档，系统即可利用向量嵌入技术将内容转化为机器可理解的数学表示；当用户提出问题时，它能迅速检索最相关的文档片段，并调用 GPT-3.5 或 GPT-4 等大模型生成自然流畅的精准回答。\n\n这款工具特别适合开发者和技术团队使用，尤其是那些希望在 Azure 云上快速落地“检索增强生成”（RAG）架构的企业用户。其独特亮点在于提供了一套遵循最佳实践的参考架构，不仅支持一键部署，还灵活集成了 Azure Form Recognizer（用于文档解析）、Azure Search 和 Redis 等组件，形成了端到端的解决方案。此外，项目详细记录了从基础概念到 API 调用的学习资源，帮助使用者深入理解 RAG 模式中的向量搜索与提示词编排机制。无论是希望构建内部知识库助手，还是探索大模型在企业数据中的应用场景，azure-open-ai-embeddings-qna 都是一个高效且易于扩展的起点。","# Azure OpenAI Embeddings QnA\n\nA simple web application for a OpenAI-enabled document search. This repo uses Azure OpenAI Service for creating embeddings vectors from documents. For answering the question of a user, it retrieves the most relevant document and then uses GPT-3 to extract the matching answer for the question.\n\n![Architecture](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_743e1e060d15.png)\n\n## Learning More about Enterprise QnA \n\nEnterprise QnA is built on a pattern the AI community calls \"Retrieval-Augmented Generation\" (RAG). In addition to this repository having a reference architecture on how to implement this pattern on Azure, here are resources to familiarize yourself with the concepts in RAG, and samples to learn each underlying product's APIs:\n\n| Resource | Links\t| Purpose| Highlights | \n| ---- | ----\t| ---- | ----------------- | \n| Reference Architecture |\t[GitHub](https:\u002F\u002Fgithub.com\u002Fruoccofabrizio\u002Fazure-open-ai-embeddings-qna) (This Repo) | \tStarter template for enterprise development.\t- Easily deployable reference architecture following best practices. |  -  Frontend is Azure OpenAI chat orchestrated with Langchain. \u003Cbr> - Composes Form Recognizer, Azure Search, Redis in an end-to-end design. \u003Cbr>\t- Supports working with Azure Search, Redis. |\n|  Educational Blog Post|\t[Microsoft Blog](https:\u002F\u002Ftechcommunity.microsoft.com\u002Ft5\u002Fai-applied-ai-blog\u002Frevolutionize-your-enterprise-data-with-chatgpt-next-gen-apps-w\u002Fba-p\u002F3762087), \u003Cbr> [GitHub](https:\u002F\u002Fgithub.com\u002FAzure-Samples\u002Fazure-search-openai-demo\u002F) |\tLearn about the building blocks in a RAG solution.\t| - Introduction to the key elements in a RAG architecture. \u003Cbr> - Understand the role of vector search in RAG scenarios.\u003Cbr> - See how Azure Search supports this pattern. \u003Cbr> - Understand the role of prompts and orchestrator like Langchain. |\n| Azure OpenAI API Sample | [GitHub](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fsample-app-aoai-chatGPT) |\tGet started with Azure OpenAI features.\t| - Sample code to make an interactive chat client as a web page.\t- Helps you get started with latest Azure OpenAI APIs |\n| Business Process Automation Samples |\t[GitHub](https:\u002F\u002Fgithub.com\u002FAzure\u002Fbusiness-process-automation)| Showcase multiple BPA scenarios implemented with Form Recognizer and Azure services.\t| - Consolidates in one repository multiple samples related to BPA and document understanding. \u003Cbr> - Includes an end to end app, GUI to create and customize a pipeline to integrate multiple Azure Cognitive services. \u003Cbr> -  Samples include document intelligence and search. | \n\n\n\n# IMPORTANT NOTE (OpenAI generated)\nWe have made some changes to the data format in the latest update of this repo. \n\u003Cbr>The new format is more efficient and compatible with the latest standards and libraries. However, we understand that some of you may have existing applications that rely on the previous format and may not be able to migrate to the new one immediately.\n\nTherefore, we have provided a way for you to continue using the previous format in a running application. All you need to do is to set your web application tag to fruocco\u002Foai-embeddings:2023-03-27_25. This will ensure that your application will use the data format that was available on March 27, 2023. We strongly recommend that you update your applications to use the new format as soon as possible.\n\nIf you want to move to the new format, please go to:\n-   \"Add Document\" -> \"Add documents in Batch\" and click on \"Convert all files and add embeddings\" to reprocess your documents. \n          \n# Use the Repo with Chat based deployment (gpt-35-turbo or gpt-4-32k or gpt-4)\nBy default, the repo uses an Instruction based model (like text-davinci-003) for QnA and Chat experience.  \nIf you want to use a Chat based deployment (gpt-35-turbo or gpt-4-32k or gpt-4), please change the environment variables as described [here](#environment-variables)\n\n# Running this repo\nYou have multiple options to run the code:\n-   [Deploy on Azure (WebApp + Batch Processing) with Azure Cognitive Search](#deploy-on-azure-webapp--batch-processing-with-azure-cognitive-search)\n-   [Deploy on Azure (WebApp + Azure Cache for Redis + Batch Processing)](#deploy-on-azure-webapp--azure-cache-for-redis-enterprise--batch-processing)\n-   [Deploy on Azure\u002FAzure China (WebApp + Redis Stack + Batch Processing)](#deploy-on-azureazure-china-webapp--redis-stack--batch-processing)\n-   [Deploy on Azure\u002FAzure China (WebApp + Azure PostgreSQL + Batch Processing)](#deploy-on-azureazure-china-webapp--azure-postgresql--batch-processing)\n-   [Run everything locally in Docker (WebApp + Redis Stack + Batch Processing)](#run-everything-locally-in-docker-webapp--redis-stack--batch-processing)\n-   [Run everything locally in Python with Conda (WebApp only)](#run-everything-locally-in-python-with-conda-webapp-only)\n-   [Run everything locally in Python with venv](#run-everything-locally-in-python-with-venv)\n-   [Run WebApp locally in Docker against an existing Redis deployment](#run-webapp-locally-in-docker-against-an-existing-redis-deployment)\n\n## Deploy on Azure (WebApp + Batch Processing) with Azure Cognitive Search\n[![Deploy to Azure](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_7343390a6970.png)](https:\u002F\u002Fportal.azure.com\u002F#create\u002FMicrosoft.Template\u002Furi\u002Fhttps%3A%2F%2Fraw.githubusercontent.com%2Fruoccofabrizio%2Fazure-open-ai-embeddings-qna%2Fmain%2Finfrastructure%2Fdeployment_ACS.json)\n\nClick on the Deploy to Azure button and configure your settings in the Azure Portal as described in the [Environment variables](#environment-variables) section.\n\n![Architecture](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_f771ea9df47d.png)\n\nPlease be aware that you need:\n-   an existing Azure OpenAI resource with models deployments (instruction models e.g. text-davinci-003, and embeddings models e.g. text-embedding-ada-002)\n\n### Signing up for Vector Search Private Preview in Azure Cognitive Search\nAzure Cognitive Search supports searching using pure vectors, pure text, or in hybrid mode where both are combined. For the vector-based cases, you'll need to sign up for Vector Search Private Preview. To sign up, please fill in this form: [https:\u002F\u002Faka.ms\u002FVectorSearchSignUp](https:\u002F\u002Faka.ms\u002FVectorSearchSignUp).\n\nPreview functionality is provided under [Supplemental Terms of Use](https:\u002F\u002Fazure.microsoft.com\u002Fen-us\u002Fsupport\u002Flegal\u002Fpreview-supplemental-terms\u002F), without a service level agreement, and isn't recommended for production workloads.\n\n\n## Deploy on Azure (WebApp + Azure Cache for Redis Enterprise + Batch Processing)\n[![Deploy to Azure](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_7343390a6970.png)](https:\u002F\u002Fportal.azure.com\u002F#create\u002FMicrosoft.Template\u002Furi\u002Fhttps%3A%2F%2Fraw.githubusercontent.com%2Fruoccofabrizio%2Fazure-open-ai-embeddings-qna%2Fmain%2Finfrastructure%2FdeploymentACRE.json)\n\nClick on the Deploy to Azure button to automatically deploy a template on Azure by with the resources needed to run this example. This option will provision an instance of [Azure Cache for Redis](https:\u002F\u002Flearn.microsoft.com\u002Fazure\u002Fazure-cache-for-redis\u002Fcache-overview) with [RediSearch](https:\u002F\u002Flearn.microsoft.com\u002Fazure\u002Fazure-cache-for-redis\u002Fcache-redis-modules#redisearch) installed to store vectors and perform the similiarity search. \n\n![Architecture](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_69685d44ad5b.png)\n\nPlease be aware that you still need:\n-   an existing Azure OpenAI resource with models deployments (instruction models e.g. `text-davinci-003`, and embeddings models e.g. `text-embedding-ada-002`) \n-   an existing Form Recognizer Resource \n-   an existing Translator Resource\n-   Azure marketplace access. (Azure Cache for Redis Enterprise uses the marketplace for IP billing)\n\nYou will add the endpoint and access key information for these resources when deploying the template. \n\n## Deploy on Azure\u002FAzure China (WebApp + Redis Stack + Batch Processing)\n[![Deploy to Azure](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_7343390a6970.png)](https:\u002F\u002Fportal.azure.com\u002F#create\u002FMicrosoft.Template\u002Furi\u002Fhttps%3A%2F%2Fraw.githubusercontent.com%2Fruoccofabrizio%2Fazure-open-ai-embeddings-qna%2Fmain%2Finfrastructure%2Fdeployment.json) \n[![Deploy to Azure](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_fe91171d8920.png)](https:\u002F\u002Fportal.azure.cn\u002F#create\u002FMicrosoft.Template\u002Furi\u002Fhttps%3A%2F%2Fraw.githubusercontent.com%2Fcyberflying%2Fazure-open-ai-embeddings-qna%2Fmain%2Finfrastructure%2Fdeployment_azcn.json)\n\nClick on the Deploy to Azure button and configure your settings in the Azure Portal as described in the [Environment variables](#environment-variables) section.\n\n![Architecture](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_eade9a353993.png)\n\nPlease be aware that you need:\n-   an existing Azure OpenAI resource with models deployments (instruction models e.g. `text-davinci-003`, and embeddings models e.g. `text-embedding-ada-002`) \n-   an existing Form Recognizer Resource (OPTIONAL - if you want to extract text out of documents)\n-   an existing Translator Resource (OPTIONAL - if you want to translate documents)\n\n## Deploy on Azure\u002FAzure China (WebApp + Azure PostgreSQL + Batch Processing)\n[![Deploy to Azure](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_7343390a6970.png)](https:\u002F\u002Fportal.azure.com\u002F#create\u002FMicrosoft.Template\u002Furi\u002Fhttps%3A%2F%2Fraw.githubusercontent.com%2Fcyberflying%2Fazure-open-ai-embeddings-qna%2Fmain%2Finfrastructure%2Fdeployment_pg.json)\n[![Deploy to Azure](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_fe91171d8920.png)](https:\u002F\u002Fportal.azure.cn\u002F#create\u002FMicrosoft.Template\u002Furi\u002Fhttps%3A%2F%2Fraw.githubusercontent.com%2Fcyberflying%2Fazure-open-ai-embeddings-qna%2Fmain%2Finfrastructure%2Fdeployment_pg_azcn.json)\n\nClick on the Deploy to Azure button and configure your settings in the Azure Portal as described in the [Environment variables](#environment-variables) section.\n\n![Architecture](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_93c99cbb3b44.png)\n\n\n## Run everything locally in Docker (WebApp + Redis Stack + Batch Processing)\n\nFirst, clone the repo:\n\n```console\ngit clone https:\u002F\u002Fgithub.com\u002Fruoccofabrizio\u002Fazure-open-ai-embeddings-qna\ncd azure-open-ai-embeddings-qna\n```\n\nNext, configure your `.env` as described in [Environment variables](#environment-variables):\n\n\n```console\ncp .env.template .env\nvi .env # or use whatever you feel comfortable with\n```\n\nFinally run the application:\n\n```console\ndocker compose up\n```\n\nOpen your browser at [http:\u002F\u002Flocalhost:8080](http:\u002F\u002Flocalhost:8080)\n\nThis will spin up three Docker containers:\n-   The WebApp itself\n-   Redis Stack for storing the embeddings\n-   Batch Processing Azure Function\n\nNOTE: Please note that the Batch Processing Azure Function uses an Azure Storage Account for queuing the documents to process. Please create a Queue named \"doc-processing\" in the account used for the \"AzureWebJobsStorage\" env setting.\n\n## Run everything locally in Python with Conda (WebApp only)\n\nThis requires Redis running somewhere and expects that you've setup `.env` as described above. In this case, point `REDIS_ADDRESS` to your Redis deployment. \n\nYou can run a local Redis instance via:\n```console\n docker run -p 6379:6379 redis\u002Fredis-stack-server:latest\n```\n\nYou can run a local Batch Processing Azure Function:\n```console\n docker run -p 7071:80 fruocco\u002Foai-batch:latest\n```\n\nCreate `conda` environment for Python:\n\n```console\nconda env create -f code\u002Fenvironment.yml\nconda activate openai-qna-env\n```\n\nConfigure your `.env` as described in as described in [Environment variables](#environment-variables)\n\nRun WebApp:\n```console\ncd code\nstreamlit run OpenAI_Queries.py\n```\n\n## Run everything locally in Python with venv\nThis requires Redis running somewhere and expects that you've setup `.env` as described above. In this case, point `REDIS_ADDRESS` to your Redis deployment. \n\nYou can run a local Redis instance via:\n```console\n docker run -p 6379:6379 redis\u002Fredis-stack-server:latest\n```\n\nYou can run a local Batch Processing Azure Function:\n```console\n docker run -p 7071:80 fruocco\u002Foai-batch:latest\n```\n\nPlease ensure you have Python 3.9+ installed.\n\nCreate `venv` environment for Python:\n\n```console\npython -m venv .venv\n.venv\\Scripts\\activate\n```\n\nInstall `PIP` Requirements\n```console\npip install -r code\\requirements.txt\n```\n\nConfigure your `.env` as described in as described in [Environment variables](#environment-variables)\n\nRun the WebApp\n```console\ncd code\nstreamlit run OpenAI_Queries.py\n```\n\n## Run WebApp locally in Docker against an existing Redis deployment\n\n### Option 1 - Run the prebuilt Docker image\n\nConfigure your `.env` as described in as described in [Environment variables](#environment-variables)\n\nThen run:\n\n```console\ndocker run --env-file .env -p 8080:80 fruocco\u002Foai-embeddings:latest\n```\n\n### Option 2 - Build the Docker image yourself\n\nConfigure your `.env` as described in as described in [Environment variables](#environment-variables)\n\n```console\ndocker build . -f Dockerfile -t your_docker_registry\u002Fyour_docker_image:your_tag\ndocker run --env-file .env -p 8080:80 your_docker_registry\u002Fyour_docker_image:your_tag\n```\n\nNote: You can use \n-   WebApp.Dockerfile to build the Web Application\n-   BatchProcess.Dockerfile to build the Azure Function for Batch Processing\n\n## Use the QnA API from the backend\nYou can use a QnA API on your data exposed by the Azure Function for Batch Processing. \n\n```python\nPOST https:\u002F\u002FYOUR_BATCH_PROCESS_AZURE_FUNCTION_URL\u002Fapi\u002FapiQnA\nBody:\n    question: str\n    history: (str,str) -- OPTIONAL\n    custom_prompt: str -- OPTIONAL\n    custom_temperature: float --OPTIONAL\n\nReturn:\n{'context': 'Introduction to Azure Cognitive Search - Azure Cognitive Search '\n            '(formerly known as \"Azure Search\") is a cloud search service that '\n            'gives developers infrastructure, APIs, and tools for building a '\n            'rich search experience over private, heterogeneous content in '\n            'web, mobile, and enterprise applications...'\n            '...'\n            '...',\n\n 'question': 'What is ACS?',\n\n 'response': 'ACS stands for Azure Cognitive Search, which is a cloud search service'\n             'that provides infrastructure, APIs, and tools for building a rich search experience'\n             'over private, heterogeneous content in web, mobile, and enterprise applications...'\n             '...'\n             '...',\n             \n 'sources': '[https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fazure\u002Fsearch\u002Fsearch-what-is-azure-search](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fazure\u002Fsearch\u002Fsearch-what-is-azure-search)'}\n```\n\n### Call the API with no history for QnA mode\n```python\nimport requests\n\nr = requests.post('http:\u002F\u002Fhttp:\u002F\u002FYOUR_BATCH_PROCESS_AZURE_FUNCTION_URL\u002Fapi\u002FapiQnA', json={\n    'question': 'What is the capital of Italy?'\n    })\n\n```\n### Call the API with history for Chat mode\n```python\nr = requests.post('http:\u002F\u002FYOUR_BATCH_PROCESS_AZURE_FUNCTION_URL\u002Fapi\u002FapiQnA', json={\n    'question': 'can I use python SDK?',\n    'history': [\n        (\"what's ACS?\", \n        'ACS stands for Azure Cognitive Search, which is a cloud search service that provides infrastructure, APIs, and tools for building a rich search experience over private, heterogeneous content in web, mobile, and enterprise applications. It includes a search engine for full-text search, rich indexing with lexical analysis and AI enrichment for content extraction and transformation, rich query syntax for text search, fuzzy search, autocomplete, geo-search, and more. ACS can be created, loaded, and queried using the portal, REST API, .NET SDK, or another SDK. It also includes data integration at the indexing layer, AI and machine learning integration with Azure Cognitive Services, and security integration with Azure Active Directory and Azure Private Link integration.'\n        )\n        ]\n    })\n```\n\n## Environment variables\n\nHere is the explanation of the parameters:\n\n| App Setting | Value | Note |\n| --- | --- | ------------- |\n|OPENAI_ENGINE|text-davinci-003|Engine deployed in your Azure OpenAI resource. E.g. Instruction based model: text-davinci-003 or Chat based model: gpt-35-turbo or gpt-4-32k or gpt-4. Please use the deployment name and not the model name.|\n|OPENAI_DEPLOYMENT_TYPE | Text | Text for Instruction engines (text-davinci-003), \u003Cbr> Chat for Chat based deployment (gpt-35-turbo or gpt-4-32k or gpt-4) |\n|OPENAI_EMBEDDINGS_ENGINE_DOC | text-embedding-ada-002  | Embedding engine for documents deployed in your Azure OpenAI resource|\n|OPENAI_EMBEDDINGS_ENGINE_QUERY | text-embedding-ada-002  | Embedding engine for query deployed in your Azure OpenAI resource|\n|OPENAI_API_BASE | https:\u002F\u002FYOUR_AZURE_OPENAI_RESOURCE.openai.azure.com\u002F | Your Azure OpenAI Resource name. Get it in the [Azure Portal](https:\u002F\u002Fportal.azure.com)|\n|OPENAI_API_KEY| YOUR_AZURE_OPENAI_KEY | Your Azure OpenAI API Key. Get it in the [Azure Portal](https:\u002F\u002Fportal.azure.com)|\n|OPENAI_TEMPERATURE|0.1| Azure OpenAI Temperature |\n|OPENAI_MAX_TOKENS|-1| Azure OpenAI Max Tokens |\n|AZURE_CLOUD|AzureCloud| Azure Cloud to use. AzureCloud for Azure Global, AzureChinaCloud for Azure China |\n|VECTOR_STORE_TYPE| PGVector | Vector Store Type. Use AzureSearch for Azure Cognitive Search, PGVector for Azure PostgreSQL, leave it blank for Redis or Azure Cache for Redis Enterprise|\n|AZURE_SEARCH_SERVICE_NAME| YOUR_AZURE_SEARCH_SERVICE_URL | Your Azure Cognitive Search service name. Get it in the [Azure Portal](https:\u002F\u002Fportal.azure.com)|\n|AZURE_SEARCH_ADMIN_KEY| AZURE_SEARCH_ADMIN_KEY | Your Azure Cognitive Search Admin key. Get it in the [Azure Portal](https:\u002F\u002Fportal.azure.com)|\n|PGVECTOR_HOST|Your_PG_NAME.postgres.database.azure.com or Your_PG_NAME.postgres.database.chinacloudapi.cn\n|PGVECTOR_PORT|5432\n|PGVECTOR_DATABASE|YOUR_PG_DATABASE\n|PGVECTOR_USER|YOUR_PG_USER\n|PGVECTOR_PASSWORD|YOUR_PG_PASSWORD\n|REDIS_ADDRESS| api | URL for Redis Stack: \"api\" for docker compose|\n|REDIS_PORT | 6379 | Port for Redis |\n|REDIS_PASSWORD| redis-stack-password | OPTIONAL - Password for your Redis Stack|\n|REDIS_ARGS | --requirepass redis-stack-password | OPTIONAL - Password for your Redis Stack|\n|REDIS_PROTOCOL| redis:\u002F\u002F | |\n|CHUNK_SIZE | 500 | OPTIONAL: Chunk size for splitting long documents in multiple subdocs. Default value: 500 |\n|CHUNK_OVERLAP |100 | OPTIONAL: Overlap between chunks for document splitting. Default: 100 |\n|CONVERT_ADD_EMBEDDINGS_URL| http:\u002F\u002Fbatch\u002Fapi\u002FBatchStartProcessing | URL for Batch processing Function: \"http:\u002F\u002Fbatch\u002Fapi\u002FBatchStartProcessing\" for docker compose |\n|AzureWebJobsStorage | AZURE_BLOB_STORAGE_CONNECTION_STRING FOR_AZURE_FUNCTION_EXECUTION | Azure Blob Storage Connection string for Azure Function - Batch Processing |\n\n\n\nOptional parameters for additional features (e.g. document text extraction with OCR):\n\n| App Setting | Value | Note |\n| --- | --- | ------------- |\n|BLOB_ACCOUNT_NAME| YOUR_AZURE_BLOB_STORAGE_ACCOUNT_NAME| OPTIONAL - Get it in the [Azure Portal](https:\u002F\u002Fportal.azure.com) if you want to use the document extraction feature |\n|BLOB_ACCOUNT_KEY| YOUR_AZURE_BLOB_STORAGE_ACCOUNT_KEY| OPTIONAL - Get it in the [Azure Portal](https:\u002F\u002Fportal.azure.com)if you want to use document extraction feature|\n|BLOB_CONTAINER_NAME| YOUR_AZURE_BLOB_STORAGE_CONTAINER_NAME| OPTIONAL - Get it in the [Azure Portal](https:\u002F\u002Fportal.azure.com) if you want to use document extraction feature|\n|FORM_RECOGNIZER_ENDPOINT| YOUR_AZURE_FORM_RECOGNIZER_ENDPOINT| OPTIONAL - Get it in the [Azure Portal](https:\u002F\u002Fportal.azure.com) if you want to use document extraction feature|\n|FORM_RECOGNIZER_KEY| YOUR_AZURE_FORM_RECOGNIZER_KEY| OPTIONAL - Get it in the [Azure Portal](https:\u002F\u002Fportal.azure.com) if you want to use document extraction feature|\n|PAGES_PER_EMBEDDINGS| Number of pages for embeddings creation. Keep in mind you should have less than 3K token for each embedding.| Default: A new embedding is created every 2 pages.|\n|TRANSLATE_ENDPOINT| YOUR_AZURE_TRANSLATE_ENDPOINT| OPTIONAL - Get it in the [Azure Portal](https:\u002F\u002Fportal.azure.com) if you want to use translation feature|\n|TRANSLATE_KEY| YOUR_TRANSLATE_KEY| OPTIONAL - Get it in the [Azure Portal](https:\u002F\u002Fportal.azure.com) if you want to use translation feature|\n|TRANSLATE_REGION| YOUR_TRANSLATE_REGION| OPTIONAL - Get it in the [Azure Portal](https:\u002F\u002Fportal.azure.com) if you want to use translation feature|\n|VNET_DEPLOYMENT| false | Boolean variable to set \"true\" if you want to deploy the solution in a VNET. Please check your [Azure Form Recognizer](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fazure\u002Fapplied-ai-services\u002Fform-recognizer\u002Fmanaged-identities-secured-access?view=form-recog-2.1.0) and [Azure Translator](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fazure\u002Fcognitive-services\u002Ftranslator\u002Freference\u002Fv3-0-reference#virtual-network-support) endpoints as well.|\n\n# DISCLAIMER\nThis presentation, demonstration, and demonstration model are for informational purposes only and (1) are not subject to SOC 1 and SOC 2 compliance audits, and (2) are not designed, intended or made available as a medical device(s) or as a substitute for professional medical advice, diagnosis, treatment or judgment. Microsoft makes no warranties, express or implied, in this presentation, demonstration, and demonstration model. Nothing in this presentation, demonstration, or demonstration model modifies any of the terms and conditions of Microsoft’s written and signed agreements. This is not an offer and applicable terms and the information provided are subject to revision and may be changed at any time by Microsoft.\n\nThis presentation, demonstration, and demonstration model do not give you or your organization any license to any patents, trademarks, copyrights, or other intellectual property covering the subject matter in this presentation, demonstration, and demonstration model.\n\nThe information contained in this presentation, demonstration and demonstration model represents the current view of Microsoft on the issues discussed as of the date of presentation and\u002For demonstration, for the duration of your access to the demonstration model. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of presentation and\u002For demonstration and for the duration of your access to the demonstration model.\n\nNo Microsoft technology, nor any of its component technologies, including the demonstration model, is intended or made available as a substitute for the professional advice, opinion, or judgment of (1) a certified financial services professional, or (2) a certified medical professional. Partners or customers are responsible for ensuring the regulatory compliance of any solution they build using Microsoft technologies.\n","# Azure OpenAI 嵌入问答\n\n一个基于 OpenAI 的简单文档搜索 Web 应用程序。此仓库使用 Azure OpenAI 服务从文档中创建嵌入向量。为了回答用户的问题，它会检索最相关的文档，然后使用 GPT-3 提取与问题匹配的答案。\n\n![架构](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_743e1e060d15.png)\n\n## 深入了解企业级问答系统\n\n企业级问答系统基于人工智能社区称为“检索增强生成”（RAG）的模式构建。除了本仓库提供在 Azure 上实现该模式的参考架构外，以下资源可以帮助您熟悉 RAG 中的相关概念，并通过示例学习各个基础产品的 API：\n\n| 资源 | 链接 | 目的 | 亮点 |\n| ---- | ---- | ---- | ----------------- |\n| 参考架构 | [GitHub](https:\u002F\u002Fgithub.com\u002Fruoccofabrizio\u002Fazure-open-ai-embeddings-qna)（本仓库） | 企业级开发的入门模板。 - 易于部署且遵循最佳实践的参考架构。 | - 前端由 Langchain 协调的 Azure OpenAI 聊天组成。\u003Cbr> - 将表单识别器、Azure 搜索和 Redis 组合在一个端到端设计中。\u003Cbr> - 支持与 Azure 搜索、Redis 集成。 |\n| 教育博客文章 | [Microsoft 博客](https:\u002F\u002Ftechcommunity.microsoft.com\u002Ft5\u002Fai-applied-ai-blog\u002Frevolutionize-your-enterprise-data-with-chatgpt-next-gen-apps-w\u002Fba-p\u002F3762087), \u003Cbr> [GitHub](https:\u002F\u002Fgithub.com\u002FAzure-Samples\u002Fazure-search-openai-demo\u002F) | 学习 RAG 解决方案中的构建模块。 | - 介绍 RAG 架构中的关键元素。\u003Cbr> - 理解向量搜索在 RAG 场景中的作用。\u003Cbr> - 了解 Azure 搜索如何支持这一模式。\u003Cbr> - 理解提示词和像 Langchain 这样的编排器的作用。 |\n| Azure OpenAI API 示例 | [GitHub](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fsample-app-aoai-chatGPT) | 开始使用 Azure OpenAI 功能。 | - 示例代码可创建一个作为网页的交互式聊天客户端。\u003Cbr> - 帮助您快速上手最新的 Azure OpenAI API |\n| 业务流程自动化示例 | [GitHub](https:\u002F\u002Fgithub.com\u002FAzure\u002Fbusiness-process-automation) | 展示使用表单识别器和 Azure 服务实现的多种 BPA 场景。 | - 将多个与 BPA 和文档理解相关的示例整合到一个仓库中。\u003Cbr> - 包括一个端到端应用，带有用于创建和自定义集成多个 Azure 认知服务管道的 GUI。\u003Cbr> - 示例涵盖文档智能和搜索。 |\n\n\n\n# 重要提示（由 OpenAI 生成）\n我们在本仓库的最新更新中对数据格式进行了一些更改。\n\u003Cbr>新格式更加高效，并且兼容最新的标准和库。然而，我们理解有些用户可能已有依赖旧格式的应用程序，暂时无法迁移到新格式。\n\n因此，我们提供了一种方法，让您可以在正在运行的应用程序中继续使用旧格式。您只需将您的 Web 应用程序标签设置为 fruocco\u002Foai-embeddings:2023-03-27_25。这将确保您的应用程序使用 2023 年 3 月 27 日可用的数据格式。我们强烈建议您尽快将应用程序更新为使用新格式。\n\n如果您想切换到新格式，请前往：\n-   “添加文档” -> “批量添加文档”，然后点击“转换所有文件并添加嵌入”以重新处理您的文档。 \n\n# 使用基于聊天的部署方式（gpt-35-turbo 或 gpt-4-32k 或 gpt-4）运行本仓库\n默认情况下，本仓库使用基于指令的模型（如 text-davinci-003）来进行问答和聊天体验。  \n如果您想使用基于聊天的部署方式（gpt-35-turbo 或 gpt-4-32k 或 gpt-4），请按照[此处](#environment-variables)所述更改环境变量。\n\n# 运行本仓库\n您有多种方式可以运行代码：\n-   [在 Azure 上部署（WebApp + 批量处理）并结合 Azure 认知搜索](#deploy-on-azure-webapp--batch-processing-with-azure-cognitive-search)\n-   [在 Azure 上部署（WebApp + Azure Cache for Redis + 批量处理）](#deploy-on-azure-webapp--azure-cache-for-redis-enterprise--batch-processing)\n-   [在 Azure\u002FAzure China 上部署（WebApp + Redis Stack + 批量处理）](#deploy-on-azureazure-china-webapp--redis-stack--batch-processing)\n-   [在 Azure\u002FAzure China 上部署（WebApp + Azure PostgreSQL + 批量处理）](#deploy-on-azureazure-china-webapp--azure-postgresql--batch-processing)\n-   [在本地 Docker 中运行全部组件（WebApp + Redis Stack + 批量处理）](#run-everything-locally-in-docker-webapp--redis-stack--batch-processing)\n-   [仅在本地 Python 中使用 Conda 运行 WebApp](#run-everything-locally-in-python-with-conda-webapp-only)\n-   [在本地 Python 中使用 venv 运行全部组件](#run-everything-locally-in-python-with-venv)\n-   [在本地 Docker 中运行 WebApp，并连接到现有的 Redis 部署](#run-webapp-locally-in-docker-against-an-existing-redis-deployment)\n\n## 在 Azure 上部署（WebApp + 批量处理）并结合 Azure 认知搜索\n[![部署到 Azure](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_7343390a6970.png)](https:\u002F\u002Fportal.azure.com\u002F#create\u002FMicrosoft.Template\u002Furi\u002Fhttps%3A%2F%2Fraw.githubusercontent.com%2Fruoccofabrizio%2Fazure-open-ai-embeddings-qna%2Fmain%2Finfrastructure%2Fdeployment_ACS.json)\n\n点击“部署到 Azure”按钮，并按照[环境变量](#environment-variables)部分的说明在 Azure 门户中配置您的设置。\n\n![架构](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_f771ea9df47d.png)\n\n请注意，您需要：\n-   一个已有的 Azure OpenAI 资源，其中包含模型部署（例如指令模型 text-davinci-003 和嵌入模型 text-embedding-ada-002）\n\n### 注册 Azure 认知搜索中的向量搜索私有预览版\nAzure 认知搜索支持纯向量搜索、纯文本搜索，以及将两者结合的混合模式。对于基于向量的场景，您需要注册向量搜索私有预览版。要注册，请填写此表格：[https:\u002F\u002Faka.ms\u002FVectorSearchSignUp](https:\u002F\u002Faka.ms\u002FVectorSearchSignUp)。\n\n预览功能受[补充使用条款](https:\u002F\u002Fazure.microsoft.com\u002Fen-us\u002Fsupport\u002Flegal\u002Fpreview-supplemental-terms\u002F)约束，不提供服务级别协议，不建议用于生产工作负载。\n\n## 在 Azure 上部署（Web 应用 + Azure Cache for Redis Enterprise + 批量处理）\n[![部署到 Azure](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_7343390a6970.png)](https:\u002F\u002Fportal.azure.com\u002F#create\u002FMicrosoft.Template\u002Furi\u002Fhttps%3A%2F%2Fraw.githubusercontent.com%2Fruoccofabrizio%2Fazure-open-ai-embeddings-qna%2Fmain%2Finfrastructure%2FdeploymentACRE.json)\n\n点击“部署到 Azure”按钮，即可在 Azure 上自动部署一个模板，其中包含运行此示例所需的资源。该选项将预配一个安装了 [RediSearch](https:\u002F\u002Flearn.microsoft.com\u002Fazure\u002Fazure-cache-for-redis\u002Fcache-redis-modules#redisearch) 的 [Azure Cache for Redis](https:\u002F\u002Flearn.microsoft.com\u002Fazure\u002Fazure-cache-for-redis\u002Fcache-overview) 实例，用于存储向量并执行相似度搜索。\n\n![架构图](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_69685d44ad5b.png)\n\n请注意，您仍然需要：\n- 一个已存在的 Azure OpenAI 资源，并已部署模型（例如指令模型 `text-davinci-003` 和嵌入模型 `text-embedding-ada-002`）\n- 一个已存在的表单识别器资源\n- 一个已存在的翻译服务资源\n- Azure 市场访问权限。（Azure Cache for Redis Enterprise 使用市场进行 IP 计费）\n\n您需要在部署模板时提供这些资源的终结点和访问密钥信息。\n\n## 在 Azure\u002FAzure 中国区上部署（Web 应用 + Redis Stack + 批量处理）\n[![部署到 Azure](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_7343390a6970.png)](https:\u002F\u002Fportal.azure.com\u002F#create\u002FMicrosoft.Template\u002Furi\u002Fhttps%3A%2F%2Fraw.githubusercontent.com%2Fruoccofabrizio%2Fazure-open-ai-embeddings-qna%2Fmain%2Finfrastructure%2Fdeployment.json)\n[![部署到 Azure 中国区](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_fe91171d8920.png)](https:\u002F\u002Fportal.azure.cn\u002F#create\u002FMicrosoft.Template\u002Furi\u002Fhttps%3A%2F%2Fraw.githubusercontent.com%2Fcyberflying%2Fazure-open-ai-embeddings-qna%2Fmain%2Finfrastructure%2Fdeployment_azcn.json)\n\n点击“部署到 Azure”按钮，并按照 [环境变量](#environment-variables) 部分的说明在 Azure 门户中配置您的设置。\n\n![架构图](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_eade9a353993.png)\n\n请注意，您需要：\n- 一个已存在的 Azure OpenAI 资源，并已部署模型（例如指令模型 `text-davinci-003` 和嵌入模型 `text-embedding-ada-002`）\n- 一个可选的已存在的表单识别器资源（如果您希望从文档中提取文本）\n- 一个可选的已存在的翻译服务资源（如果您希望翻译文档）\n\n## 在 Azure\u002FAzure 中国区上部署（Web 应用 + Azure PostgreSQL + 批量处理）\n[![部署到 Azure](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_7343390a6970.png)](https:\u002F\u002Fportal.azure.com\u002F#create\u002FMicrosoft.Template\u002Furi\u002Fhttps%3A%2F%2Fraw.githubusercontent.com%2Fcyberflying%2Fazure-open-ai-embeddings-qna%2Fmain%2Finfrastructure%2Fdeployment_pg.json)\n[![部署到 Azure 中国区](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_fe91171d8920.png)](https:\u002F\u002Fportal.azure.cn\u002F#create\u002FMicrosoft.Template\u002Furi\u002Fhttps%3A%2F%2Fraw.githubusercontent.com%2Fcyberflying%2Fazure-open-ai-embeddings-qna%2Fmain%2Finfrastructure%2Fdeployment_pg_azcn.json)\n\n点击“部署到 Azure”按钮，并按照 [环境变量](#environment-variables) 部分的说明在 Azure 门户中配置您的设置。\n\n![架构图](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_readme_93c99cbb3b44.png)\n\n## 在本地使用 Docker 运行所有组件（Web 应用 + Redis Stack + 批量处理）\n\n首先，克隆仓库：\n\n```console\ngit clone https:\u002F\u002Fgithub.com\u002Fruoccofabrizio\u002Fazure-open-ai-embeddings-qna\ncd azure-open-ai-embeddings-qna\n```\n\n接下来，按照 [环境变量](#environment-variables) 中的说明配置 `.env` 文件：\n\n```console\ncp .env.template .env\nvi .env # 或者使用您熟悉的编辑器\n```\n\n最后，运行应用程序：\n\n```console\ndocker compose up\n```\n\n打开浏览器访问 [http:\u002F\u002Flocalhost:8080](http:\u002F\u002Flocalhost:8080)。\n\n这将启动三个 Docker 容器：\n- Web 应用本身\n- 用于存储嵌入的 Redis Stack\n- 批量处理的 Azure 函数\n\n注意：批量处理的 Azure 函数使用 Azure 存储账户来排队待处理的文档。请在用于 `AzureWebJobsStorage` 环境变量设置的存储账户中创建一个名为 “doc-processing” 的队列。\n\n## 在本地使用 Python 和 Conda 运行所有组件（仅 Web 应用）\n\n这需要 Redis 在某个地方运行，并且假设您已按照上述说明设置了 `.env` 文件。在这种情况下，请将 `REDIS_ADDRESS` 指向您的 Redis 部署。\n\n您可以通过以下命令运行本地 Redis 实例：\n```console\n docker run -p 6379:6379 redis\u002Fredis-stack-server:latest\n```\n\n您还可以运行本地的批量处理 Azure 函数：\n```console\n docker run -p 7071:80 fruocco\u002Foai-batch:latest\n```\n\n创建 Python 的 `conda` 环境：\n\n```console\nconda env create -f code\u002Fenvironment.yml\nconda activate openai-qna-env\n```\n\n按照 [环境变量](#environment-variables) 中的说明配置 `.env` 文件。\n\n运行 Web 应用程序：\n```console\ncd code\nstreamlit run OpenAI_Queries.py\n```\n\n## 在本地使用 Python 和 venv 运行所有组件\n\n这同样需要 Redis 在某个地方运行，并且假设您已按照上述说明设置了 `.env` 文件。在这种情况下，请将 `REDIS_ADDRESS` 指向您的 Redis 部署。\n\n您可以通过以下命令运行本地 Redis 实例：\n```console\n docker run -p 6379:6379 redis\u002Fredis-stack-server:latest\n```\n\n您还可以运行本地的批量处理 Azure 函数：\n```console\n docker run -p 7071:80 fruocco\u002Foai-batch:latest\n```\n\n请确保已安装 Python 3.9 或更高版本。\n\n创建 Python 的 `venv` 环境：\n\n```console\npython -m venv .venv\n.venv\\Scripts\\activate\n```\n\n安装 `PIP` 依赖项：\n```console\npip install -r code\\requirements.txt\n```\n\n按照 [环境变量](#environment-variables) 中的说明配置 `.env` 文件。\n\n运行 Web 应用程序：\n```console\ncd code\nstreamlit run OpenAI_Queries.py\n```\n\n## 在本地使用 Docker 运行 Web 应用，并连接到现有的 Redis 部署\n\n### 选项 1 - 运行预构建的 Docker 镜像\n\n按照 [环境变量](#environment-variables) 中的说明配置 `.env` 文件。\n\n然后运行：\n```console\ndocker run --env-file .env -p 8080:80 fruocco\u002Foai-embeddings:latest\n```\n\n### 选项 2 - 自己构建 Docker 镜像\n\n按照 [环境变量](#environment-variables) 中的说明配置 `.env` 文件。\n\n```console\ndocker build . -f Dockerfile -t your_docker_registry\u002Fyour_docker_image:your_tag\ndocker run --env-file .env -p 8080:80 your_docker_registry\u002Fyour_docker_image:your_tag\n```\n\n注意：您可以使用\n- WebApp.Dockerfile 来构建 Web 应用程序\n- BatchProcess.Dockerfile 来构建批量处理的 Azure 函数\n\n## 从后端使用 QnA API\n您可以在由 Azure Function for Batch Processing 公开的数据上使用 QnA API。\n\n```python\nPOST https:\u002F\u002FYOUR_BATCH_PROCESS_AZURE_FUNCTION_URL\u002Fapi\u002FapiQnA\n请求体：\n    question: str\n    history: (str,str) -- 可选\n    custom_prompt: str -- 可选\n    custom_temperature: float --可选\n\n返回：\n{'context': 'Azure 认知搜索简介 - Azure 认知搜索（以前称为“Azure 搜索”）是一项云搜索服务，为开发人员提供基础设施、API 和工具，用于在 Web、移动和企业应用程序中对私有、异构内容构建丰富的搜索体验...'\n            '...'\n            '...',\n\n 'question': '什么是 ACS？',\n\n 'response': 'ACS 是 Azure 认知搜索的缩写，它是一项云搜索服务，提供基础设施、API 和工具，用于在 Web、移动和企业应用程序中对私有、异构内容构建丰富的搜索体验...'\n             '...'\n             '...',\n             \n 'sources': '[https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fazure\u002Fsearch\u002Fsearch-what-is-azure-search](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fazure\u002Fsearch\u002Fsearch-what-is-azure-search)'}\n```\n\n### 在无历史记录的情况下调用 API 进行 QnA 模式\n```python\nimport requests\n\nr = requests.post('http:\u002F\u002FYOUR_BATCH_PROCESS_AZURE_FUNCTION_URL\u002Fapi\u002FapiQnA', json={\n    'question': '意大利的首都是哪里？'\n    })\n\n```\n### 在有历史记录的情况下调用 API 进行聊天模式\n```python\nr = requests.post('YOUR_BATCH_PROCESS_AZURE_FUNCTION_URL\u002Fapi\u002FapiQnA', json={\n    'question': '我可以使用 Python SDK 吗？',\n    'history': [\n        (\"什么是 ACS？\", \n        'ACS 是 Azure 认知搜索的缩写，它是一项云搜索服务，提供基础设施、API 和工具，用于在 Web、移动和企业应用程序中对私有、异构内容构建丰富的搜索体验。它包括用于全文搜索的搜索引擎、带有词汇分析和 AI 增强功能的丰富索引，以实现内容提取和转换；丰富的查询语法，支持文本搜索、模糊搜索、自动补全、地理搜索等。ACS 可以通过门户、REST API、.NET SDK 或其他 SDK 创建、加载和查询。此外，它还包含索引层的数据集成、与 Azure 认知服务的 AI 和机器学习集成，以及与 Azure Active Directory 和 Azure Private Link 的安全集成。'\n        )\n        ]\n    })\n```\n\n## 环境变量\n\n以下是参数说明：\n\n| 应用设置 | 值 | 备注 |\n| --- | --- | ------------- |\n|OPENAI_ENGINE|text-davinci-003|在您的 Azure OpenAI 资源中部署的引擎。例如，基于指令的模型：text-davinci-003；基于聊天的模型：gpt-35-turbo、gpt-4-32k 或 gpt-4。请使用部署名称，而非模型名称。|\n|OPENAI_DEPLOYMENT_TYPE | Text | 对于基于指令的引擎（text-davinci-003），填写“Text”；对于基于聊天的部署（gpt-35-turbo、gpt-4-32k 或 gpt-4），填写“Chat”。|\n|OPENAI_EMBEDDINGS_ENGINE_DOC | text-embedding-ada-002  | 在您的 Azure OpenAI 资源中部署的文档嵌入引擎|\n|OPENAI_EMBEDDINGS_ENGINE_QUERY | text-embedding-ada-002  | 在您的 Azure OpenAI 资源中部署的查询嵌入引擎|\n|OPENAI_API_BASE | https:\u002F\u002FYOUR_AZURE_OPENAI_RESOURCE.openai.azure.com\u002F | 您的 Azure OpenAI 资源名称。可在 [Azure 门户](https:\u002F\u002Fportal.azure.com) 中获取|\n|OPENAI_API_KEY| YOUR_AZURE_OPENAI_KEY | 您的 Azure OpenAI API 密钥。可在 [Azure 门户](https:\u002F\u002Fportal.azure.com) 中获取|\n|OPENAI_TEMPERATURE|0.1| Azure OpenAI 温度参数|\n|OPENAI_MAX_TOKENS|-1| Azure OpenAI 最大令牌数|\n|AZURE_CLOUD|AzureCloud| 要使用的 Azure 云环境。AzureCloud 用于全球 Azure，AzureChinaCloud 用于中国 Azure|\n|VECTOR_STORE_TYPE| PGVector | 向量存储类型。使用 AzureSearch 进行 Azure 认知搜索，PGVector 用于 Azure PostgreSQL，留空则表示 Redis 或 Azure Cache for Redis Enterprise|\n|AZURE_SEARCH_SERVICE_NAME| YOUR_AZURE_SEARCH_SERVICE_URL | 您的 Azure 认知搜索服务名称。可在 [Azure 门户](https:\u002F\u002Fportal.azure.com) 中获取|\n|AZURE_SEARCH_ADMIN_KEY| AZURE_SEARCH_ADMIN_KEY | 您的 Azure 认知搜索管理员密钥。可在 [Azure 门户](https:\u002F\u002Fportal.azure.com) 中获取|\n|PGVECTOR_HOST|Your_PG_NAME.postgres.database.azure.com 或 Your_PG_NAME.postgres.database.chinacloudapi.cn\n|PGVECTOR_PORT|5432\n|PGVECTOR_DATABASE|YOUR_PG_DATABASE\n|PGVECTOR_USER|YOUR_PG_USER\n|PGVECTOR_PASSWORD|YOUR_PG_PASSWORD\n|REDIS_ADDRESS| api | Redis Stack 的 URL：“api”用于 Docker Compose|\n|REDIS_PORT | 6379 | Redis 的端口|\n|REDIS_PASSWORD| redis-stack-password | 可选——您的 Redis Stack 密码|\n|REDIS_ARGS | --requirepass redis-stack-password | 可选——您的 Redis Stack 密码|\n|REDIS_PROTOCOL| redis:\u002F\u002F | |\n|CHUNK_SIZE | 500 | 可选：用于将长文档拆分为多个子文档的分块大小。默认值：500|\n|CHUNK_OVERLAP |100 | 可选：文档拆分时各分块之间的重叠量。默认：100|\n|CONVERT_ADD_EMBEDDINGS_URL| http:\u002F\u002Fbatch\u002Fapi\u002FBatchStartProcessing | 批处理函数的 URL：“http:\u002F\u002Fbatch\u002Fapi\u002FBatchStartProcessing”适用于 Docker Compose|\n|AzureWebJobsStorage | AZURE_BLOB_STORAGE_CONNECTION_STRING FOR_AZURE_FUNCTION_EXECUTION | 用于 Azure 函数——批处理的 Azure Blob 存储连接字符串 |\n\n\n\n用于附加功能的可选参数（例如，使用 OCR 提取文档文本）：\n\n| 应用设置 | 值 | 备注 |\n| --- | --- | ------------- |\n|BLOB_ACCOUNT_NAME| YOUR_AZURE_BLOB_STORAGE_ACCOUNT_NAME| 可选——如果您想使用文档提取功能，请在 [Azure 门户](https:\u002F\u002Fportal.azure.com) 中获取|\n|BLOB_ACCOUNT_KEY| YOUR_AZURE_BLOB_STORAGE_ACCOUNT_KEY| 可选——如果您想使用文档提取功能，请在 [Azure 门户](https:\u002F\u002Fportal.azure.com) 中获取|\n|BLOB_CONTAINER_NAME| YOUR_AZURE_BLOB_STORAGE_CONTAINER_NAME| 可选——如果您想使用文档提取功能，请在 [Azure 门户](https:\u002F\u002Fportal.azure.com) 中获取|\n|FORM_RECOGNIZER_ENDPOINT| YOUR_AZURE_FORM_RECOGNIZER_ENDPOINT| 可选——如果您想使用文档提取功能，请在 [Azure 门户](https:\u002F\u002Fportal.azure.com) 中获取|\n|FORM_RECOGNIZER_KEY| YOUR_AZURE_FORM_RECOGNIZER_KEY| 可选——如果您想使用文档提取功能，请在 [Azure 门户](https:\u002F\u002Fportal.azure.com) 中获取|\n|PAGES_PER_EMBEDDINGS| 用于创建嵌入的页数。请注意，每个嵌入的令牌数应少于 3K。| 默认：每 2 页创建一个新的嵌入。|\n|TRANSLATE_ENDPOINT| YOUR_AZURE_TRANSLATE_ENDPOINT| 可选——如果您想使用翻译功能，请在 [Azure 门户](https:\u002F\u002Fportal.azure.com) 中获取|\n|TRANSLATE_KEY| YOUR_TRANSLATE_KEY| 可选——如果您想使用翻译功能，请在 [Azure 门户](https:\u002F\u002Fportal.azure.com) 中获取|\n|TRANSLATE_REGION| YOUR_TRANSLATE_REGION| 可选——如果您想使用翻译功能，请在 [Azure 门户](https:\u002F\u002Fportal.azure.com) 中获取|\n|VNET_DEPLOYMENT| false | 布尔变量，若要在 VNET 中部署解决方案，则设置为“true”。请同时检查您的 [Azure Form Recognizer](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fazure\u002Fapplied-ai-services\u002Fform-recognizer\u002Fmanaged-identities-secured-access?view=form-recog-2.1.0) 和 [Azure Translator](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fazure\u002Fcognitive-services\u002Ftranslator\u002Freference\u002Fv3-0-reference#virtual-network-support) 端点。|\n\n# 免责声明\n本演示文稿、演示及演示模型仅用于信息目的，并且 (1) 不受 SOC 1 和 SOC 2 合规性审计的约束，(2) 并非设计、意图或作为医疗器械或专业医疗建议、诊断、治疗或判断的替代品而提供。微软在此演示文稿、演示及演示模型中不作任何明示或暗示的保证。本演示文稿、演示或演示模型中的任何内容均不会修改微软书面签署协议中的任何条款和条件。这并非要约，适用条款及所提供的信息可能会随时由微软修订或更改。\n\n本演示文稿、演示及演示模型并未授予您或贵组织与本演示文稿、演示及演示模型主题相关的任何专利、商标、版权或其他知识产权的许可。\n\n本演示文稿、演示及演示模型中包含的信息代表微软在演示和\u002F或展示日期对所讨论问题的当前观点，仅在您访问演示模型期间有效。由于微软必须应对不断变化的市场条件，因此不应将其视为微软的承诺，且微软无法保证在演示和\u002F或展示日期之后以及您访问演示模型期间所呈现信息的准确性。\n\n任何微软技术及其组件技术，包括本演示模型，均无意也未被提供作为 (1) 经认证金融服务专业人士，或 (2) 经认证医疗专业人士的专业建议、意见或判断的替代品。合作伙伴或客户有责任确保其使用微软技术构建的任何解决方案符合相关法规要求。","# Azure OpenAI Embeddings QnA 快速上手指南\n\n本项目是一个基于 Azure OpenAI 服务的文档搜索与问答（QnA）Web 应用。它利用检索增强生成（RAG）模式，将文档转换为向量嵌入，并通过 GPT 模型提取答案。\n\n## 环境准备\n\n在开始之前，请确保满足以下系统要求和前置依赖：\n\n### 1. 云资源要求\n你需要拥有以下 Azure 资源（需提前在 Azure 门户创建）：\n*   **Azure OpenAI Service**：已部署以下模型：\n    *   指令模型（如 `text-davinci-003`）或聊天模型（如 `gpt-35-turbo`, `gpt-4`）。\n    *   嵌入模型（如 `text-embedding-ada-002`）。\n*   **可选资源**（用于文档解析和翻译）：\n    *   Azure Form Recognizer (Document Intelligence)\n    *   Azure Translator\n*   **存储后端**（任选其一，取决于部署方案）：\n    *   Azure Cognitive Search (需申请 Vector Search Private Preview)\n    *   Azure Cache for Redis Enterprise (含 RediSearch 模块)\n    *   Redis Stack (自建或容器化)\n    *   Azure PostgreSQL\n\n### 2. 本地开发环境\n*   **操作系统**：Windows, macOS, 或 Linux\n*   **运行时**：\n    *   Docker & Docker Compose (推荐用于全栈本地运行)\n    *   Python 3.9+ (用于仅运行 Web 前端)\n    *   Conda 或 venv (Python 虚拟环境管理工具)\n*   **其他**：Git\n\n---\n\n## 安装步骤\n\n你可以选择通过 Azure 一键部署，或在本地使用 Docker\u002FPython 运行。\n\n### 方案 A：一键部署到 Azure (推荐生产试用)\n\n根据你选择的存储后端，点击对应的部署按钮并在 Azure 门户中填写配置参数（参考下方的“环境变量”部分）：\n\n*   **Azure Cognitive Search**: [Deploy to Azure](https:\u002F\u002Fportal.azure.com\u002F#create\u002FMicrosoft.Template\u002Furi\u002Fhttps%3A%2F%2Fraw.githubusercontent.com%2Fruoccofabrizio%2Fazure-open-ai-embeddings-qna%2Fmain%2Finfrastructure%2Fdeployment_ACS.json)\n*   **Redis Enterprise**: [Deploy to Azure](https:\u002F\u002Fportal.azure.com\u002F#create\u002FMicrosoft.Template\u002Furi\u002Fhttps%3A%2F%2Fraw.githubusercontent.com%2Fruoccofabrizio%2Fazure-open-ai-embeddings-qna%2Fmain%2Finfrastructure%2FdeploymentACRE.json)\n*   **Redis Stack**: [Deploy to Azure](https:\u002F\u002Fportal.azure.com\u002F#create\u002FMicrosoft.Template\u002Furi\u002Fhttps%3A%2F%2Fraw.githubusercontent.com%2Fruoccofabrizio%2Fazure-open-ai-embeddings-qna%2Fmain%2Finfrastructure%2Fdeployment.json)\n*   **PostgreSQL**: [Deploy to Azure](https:\u002F\u002Fportal.azure.com\u002F#create\u002FMicrosoft.Template\u002Furi\u002Fhttps%3A%2F%2Fraw.githubusercontent.com%2Fcyberflying%2Fazure-open-ai-embeddings-qna%2Fmain%2Finfrastructure%2Fdeployment_pg.json)\n\n> **注意**：若使用 Azure Cognitive Search 的向量搜索功能，需先在此处注册预览版：[Vector Search SignUp](https:\u002F\u002Faka.ms\u002FVectorSearchSignUp)。\n\n### 方案 B：本地 Docker 运行 (全栈：Web + Redis + 批处理)\n\n这是最简单的本地测试方式，会自动启动 Web 应用、Redis 数据库和批处理函数。\n\n1.  **克隆仓库**：\n    ```console\n    git clone https:\u002F\u002Fgithub.com\u002Fruoccofabrizio\u002Fazure-open-ai-embeddings-qna\n    cd azure-open-ai-embeddings-qna\n    ```\n\n2.  **配置环境变量**：\n    复制模板文件并填入你的 Azure 资源密钥。\n    ```console\n    cp .env.template .env\n    vi .env \n    # 请使用编辑器打开 .env 文件，填入 OPENAI_API_KEY, REDIS_ADDRESS 等必要信息\n    ```\n\n3.  **准备存储队列**：\n    确保你在 `.env` 中配置的 `AzureWebJobsStorage` 存储账户中，创建一个名为 `doc-processing` 的队列。\n\n4.  **启动服务**：\n    ```console\n    docker compose up\n    ```\n\n### 方案 C：本地 Python 运行 (仅 Web 前端)\n\n如果你已有后端的 Redis 实例和批处理服务，只想运行前端界面：\n\n1.  **启动依赖服务** (使用 Docker 快速启动 Redis 和批处理函数)：\n    ```console\n    docker run -p 6379:6379 redis\u002Fredis-stack-server:latest\n    docker run -p 7071:80 fruocco\u002Foai-batch:latest\n    ```\n\n2.  **配置 Python 环境** (以 venv 为例)：\n    ```console\n    python -m venv .venv\n    # Windows:\n    .venv\\Scripts\\activate\n    # Mac\u002FLinux:\n    source .venv\u002Fbin\u002Factivate\n    \n    pip install -r code\\requirements.txt\n    ```\n\n3.  **配置环境变量**：\n    编辑 `.env` 文件，将 `REDIS_ADDRESS` 指向你的 Redis 实例地址。\n\n4.  **运行 Web 应用**：\n    ```console\n    cd code\n    streamlit run OpenAI_Queries.py\n    ```\n\n---\n\n## 基本使用\n\n### 1. 访问应用\n启动成功后，在浏览器中打开：\n*   Docker 部署：[http:\u002F\u002Flocalhost:8080](http:\u002F\u002Flocalhost:8080)\n*   Python 本地运行：通常默认为 [http:\u002F\u002Flocalhost:8501](http:\u002F\u002Flocalhost:8501) (具体端口请参考 Streamlit 控制台输出)\n\n### 2. 上传文档并生成向量\n1.  在界面中找到 **\"Add Document\"** 区域。\n2.  选择 **\"Add documents in Batch\"**。\n3.  上传你的 PDF、Word 或文本文件。\n4.  点击 **\"Convert all files and add embeddings\"**。\n    *   系统将调用 Azure Form Recognizer (如果配置了) 提取文本。\n    *   调用 Azure OpenAI 生成向量嵌入。\n    *   将结果存入 Redis 或 Azure Search。\n\n### 3. 进行问答\n1.  在聊天框中输入关于文档内容的问题。\n2.  系统会检索最相关的文档片段，并利用 GPT 模型生成精准答案。\n\n### 关键配置说明 (环境变量)\n\n在 `.env` 文件中，你需要重点关注以下配置：\n\n*   **模型切换**：\n    *   默认使用指令模型 (如 `text-davinci-003`)。\n    *   若要使用聊天模型 (如 `gpt-35-turbo`, `gpt-4`)，请修改环境变量中的模型名称配置。\n*   **数据格式兼容性**：\n    *   如果你需要兼容旧版本的数据格式，请将 Web 应用标签设置为 `fruocco\u002Foai-embeddings:2023-03-27_25`。\n    *   建议使用最新格式，如需迁移旧数据，请在界面执行一次 \"Convert all files and add embeddings\"。\n\n> **提示**：对于中国开发者，如果遇到 Docker 拉取镜像缓慢的问题，建议配置国内 Docker 镜像加速器。","某大型制造企业的技术支持团队每天需面对数百起设备故障咨询，而解答依据分散在数千页的 PDF 维修手册和历史工单中。\n\n### 没有 azure-open-ai-embeddings-qna 时\n- 工程师必须手动打开多个文档逐页搜索关键词，平均每次排查耗时 20 分钟以上。\n- 遇到复杂故障描述时，传统关键字搜索无法理解语义，常返回大量无关章节，导致误判率高。\n- 新员工因不熟悉文档结构，难以快速定位标准操作流程，严重依赖老员工口传心授。\n- 历史工单中的非结构化文本数据（如现场备注）完全无法被检索利用，知识沉淀形同虚设。\n\n### 使用 azure-open-ai-embeddings-qna 后\n- 系统自动将维修手册和工单向量化存入 Azure Search，工程师输入自然语言问题，秒级返回精准答案段落。\n- 基于 RAG 架构的语义理解能力，能准确匹配“电机过热异响”等模糊描述与文档中的专业解决方案。\n- 内置的 GPT-4  orchestrator 自动提炼核心步骤并生成简洁回复，新员工也能立即上手处理复杂报修。\n- 支持批量上传各类格式文档并自动重处理，确保最新的技术通告实时融入知识库，无需人工维护索引。\n\nazure-open-ai-embeddings-qna 通过将静态文档转化为可对话的智能知识库，把故障响应时间从小时级压缩至分钟级，显著提升了企业服务效率。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fruoccofabrizio_azure-open-ai-embeddings-qna_52f1c050.png","ruoccofabrizio","Fabrizio Ruocco","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fruoccofabrizio_2d09bb1e.jpg","\r\n    \r\n    \r\n    \r\n    AI Global Black Belt @microsoft\r\n\r\n","Microsoft",null,"https:\u002F\u002Fgithub.com\u002Fruoccofabrizio",[81,85],{"name":82,"color":83,"percentage":84},"Python","#3572A5",99.3,{"name":86,"color":87,"percentage":88},"Dockerfile","#384d54",0.7,850,500,"2026-04-07T17:27:07","MIT",4,"Linux, macOS, Windows","未说明",{"notes":97,"python":98,"dependencies":99},"该工具主要依赖 Azure 云服务（如 Azure OpenAI, Azure Cognitive Search, Redis, Form Recognizer 等）。本地运行可通过 Docker 一键部署完整环境（含 Web 应用、Redis Stack 和批处理函数），或使用 Python (Conda\u002Fvenv) 仅运行 Web 应用（需自行搭建 Redis 和批处理服务）。使用 Azure Cognitive Search 的向量搜索功能需要申请私有预览资格。若使用旧版数据格式，需指定特定的 Docker 镜像标签。","3.9+",[100,101,102,103,104,105],"streamlit","langchain","azure-identity","azure-search-documents","redis","openai",[35,14],[108],"azureopenai","2026-03-27T02:49:30.150509","2026-04-08T09:20:04.089638",[112,117,122,127,132,137],{"id":113,"question_zh":114,"answer_zh":115,"source_url":116},23950,"部署成功但门户显示 InvalidRequestError（API 部署不存在）怎么办？","这通常是因为模型部署尚未完成或配置名称不匹配。请确保按照官方文档正确部署了所需的模型：https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fazure\u002Fcognitive-services\u002Fopenai\u002Fhow-to\u002Fcreate-resource?pivots=web-portal。如果在过去 5 分钟内创建了部署，请稍等片刻再试。同时检查脚本中引用的 OpenAI 服务名称是否与资源组中的实际名称一致。","https:\u002F\u002Fgithub.com\u002Fruoccofabrizio\u002Fazure-open-ai-embeddings-qna\u002Fissues\u002F60",{"id":118,"question_zh":119,"answer_zh":120,"source_url":121},23951,"如何增加回答的长度限制以避免内容被截断？","项目已针对此问题进行了更新。请拉取最新的代码或更新 Docker 镜像后重试。维护者已通过 PR 修复了相关限制，更新后应能支持更长的回答生成。如果使用的是 text-davinci 模型且遇到中文内容截断问题，更新版本通常也能解决该编码或长度计算问题。","https:\u002F\u002Fgithub.com\u002Fruoccofabrizio\u002Fazure-open-ai-embeddings-qna\u002Fissues\u002F48",{"id":123,"question_zh":124,"answer_zh":125,"source_url":126},23952,"上传包含非拉丁字符（如中文）文件名的 PDF 时出错或状态显示异常怎么办？","该问题是由于 Azure Blob Storage 中的元数据设置不支持非拉丁字符导致的编码问题。虽然文件可能已成功上传且聊天功能正常，但文档查看器中的 'embeddings_added' 状态可能无法显示。解决方案是确保文件名编码兼容，或者忽略查看器中的状态显示错误，直接测试聊天功能确认内容是否可用。维护者已确认这是元数据编码问题而非文件上传失败。","https:\u002F\u002Fgithub.com\u002Fruoccofabrizio\u002Fazure-open-ai-embeddings-qna\u002Fissues\u002F52",{"id":128,"question_zh":129,"answer_zh":130,"source_url":131},23953,"使用 Azure Cache for Redis Enterprise 替换 ACI 上的 Redis 时连接失败如何解决？","LangChain 库已合并了修复此问题的更改。请更新代码库，并设置以下环境变量以连接 Redis Enterprise：\nREDIS_ADDRESS=YOUR_AZURE_REDIS_ADDRESS\nREDIS_PORT=10000\nREDIS_PASSWORD=XXX\n创建 Redis Enterprise 实例时，确保选择了 'Search Module'（搜索模块），这对于演示程序的正常运行是必需的。","https:\u002F\u002Fgithub.com\u002Fruoccofabrizio\u002Fazure-open-ai-embeddings-qna\u002Fissues\u002F39",{"id":133,"question_zh":134,"answer_zh":135,"source_url":136},23954,"点击“Compute Embeddings”后没有反应且无报错，无法生成新的嵌入向量怎么办？","由于 LLM 环境变化快速，仓库进行了重大重构。请尝试拉取最新的代码并重新构建或拉取最新的 Docker 镜像（例如：docker pull fruocco\u002Foai-batch:latest）。如果更新镜像后仍无效，请再次执行拉取操作以确保获取到包含修复提交的最新版本。旧版本的代码可能与新的页面结构或 API 不兼容。","https:\u002F\u002Fgithub.com\u002Fruoccofabrizio\u002Fazure-open-ai-embeddings-qna\u002Fissues\u002F14",{"id":138,"question_zh":139,"answer_zh":140,"source_url":141},23955,"QNA API 函数返回 500 错误如何处理？","这通常是由于环境变量配置不正确导致的。在更新 QNA API 的镜像后，需要检查并更新 Azure Function 的环境设置。特别是要检查 'OPENAI_ENGINE' 的值，确保将其设置为您的 Azure OpenAI 部署名称（Deployment Name），而不是模型名称。此外，查看 Azure Function 的日志以获取详细的错误信息有助于进一步排查。","https:\u002F\u002Fgithub.com\u002Fruoccofabrizio\u002Fazure-open-ai-embeddings-qna\u002Fissues\u002F96",[]]