Skip to main content

Update a Chunk

To update a chunk, use the update_chunk method. This method requires three primary parameters:

  • collection_id: Required. The identifier of the collection where the chunk is stored.
  • chunk_id: Required. The identifier of the chunk to be updated.
  • content: Optional. The textual content of the chunk.
  • metadata: Optional. A dictionary containing the metadata of the chunk.

Here is an example of updating a record with new content:

import taskingai

chunk = taskingai.retrieval.update_chunk(
collection_id="YOUR_COLLECTION_ID",
chunk_id="YOUR_CHUNK_ID",
content="Machine learning is a subfield of ..."
)

Another example of updating a chunk with new metadata:

import taskingai

chunk = taskingai.retrieval.update_chunk(
collection_id="YOUR_COLLECTION_ID",
chunk_id="YOUR_CHUNK_ID",
metadata={"file_name":"machine_learning.pdf", "author": "James Brown"}
)