如何自动导入 Q&N?

问题描述 投票:0回答:1

使用Lanaguage Studio,我可以手动从一个环境导出我的问题和答案,然后将其导入到另一个环境中。

有没有办法自动执行此操作? langauge studio API 有端点来获取答案,但我找不到可以进行导出或导入的端点。

我想使用 powershell 模块,但我在 Az.CognitiveServices 模块中没有看到这些功能。 https://learn.microsoft.com/en-us/powershell/module/az.cognitiveservices/?view=azps-11.2.0

botframework azure-qna-maker language-studio
1个回答
0
投票

您可以使用 Authoring API 检索和更新所提供项目的问题和答案。

要获取问题和答案对,请使用以下 API 请求。

curl -X GET -H "Ocp-Apim-Subscription-Key: {API-KEY}" -H "Content-Type: application/json" 'https://{ENDPOINT}.api.cognitive.microsoft.com/language/query-knowledgebases/projects/{PROJECT-NAME}/qnas?api-version=2021-10-01'

如需更新,请使用下面的 API 请求。

curl -X PATCH -H "Ocp-Apim-Subscription-Key: {API-KEY}" -H "Content-Type: application/json" -d '[
    {
        "op": "add",
        "value":{
            "id": 1,
            "answer": "The latest question answering docs are on https://learn.microsoft.com",
            "source": "source5",
            "questions": [
                "Where do I find docs for question answering?"
            ],
            "metadata": {},
            "dialog": {
                "isContextOnly": false,
                "prompts": []
            }
        }
    }
]'  -i 'https://{ENDPOINT}.api.cognitive.microsoft.com/language/query-knowledgebases/projects/{PROJECT-NAME}/qnas?api-version=2021-10-01'

这里的想法是从一个环境获取详细信息,并使用此curl请求在另一个环境中更新它们。

您还可以导入和导出项目本身,而不是问题和答案。这是它的参考。 Export 为您提供 URI,该 URI 进一步用于 import

© www.soinside.com 2019 - 2024. All rights reserved.