Models API Reference¶
This page provides detailed documentation for the GUM models.
Models¶
gum.models.Observation
¶
Bases: Base
Represents an observation of user behavior.
This model stores observations made by various observers about user behavior, including the content of the observation and metadata about when and how it was made.
Attributes:
Name | Type | Description |
---|---|---|
id |
int
|
Primary key for the observation. |
observer_name |
str
|
Name of the observer that made this observation. |
content |
str
|
The actual content of the observation. |
content_type |
str
|
Type of content (e.g., 'text', 'image', etc.). |
created_at |
datetime
|
When the observation was created. |
updated_at |
datetime
|
When the observation was last updated. |
propositions |
set[Proposition]
|
Set of propositions related to this observation. |
Attributes¶
__tablename__ = 'observations'
class-attribute
instance-attribute
¶
content: Mapped[str] = mapped_column(Text, nullable=False)
class-attribute
instance-attribute
¶
content_type: Mapped[str] = mapped_column(String(50), nullable=False)
class-attribute
instance-attribute
¶
created_at: Mapped[str] = mapped_column(DateTime(timezone=True), server_default=func.now(), nullable=False)
class-attribute
instance-attribute
¶
id: Mapped[int] = mapped_column(primary_key=True)
class-attribute
instance-attribute
¶
observer_name: Mapped[str] = mapped_column(String(100), nullable=False)
class-attribute
instance-attribute
¶
propositions: Mapped[set['Proposition']] = relationship('Proposition', secondary=observation_proposition, back_populates='observations', collection_class=set, passive_deletes=True, lazy='selectin')
class-attribute
instance-attribute
¶
updated_at: Mapped[str] = mapped_column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now(), nullable=False)
class-attribute
instance-attribute
¶
Functions¶
__repr__() -> str
¶
String representation of the observation.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
A string representation showing the observation ID and observer name. |
gum.models.Proposition
¶
Bases: Base
Represents a proposition about user behavior.
This model stores propositions generated from observations, including the proposition text, reasoning behind it, and metadata about its creation and relationships.
Attributes:
Name | Type | Description |
---|---|---|
id |
int
|
Primary key for the proposition. |
text |
str
|
The actual proposition text. |
reasoning |
str
|
The reasoning behind this proposition. |
confidence |
Optional[int]
|
Confidence level in this proposition. |
decay |
Optional[int]
|
Decay factor for this proposition. |
created_at |
datetime
|
When the proposition was created. |
updated_at |
datetime
|
When the proposition was last updated. |
revision_group |
str
|
Group identifier for related proposition revisions. |
version |
int
|
Version number of this proposition. |
parents |
set[Proposition]
|
Set of parent propositions. |
observations |
set[Observation]
|
Set of observations related to this proposition. |
Attributes¶
__tablename__ = 'propositions'
class-attribute
instance-attribute
¶
confidence: Mapped[Optional[int]]
instance-attribute
¶
created_at: Mapped[str] = mapped_column(DateTime(timezone=True), server_default=func.now(), nullable=False)
class-attribute
instance-attribute
¶
decay: Mapped[Optional[int]]
instance-attribute
¶
id: Mapped[int] = mapped_column(primary_key=True)
class-attribute
instance-attribute
¶
observations: Mapped[set[Observation]] = relationship('Observation', secondary=observation_proposition, back_populates='propositions', collection_class=set, passive_deletes=True, lazy='selectin')
class-attribute
instance-attribute
¶
parents: Mapped[set['Proposition']] = relationship('Proposition', secondary=proposition_parent, primaryjoin=id == proposition_parent.c.child_id, secondaryjoin=id == proposition_parent.c.parent_id, backref='children', collection_class=set, lazy='selectin')
class-attribute
instance-attribute
¶
reasoning: Mapped[str] = mapped_column(Text, nullable=False)
class-attribute
instance-attribute
¶
revision_group: Mapped[str] = mapped_column(String(36), nullable=False, index=True)
class-attribute
instance-attribute
¶
text: Mapped[str] = mapped_column(Text, nullable=False)
class-attribute
instance-attribute
¶
updated_at: Mapped[str] = mapped_column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now(), nullable=False)
class-attribute
instance-attribute
¶
version: Mapped[int] = mapped_column(Integer, server_default='1', nullable=False)
class-attribute
instance-attribute
¶
Functions¶
__repr__() -> str
¶
String representation of the proposition.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
A string representation showing the proposition ID and a preview of its text. |