Skip to Content

Entities

The EntitiesResource provides CRUD access to entities in the knowledge graph — people, places, organizations, preferences, skills, and other extracted concepts.

Access

user = client.for_user("user-123") entities = user.entities

Methods

list(**kwargs)

List entities with optional filtering.

entities_list = entities.list(type="person") for entity in entities_list: print(f"{entity.content} ({entity.type}) - importance: {entity.importance}")
ParameterTypeDefaultDescription
owner_idstr | NoneNoneFilter by owner
limitint100Maximum number to return
offsetint0Pagination offset
typestr | NoneNoneFilter by entity type

Returns: EntityList — iterable of Entity objects

get(entity_id)

Get a single entity by ID.

entity = entities.get("entity-uuid") print(entity.content) # Entity text content print(entity.type) # "person", "organization", etc. print(entity.category) # Category grouping print(entity.importance) # 0.0 to 1.0 print(entity.community_id) # Community cluster ID print(entity.created_at) print(entity.updated_at) print(entity.metadata)

Returns: Entity

Entity model fields

FieldTypeDescription
idstrUnique identifier
contentstrEntity text content
typestrType (person, organization, location, etc.)
categorystr | NoneCategory grouping
importancefloatImportance score (0.0–1.0)
community_idstr | NoneID of the detected community cluster
created_atdatetimeWhen the entity was first created
updated_atdatetimeWhen the entity was last updated
metadatadict | NoneOptional metadata

update(entity_id, updates)

Update an entity’s fields.

from memorer.types import EntityUpdate entity = entities.update( "entity-uuid", EntityUpdate(importance=0.9, category="vip") )
ParameterTypeDescription
entity_idstrUUID of the entity
updatesEntityUpdateFields to update (at least one required)

EntityUpdate fields (all optional): content, type, category, importance

Returns: Updated Entity

delete(entity_id)

Soft-delete an entity.

entities.delete("entity-uuid")

relationships(entity_id)

Get all incoming and outgoing relationships for an entity.

rels = entities.relationships("entity-uuid") print(f"Outgoing: {len(rels.outgoing)}") print(f"Incoming: {len(rels.incoming)}") for rel in rels.outgoing: print(f" --{rel.relationship_type}--> {rel.target_id}")

Returns: EntityRelationships with fields:

  • entity_id — The entity ID
  • incoming — List of Relationship objects pointing to this entity
  • outgoing — List of Relationship objects pointing from this entity
Last updated on