MemoryRecord

class MemoryRecord(BaseModel):

The basic message storing unit in the CAMEL memory system.

Attributes: message (BaseMessage): The main content of the record. role_at_backend (OpenAIBackendRole): An enumeration value representing the role this message played at the OpenAI backend. Note that this value is different from the :obj:RoleType used in the CAMEL role playing system. uuid (UUID, optional): A universally unique identifier for this record. This is used to uniquely identify this record in the memory system. If not given, it will be assigned with a random UUID. extra_info (Dict[str, str], optional): A dictionary of additional key-value pairs that provide more information. If not given, it will be an empty Dict. timestamp (float, optional): The timestamp when the record was created. agent_id (str): The identifier of the agent associated with this memory.

from_dict

def from_dict(cls, record_dict: Dict[str, Any]):

Reconstruct a :obj:MemoryRecord from the input dict.

Parameters:

  • record_dict (Dict[str, Any]): A dict generated by :meth:to_dict.

to_dict

def to_dict(self):

Convert the :obj:MemoryRecord to a dict for serialization purposes.

to_openai_message

def to_openai_message(self):

Converts the record to an :obj:OpenAIMessage object.

ContextRecord

class ContextRecord(BaseModel):

The result of memory retrieving.