Trait (v1)
Reference for magick_mind.resources.v1.trait.
magick_mind.resources.v1.trait
Trait resource for Magick Mind SDK v1 API.
Provides CRUD operations for trait definitions.
TraitResourceV1
class TraitResourceV1(BaseResource)Trait resource for managing trait definitions.
TraitResourceV1.create
async def create(name: str,
namespace: TraitNamespace,
category: str,
display_name: str,
type: TraitType,
visibility: TraitVisibility,
description: Optional[str] = None,
numeric_config: Optional[NumericConfig] = None,
categorical_config: Optional[CategoricalConfig] = None,
multilabel_config: Optional[MultilabelConfig] = None,
default_lock: Optional[LockType] = None,
default_learning_rate: float = 0.0,
supports_dyadic: bool = False) -> TraitCreate a new trait.
Note: TraitNamespace includes PROMOTED which is not available in Blueprint namespace.
Arguments:
name- Trait namenamespace- One of SYSTEM, USER, ORG, PROMOTEDcategory- Trait categorydisplay_name- Human-readable display nametype- One of NUMERIC, CATEGORICAL, MULTILABELvisibility- One of PRIVATE, ORG, PUBLICdescription- Optional descriptionnumeric_config- Config for NUMERIC traitscategorical_config- Config for CATEGORICAL traitsmultilabel_config- Config for MULTILABEL traitsdefault_lock- One of HARD, SOFTdefault_learning_rate- Default learning rate (default 0.0)supports_dyadic- Whether trait supports dyadic interactions (default False)
Returns:
Created Trait object
TraitResourceV1.get
async def get(trait_id: str) -> TraitGet a trait by ID.
Arguments:
trait_id- The trait ID to retrieve
Returns:
Trait object
TraitResourceV1.list
async def list(cursor: Optional[str] = None,
limit: Optional[int] = None,
order: Optional[str] = None) -> list[Trait]List traits with optional pagination.
Arguments:
cursor- Pagination cursorlimit- Max results to returnorder- Sort order, ASC or DESC
Returns:
List of Trait objects
TraitResourceV1.update
async def update(trait_id: str,
category: str,
display_name: str,
description: str,
type: TraitType,
default_learning_rate: float,
supports_dyadic: bool,
visibility: TraitVisibility,
numeric_config: Optional[NumericConfig] = None,
categorical_config: Optional[CategoricalConfig] = None,
multilabel_config: Optional[MultilabelConfig] = None,
default_lock: Optional[LockType] = None) -> TraitFully replace a trait (PUT).
Note: name and namespace are immutable after creation and cannot be changed.
Arguments:
trait_id- The trait ID to updatecategory- Trait categorydisplay_name- Human-readable display namedescription- Trait descriptiontype- One of NUMERIC, CATEGORICAL, MULTILABELdefault_learning_rate- Default learning ratesupports_dyadic- Whether trait supports dyadic interactionsvisibility- One of PRIVATE, ORG, PUBLICnumeric_config- Config for NUMERIC traitscategorical_config- Config for CATEGORICAL traitsmultilabel_config- Config for MULTILABEL traitsdefault_lock- One of HARD, SOFT
Returns:
Updated Trait object
TraitResourceV1.patch
async def patch(trait_id: str,
category: Optional[str] = None,
display_name: Optional[str] = None,
description: Optional[str] = None,
type: Optional[TraitType] = None,
numeric_config: Optional[NumericConfig] = None,
categorical_config: Optional[CategoricalConfig] = None,
multilabel_config: Optional[MultilabelConfig] = None,
default_lock: Optional[LockType] = None,
default_learning_rate: Optional[float] = None,
supports_dyadic: Optional[bool] = None,
visibility: Optional[TraitVisibility] = None) -> TraitPartially update a trait (PATCH).
Note: name and namespace are immutable after creation and cannot be changed.
Arguments:
trait_id- The trait ID to patchcategory- Trait categorydisplay_name- Human-readable display namedescription- Trait descriptiontype- One of NUMERIC, CATEGORICAL, MULTILABELnumeric_config- Config for NUMERIC traitscategorical_config- Config for CATEGORICAL traitsmultilabel_config- Config for MULTILABEL traitsdefault_lock- One of HARD, SOFTdefault_learning_rate- Default learning ratesupports_dyadic- Whether trait supports dyadic interactionsvisibility- One of PRIVATE, ORG, PUBLIC
Returns:
Updated Trait object
TraitResourceV1.delete
async def delete(trait_id: str) -> NoneDelete a trait.
Arguments:
trait_id- The trait ID to delete