logo
การพัฒนา
ค้นหา
Add Chunks (Text).md

Add Chunks (Text).md

Add knowledge blocks to text documents. The system will sequentially perform chunking/slicing, embedding/vectorization, and finally add new knowledge blocks to the document.

Note: The embedding model used is the default model and cannot be defined within the API.

Request Method

POST

Request URL

https://api-${endpoint}.gptbots.ai/v1/bot/doc/chunks/add

Request Authentication

See Overview for authentication details.

Request

Request Example

curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/bot/doc/chunks/add' \ -H 'Authorization: Bearer ${API Key}' \ -H 'Content-Type: application/json' \ -d '{ "doc_id": "675174292b8b977ba6316191", "chunks": [ { "content": "This is a chunk.", "keywords": ["This","chunk"] } ] }'
                      
                      curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/bot/doc/chunks/add' \
-H 'Authorization: Bearer ${API Key}' \	
-H 'Content-Type: application/json' \
-d '{
    "doc_id": "675174292b8b977ba6316191",
    "chunks": [
        {
            "content": "This is a chunk.",
            "keywords": ["This","chunk"]
        }
    ]
}'

                    
บล็อกโค้ดนี้ในหน้าต่างลอย

Request Header

Field Type Description
Authorization Bearer ${API Key} Use Authorization: Bearer ${API Key} for authentication. Get API key from API Key page.
Content-Type application/json Data type, set to application/json.

Request Parameters

Field Type Required Description
doc_id String Yes The ID of the document to which the knowledge block will be added.
chunks Array<Object> Yes The content of the knowledge blocks.
content String Yes The content of the knowledge block, up to 1000 Tokens long.
keywords Array<String> No The keywords for the knowledge block.

Response

Response Example

{ "code": 0, "message": "OK" }
                      
                      {
    "code": 0,
    "message": "OK"
}

                    
บล็อกโค้ดนี้ในหน้าต่างลอย

Success Response

Field Type Description
code Int Response code.
message String Response details.

Failure Response

Field Type Description
code Int Error code.
message String Error details.