Skip to main content
This cookbook shows you how to use the platform’s AI to automatically generate custom taxonomies. Instead of manually defining tags one by one, you can describe your use case in natural language, and the AI will propose a complete taxonomy for you.

AI-Generated Taxonomies

taxonomy.generate_from_context bootstraps a taxonomy from a free-form description of your data. Nothing is saved, so you can review the result first:
Optional parameters steer the result: industry, data_type, use_case, taxonomy_type (default hierarchical) and max_depth (default 3).

Validate Against Your Documents

For higher accuracy, pass the data source’s id and set validate_tags=True. The platform samples that data source’s files and scores the suggested tags against them; tag_not_found_rates reports how often each tag was not found in the sample.
A rate of -1 means there is no score for that tag. Validation was not requested, no sample files were found, or validation failed. Without a data source and validate_tags=True, every tag reports -1.
generate_from_context takes the data source by id only. The lookup above is the same name-to-id lookup described in the SDK README.

Create the Tags

Once you are happy with the suggestion, create its tags with tags.upsert. Each entry in suggested_tags is keyed by tag name:
Add tags the AI missed the same way:
The suggested graph names its nodes by tag name, while a saved taxonomy refers to tags by id, so don’t pass suggestion.taxonomy_data to taxonomy.upsert as returned. Use the suggestion as a blueprint for the tags above.

Common Use Cases

Next Steps

Organize a SharePoint Library

Enrich libraries at the source with your taxonomy.

Clean Up a RAG Index

Curate a serving collection with your taxonomy.

Protect Sensitive Data

Add sensitive data detection.

Taxonomies Concept

Learn the fundamentals of taxonomies.