quaint-moccasin
quaint-moccasin15mo ago

Help with changing chunk size

Hello! I have trouble understanding how to make this post request. Is this done inside the workflow with API card/node? May you help me understand? Thank you! https://developer.voiceflow.com/reference/post_v3alpha-knowledge-base-docs-upload
No description
1 Reply
Tico | Voiceflow Assistant
To change the chunk size for a document upload in Voiceflow, you need to make a POST request to the Knowledge Base API. Here’s how you can do it using an API card/node in your Voiceflow workflow: 1. API Endpoint: Use the endpoint https://api.voiceflow.com/v3alpha/knowledge-base/docs/upload. 2. Request Method: POST 3. Headers: - Content-Type: multipart/form-data 4. Query Parameters: - overwrite (optional): Set to true if you want to overwrite existing data. - maxChunkSize (optional): Set the chunk size. The default is 1000, and the range is 500-1500 tokens. 5. Body: - Use form-data to include the document file. Accepted file types are pdf, text, or docx. Here’s an example of how to set this up in the API card/node: API Card/Node Configuration Method: POST URL: https://api.voiceflow.com/v3alpha/knowledge-base/docs/upload Headers:
{
"Content-Type": "multipart/form-data"
}
{
"Content-Type": "multipart/form-data"
}
Query Parameters:
{
"overwrite": true,
"maxChunkSize": 1200
}
{
"overwrite": true,
"maxChunkSize": 1200
}
Body: - Add a form-data field for the file you want to upload. Example Request
{
"file": "path/to/your/document.pdf"
}
{
"file": "path/to/your/document.pdf"
}
Example Response
{
"data": {
"documentID": "6515dccab4bc5400060fbc6a",
"type": "pdf",
"name": "Learn-to-Sail.pdf",
"updatedAt": "2023-09-28T20:06:34.049Z",
"status": "PENDING",
"tags": ["beginner"]
}
}
{
"data": {
"documentID": "6515dccab4bc5400060fbc6a",
"type": "pdf",
"name": "Learn-to-Sail.pdf",
"updatedAt": "2023-09-28T20:06:34.049Z",
"status": "PENDING",
"tags": ["beginner"]
}
}
For more details, you can refer to the Voiceflow API Documentation.

Did you find this page helpful?