Collections support arbitrary key-value metadata. Updates use deep merge — nested dictionaries
are merged recursively, preserving existing keys.
See Metadata for more on how metadata works in Docent.
from docent import Docent
client = Docent()
metadata = client.get_collection_metadata("my-collection-id")
print(metadata) # {"team": "support", "model": "gpt-4"}
Parameters
Returns
The collection’s metadata dictionary.
Updates are deep-merged into existing metadata. Existing keys not in the update are preserved.
# Existing metadata: {"team": "support", "config": {"model": "gpt-4"}}
client.update_collection_metadata("my-collection-id", {
"config": {"temperature": 0.7},
"version": "v2",
})
# Result: {"team": "support", "config": {"model": "gpt-4", "temperature": 0.7}, "version": "v2"}
Parameters
Metadata to merge into the existing metadata.
Returns
The full merged metadata dictionary after the update.
Remove specific keys from metadata. Supports dot-delimited paths for nested deletion.
# Existing metadata: {"team": "support", "config": {"model": "gpt-4", "temperature": 0.7}}
metadata, not_found = client.delete_collection_metadata_keys(
"my-collection-id",
keys=["config.temperature", "nonexistent_key"],
)
print(metadata) # {"team": "support", "config": {"model": "gpt-4"}}
print(not_found) # ["nonexistent_key"]
Parameters
Keys to remove. Use dot notation for nested keys (e.g., "config.model").
Returns
Returns a tuple of two values:
The metadata dictionary after deletion.
Keys that were not found in the metadata.