【问题标题】:How to import knowledge base through api?如何通过api导入知识库?
【发布时间】:2021-08-29 18:23:18
【问题描述】:

https://cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/projects.knowledgeBases.documents/import

考虑我有一个 csv 文件要导入云存储,我该如何执行上面的 API 请求并导入知识库 qna,我已经添加了上面的文档链接,我得到了下面也有错误

【问题讨论】:

    标签: google-cloud-platform dialogflow-es google-apis-explorer


    【解决方案1】:

    将父级更改为projects/your-project-id/knowledgeBases/xxxxxx 并且导入应该接受它。

    但如果您打算使用 CSV 文件从头开始创建知识库,我建议使用 projects.knowledgeBases.documents.create。通过projects.knowledgeBases.documents.create查看样品请求:

    parent: projects/your-project-id/knowledgeBases/xxxxx
    importGcsCustomMetadata: false
    
    Request Body:
    {
      "contentUri": "gs://my-bucket/faq.csv",
      "displayName": "test_csv",
      "knowledgeTypes": [
        "FAQ"
      ],
      "mimeType": "text/csv"
    }
    

    返回 HTTP 200:

    {
      "name": "projects/your-project-id/locations/us/operations/document-create-20210829-21261630297603-6127fbb9-0000-21dc-bec9-240588717654"
    }
    

    在 Dialogflow 控制台中创建知识库:

    【讨论】:

    • 我有 azure blob 中的 csv
    • 很遗憾,Google Cloud URI 仅适用于 importcreate
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多