如何通过api导入知识库?
How to import knowledge base through api?
考虑到我有一个要导入到云存储中的 csv 文件,我如何在上面执行这个 API 请求并导入知识库 qna,我添加了文档 link 以上,我也收到以下错误
将父级更改为 projects/your-project-id/knowledgeBases/xxxxxx
并且导入应该接受它。
但我建议使用projects.knowledgeBases.documents.create if you are planning to create a knowledge base from scratch using a CSV file. See sample request via 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"
}
Returns HTTP 200:
{
"name": "projects/your-project-id/locations/us/operations/document-create-20210829-21261630297603-6127fbb9-0000-21dc-bec9-240588717654"
}
在 Dialogflow 控制台中创建了知识库:
考虑到我有一个要导入到云存储中的 csv 文件,我如何在上面执行这个 API 请求并导入知识库 qna,我添加了文档 link 以上,我也收到以下错误
将父级更改为 projects/your-project-id/knowledgeBases/xxxxxx
并且导入应该接受它。
但我建议使用projects.knowledgeBases.documents.create if you are planning to create a knowledge base from scratch using a CSV file. See sample request via 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"
}
Returns HTTP 200:
{
"name": "projects/your-project-id/locations/us/operations/document-create-20210829-21261630297603-6127fbb9-0000-21dc-bec9-240588717654"
}
在 Dialogflow 控制台中创建了知识库: