Skip to contentSkip to navigationSkip to topbar
On this page

Knowledge Chunk Resource


When you create a Knowledge source, Twilio AI Assistants processes that Knowledge and breaks it into discrete pieces called Chunks. These pieces can help you troubleshoot unexpected behavior with your Assistant.

This API returns a list of all Knowledge Chunks created from uploading Knowledge sources.


Chunk Properties

chunk-properties page anchor
Property nameTypeRequiredDescriptionChild properties
account_sidSID<AC>Optional
Not PII

The SID of the Account that created the Knowledge resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

contentstringOptional

The chunk content.


metadataobjectOptional

The metadata of the chunk.


date_updatedstring<date-time>Optional

The date and time in GMT when the Chunk was updated specified in ISO 8601(link takes you to an external page) format.


GET https://assistants.twilio.com/v1/Knowledge/{id}/Chunks

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
idstringrequired

The knowledge ID.

Property nameTypeRequiredPIIDescription
PageSizeintegerOptional

How many resources to return in each list page. The default is 50, and the maximum is 1000.

Minimum: 1Maximum: 1000

PageTokenstringOptional

The page token. This is provided by the API.

List multiple ChunksLink to code sample: List multiple Chunks
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function listKnowledgeChunks() {
11
const chunks = await client.assistants.v1
12
.knowledge("id")
13
.chunks.list({ limit: 20 });
14
15
chunks.forEach((c) => console.log(c.accountSid));
16
}
17
18
listKnowledgeChunks();

Output

1
{
2
"chunks": [
3
{
4
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"content": "content",
6
"metadata": {},
7
"date_created": "2009-07-06T20:30:00Z",
8
"date_updated": "2009-07-06T20:30:00Z"
9
}
10
],
11
"meta": {
12
"first_page_url": "https://www.example.com",
13
"key": "key",
14
"next_page_url": "https://www.example.com",
15
"page": 42,
16
"page_size": 42,
17
"previous_page_url": "https://www.example.com",
18
"url": "https://www.example.com"
19
}
20
}

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.