Knowledge
Segments
Request fields, response objects and current limitations.
Quickstart: official Python SDK
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
| Name | Location and type | Description |
|---|---|---|
| vector_store_id | path: string | Required; Knowledge-base ID returned by create or list; use the ID rather than its display name. min characters: 1 |
| file_id | path: string | Required; Source File ID of an attachment, returned by file attachment or listing. min characters: 1 |
| after | query: string | Cursor ID from the previous page. min characters: 1 |
| before | query: string | Return items before this ID. min characters: 1 |
| limit | query: integer | Page size. min: 1; max: 100; default: 20 |
| order | query: "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
| Field | Type | Description |
|---|---|---|
| object | "list" | required; Object discriminator; list identifies a cursor-paginated collection. |
| data | object[] | required; Current page of segments in the requested order. |
| data[].id | string | required; Resource ID.; min characters: 1 |
| data[].file_id | string | required; Resource ID.; min characters: 1 |
| data[].index | integer | required; Zero-based position of this chunk in the source document.; min: 0 |
| data[].text | string | required; Extracted text covered by this chunk; neighboring chunks may overlap. |
| data[].tokens | integer | required; Estimated token count of this chunk, not a model tokenizer count.; min: 0 |
| data[].page | integer / null | required; One-based source page containing the chunk start; null when no page mapping is available. |
| data[].span | integer[] | required; Start and end offsets in UTF-16 code units.; min items: 2; max items: 2 |
| data[].overlap_prev_tokens | integer | required; Estimated tokens shared with the previous chunk; zero for the first chunk.; min: 0 |
| data[].overlap_next_tokens | integer | required; Estimated tokens shared with the next chunk; zero for the last chunk.; min: 0 |
| first_id | string / null | required; ID of the first item on this page; null for an empty page. |
| last_id | string / null | required; ID of the last item on this page; use as after to continue. Null for an empty page. |
| has_more | boolean | required; Whether additional items remain after this page within the selected cursor range. |
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
| Name | Location and type | Description |
|---|---|---|
| vector_store_id | path: string | Required; Knowledge-base ID returned by create or list; use the ID rather than its display name. min characters: 1 |
| chunk_id | path: string | Required; 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
| Field | Type | Description |
|---|---|---|
| id | string | required; Resource ID.; min characters: 1 |
| file_id | string | required; Resource ID.; min characters: 1 |
| index | integer | required; Zero-based position of this chunk in the source document.; min: 0 |
| text | string | required; Extracted text covered by this chunk; neighboring chunks may overlap. |
| tokens | integer | required; Estimated token count of this chunk, not a model tokenizer count.; min: 0 |
| page | integer / null | required; One-based source page containing the chunk start; null when no page mapping is available. |
| span | integer[] | required; Start and end offsets in UTF-16 code units.; min items: 2; max items: 2 |
| overlap_prev_tokens | integer | required; Estimated tokens shared with the previous chunk; zero for the first chunk.; min: 0 |
| overlap_next_tokens | integer | required; Estimated tokens shared with the next chunk; zero for the last chunk.; min: 0 |
| terms | object[] | required; Terms occurring in this chunk with local frequency and store-wide chunk counts. |
| terms[].term | string | required; Lowercase text token; consecutive Han characters also produce adjacent two-character terms. |
| terms[].count | integer | required; Number of occurrences of this term in this chunk.; min: 0 |
| terms[].chunks_in_store | integer | required; Number of indexed chunks in this store containing the term.; min: 0 |