A I Hub Knowledge Base

Create documents from files

POST
/datasets/{dataset_id}/document/create_by_file

This API is based on existing knowledge and creates a new document through text based on this Knowledge.

Authorization

bearerAuth
AuthorizationBearer <token>

JWT access token returned by Signing In (POST /auth/v1/tokens/).

In: header

Path Parameters

dataset_id*string

Knowledge ID

Request Body

application/json

original_document_id?string

Source document ID (optional)

process_rule?

File processing rules

indexing_technique?string
  1. "high_quality": embedding using embedding model, built as vector database index. 2. "economy": Build using inverted index of Keyword Table Index
file?string

Files that need to be uploaded.

Formatjson

Response Body

application/json

application/json

curl -X POST "https://example.com/datasets/string/document/create_by_file" \  -H "Content-Type: application/json" \  -d '{}'
"{\n  \"document\": {\n    \"id\": \"\",\n    \"position\": 1,\n    \"data_source_type\": \"upload_file\",\n    \"data_source_info\": {\n        \"upload_file_id\": \"\"\n    },\n    \"dataset_process_rule_id\": \"\",\n    \"name\": \"text.txt\",\n    \"created_from\": \"api\",\n    \"created_by\": \"\",\n    \"created_at\": 1695690280,\n    \"tokens\": 0,\n    \"indexing_status\": \"waiting\",\n    \"error\": null,\n    \"enabled\": true,\n    \"disabled_at\": null,\n    \"disabled_by\": null,\n    \"archived\": false,\n    \"display_status\": \"queuing\",\n    \"word_count\": 0,\n    \"hit_count\": 0,\n    \"doc_form\": \"text_model\"\n  },\n  \"batch\": \"\"\n}\n"