Azure OpenAI REST API Completions Extensions - Is more than one data source supported?
题意 :
Azure OpenAI REST API 完成扩展 - 是否支持多个数据源?
问题背景:
The AzureOpenAI REST API documentation (Azure OpenAI Service REST API reference - Azure OpenAI | Microsoft Learn) and the API Swagger (azure-rest-api-specs/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2023-08-01-preview/inference.json at main · Azure/azure-rest-api-specs · GitHub) suggest that the completions extensions endpoint can support more than one data source as it has a type of array and the description is "The data sources to be used for the Azure OpenAI on your data feature".
Azure OpenAI REST API 文档(Azure OpenAI 服务 REST API 参考 - Azure OpenAI | Microsoft Learn)和 API Swagger(azure-rest-api-specs/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2023-08-01-preview/inference.json at main · Azure/azure-rest-api-specs · GitHub)建议,完成扩展端点可以支持多个数据源,因为它的类型是数组,并且描述为“用于 Azure OpenAI 上的数据功能的数据源”。
I've tested out adding 2 Azure Cognitive Search Indexes and I receive the error: "Validation error at #/dataSources: List should have at most 1 item after validation, not 2". Does this endpoint not currently support more than one data source? Do the data sources need to be different types (i.e. AzureCognitiveSearch and AzureCosmosDB)?
我测试了添加 2 个 Azure Cognitive Search 索引,并收到了错误:“验证错误:#/dataSources:验证后列表最多应包含 1 项,而不是 2 项”。这个端点目前不支持多个数据源吗?数据源是否需要是不同类型的(例如 AzureCognitiveSearch 和 AzureCosmosDB)?
问题解决:
I had this same question. I asked my Microsoft contacts, and the answer is No , the API does not support multiple data sources (I'm not sure if it's on their roadmap or not).
我有同样的问题。我问了我的微软联系人,答案是:不,API 不支持多个数据源(我不确定它是否在他们的路线图上)。
You will have to use LLM orchestration tools like Langchain, semantic model, or function calling with Prompt flow etc.
你将不得不使用像 Langchain、语义模型或使用 Prompt Flow 等功能调用的 LLM 协调工具。
You will have to build your prompt in such a way that your LLM uses the right data source based on the user's questions or use Open AI's function calling feature.
你将不得不以这样的方式构建你的提示,使得你的 LLM 根据用户的问题使用正确的数据源,或者使用 OpenAI 的功能调用特性。
So Azure Prompt Flow + Function calling would be how you would build a solution on the Azure platform leveraging multiple data sources. You can also use LangChain in conjunction with Prompt Flow.
因此,Azure Prompt Flow + 功能调用将是你在 Azure 平台上构建解决方案、利用多个数据源的方式。你也可以将 LangChain 与 Prompt Flow 结合使用。
Here is one interesting example matching a use case where one of the data sources is Bing search and other are different knowledge base stores. This one uses Langchain orchestration in python code:
这里有一个有趣的示例,适用于一个用例,其中一个数据源是 Bing 搜索,其他是不同的知识库存储。这个示例使用了 Langchain 在 Python 代码中的 orchestration:
Azure-Cognitive-Search-Azure-OpenAI-Accelerator GitHub
For the prompt flow + function calling approach, you can review the example from the prompt flow gallery. In 'prompt flow', click 'create new flow' and you will get access to a gallery with pre-built examples. See Use GPT Function Calling.
对于 prompt flow + function calling 方法,您可以查看 prompt flow 画廊中的示例。在“prompt flow”中,点击“创建新流程”,您将可以访问一个包含预构建示例的画廊。请参见《使用 GPT 功能调用》。
Alternatively, if you're using Power Virtual Agents (now Copilot Studio), you can use generative answers to leverage multiple data sources.
或者,如果您使用的是 Power Virtual Agents(现在称为 Copilot Studio),您可以使用生成式回答来利用多个数据源。
Generative answers with Search and summarize - Information Sources
With Copilot Studio you can create copilots with Generative Answers using public websites, SharePoint sources, documents and Azure OpenAI Service. Then you have the option to deploy your copilot to different channels listed here.
通过 Copilot Studio,您可以使用公共网站、SharePoint 数据源、文档和 Azure OpenAI 服务创建具有生成性回答的 copilots。然后,您可以选择将您的 copilot 部署到这里列出的不同渠道。

