Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

2.0 KB
Raw Blame
<a id="camel.memories.records"></a>

<a id="camel.memories.records.MemoryRecord"></a>

## MemoryRecord

```python
class MemoryRecord(BaseModel):
```

The basic message storing unit in the CAMEL memory system.

**Parameters:**

- **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.

<a id="camel.memories.records.MemoryRecord._get_constructor_params"></a>

### _get_constructor_params

```python
def _get_constructor_params(cls, message_cls):
```

Get constructor parameters for a message class with caching.

<a id="camel.memories.records.MemoryRecord.from_dict"></a>

### from_dict

```python
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`.

<a id="camel.memories.records.MemoryRecord.to_dict"></a>

### to_dict

```python
def to_dict(self):
```

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

<a id="camel.memories.records.MemoryRecord.to_openai_message"></a>

### to_openai_message

```python
def to_openai_message(self):
```

Converts the record to an :obj:`OpenAIMessage` object.

<a id="camel.memories.records.ContextRecord"></a>

## ContextRecord

```python
class ContextRecord(BaseModel):
```

The result of memory retrieving.