Skip to content

Commit 337aa8d

Browse files
committed
Merge branch 'test' into feat/reorg-memcube
2 parents a15f18a + de2b5c6 commit 337aa8d

24 files changed

+452
-234
lines changed

evaluation/.env-example

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,24 @@ ZEP_API_KEY="z_***REDACTED***"
99
CHAT_MODEL="gpt-4o-mini"
1010
CHAT_MODEL_BASE_URL="http://***.***.***.***:3000/v1"
1111
CHAT_MODEL_API_KEY="sk-***REDACTED***"
12+
13+
# Configuration Only For Scheduler
14+
# RabbitMQ Configuration
15+
MEMSCHEDULER_RABBITMQ_HOST_NAME=rabbitmq-cn-***.cn-***.amqp-32.net.mq.amqp.aliyuncs.com
16+
MEMSCHEDULER_RABBITMQ_USER_NAME=***
17+
MEMSCHEDULER_RABBITMQ_PASSWORD=***
18+
MEMSCHEDULER_RABBITMQ_VIRTUAL_HOST=memos
19+
MEMSCHEDULER_RABBITMQ_ERASE_ON_CONNECT=true
20+
MEMSCHEDULER_RABBITMQ_PORT=5672
21+
22+
# OpenAI Configuration
23+
MEMSCHEDULER_OPENAI_API_KEY=sk-***
24+
MEMSCHEDULER_OPENAI_BASE_URL=http://***.***.***.***:3000/v1
25+
MEMSCHEDULER_OPENAI_DEFAULT_MODEL=gpt-4o-mini
26+
27+
# Graph DB Configuration
28+
MEMSCHEDULER_GRAPHDBAUTH_URI=bolt://localhost:7687
29+
MEMSCHEDULER_GRAPHDBAUTH_USER=neo4j
30+
MEMSCHEDULER_GRAPHDBAUTH_PASSWORD=***
31+
MEMSCHEDULER_GRAPHDBAUTH_DB_NAME=neo4j
32+
MEMSCHEDULER_GRAPHDBAUTH_AUTO_CREATE=true

evaluation/scripts/temporal_locomo/modules/base_eval_module.py

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -91,51 +91,53 @@ def __init__(self, args):
9191
self.ingestion_storage_dir = self.result_dir / "storages"
9292
self.mos_config_path = Path(f"{BASE_DIR}/configs-example/mos_w_scheduler_config.json")
9393
self.mem_cube_config_path = Path(f"{BASE_DIR}/configs-example/mem_cube_config.json")
94+
9495
self.openai_api_key = os.getenv("CHAT_MODEL_API_KEY")
9596
self.openai_base_url = os.getenv("CHAT_MODEL_BASE_URL")
9697
self.openai_chat_model = os.getenv("CHAT_MODEL")
9798

