Knowledge

Segments

Request fields, response objects and current limitations.

Quickstart: official Python SDK

Base URL and authentication

Use existing resource IDs in paths. Set the environment variables shown in each example.

List file segments

GET /knowledge/v1/vector_stores/{vector_store_id}/files/{file_id}/segments

Lists the stored chunks of an attached file, ordered by increasing segment index by default. Use the attachment id and last_id as after to continue; returned chunk ids can be retrieved individually.

Parameters

NameLocation and typeDescription
vector_store_idpath: stringRequired; Knowledge-base ID returned by create or list; use the ID rather than its display name. min characters: 1
file_idpath: stringRequired; Source File ID of an attachment, returned by file attachment or listing. min characters: 1
afterquery: stringCursor ID from the previous page. min characters: 1
beforequery: stringReturn items before this ID. min characters: 1
limitquery: integerPage size. min: 1; max: 100; default: 20
orderquery: "asc" / "desc"Order by creation time; defaults to desc for stores/files and asc by index for segments. default: "asc"

Request example

curl -X GET "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/files/${FILE_ID}/segments" \
  -H "Authorization: Bearer $PRAXIS_API_KEY"

Response

HTTP 200

FieldTypeDescription
object"list"required; Object discriminator; list identifies a cursor-paginated collection.
dataobject[]required; Current page of segments in the requested order.
data[].idstringrequired; Resource ID.; min characters: 1
data[].file_idstringrequired; Resource ID.; min characters: 1
data[].indexintegerrequired; Zero-based position of this chunk in the source document.; min: 0
data[].textstringrequired; Extracted text covered by this chunk; neighboring chunks may overlap.
data[].tokensintegerrequired; Estimated token count of this chunk, not a model tokenizer count.; min: 0
data[].pageinteger / nullrequired; One-based source page containing the chunk start; null when no page mapping is available.
data[].spaninteger[]required; Start and end offsets in UTF-16 code units.; min items: 2; max items: 2
data[].overlap_prev_tokensintegerrequired; Estimated tokens shared with the previous chunk; zero for the first chunk.; min: 0
data[].overlap_next_tokensintegerrequired; Estimated tokens shared with the next chunk; zero for the last chunk.; min: 0
first_idstring / nullrequired; ID of the first item on this page; null for an empty page.
last_idstring / nullrequired; ID of the last item on this page; use as after to continue. Null for an empty page.
has_morebooleanrequired; Whether additional items remain after this page within the selected cursor range.

Error codes and objects

Retrieve segment

GET /knowledge/v1/vector_stores/{vector_store_id}/segments/{chunk_id}

Retrieves one chunk and its term statistics. Take chunk_id from segment listing or native search content; the chunk must belong to this knowledge base.

Parameters

NameLocation and typeDescription
vector_store_idpath: stringRequired; Knowledge-base ID returned by create or list; use the ID rather than its display name. min characters: 1
chunk_idpath: stringRequired; Chunk ID returned by segment listing or native search content. min characters: 1

Request example

curl -X GET "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/segments/${CHUNK_ID}" \
  -H "Authorization: Bearer $PRAXIS_API_KEY"

Response

HTTP 200

FieldTypeDescription
idstringrequired; Resource ID.; min characters: 1
file_idstringrequired; Resource ID.; min characters: 1
indexintegerrequired; Zero-based position of this chunk in the source document.; min: 0
textstringrequired; Extracted text covered by this chunk; neighboring chunks may overlap.
tokensintegerrequired; Estimated token count of this chunk, not a model tokenizer count.; min: 0
pageinteger / nullrequired; One-based source page containing the chunk start; null when no page mapping is available.
spaninteger[]required; Start and end offsets in UTF-16 code units.; min items: 2; max items: 2
overlap_prev_tokensintegerrequired; Estimated tokens shared with the previous chunk; zero for the first chunk.; min: 0
overlap_next_tokensintegerrequired; Estimated tokens shared with the next chunk; zero for the last chunk.; min: 0
termsobject[]required; Terms occurring in this chunk with local frequency and store-wide chunk counts.
terms[].termstringrequired; Lowercase text token; consecutive Han characters also produce adjacent two-character terms.
terms[].countintegerrequired; Number of occurrences of this term in this chunk.; min: 0
terms[].chunks_in_storeintegerrequired; Number of indexed chunks in this store containing the term.; min: 0

Error codes and objects

Export

On this page