Memobase uses a single config.yaml
to initialize the server. It contains the configs of:
- LLM:
llm_base_url
,llm_api_key
,best_llm_model
,... - Embedding:
enable_event_embedding
,embedding_api_key
... - Memory:
max_pre_profile_token_size
,max_profile_subtopics
,additional_user_profiles
...
By default, Memobase enables user profile and event memory with filter ability. That means running a Memobase server requires you to have below things:
- LLM API: You must fill the OpenAI API Key in
llm_api_key
ofconfig.yaml
.Or you can changellm_base_url
to any OpenAI-SDK-Compatible service(via vllm, Ollama,...). Alternatively, you can setllm_api_key
andllm_base_url
using environment variablesMEMOBASE_LLM_API_KEY
andMEMOBASE_LLM_BASE_URL
- Embedding API: Memobase supports OpenAI-Compatible SDK and Jina Embedding. Memobase uses embedding API to retrieve related user events. If you don't have a embedding API, you can set
enable_event_embedding: false
inconfig.yaml
environment variables
Check ./.env.example
for necessary vars. You can configure the running port and access token in here. Also, anything in config.yaml
can be override in env(doc), just starts with MEMOBASE_
-
Make sure you have docker-compose installed.
-
Prepare the configs:
cd src/server cp .env.example .env cp ./api/config.yaml.example ./api/config.yaml
.env
contains the service configs, like running port, secret token...config.yaml
contains the Memobase configs, like LLM model, profile slots. docs
-
Run
docker-compose build && docker-compose up
to start the services.
Check out the docs of how to use Memobase client or APIs.
-
If you have existing postgres and reids, you can only launch the Memobase core
-
Find and download the docker image of Memobase:
docker pull ghcr.io/memodb-io/memobase:latest
-
Setup your
config.yaml
and anenv.list
file, theenv.list
should look like this: -
Run the service:
docker run --env-file env.list -v ./api/config.yaml:/app/config.yaml -p 8019:8000 ghcr.io/memodb-io/memobase:main
- Start a local DB first by
sh script/up-dev.sh
- Open a new terminal window and
cd ./api
- Install python deps:
pip install -r requirements.txt
- To test if you got everything right, run
pytest
to see if all the tests are passed. - Launch Memobase Server in dev mode:
fastapi dev --port 8019
fastapi dev
has hot-reload, so you can just modify the code and test it without relaunch the service.
Memobase may introduce breaking changes in DB schema, here is a guideline of how to migrate your data to latest Memobase:
-
Install
alembic
:pip install alembic
-
Modify
./api/alembic.ini
. Find the field calledsqlalchemy.url
inalembbic.ini
, change it to your Postgres DB of Memobase -
Run below commands to prepare the migration plan:
cd api mkdir migrations/versions alembic upgrade head alembic revision --autogenerate -m "memobase changes"
-
⚠️ Run the commandalembic upgrade head
again to migrate your current Memobase DB to the latest one.