Skip to main content

Create a Chunk

Creating a new record will automatically create chunks. As chunks are the minimal units of information within the TaskingAI retrieval system. When a new record is to be created, it is split into smaller segments known as chunks. And each chunk will be individually vectorized and stored into the vector databases for future similarity search and information retrieval.

Create chunks by creating a new record

Please refer to the Create a Record guide for more information on how to create a new record. This method will automatically create chunks for the record.

Create chunks directly

TaskingAI also allows direct creation of chunks without creating a record.

import taskingai

chunk = taskingai.retrieval.create_chunk(
collection_id="YOUR_COLLECTION_ID",
content="The dog is a domesticated descendant of the wolf. Also called the domestic dog, it is derived from extinct gray wolves, and the gray wolf is the dog's closest living relative. The dog was the first species to be domesticated by humans.",
)

print(f"created chunk: {chunk.chunk_id}\n")