Preview datasource chunks
curl --request POST \
--url https://my.orq.ai/v2/knowledge/{knowledge_id}/datasources/preview-chunks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"file_id": "<string>",
"chunking_options": {
"chunking_configuration": {
"type": "default"
},
"chunking_cleanup_options": {
"delete_emails": true,
"delete_credit_cards": true,
"delete_phone_numbers": true,
"clean_bullet_points": true,
"clean_numbered_list": true,
"clean_unicode": true,
"clean_dashes": true,
"clean_whitespaces": true
}
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
file_id: '<string>',
chunking_options: {
chunking_configuration: {type: 'default'},
chunking_cleanup_options: {
delete_emails: true,
delete_credit_cards: true,
delete_phone_numbers: true,
clean_bullet_points: true,
clean_numbered_list: true,
clean_unicode: true,
clean_dashes: true,
clean_whitespaces: true
}
}
})
};
fetch('https://my.orq.ai/v2/knowledge/{knowledge_id}/datasources/preview-chunks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://my.orq.ai/v2/knowledge/{knowledge_id}/datasources/preview-chunks"
payload = {
"file_id": "<string>",
"chunking_options": {
"chunking_configuration": { "type": "default" },
"chunking_cleanup_options": {
"delete_emails": True,
"delete_credit_cards": True,
"delete_phone_numbers": True,
"clean_bullet_points": True,
"clean_numbered_list": True,
"clean_unicode": True,
"clean_dashes": True,
"clean_whitespaces": True
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"chunks": [
{
"text": "<string>",
"page_number": 123
}
],
"metadata": {
"words_count": 123,
"sentences_count": 123,
"paragraphs_count": 123,
"tokens_count": 123,
"characters_count": 123,
"chunks_count": 123
}
}Knowledge Bases
Preview datasource chunks
Parses an uploaded file and returns the chunks it would produce for the given chunking options without creating a datasource.
POST
/
v2
/
knowledge
/
{knowledge_id}
/
datasources
/
preview-chunks
Preview datasource chunks
curl --request POST \
--url https://my.orq.ai/v2/knowledge/{knowledge_id}/datasources/preview-chunks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"file_id": "<string>",
"chunking_options": {
"chunking_configuration": {
"type": "default"
},
"chunking_cleanup_options": {
"delete_emails": true,
"delete_credit_cards": true,
"delete_phone_numbers": true,
"clean_bullet_points": true,
"clean_numbered_list": true,
"clean_unicode": true,
"clean_dashes": true,
"clean_whitespaces": true
}
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
file_id: '<string>',
chunking_options: {
chunking_configuration: {type: 'default'},
chunking_cleanup_options: {
delete_emails: true,
delete_credit_cards: true,
delete_phone_numbers: true,
clean_bullet_points: true,
clean_numbered_list: true,
clean_unicode: true,
clean_dashes: true,
clean_whitespaces: true
}
}
})
};
fetch('https://my.orq.ai/v2/knowledge/{knowledge_id}/datasources/preview-chunks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://my.orq.ai/v2/knowledge/{knowledge_id}/datasources/preview-chunks"
payload = {
"file_id": "<string>",
"chunking_options": {
"chunking_configuration": { "type": "default" },
"chunking_cleanup_options": {
"delete_emails": True,
"delete_credit_cards": True,
"delete_phone_numbers": True,
"clean_bullet_points": True,
"clean_numbered_list": True,
"clean_unicode": True,
"clean_dashes": True,
"clean_whitespaces": True
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"chunks": [
{
"text": "<string>",
"page_number": 123
}
],
"metadata": {
"words_count": 123,
"sentences_count": 123,
"paragraphs_count": 123,
"tokens_count": 123,
"characters_count": 123,
"chunks_count": 123
}
}Related guide: Knowledge bases guide. See the Knowledge bases guide for a walkthrough with examples.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Was this page helpful?