9899
auth_config_path = Path(f"{BASE_DIR}/scripts/temporal_locomo/eval_auth.json")
99100
if auth_config_path.exists():
100101
auth_config = AuthConfig.from_local_config(config_path=auth_config_path)
101-
102-
self.openai_api_key = auth_config.openai.api_key
103-
self.openai_base_url = auth_config.openai.base_url
104-
self.openai_chat_model = auth_config.openai.default_model
105-
106-
self.mos_config_data = json.load(self.mos_config_path.open("r", encoding="utf-8"))
107-
self.mem_cube_config_data = json.load(
108-
self.mem_cube_config_path.open("r", encoding="utf-8")
109-
)
110-
111-
# Update LLM authentication information in MOS configuration using dictionary assignment
112-
self.mos_config_data["mem_reader"]["config"]["llm"]["config"]["api_key"] = (
113-
auth_config.openai.api_key
114-
)
115-
self.mos_config_data["mem_reader"]["config"]["llm"]["config"]["api_base"] = (
116-
auth_config.openai.base_url
117-
)
118-
119-
# Update graph database authentication information in memory cube configuration using dictionary assignment
120-
self.mem_cube_config_data["text_mem"]["config"]["graph_db"]["config"]["uri"] = (
121-
auth_config.graph_db.uri
122-
)
123-
self.mem_cube_config_data["text_mem"]["config"]["graph_db"]["config"]["user"] = (
124-
auth_config.graph_db.user
125-
)
126-
self.mem_cube_config_data["text_mem"]["config"]["graph_db"]["config"]["password"] = (
127-
auth_config.graph_db.password
128-
)
129-
self.mem_cube_config_data["text_mem"]["config"]["graph_db"]["config"]["db_name"] = (
130-
auth_config.graph_db.db_name
102+
print(
103+
f"✅ Configuration loaded successfully: from local config file {auth_config_path}"
131104
)
132-
self.mem_cube_config_data["text_mem"]["config"]["graph_db"]["config"]["auto_create"] = (
133-
auth_config.graph_db.auto_create
134-
)
135-
136105
else:
137-
print("Please referring to configs-example to provide valid configs.")
138-
exit()
106+
# Load .env file first before reading environment variables
107+
load_dotenv()
108+
auth_config = AuthConfig.from_local_env()
109+
print("✅ Configuration loaded successfully: from environment variables")
110+
self.openai_api_key = auth_config.openai.api_key
111+
self.openai_base_url = auth_config.openai.base_url
112+
self.openai_chat_model = auth_config.openai.default_model
113+
114+
self.mos_config_data = json.load(self.mos_config_path.open("r", encoding="utf-8"))
115+
self.mem_cube_config_data = json.load(self.mem_cube_config_path.open("r", encoding="utf-8"))
116+
117+
# Update LLM authentication information in MOS configuration using dictionary assignment
118+
self.mos_config_data["mem_reader"]["config"]["llm"]["config"]["api_key"] = (
119+
auth_config.openai.api_key
120+
)
121+
self.mos_config_data["mem_reader"]["config"]["llm"]["config"]["api_base"] = (
122+
auth_config.openai.base_url
123+
)
124+
125+
# Update graph database authentication information in memory cube configuration using dictionary assignment
126+
self.mem_cube_config_data["text_mem"]["config"]["graph_db"]["config"]["uri"] = (
127+
auth_config.graph_db.uri
128+
)
129+
self.mem_cube_config_data["text_mem"]["config"]["graph_db"]["config"]["user"] = (
130+
auth_config.graph_db.user
131+
)
132+
self.mem_cube_config_data["text_mem"]["config"]["graph_db"]["config"]["password"] = (
133+
auth_config.graph_db.password
134+
)
135+
self.mem_cube_config_data["text_mem"]["config"]["graph_db"]["config"]["db_name"] = (
136+
auth_config.graph_db.db_name
137+
)
138+
self.mem_cube_config_data["text_mem"]["config"]["graph_db"]["config"]["auto_create"] = (
139+
auth_config.graph_db.auto_create
140+
)
139141

140142
# Logger initialization
141143
self.logger = logger
@@ -158,7 +160,6 @@ def __init__(self, args):
158160

159161
self.can_answer_cases: list[RecordingCase] = []
160162
self.cannot_answer_cases: list[RecordingCase] = []
161-
load_dotenv()
162163

163164
def print_eval_info(self):
164165
"""

examples/data/config/mem_scheduler/mem_cube_config.yaml renamed to examples/data/config/mem_scheduler/mem_cube_config_neo4j.yaml

File renamed without changes.

examples/data/config/mem_scheduler/memos_config_w_optimized_scheduler_and_openai.yaml renamed to examples/data/config/mem_scheduler/memos_config_w_optimized_scheduler.yaml

File renamed without changes.

examples/data/config/mem_scheduler/memos_config_w_scheduler.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ mem_reader:
1010
backend: "simple_struct"
1111
config:
1212
llm:
13-
backend: "ollama"
13+
backend: "openai"
1414
config:
15-
model_name_or_path: "qwen3:0.6b"
16-
remove_think_prefix: true
15+
model_name_or_path: "gpt-4o-mini"
1716
temperature: 0.8
18-
max_tokens: 1024
17+
max_tokens: 4096
1918
top_p: 0.9
2019
top_k: 50
20+
remove_think_prefix: true
21+
api_key: "sk-xxxxxx"
22+
api_base: "https://api.openai.com/v1"
2123
embedder:
2224
backend: "ollama"
2325
config:

examples/data/config/mem_scheduler/memos_config_w_scheduler_and_openai.yaml

Lines changed: 0 additions & 51 deletions
This file was deleted.

examples/mem_os/chat_w_scheduler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717

1818
# set configs
1919
mos_config = MOSConfig.from_yaml_file(
20-
f"{BASE_DIR}/examples/data/config/mem_scheduler/memos_config_w_scheduler_and_openai.yaml"
20+
f"{BASE_DIR}/examples/data/config/mem_scheduler/memos_config_w_scheduler.yaml"
2121
)
2222

2323
mem_cube_config = GeneralMemCubeConfig.from_yaml_file(
24-
f"{BASE_DIR}/examples/data/config/mem_scheduler/mem_cube_config.yaml"
24+
f"{BASE_DIR}/examples/data/config/mem_scheduler/mem_cube_config_neo4j.yaml"
2525
)
2626

2727
# default local graphdb uri

examples/mem_scheduler/debug_text_mem_replace.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828

2929
# set configs
3030
mos_config = MOSConfig.from_yaml_file(
31-
f"{BASE_DIR}/examples/data/config/mem_scheduler/memos_config_w_optimized_scheduler_and_openai.yaml"
31+
f"{BASE_DIR}/examples/data/config/mem_scheduler/memos_config_w_optimized_scheduler.yaml"
3232
)
3333

3434
mem_cube_config = GeneralMemCubeConfig.from_yaml_file(
35-
f"{BASE_DIR}/examples/data/config/mem_scheduler/mem_cube_config.yaml"
35+
f"{BASE_DIR}/examples/data/config/mem_scheduler/mem_cube_config_neo4j.yaml"
3636
)
3737

3838
# default local graphdb uri

examples/mem_scheduler/memos_w_optimized_scheduler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ def run_with_scheduler_init():
2626

2727
# set configs
2828
mos_config = MOSConfig.from_yaml_file(
29-
f"{BASE_DIR}/examples/data/config/mem_scheduler/memos_config_w_optimized_scheduler_and_openai.yaml"
29+
f"{BASE_DIR}/examples/data/config/mem_scheduler/memos_config_w_optimized_scheduler.yaml"
3030
)
3131

3232
mem_cube_config = GeneralMemCubeConfig.from_yaml_file(
33-
f"{BASE_DIR}/examples/data/config/mem_scheduler/mem_cube_config.yaml"
33+
f"{BASE_DIR}/examples/data/config/mem_scheduler/mem_cube_config_neo4j.yaml"
3434
)
3535

3636
# default local graphdb uri

examples/mem_scheduler/memos_w_optimized_scheduler_for_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828

2929
# set configs
3030
mos_config = MOSConfig.from_yaml_file(
31-
f"{BASE_DIR}/examples/data/config/mem_scheduler/memos_config_w_optimized_scheduler_and_openai.yaml"
31+
f"{BASE_DIR}/examples/data/config/mem_scheduler/memos_config_w_optimized_scheduler.yaml"
3232
)
3333

3434
mem_cube_config = GeneralMemCubeConfig.from_yaml_file(
35-
f"{BASE_DIR}/examples/data/config/mem_scheduler/mem_cube_config.yaml"
35+
f"{BASE_DIR}/examples/data/config/mem_scheduler/mem_cube_config_neo4j.yaml"
3636
)
3737

3838
# default local graphdb uri

0 commit comments

Comments
 (0)