|
| 1 | +# Membase Plugin for GAME SDK |
| 2 | + |
| 3 | +A plugin for interacting with membase protocol through the GAME SDK. |
| 4 | + |
| 5 | +## Description |
| 6 | + |
| 7 | +Membase is a core component of the Unibase ecosystem. It stores historical information, interaction records, and persistent data of Agents, ensuring their continuity and traceability. |
| 8 | + |
| 9 | +The membase plugin enables seamless integration with the membase protocol for decentralized storage. It provides functionality to upload memory to and reload it from the Unibase DA network. |
| 10 | + |
| 11 | +- support conversation switch |
| 12 | +- support conversation pesistence, upload if auto_upload_to_hub is set, conversation content can be visit at: https://testnet.hub.membase.io/ |
| 13 | +- support conversation preload from membase hub: https://testnet.hub.membase.io/ |
| 14 | + |
| 15 | +## Installation |
| 16 | + |
| 17 | +```bash |
| 18 | +pip install -e plugins/membase |
| 19 | +``` |
| 20 | + |
| 21 | +## Configuration |
| 22 | + |
| 23 | +The plugin requires the following environment variables to be set: |
| 24 | + |
| 25 | +```shell |
| 26 | +MEMBASE_HUB=<Membase hub endpoint, default is 'https://testnet.hub.membase.io' > |
| 27 | +MEMBASE_ACCOUNT=<Membase account address> |
| 28 | +MEMBASE_ID=<your agent name> |
| 29 | +``` |
| 30 | + |
| 31 | +## Usage |
| 32 | + |
| 33 | +```python |
| 34 | +import time |
| 35 | +import uuid |
| 36 | +from membase_plugin_gamesdk.membase_plugin_gamesdk import MembasePlugin |
| 37 | + |
| 38 | +# set your own account and agent name |
| 39 | +# or set environment variables |
| 40 | +default_account = "game_sdk_test" |
| 41 | +default_agent_name = "game_sdk_test_agent" |
| 42 | +membase_plugin = MembasePlugin( |
| 43 | + account=default_account, |
| 44 | + agent_name=default_agent_name, |
| 45 | + auto_upload_to_hub=True, |
| 46 | + preload_from_hub=True, |
| 47 | +) |
| 48 | + |
| 49 | +membase_plugin.add_memory("Hello, world!") |
| 50 | +new_conversation_id = str(uuid.uuid4()) |
| 51 | +membase_plugin.switch_conversation_id(new_conversation_id) |
| 52 | +membase_plugin.add_memory("Hello, world! 2") |
| 53 | +``` |
| 54 | + |
| 55 | +more in `test_membase.py` file |
0 commit comments