mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-08-28 05:25:04 +00:00
update appworld experiment & readme
This commit is contained in:
parent
5302b1b69c
commit
020f2bc3ef
4 changed files with 25 additions and 30 deletions
|
|
@ -1,7 +1,5 @@
|
|||
import os
|
||||
from typing import List
|
||||
|
||||
from oauthlib.uri_validate import query
|
||||
from tqdm import tqdm
|
||||
|
||||
os.environ["APPWORLD_ROOT"] = "."
|
||||
|
|
@ -63,7 +61,7 @@ class AppworldReactAgent:
|
|||
model=self.model_name,
|
||||
messages=messages,
|
||||
temperature=self.temperature,
|
||||
extra_body={"enable_thinking": True},
|
||||
extra_body={"enable_thinking": False},
|
||||
seed=0)
|
||||
|
||||
return response.choices[0].message.content
|
||||
|
|
@ -84,7 +82,7 @@ class AppworldReactAgent:
|
|||
print(dictionary)
|
||||
prompt = Template(PROMPT_TEMPLATE_WITH_EXPERIENCE.lstrip()).render(dictionary)
|
||||
messages: list[dict] = []
|
||||
last_start = 0
|
||||
# last_start = 0
|
||||
# for match in re.finditer("(USER|ASSISTANT|SYSTEM):\n", prompt):
|
||||
# last_end = match.span()[0]
|
||||
# if len(messages) == 0:
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ Launch the ReMe service to enable memory library functionality:
|
|||
```bash
|
||||
reme \
|
||||
backend=http \
|
||||
http.port=8001 \
|
||||
http.port=8002 \
|
||||
llm.default.model_name=qwen-max-latest \
|
||||
embedding_model.default.model_name=text-embedding-v4 \
|
||||
vector_store.default.backend=local
|
||||
|
|
@ -65,12 +65,12 @@ reme \
|
|||
|
||||
add memories for appworld:
|
||||
```bash
|
||||
curl -X POST "http://0.0.0.0:8001/vector_store" \
|
||||
curl -X POST "http://0.0.0.0:8002/vector_store" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"workspace_id": "appworld_v1",
|
||||
"action": "dump",
|
||||
"path": "./memory_library"
|
||||
"workspace_id": "appworld",
|
||||
"action": "load",
|
||||
"path": "./docs/library"
|
||||
}'
|
||||
```
|
||||
Now you have loaded the ReMe memory library to enable memory-based agent!
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ def dump_memory(workspace_id: str, path: str = "./", api_url: str = "http://0.0.
|
|||
print(f"Memory dumped to {path}")
|
||||
|
||||
|
||||
def load_memory(workspace_id: str, path: str = "./", api_url: str = "http://0.0.0.0:8002/"):
|
||||
def load_memory(workspace_id: str, path: str = "docs/library", api_url: str = "http://0.0.0.0:8002/"):
|
||||
"""Load memories from disk into the vector store"""
|
||||
response = requests.post(
|
||||
url=f"{api_url}vector_store",
|
||||
|
|
@ -138,7 +138,7 @@ def run_agent(dataset_name: str, experiment_suffix: str, max_workers: int, num_r
|
|||
def main():
|
||||
max_workers = 8
|
||||
num_runs = 1 # Run each task once
|
||||
workspace_id = "appworld_v1"
|
||||
workspace_id = "appworld"
|
||||
api_url = "http://0.0.0.0:8002/"
|
||||
|
||||
if max_workers > 1:
|
||||
|
|
@ -149,32 +149,29 @@ def main():
|
|||
delete_workspace(workspace_id=workspace_id, api_url=api_url)
|
||||
|
||||
# First run to build task memories
|
||||
logger.info("Start running experiments to build task memories")
|
||||
run_agent(dataset_name="dev", experiment_suffix="build-memory",
|
||||
max_workers=max_workers, num_runs=1,
|
||||
use_task_memory=False, make_task_memory=True,
|
||||
workspace_id=workspace_id, api_url=api_url)
|
||||
|
||||
# Dump memories to disk for persistence
|
||||
logger.info("Dumping memories to disk...")
|
||||
dump_memory(workspace_id=workspace_id, api_url=api_url)
|
||||
|
||||
# Run experiments without task memory
|
||||
logger.info("Start running experiments without task memory")
|
||||
for i in range(num_runs):
|
||||
run_agent(dataset_name="dev", experiment_suffix=f"no-memory",
|
||||
max_workers=max_workers, num_runs=1,
|
||||
use_task_memory=False, make_task_memory=False,
|
||||
workspace_id=workspace_id, api_url=api_url)
|
||||
logger.info("Start load experiments to build task memories")
|
||||
load_memory(workspace_id=workspace_id, api_url=api_url)
|
||||
# run_agent(dataset_name="dev", experiment_suffix="build-memory",
|
||||
# max_workers=max_workers, num_runs=1,
|
||||
# use_task_memory=False, make_task_memory=True,
|
||||
# workspace_id=workspace_id, api_url=api_url)
|
||||
|
||||
# Run experiments with task memory
|
||||
logger.info("Start running experiments with task memory")
|
||||
for i in range(num_runs):
|
||||
|
||||
# Run experiments with task memory
|
||||
logger.info("Start running experiments with task memory")
|
||||
run_agent(dataset_name="dev", experiment_suffix=f"with-memory",
|
||||
max_workers=max_workers, num_runs=1,
|
||||
use_task_memory=True, make_task_memory=False,
|
||||
workspace_id=workspace_id, api_url=api_url)
|
||||
|
||||
# Run experiments without task memory
|
||||
logger.info("Start running experiments without task memory")
|
||||
run_agent(dataset_name="dev", experiment_suffix=f"no-memory",
|
||||
max_workers=max_workers, num_runs=1,
|
||||
use_task_memory=False, make_task_memory=False,
|
||||
workspace_id=workspace_id, api_url=api_url)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 458 KiB |
Loading…
Add table
Reference in a new issue