Skip to content

Models Used Throughout

Contains Pydantic data models that are used throughout the application for storing and retrieving from data sources.

memora.schema.models.Organization

Bases: BaseModel

Attributes

created_at class-attribute instance-attribute

created_at: datetime = Field(
    description="DateTime object of when the organization was created."
)

org_id class-attribute instance-attribute

org_id: str = Field(
    description="Short UUID string identifying the organization."
)

org_name class-attribute instance-attribute

org_name: str = Field(
    description="Name of the organization."
)

memora.schema.models.Agent

Bases: BaseModel

Attributes

agent_id class-attribute instance-attribute

agent_id: str = Field(
    description="Short UUID string identifying the agent."
)

agent_label class-attribute instance-attribute

agent_label: str = Field(
    description="Label/name for the agent."
)

created_at class-attribute instance-attribute

created_at: datetime = Field(
    description="DateTime object of when the agent was created."
)

org_id class-attribute instance-attribute

org_id: str = Field(
    description="Short UUID string identifying the organization."
)

user_id class-attribute instance-attribute

user_id: Optional[str] = Field(
    default=None,
    description="Short UUID string identifying the user.",
)

memora.schema.models.User

Bases: BaseModel

Attributes

created_at class-attribute instance-attribute

created_at: datetime = Field(
    description="DateTime object of when the user was created."
)

org_id class-attribute instance-attribute

org_id: str = Field(
    description="Short UUID string identifying the organization."
)

user_id class-attribute instance-attribute

user_id: str = Field(
    description="Short UUID string identifying the user."
)

user_name class-attribute instance-attribute

user_name: str = Field(description='Name of the user.')

memora.schema.models.Interaction

Bases: BaseModel

Attributes

agent_id class-attribute instance-attribute

agent_id: str = Field(
    description="Short UUID string identifying the agent."
)

created_at class-attribute instance-attribute

created_at: datetime = Field(
    description="DateTime object of when the interaction was created."
)

interaction_id class-attribute instance-attribute

interaction_id: str = Field(
    description="Short UUID string identifying the interaction."
)

memories class-attribute instance-attribute

memories: Optional[List[Memory]] = Field(
    default=None,
    description="List of memories gotten across all occurrences of this interaction.",
)

messages class-attribute instance-attribute

messages: Optional[List[MessageBlock]] = Field(
    default=None,
    description="List of messages in the interaction.",
)

org_id class-attribute instance-attribute

org_id: str = Field(
    description="Short UUID string identifying the organization."
)

updated_at class-attribute instance-attribute

updated_at: datetime = Field(
    description="DateTime object of when the interaction was last updated."
)

user_id class-attribute instance-attribute

user_id: str = Field(
    description="Short UUID string identifying the user."
)

memora.schema.models.MessageBlock

Bases: BaseModel

Attributes

content class-attribute instance-attribute

content: Optional[str] = Field(
    default=None,
    description="The actual content of the message.",
)

msg_position class-attribute instance-attribute

msg_position: int = Field(
    description="Position of this message in the interaction."
)

role class-attribute instance-attribute

role: Optional[str] = Field(
    default=None, description="e.g., user, assistant, tool."
)

memora.schema.models.Memory

Bases: BaseModel

Attributes

agent_id class-attribute instance-attribute

agent_id: str = Field(
    description="Short UUID string identifying the agent."
)

interaction_id class-attribute instance-attribute

interaction_id: Optional[str] = Field(
    default=None,
    description="Short UUID string identifying the interaction where this memory was sourced from.",
)

memory class-attribute instance-attribute

memory: str = Field(description='The memory.')

memory_id class-attribute instance-attribute

memory_id: str = Field(
    description="Full UUID string identifying the memory."
)

message_sources class-attribute instance-attribute

message_sources: Optional[List[MessageBlock]] = Field(
    default=None,
    description="List of messages in the interaction that triggered the memory. (Note: A memory won't have a message source, if its interaction was updated with a conflicting conversation thread that lead to truncation of the former thread. See `graph.update_interaction_and_memories`)",
)

obtained_at class-attribute instance-attribute

obtained_at: datetime = Field(
    description="DateTime object of when the memory was obtained."
)

org_id class-attribute instance-attribute

org_id: str = Field(
    description="Short UUID string identifying the organization."
)

user_id class-attribute instance-attribute

user_id: str = Field(
    description="Short UUID string identifying the user."
)

Functions

id_memory_and_timestamp_dict

id_memory_and_timestamp_dict()
Source code in memora/schema/models.py
def id_memory_and_timestamp_dict(self):
    return {
        "memory_id": self.memory_id,
        "memory": self.memory,
        "obtained_at": str(self.obtained_at),
    }

memory_and_timestamp_dict

memory_and_timestamp_dict()
Source code in memora/schema/models.py
def memory_and_timestamp_dict(self):
    return {"memory": self.memory, "obtained_at": str(self.obtained_at)}