Configuration for attribute-based clustering. Attribute-based clustering groups documents by metadata attributes (e.g., category, brand, status) instead of vector similarity. This is useful for organizing content by business logic rather than semantic similarity. Examples: - Group products by category and brand - Organize orders by status and priority - Cluster content by author and topic
| Name | Type | Description | Notes |
|---|---|---|---|
| attributes | List[str] | List of attribute field names to use for clustering. Documents will be grouped by unique combinations of these attribute values. Supports dot-notation for nested fields (e.g., 'metadata.category'). Order matters for hierarchical grouping: first attribute is top-level, subsequent are nested. | |
| hierarchical_grouping | bool | Whether to create hierarchical clusters based on attribute order. When True: Creates parent clusters for each unique value of the first attribute, then child clusters for subsequent attributes within each parent. When False: Creates flat clusters for each unique combination of all attributes. Example with ['category', 'brand']: hierarchical=True → 'Electronics' (parent) → 'Apple', 'Samsung' (children). hierarchical=False → 'Electronics_Apple', 'Electronics_Samsung' (flat). | [optional] [default to False] |
| aggregation_method | str | Method for aggregating attribute values when creating cluster centroids. Options: 'most_frequent' (default), 'first', 'last'. Most use cases should use the default. | [optional] |
from mixpeek.models.attribute_based_config import AttributeBasedConfig
# TODO update the JSON string below
json = "{}"
# create an instance of AttributeBasedConfig from a JSON string
attribute_based_config_instance = AttributeBasedConfig.from_json(json)
# print the JSON string representation of the object
print(AttributeBasedConfig.to_json())
# convert the object into a dict
attribute_based_config_dict = attribute_based_config_instance.to_dict()
# create an instance of AttributeBasedConfig from a dict
attribute_based_config_from_dict = AttributeBasedConfig.from_dict(attribute_based_config_dict)