From 7ca51b728cffa40bcc00cc20285b82b878c42d95 Mon Sep 17 00:00:00 2001 From: better629 Date: Wed, 27 Mar 2024 23:07:46 +0800 Subject: [PATCH] rename folder --- examples/st_game/requirements.txt | 0 examples/st_game/run_st_game.py | 93 ---------------- examples/st_game/storage/.gitignore | 3 - .../environment/0.json | 26 ----- .../associative_memory/embeddings.json | 1 - .../associative_memory/kw_strength.json | 2 - .../associative_memory/nodes.json | 1 - .../bootstrap_memory/scratch.json | 51 --------- .../bootstrap_memory/spatial_memory.json | 66 ----------- .../test_memory/embeddings.json | 1 - .../test_memory/kw_strength.json | 4 - .../bootstrap_memory/test_memory/nodes.json | 1 - .../associative_memory/embeddings.json | 1 - .../associative_memory/kw_strength.json | 2 - .../associative_memory/nodes.json | 1 - .../bootstrap_memory/scratch.json | 51 --------- .../bootstrap_memory/spatial_memory.json | 86 -------------- .../associative_memory/embeddings.json | 1 - .../associative_memory/kw_strength.json | 2 - .../associative_memory/nodes.json | 1 - .../Maria Lopez/bootstrap_memory/scratch.json | 51 --------- .../bootstrap_memory/spatial_memory.json | 87 --------------- .../reverie/meta.json | 13 --- examples/st_game/utils/__init__.py | 3 - .../{st_game => stanford_town}/.gitignore | 0 examples/{st_game => stanford_town}/README.md | 4 +- .../{st_game => stanford_town}/README_CN.md | 4 +- .../actions}/__init__.py | 0 .../actions/agent_chat_sum_rel.py | 2 +- .../actions/decide_to_talk.py | 2 +- .../actions/dummy_action.py | 0 .../actions/gen_action_details.py | 2 +- .../actions/gen_daily_schedule.py | 0 .../actions/gen_hourly_schedule.py | 0 .../actions/gen_iter_chat_utt.py | 6 +- .../actions/inner_voice_action.py | 2 +- .../actions/new_decomp_schedule.py | 2 +- .../actions/run_reflect_action.py | 2 +- .../actions/st_action.py | 2 +- .../actions/summarize_conv.py | 2 +- .../actions/task_decomp.py | 0 .../actions/wake_up.py | 0 .../memory/__init__.py | 0 .../memory/agent_memory.py | 0 .../memory/retrieve.py | 4 +- .../memory/scratch.py | 0 .../memory/spatial_memory.py | 0 .../plan}/__init__.py | 0 .../plan/converse.py | 6 +- .../plan/st_plan.py | 0 .../prompts/__init__.py | 0 .../prompts/action_location_object_vMar11.txt | 0 .../prompts/action_location_sector_v1.txt | 0 .../prompts/action_object_v2.txt | 0 .../prompts/daily_planning_v6.txt | 0 .../prompts/decide_to_talk_v2.txt | 0 .../prompts/generate_event_triple_v1.txt | 0 .../prompts/generate_focal_pt_v1.txt | 0 .../prompts/generate_hourly_schedule_v2.txt | 0 .../prompts/generate_obj_event_v1.txt | 0 .../prompts/generate_pronunciatio_v1.txt | 0 .../prompts/insight_and_evidence_v1.txt | 0 .../prompts/iterative_convo_v1.txt | 0 .../prompts/memo_on_convo_v1.txt | 0 .../prompts/new_decomp_schedule_v1.txt | 0 .../prompts/planning_thought_on_convo_v1.txt | 0 .../prompts/poignancy_action_v1.txt | 0 .../prompts/poignancy_chat_v1.txt | 0 .../prompts/poignancy_event_v1.txt | 0 .../prompts/poignancy_thought_v1.txt | 0 .../summarize_chat_relationship_v2.txt | 0 .../prompts/summarize_conversation_v1.txt | 0 .../prompts/task_decomp_v3.txt | 0 .../prompts/wake_up_hour_v1.txt | 0 .../prompts/whisper_inner_thought_v1.txt | 0 .../reflect/__init__.py | 0 .../reflect/reflect.py | 6 +- .../plan => stanford_town/roles}/__init__.py | 0 .../roles/st_role.py | 28 ++--- .../stanford_town.py | 6 +- .../the_ville/agent_history_init_n25.csv | 0 .../the_ville/agent_history_init_n3.csv | 0 .../the_ville/matrix/maze/arena_maze.csv | 0 .../the_ville/matrix/maze/collision_maze.csv | 0 .../matrix/maze/game_object_maze.csv | 0 .../the_ville/matrix/maze/sector_maze.csv | 0 .../matrix/maze/spawning_location_maze.csv | 0 .../the_ville/matrix/maze_meta_info.json | 0 .../matrix/special_blocks/arena_blocks.csv | 0 .../special_blocks/game_object_blocks.csv | 0 .../matrix/special_blocks/sector_blocks.csv | 0 .../spawning_location_blocks.csv | 0 .../matrix/special_blocks/world_blocks.csv | 0 .../tests/__init__.py | 0 .../tests/actions}/__init__.py | 0 .../tests/actions/test_gen_action_details.py | 8 +- .../tests/actions/test_summarize_conv.py | 2 +- .../tests/plan}/__init__.py | 0 .../tests/plan/test_conversation.py | 12 +- .../tests/plan/test_st_plan.py | 8 +- .../tests/roles}/__init__.py | 0 .../tests/roles/test_st_role.py | 8 +- .../tests/test_agent_memory.py | 6 +- .../tests/test_basic_memory.py | 2 +- .../tests/test_reflect.py | 8 +- .../tests/test_spatial_memory.py | 0 .../roles => stanford_town/utils}/__init__.py | 0 .../{st_game => stanford_town}/utils/const.py | 0 .../utils/mg_ga_transform.py | 2 +- .../{st_game => stanford_town}/utils/utils.py | 0 .../stanford_town/stanford_town_ext_env.py | 4 - .../stanford_town_env/env_space.py | 105 ------------------ 112 files changed, 70 insertions(+), 723 deletions(-) delete mode 100644 examples/st_game/requirements.txt delete mode 100644 examples/st_game/run_st_game.py delete mode 100644 examples/st_game/storage/.gitignore delete mode 100644 examples/st_game/storage/base_the_ville_isabella_maria_klaus/environment/0.json delete mode 100644 examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/associative_memory/embeddings.json delete mode 100644 examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/associative_memory/kw_strength.json delete mode 100644 examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/associative_memory/nodes.json delete mode 100644 examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/scratch.json delete mode 100644 examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/spatial_memory.json delete mode 100644 examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/test_memory/embeddings.json delete mode 100644 examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/test_memory/kw_strength.json delete mode 100644 examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/test_memory/nodes.json delete mode 100644 examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Klaus Mueller/bootstrap_memory/associative_memory/embeddings.json delete mode 100644 examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Klaus Mueller/bootstrap_memory/associative_memory/kw_strength.json delete mode 100644 examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Klaus Mueller/bootstrap_memory/associative_memory/nodes.json delete mode 100644 examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Klaus Mueller/bootstrap_memory/scratch.json delete mode 100644 examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Klaus Mueller/bootstrap_memory/spatial_memory.json delete mode 100644 examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Maria Lopez/bootstrap_memory/associative_memory/embeddings.json delete mode 100644 examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Maria Lopez/bootstrap_memory/associative_memory/kw_strength.json delete mode 100644 examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Maria Lopez/bootstrap_memory/associative_memory/nodes.json delete mode 100644 examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Maria Lopez/bootstrap_memory/scratch.json delete mode 100644 examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Maria Lopez/bootstrap_memory/spatial_memory.json delete mode 100644 examples/st_game/storage/base_the_ville_isabella_maria_klaus/reverie/meta.json delete mode 100644 examples/st_game/utils/__init__.py rename examples/{st_game => stanford_town}/.gitignore (100%) rename examples/{st_game => stanford_town}/README.md (77%) rename examples/{st_game => stanford_town}/README_CN.md (77%) rename examples/{st_game => stanford_town/actions}/__init__.py (100%) rename examples/{st_game => stanford_town}/actions/agent_chat_sum_rel.py (95%) rename examples/{st_game => stanford_town}/actions/decide_to_talk.py (98%) rename examples/{st_game => stanford_town}/actions/dummy_action.py (100%) rename examples/{st_game => stanford_town}/actions/gen_action_details.py (99%) rename examples/{st_game => stanford_town}/actions/gen_daily_schedule.py (100%) rename examples/{st_game => stanford_town}/actions/gen_hourly_schedule.py (100%) rename examples/{st_game => stanford_town}/actions/gen_iter_chat_utt.py (95%) rename examples/{st_game => stanford_town}/actions/inner_voice_action.py (94%) rename examples/{st_game => stanford_town}/actions/new_decomp_schedule.py (98%) rename examples/{st_game => stanford_town}/actions/run_reflect_action.py (99%) rename examples/{st_game => stanford_town}/actions/st_action.py (98%) rename examples/{st_game => stanford_town}/actions/summarize_conv.py (96%) rename examples/{st_game => stanford_town}/actions/task_decomp.py (100%) rename examples/{st_game => stanford_town}/actions/wake_up.py (100%) rename examples/{st_game => stanford_town}/memory/__init__.py (100%) rename examples/{st_game => stanford_town}/memory/agent_memory.py (100%) rename examples/{st_game => stanford_town}/memory/retrieve.py (97%) rename examples/{st_game => stanford_town}/memory/scratch.py (100%) rename examples/{st_game => stanford_town}/memory/spatial_memory.py (100%) rename examples/{st_game/actions => stanford_town/plan}/__init__.py (100%) rename examples/{st_game => stanford_town}/plan/converse.py (94%) rename examples/{st_game => stanford_town}/plan/st_plan.py (100%) rename examples/{st_game => stanford_town}/prompts/__init__.py (100%) rename examples/{st_game => stanford_town}/prompts/action_location_object_vMar11.txt (100%) rename examples/{st_game => stanford_town}/prompts/action_location_sector_v1.txt (100%) rename examples/{st_game => stanford_town}/prompts/action_object_v2.txt (100%) rename examples/{st_game => stanford_town}/prompts/daily_planning_v6.txt (100%) rename examples/{st_game => stanford_town}/prompts/decide_to_talk_v2.txt (100%) rename examples/{st_game => stanford_town}/prompts/generate_event_triple_v1.txt (100%) rename examples/{st_game => stanford_town}/prompts/generate_focal_pt_v1.txt (100%) rename examples/{st_game => stanford_town}/prompts/generate_hourly_schedule_v2.txt (100%) rename examples/{st_game => stanford_town}/prompts/generate_obj_event_v1.txt (100%) rename examples/{st_game => stanford_town}/prompts/generate_pronunciatio_v1.txt (100%) rename examples/{st_game => stanford_town}/prompts/insight_and_evidence_v1.txt (100%) rename examples/{st_game => stanford_town}/prompts/iterative_convo_v1.txt (100%) rename examples/{st_game => stanford_town}/prompts/memo_on_convo_v1.txt (100%) rename examples/{st_game => stanford_town}/prompts/new_decomp_schedule_v1.txt (100%) rename examples/{st_game => stanford_town}/prompts/planning_thought_on_convo_v1.txt (100%) rename examples/{st_game => stanford_town}/prompts/poignancy_action_v1.txt (100%) rename examples/{st_game => stanford_town}/prompts/poignancy_chat_v1.txt (100%) rename examples/{st_game => stanford_town}/prompts/poignancy_event_v1.txt (100%) rename examples/{st_game => stanford_town}/prompts/poignancy_thought_v1.txt (100%) rename examples/{st_game => stanford_town}/prompts/summarize_chat_relationship_v2.txt (100%) rename examples/{st_game => stanford_town}/prompts/summarize_conversation_v1.txt (100%) rename examples/{st_game => stanford_town}/prompts/task_decomp_v3.txt (100%) rename examples/{st_game => stanford_town}/prompts/wake_up_hour_v1.txt (100%) rename examples/{st_game => stanford_town}/prompts/whisper_inner_thought_v1.txt (100%) rename examples/{st_game => stanford_town}/reflect/__init__.py (100%) rename examples/{st_game => stanford_town}/reflect/reflect.py (97%) rename examples/{st_game/plan => stanford_town/roles}/__init__.py (100%) rename examples/{st_game => stanford_town}/roles/st_role.py (96%) rename examples/{st_game => stanford_town}/stanford_town.py (87%) rename examples/{st_game => stanford_town}/static_dirs/assets/the_ville/agent_history_init_n25.csv (100%) rename examples/{st_game => stanford_town}/static_dirs/assets/the_ville/agent_history_init_n3.csv (100%) rename examples/{st_game => stanford_town}/static_dirs/assets/the_ville/matrix/maze/arena_maze.csv (100%) rename examples/{st_game => stanford_town}/static_dirs/assets/the_ville/matrix/maze/collision_maze.csv (100%) rename examples/{st_game => stanford_town}/static_dirs/assets/the_ville/matrix/maze/game_object_maze.csv (100%) rename examples/{st_game => stanford_town}/static_dirs/assets/the_ville/matrix/maze/sector_maze.csv (100%) rename examples/{st_game => stanford_town}/static_dirs/assets/the_ville/matrix/maze/spawning_location_maze.csv (100%) rename examples/{st_game => stanford_town}/static_dirs/assets/the_ville/matrix/maze_meta_info.json (100%) rename examples/{st_game => stanford_town}/static_dirs/assets/the_ville/matrix/special_blocks/arena_blocks.csv (100%) rename examples/{st_game => stanford_town}/static_dirs/assets/the_ville/matrix/special_blocks/game_object_blocks.csv (100%) rename examples/{st_game => stanford_town}/static_dirs/assets/the_ville/matrix/special_blocks/sector_blocks.csv (100%) rename examples/{st_game => stanford_town}/static_dirs/assets/the_ville/matrix/special_blocks/spawning_location_blocks.csv (100%) rename examples/{st_game => stanford_town}/static_dirs/assets/the_ville/matrix/special_blocks/world_blocks.csv (100%) rename examples/{st_game => stanford_town}/tests/__init__.py (100%) rename examples/{st_game/roles => stanford_town/tests/actions}/__init__.py (100%) rename examples/{st_game => stanford_town}/tests/actions/test_gen_action_details.py (90%) rename examples/{st_game => stanford_town}/tests/actions/test_summarize_conv.py (83%) rename examples/{st_game/tests/actions => stanford_town/tests/plan}/__init__.py (100%) rename examples/{st_game => stanford_town}/tests/plan/test_conversation.py (80%) rename examples/{st_game => stanford_town}/tests/plan/test_st_plan.py (87%) rename examples/{st_game/tests/plan => stanford_town/tests/roles}/__init__.py (100%) rename examples/{st_game => stanford_town}/tests/roles/test_st_role.py (67%) rename examples/{st_game => stanford_town}/tests/test_agent_memory.py (94%) rename examples/{st_game => stanford_town}/tests/test_basic_memory.py (96%) rename examples/{st_game => stanford_town}/tests/test_reflect.py (93%) rename examples/{st_game => stanford_town}/tests/test_spatial_memory.py (100%) rename examples/{st_game/tests/roles => stanford_town/utils}/__init__.py (100%) rename examples/{st_game => stanford_town}/utils/const.py (100%) rename examples/{st_game => stanford_town}/utils/mg_ga_transform.py (96%) rename examples/{st_game => stanford_town}/utils/utils.py (100%) delete mode 100644 metagpt/environment/stanford_town_env/env_space.py diff --git a/examples/st_game/requirements.txt b/examples/st_game/requirements.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/st_game/run_st_game.py b/examples/st_game/run_st_game.py deleted file mode 100644 index 304bf24ba..000000000 --- a/examples/st_game/run_st_game.py +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# @Desc : entry of Stanford Town(ST/st) game - -import asyncio -from typing import Optional - -import fire - -from examples.st_game.roles.st_role import STRole -from examples.st_game.stanford_town import StanfordTown -from examples.st_game.utils.const import STORAGE_PATH -from examples.st_game.utils.mg_ga_transform import ( - get_reverie_meta, - write_curr_sim_code, - write_curr_step, -) -from examples.st_game.utils.utils import copy_folder -from metagpt.logs import logger - - -async def startup( - idea: str, fork_sim_code: str, sim_code: str, temp_storage_path: str, investment: float = 30.0, n_round: int = 500 -): - town = StanfordTown() - logger.info("StanfordTown init environment") - - # copy `storage/{fork_sim_code}` to `storage/{sim_code}` - copy_folder(str(STORAGE_PATH.joinpath(fork_sim_code)), str(STORAGE_PATH.joinpath(sim_code))) - - # get role names from `storage/{simulation_name}/reverie/meta.json` and then init roles - reverie_meta = get_reverie_meta(fork_sim_code) - roles = [] - sim_path = STORAGE_PATH.joinpath(sim_code) - sim_path.mkdir(exist_ok=True) - for idx, role_name in enumerate(reverie_meta["persona_names"]): - has_inner_voice = True if idx == 0 else False - role = STRole( - name=role_name, - profile=role_name, - sim_code=sim_code, - step=reverie_meta.get("step", 0), - start_time=reverie_meta.get("start_date"), - curr_time=reverie_meta.get("curr_time"), - sec_per_step=reverie_meta.get("sec_per_step"), - has_inner_voice=has_inner_voice, - ) - roles.append(role) - - # init temp_storage - write_curr_sim_code({"sim_code": sim_code}, temp_storage_path) - write_curr_step({"step": reverie_meta.get("step", 0)}, temp_storage_path) - - await town.hire(roles) - - town.invest(investment) - town.run_project(idea) - - await town.run(n_round) - - -def main( - idea: str, - fork_sim_code: str, - sim_code: str, - temp_storage_path: Optional[str] = None, - investment: float = 30.0, - n_round: int = 500, -): - """ - Args: - idea: idea works as an `inner voice` to the first agent. - fork_sim_code: old simulation name to start with, choose one inside `generative_agents/environment/frontend_server/storage/` - sim_code: new simulation name to save simulation result - temp_storage_path: generative_agents temp_storage path inside `environment/frontend_server` to interact. - investment: the investment of running agents - n_round: rounds to run agents - """ - - asyncio.run( - startup( - idea=idea, - fork_sim_code=fork_sim_code, - sim_code=sim_code, - temp_storage_path=temp_storage_path, - investment=investment, - n_round=n_round, - ) - ) - - -if __name__ == "__main__": - fire.Fire(main) diff --git a/examples/st_game/storage/.gitignore b/examples/st_game/storage/.gitignore deleted file mode 100644 index 72b125e04..000000000 --- a/examples/st_game/storage/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# path to store simulation data -test_* -July* \ No newline at end of file diff --git a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/environment/0.json b/examples/st_game/storage/base_the_ville_isabella_maria_klaus/environment/0.json deleted file mode 100644 index 6eaa46c51..000000000 --- a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/environment/0.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "Isabella Rodriguez": { - "maze": "the_ville", - "x": 72, - "y": 14 - }, - "Klaus Mueller": { - "maze": "the_ville", - "x": 126, - "y": 46 - }, - "Maria Lopez": { - "maze": "the_ville", - "x": 123, - "y": 57 - } -} - - - - - - - - - diff --git a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/associative_memory/embeddings.json b/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/associative_memory/embeddings.json deleted file mode 100644 index 9e26dfeeb..000000000 --- a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/associative_memory/embeddings.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/associative_memory/kw_strength.json b/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/associative_memory/kw_strength.json deleted file mode 100644 index 6dc73c1c8..000000000 --- a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/associative_memory/kw_strength.json +++ /dev/null @@ -1,2 +0,0 @@ -{"kw_strength_event": {}, - "kw_strength_thought": {}} \ No newline at end of file diff --git a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/associative_memory/nodes.json b/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/associative_memory/nodes.json deleted file mode 100644 index 9e26dfeeb..000000000 --- a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/associative_memory/nodes.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/scratch.json b/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/scratch.json deleted file mode 100644 index dbed4b705..000000000 --- a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/scratch.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "vision_r": 8, - "att_bandwidth": 8, - "retention": 8, - "curr_time": null, - "curr_tile": null, - "daily_plan_req": "Isabella Rodriguez opens Hobbs Cafe at 8am everyday, and works at the counter until 8pm, at which point she closes the cafe.", - "name": "Isabella Rodriguez", - "first_name": "Isabella", - "last_name": "Rodriguez", - "age": 34, - "innate": "friendly, outgoing, hospitable", - "learned": "Isabella Rodriguez is a cafe owner of Hobbs Cafe who loves to make people feel welcome. She is always looking for ways to make the cafe a place where people can come to relax and enjoy themselves.", - "currently": "Isabella Rodriguez is planning on having a Valentine's Day party at Hobbs Cafe with her customers on February 14th, 2023 at 5pm. She is gathering party material, and is telling everyone to join the party at Hobbs Cafe on February 14th, 2023, from 5pm to 7pm.", - "lifestyle": "Isabella Rodriguez goes to bed around 11pm, awakes up around 6am.", - "living_area": "the Ville:Isabella Rodriguez's apartment:main room", - "concept_forget": 100, - "daily_reflection_time": 180, - "daily_reflection_size": 5, - "overlap_reflect_th": 4, - "kw_strg_event_reflect_th": 10, - "kw_strg_thought_reflect_th": 9, - - "recency_w": 1, - "relevance_w": 1, - "importance_w": 1, - "recency_decay": 0.995, - "importance_trigger_max": 150, - "importance_trigger_curr": 150, - "importance_ele_n": 0, - "thought_count": 5, - - "daily_req": [], - "f_daily_schedule": [], - "f_daily_schedule_hourly_org": [], - "act_address": null, - "act_start_time": null, - "act_duration": null, - "act_description": null, - "act_pronunciatio": null, - "act_event": ["Isabella Rodriguez", null, null], - "act_obj_description": null, - "act_obj_pronunciatio": null, - "act_obj_event": [null, null, null], - "chatting_with": null, - "chat": null, - "chatting_with_buffer": {}, - "chatting_end_time": null, - "act_path_set": false, - "planned_path": [] -} \ No newline at end of file diff --git a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/spatial_memory.json b/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/spatial_memory.json deleted file mode 100644 index f88157950..000000000 --- a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/spatial_memory.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "the Ville": { - "Hobbs Cafe": { - "cafe": [ - "refrigerator", - "cafe customer seating", - "cooking area", - "kitchen sink", - "behind the cafe counter", - "piano" - ] - }, - "Isabella Rodriguez's apartment": { - "main room": [ - "bed", - "desk", - "refrigerator", - "closet", - "shelf" - ] - }, - "The Rose and Crown Pub": { - "pub": [ - "shelf", - "refrigerator", - "bar customer seating", - "behind the bar counter", - "kitchen sink", - "cooking area", - "microphone" - ] - }, - "Harvey Oak Supply Store": { - "supply store": [ - "supply store product shelf", - "behind the supply store counter", - "supply store counter" - ] - }, - "The Willows Market and Pharmacy": { - "store": [ - "behind the pharmacy counter", - "pharmacy store shelf", - "pharmacy store counter", - "grocery store shelf", - "behind the grocery counter", - "grocery store counter" - ] - }, - "Dorm for Oak Hill College": { - "garden": [ - "dorm garden" - ], - "common room": [ - "common room sofa", - "pool table", - "common room table" - ] - }, - "Johnson Park": { - "park": [ - "park garden" - ] - } - } -} \ No newline at end of file diff --git a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/test_memory/embeddings.json b/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/test_memory/embeddings.json deleted file mode 100644 index 9e26dfeeb..000000000 --- a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/test_memory/embeddings.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/test_memory/kw_strength.json b/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/test_memory/kw_strength.json deleted file mode 100644 index 041a8bd0c..000000000 --- a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/test_memory/kw_strength.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "kw_strength_event": {}, - "kw_strength_thought": {} -} \ No newline at end of file diff --git a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/test_memory/nodes.json b/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/test_memory/nodes.json deleted file mode 100644 index 9e26dfeeb..000000000 --- a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Isabella Rodriguez/bootstrap_memory/test_memory/nodes.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Klaus Mueller/bootstrap_memory/associative_memory/embeddings.json b/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Klaus Mueller/bootstrap_memory/associative_memory/embeddings.json deleted file mode 100644 index 9e26dfeeb..000000000 --- a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Klaus Mueller/bootstrap_memory/associative_memory/embeddings.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Klaus Mueller/bootstrap_memory/associative_memory/kw_strength.json b/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Klaus Mueller/bootstrap_memory/associative_memory/kw_strength.json deleted file mode 100644 index 6dc73c1c8..000000000 --- a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Klaus Mueller/bootstrap_memory/associative_memory/kw_strength.json +++ /dev/null @@ -1,2 +0,0 @@ -{"kw_strength_event": {}, - "kw_strength_thought": {}} \ No newline at end of file diff --git a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Klaus Mueller/bootstrap_memory/associative_memory/nodes.json b/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Klaus Mueller/bootstrap_memory/associative_memory/nodes.json deleted file mode 100644 index 9e26dfeeb..000000000 --- a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Klaus Mueller/bootstrap_memory/associative_memory/nodes.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Klaus Mueller/bootstrap_memory/scratch.json b/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Klaus Mueller/bootstrap_memory/scratch.json deleted file mode 100644 index 7b0ce7d72..000000000 --- a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Klaus Mueller/bootstrap_memory/scratch.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "vision_r": 8, - "att_bandwidth": 8, - "retention": 8, - "curr_time": null, - "curr_tile": null, - "daily_plan_req": "Klaus Mueller goes to the library at Oak Hill College early in the morning, spends his days writing, and eats at Hobbs Cafe.", - "name": "Klaus Mueller", - "first_name": "Klaus", - "last_name": "Mueller", - "age": 20, - "innate": "kind, inquisitive, passionate", - "learned": "Klaus Mueller is a student at Oak Hill College studying sociology. He is passionate about social justice and loves to explore different perspectives.", - "currently": "Klaus Mueller is writing a research paper on the effects of gentrification in low-income communities.", - "lifestyle": "Klaus Mueller goes to bed around 11pm, awakes up around 7am, eats dinner around 5pm.", - "living_area": "the Ville:Dorm for Oak Hill College:Klaus Mueller's room", - "concept_forget": 100, - "daily_reflection_time": 180, - "daily_reflection_size": 5, - "overlap_reflect_th": 4, - "kw_strg_event_reflect_th": 10, - "kw_strg_thought_reflect_th": 9, - - "recency_w": 1, - "relevance_w": 1, - "importance_w": 1, - "recency_decay": 0.99, - "importance_trigger_max": 150, - "importance_trigger_curr": 150, - "importance_ele_n": 0, - "thought_count": 5, - - "daily_req": [], - "f_daily_schedule": [], - "f_daily_schedule_hourly_org": [], - "act_address": null, - "act_start_time": null, - "act_duration": null, - "act_description": null, - "act_pronunciatio": null, - "act_event": ["Klaus Mueller", null, null], - "act_obj_description": null, - "act_obj_pronunciatio": null, - "act_obj_event": [null, null, null], - "chatting_with": null, - "chat": null, - "chatting_with_buffer": {}, - "chatting_end_time": null, - "act_path_set": false, - "planned_path": [] -} \ No newline at end of file diff --git a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Klaus Mueller/bootstrap_memory/spatial_memory.json b/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Klaus Mueller/bootstrap_memory/spatial_memory.json deleted file mode 100644 index 4f4168677..000000000 --- a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Klaus Mueller/bootstrap_memory/spatial_memory.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "the Ville": { - "Oak Hill College": { - "hallway": [], - "library": [ - "library sofa", - "library table", - "bookshelf" - ], - "classroom": [ - "blackboard", - "classroom podium", - "classroom student seating" - ] - }, - "Dorm for Oak Hill College": { - "garden": [ - "dorm garden" - ], - "Klaus Mueller's room": [ - "bed", - "game console", - "closet", - "desk" - ], - "woman's bathroom": [ - "toilet", - "shower", - "bathroom sink" - ], - "common room": [ - "common room sofa", - "pool table", - "common room table" - ], - "man's bathroom": [ - "shower", - "bathroom sink", - "toilet" - ] - }, - "The Willows Market and Pharmacy": { - "store": [ - "grocery store shelf", - "behind the grocery counter", - "grocery store counter", - "pharmacy store shelf", - "pharmacy store counter", - "behind the pharmacy counter" - ] - }, - "Harvey Oak Supply Store": { - "supply store": [ - "supply store product shelf", - "behind the supply store counter", - "supply store counter" - ] - }, - "Johnson Park": { - "park": [ - "park garden" - ] - }, - "The Rose and Crown Pub": { - "pub": [ - "shelf", - "refrigerator", - "bar customer seating", - "behind the bar counter", - "kitchen sink", - "cooking area", - "microphone" - ] - }, - "Hobbs Cafe": { - "cafe": [ - "refrigerator", - "cafe customer seating", - "cooking area", - "kitchen sink", - "behind the cafe counter", - "piano" - ] - } - } -} \ No newline at end of file diff --git a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Maria Lopez/bootstrap_memory/associative_memory/embeddings.json b/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Maria Lopez/bootstrap_memory/associative_memory/embeddings.json deleted file mode 100644 index 9e26dfeeb..000000000 --- a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Maria Lopez/bootstrap_memory/associative_memory/embeddings.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Maria Lopez/bootstrap_memory/associative_memory/kw_strength.json b/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Maria Lopez/bootstrap_memory/associative_memory/kw_strength.json deleted file mode 100644 index 6dc73c1c8..000000000 --- a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Maria Lopez/bootstrap_memory/associative_memory/kw_strength.json +++ /dev/null @@ -1,2 +0,0 @@ -{"kw_strength_event": {}, - "kw_strength_thought": {}} \ No newline at end of file diff --git a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Maria Lopez/bootstrap_memory/associative_memory/nodes.json b/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Maria Lopez/bootstrap_memory/associative_memory/nodes.json deleted file mode 100644 index 9e26dfeeb..000000000 --- a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Maria Lopez/bootstrap_memory/associative_memory/nodes.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Maria Lopez/bootstrap_memory/scratch.json b/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Maria Lopez/bootstrap_memory/scratch.json deleted file mode 100644 index c3a304952..000000000 --- a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Maria Lopez/bootstrap_memory/scratch.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "vision_r": 8, - "att_bandwidth": 8, - "retention": 8, - "curr_time": null, - "curr_tile": null, - "daily_plan_req": "Maria Lopez spends at least 3 hours a day Twitch streaming or gaming.", - "name": "Maria Lopez", - "first_name": "Maria", - "last_name": "Lopez", - "age": 21, - "innate": "energetic, enthusiastic, inquisitive", - "learned": "Maria Lopez is a student at Oak Hill College studying physics and a part time Twitch game streamer who loves to connect with people and explore new ideas.", - "currently": "Maria Lopez is working on her physics degree and streaming games on Twitch to make some extra money. She visits Hobbs Cafe for studying and eating just about everyday.", - "lifestyle": "Maria Lopez goes to bed around 2am, awakes up around 9am, eats dinner around 6pm. She likes to hang out at Hobbs Cafe if it's before 6pm.", - "living_area": "the Ville:Dorm for Oak Hill College:Maria Lopez's room", - "concept_forget": 100, - "daily_reflection_time": 180, - "daily_reflection_size": 5, - "overlap_reflect_th": 4, - "kw_strg_event_reflect_th": 10, - "kw_strg_thought_reflect_th": 9, - - "recency_w": 1, - "relevance_w": 1, - "importance_w": 1, - "recency_decay": 0.99, - "importance_trigger_max": 150, - "importance_trigger_curr": 150, - "importance_ele_n": 0, - "thought_count": 5, - - "daily_req": [], - "f_daily_schedule": [], - "f_daily_schedule_hourly_org": [], - "act_address": null, - "act_start_time": null, - "act_duration": null, - "act_description": null, - "act_pronunciatio": null, - "act_event": ["Maria Lopez", null, null], - "act_obj_description": null, - "act_obj_pronunciatio": null, - "act_obj_event": [null, null, null], - "chatting_with": null, - "chat": null, - "chatting_with_buffer": {}, - "chatting_end_time": null, - "act_path_set": false, - "planned_path": [] -} \ No newline at end of file diff --git a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Maria Lopez/bootstrap_memory/spatial_memory.json b/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Maria Lopez/bootstrap_memory/spatial_memory.json deleted file mode 100644 index 0a58212bd..000000000 --- a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/personas/Maria Lopez/bootstrap_memory/spatial_memory.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "the Ville": { - "Oak Hill College": { - "hallway": [], - "library": [ - "library sofa", - "library table", - "bookshelf" - ], - "classroom": [ - "blackboard", - "classroom podium", - "classroom student seating" - ] - }, - "Dorm for Oak Hill College": { - "garden": [ - "dorm garden" - ], - "Maria Lopez's room": [ - "closet", - "desk", - "bed", - "computer", - "blackboard" - ], - "woman's bathroom": [ - "toilet", - "shower", - "bathroom sink" - ], - "common room": [ - "common room sofa", - "pool table", - "common room table" - ], - "man's bathroom": [ - "shower", - "bathroom sink", - "toilet" - ] - }, - "The Willows Market and Pharmacy": { - "store": [ - "grocery store shelf", - "behind the grocery counter", - "grocery store counter", - "pharmacy store shelf", - "pharmacy store counter", - "behind the pharmacy counter" - ] - }, - "Harvey Oak Supply Store": { - "supply store": [ - "supply store product shelf", - "behind the supply store counter", - "supply store counter" - ] - }, - "Johnson Park": { - "park": [ - "park garden" - ] - }, - "The Rose and Crown Pub": { - "pub": [ - "shelf", - "refrigerator", - "bar customer seating", - "behind the bar counter", - "kitchen sink", - "cooking area", - "microphone" - ] - }, - "Hobbs Cafe": { - "cafe": [ - "refrigerator", - "cafe customer seating", - "cooking area", - "kitchen sink", - "behind the cafe counter", - "piano" - ] - } - } -} \ No newline at end of file diff --git a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/reverie/meta.json b/examples/st_game/storage/base_the_ville_isabella_maria_klaus/reverie/meta.json deleted file mode 100644 index 1e81ec12d..000000000 --- a/examples/st_game/storage/base_the_ville_isabella_maria_klaus/reverie/meta.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "fork_sim_code": "base_the_ville_isabella_maria_klaus", - "start_date": "February 13, 2023", - "curr_time": "February 13, 2023, 00:00:00", - "sec_per_step": 10, - "maze_name": "the_ville", - "persona_names": [ - "Isabella Rodriguez", - "Maria Lopez", - "Klaus Mueller" - ], - "step": 0 -} \ No newline at end of file diff --git a/examples/st_game/utils/__init__.py b/examples/st_game/utils/__init__.py deleted file mode 100644 index 2bcf8efd0..000000000 --- a/examples/st_game/utils/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# @Desc : diff --git a/examples/st_game/.gitignore b/examples/stanford_town/.gitignore similarity index 100% rename from examples/st_game/.gitignore rename to examples/stanford_town/.gitignore diff --git a/examples/st_game/README.md b/examples/stanford_town/README.md similarity index 77% rename from examples/st_game/README.md rename to examples/stanford_town/README.md index 114f7f672..915c61356 100644 --- a/examples/st_game/README.md +++ b/examples/stanford_town/README.md @@ -1,7 +1,7 @@ ## Stanford Town Game ### Pre-Description -The path configured in `examples/st_game/utils/const.py` is the storage path of the current project. In order to facilitate GA( [generative_agents](https://github.com/joonspk-research/generative_agents) )'s frontend docking data (to avoid changing its code), you can set the value `temp_storage_path` to `temp_storage` of `generative_agents` when start `run_st_game.py`. like +The path configured in `examples/stanford_town/utils/const.py` is the storage path of the current project. In order to facilitate GA( [generative_agents](https://github.com/joonspk-research/generative_agents) )'s frontend docking data (to avoid changing its code), you can set the value `temp_storage_path` to `temp_storage` of `generative_agents` when start `run_st_game.py`. like `python3 run_st_game.py --temp_storage_path path/to/ga/temp_storage xxx` @@ -17,7 +17,7 @@ # updated This can be used to achieve docking of simulation data without changing the GA code. Otherwise, the GA code must be modified to adapt to the MG output path. -If you don't want to start from 0, copy other simulation directories under `generative_agents/environment/frontend_server/storage/` to `examples/st_game/storage`, and select a directory named `fork_sim_code`. +If you don't want to start from 0, copy other simulation directories under `generative_agents/environment/frontend_server/storage/` to `examples/stanford_town/storage`, and select a directory named `fork_sim_code`. ### Backend service startup The execution entry is `python3 run_st_game.py "Host a open lunch party at 13:00 pm" "base_the_ville_isabella_maria_klaus" "test_sim" 10` diff --git a/examples/st_game/README_CN.md b/examples/stanford_town/README_CN.md similarity index 77% rename from examples/st_game/README_CN.md rename to examples/stanford_town/README_CN.md index 84470f5c2..445a5b1b3 100644 --- a/examples/st_game/README_CN.md +++ b/examples/stanford_town/README_CN.md @@ -1,7 +1,7 @@ ## Stanford Town Game ### 前置 -`examples/st_game/utils/const.py`配置的路径为当前项目的存储路径,为了方便GA( [generative_agents](https://github.com/joonspk-research/generative_agents) )的前端对接数据(避免改动它那块的代码),可在启动`run_st_game.py`加上`temp_storage_path`指向`generative_agents`对应的`temp_storage`路径。比如 +`examples/stanford_town/utils/const.py`配置的路径为当前项目的存储路径,为了方便GA( [generative_agents](https://github.com/joonspk-research/generative_agents) )的前端对接数据(避免改动它那块的代码),可在启动`run_st_game.py`加上`temp_storage_path`指向`generative_agents`对应的`temp_storage`路径。比如 `python3 run_st_game.py --temp_storage_path path/to/ga/temp_storage xxx` @@ -16,7 +16,7 @@ # 更新为 ``` 这样可用实现不改变GA代码情况下,实现仿真数据的对接。不然得修改GA的代码来适配MG的输出路径。 -如果你不想从0开始启动,拷贝`generative_agents/environment/frontend_server/storage/`下的其他仿真目录到`examples/st_game/storage`,并选择一个目录名作为`fork_sim_code`。 +如果你不想从0开始启动,拷贝`generative_agents/environment/frontend_server/storage/`下的其他仿真目录到`examples/stanford_town/storage`,并选择一个目录名作为`fork_sim_code`。 ### 后端服务启动 执行入口为:`python3 run_st_game.py "Host a open lunch party at 13:00 pm" "base_the_ville_isabella_maria_klaus" "test_sim" 10` diff --git a/examples/st_game/__init__.py b/examples/stanford_town/actions/__init__.py similarity index 100% rename from examples/st_game/__init__.py rename to examples/stanford_town/actions/__init__.py diff --git a/examples/st_game/actions/agent_chat_sum_rel.py b/examples/stanford_town/actions/agent_chat_sum_rel.py similarity index 95% rename from examples/st_game/actions/agent_chat_sum_rel.py rename to examples/stanford_town/actions/agent_chat_sum_rel.py index 00f15e82f..3e564a60c 100644 --- a/examples/st_game/actions/agent_chat_sum_rel.py +++ b/examples/stanford_town/actions/agent_chat_sum_rel.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # @Desc : summarize relationship in a agent chat -from examples.st_game.actions.st_action import STAction +from examples.stanford_town.actions.st_action import STAction from metagpt.logs import logger diff --git a/examples/st_game/actions/decide_to_talk.py b/examples/stanford_town/actions/decide_to_talk.py similarity index 98% rename from examples/st_game/actions/decide_to_talk.py rename to examples/stanford_town/actions/decide_to_talk.py index cabb5ceff..414ee7e36 100644 --- a/examples/st_game/actions/decide_to_talk.py +++ b/examples/stanford_town/actions/decide_to_talk.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # @Desc : device to talk to another role, return yes or no -from examples.st_game.actions.st_action import STAction +from examples.stanford_town.actions.st_action import STAction from metagpt.logs import logger diff --git a/examples/st_game/actions/dummy_action.py b/examples/stanford_town/actions/dummy_action.py similarity index 100% rename from examples/st_game/actions/dummy_action.py rename to examples/stanford_town/actions/dummy_action.py diff --git a/examples/st_game/actions/gen_action_details.py b/examples/stanford_town/actions/gen_action_details.py similarity index 99% rename from examples/st_game/actions/gen_action_details.py rename to examples/stanford_town/actions/gen_action_details.py index 6af2cb338..0eb7cb701 100644 --- a/examples/st_game/actions/gen_action_details.py +++ b/examples/stanford_town/actions/gen_action_details.py @@ -4,7 +4,7 @@ import random -from metagpt.environment.stanford_town_env.env_space import EnvObsParams, EnvObsType +from metagpt.environment.stanford_town.env_space import EnvObsParams, EnvObsType from metagpt.logs import logger from .st_action import STAction diff --git a/examples/st_game/actions/gen_daily_schedule.py b/examples/stanford_town/actions/gen_daily_schedule.py similarity index 100% rename from examples/st_game/actions/gen_daily_schedule.py rename to examples/stanford_town/actions/gen_daily_schedule.py diff --git a/examples/st_game/actions/gen_hourly_schedule.py b/examples/stanford_town/actions/gen_hourly_schedule.py similarity index 100% rename from examples/st_game/actions/gen_hourly_schedule.py rename to examples/stanford_town/actions/gen_hourly_schedule.py diff --git a/examples/st_game/actions/gen_iter_chat_utt.py b/examples/stanford_town/actions/gen_iter_chat_utt.py similarity index 95% rename from examples/st_game/actions/gen_iter_chat_utt.py rename to examples/stanford_town/actions/gen_iter_chat_utt.py index eb5f569c7..82104b6ca 100644 --- a/examples/st_game/actions/gen_iter_chat_utt.py +++ b/examples/stanford_town/actions/gen_iter_chat_utt.py @@ -2,9 +2,9 @@ # -*- coding: utf-8 -*- # @Desc : generate_iterative_chat_utt -from examples.st_game.actions.st_action import STAction -from examples.st_game.utils.utils import extract_first_json_dict -from metagpt.environment.stanford_town_env.env_space import EnvObsParams, EnvObsType +from examples.stanford_town.actions.st_action import STAction +from examples.stanford_town.utils.utils import extract_first_json_dict +from metagpt.environment.stanford_town.env_space import EnvObsParams, EnvObsType from metagpt.logs import logger diff --git a/examples/st_game/actions/inner_voice_action.py b/examples/stanford_town/actions/inner_voice_action.py similarity index 94% rename from examples/st_game/actions/inner_voice_action.py rename to examples/stanford_town/actions/inner_voice_action.py index cfbdf0303..121f1dcee 100644 --- a/examples/st_game/actions/inner_voice_action.py +++ b/examples/stanford_town/actions/inner_voice_action.py @@ -1,4 +1,4 @@ -from examples.st_game.actions.st_action import STAction +from examples.stanford_town.actions.st_action import STAction from metagpt.logs import logger diff --git a/examples/st_game/actions/new_decomp_schedule.py b/examples/stanford_town/actions/new_decomp_schedule.py similarity index 98% rename from examples/st_game/actions/new_decomp_schedule.py rename to examples/stanford_town/actions/new_decomp_schedule.py index 8e5c79401..c7078be9c 100644 --- a/examples/st_game/actions/new_decomp_schedule.py +++ b/examples/stanford_town/actions/new_decomp_schedule.py @@ -4,7 +4,7 @@ import datetime -from examples.st_game.actions.st_action import STAction +from examples.stanford_town.actions.st_action import STAction from metagpt.logs import logger diff --git a/examples/st_game/actions/run_reflect_action.py b/examples/stanford_town/actions/run_reflect_action.py similarity index 99% rename from examples/st_game/actions/run_reflect_action.py rename to examples/stanford_town/actions/run_reflect_action.py index d3bf008cb..055c03db4 100644 --- a/examples/st_game/actions/run_reflect_action.py +++ b/examples/stanford_town/actions/run_reflect_action.py @@ -4,7 +4,7 @@ import re -from examples.st_game.actions.st_action import STAction +from examples.stanford_town.actions.st_action import STAction from metagpt.logs import logger diff --git a/examples/st_game/actions/st_action.py b/examples/stanford_town/actions/st_action.py similarity index 98% rename from examples/st_game/actions/st_action.py rename to examples/stanford_town/actions/st_action.py index 81f66c080..72ef851e0 100644 --- a/examples/st_game/actions/st_action.py +++ b/examples/stanford_town/actions/st_action.py @@ -7,7 +7,7 @@ from abc import abstractmethod from pathlib import Path from typing import Any, Optional, Union -from examples.st_game.utils.const import PROMPTS_DIR +from examples.stanford_town.utils.const import PROMPTS_DIR from metagpt.actions.action import Action from metagpt.config2 import config from metagpt.logs import logger diff --git a/examples/st_game/actions/summarize_conv.py b/examples/stanford_town/actions/summarize_conv.py similarity index 96% rename from examples/st_game/actions/summarize_conv.py rename to examples/stanford_town/actions/summarize_conv.py index f35651b35..f01fb36ad 100644 --- a/examples/st_game/actions/summarize_conv.py +++ b/examples/stanford_town/actions/summarize_conv.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # @Desc : summarize the content of agents' conversation -from examples.st_game.actions.st_action import STAction +from examples.stanford_town.actions.st_action import STAction from metagpt.logs import logger diff --git a/examples/st_game/actions/task_decomp.py b/examples/stanford_town/actions/task_decomp.py similarity index 100% rename from examples/st_game/actions/task_decomp.py rename to examples/stanford_town/actions/task_decomp.py diff --git a/examples/st_game/actions/wake_up.py b/examples/stanford_town/actions/wake_up.py similarity index 100% rename from examples/st_game/actions/wake_up.py rename to examples/stanford_town/actions/wake_up.py diff --git a/examples/st_game/memory/__init__.py b/examples/stanford_town/memory/__init__.py similarity index 100% rename from examples/st_game/memory/__init__.py rename to examples/stanford_town/memory/__init__.py diff --git a/examples/st_game/memory/agent_memory.py b/examples/stanford_town/memory/agent_memory.py similarity index 100% rename from examples/st_game/memory/agent_memory.py rename to examples/stanford_town/memory/agent_memory.py diff --git a/examples/st_game/memory/retrieve.py b/examples/stanford_town/memory/retrieve.py similarity index 97% rename from examples/st_game/memory/retrieve.py rename to examples/stanford_town/memory/retrieve.py index eeeecf85a..db3a87bea 100644 --- a/examples/st_game/memory/retrieve.py +++ b/examples/stanford_town/memory/retrieve.py @@ -7,8 +7,8 @@ import datetime from numpy import dot from numpy.linalg import norm -from examples.st_game.memory.agent_memory import BasicMemory -from examples.st_game.utils.utils import get_embedding +from examples.stanford_town.memory.agent_memory import BasicMemory +from examples.stanford_town.utils.utils import get_embedding def agent_retrieve( diff --git a/examples/st_game/memory/scratch.py b/examples/stanford_town/memory/scratch.py similarity index 100% rename from examples/st_game/memory/scratch.py rename to examples/stanford_town/memory/scratch.py diff --git a/examples/st_game/memory/spatial_memory.py b/examples/stanford_town/memory/spatial_memory.py similarity index 100% rename from examples/st_game/memory/spatial_memory.py rename to examples/stanford_town/memory/spatial_memory.py diff --git a/examples/st_game/actions/__init__.py b/examples/stanford_town/plan/__init__.py similarity index 100% rename from examples/st_game/actions/__init__.py rename to examples/stanford_town/plan/__init__.py diff --git a/examples/st_game/plan/converse.py b/examples/stanford_town/plan/converse.py similarity index 94% rename from examples/st_game/plan/converse.py rename to examples/stanford_town/plan/converse.py index 0371b3d44..b0ff54b68 100644 --- a/examples/st_game/plan/converse.py +++ b/examples/stanford_town/plan/converse.py @@ -4,9 +4,9 @@ from typing import Tuple -from examples.st_game.actions.agent_chat_sum_rel import AgentChatSumRel -from examples.st_game.actions.gen_iter_chat_utt import GenIterChatUTT -from examples.st_game.memory.retrieve import new_agent_retrieve +from examples.stanford_town.actions.agent_chat_sum_rel import AgentChatSumRel +from examples.stanford_town.actions.gen_iter_chat_utt import GenIterChatUTT +from examples.stanford_town.memory.retrieve import new_agent_retrieve from metagpt.logs import logger diff --git a/examples/st_game/plan/st_plan.py b/examples/stanford_town/plan/st_plan.py similarity index 100% rename from examples/st_game/plan/st_plan.py rename to examples/stanford_town/plan/st_plan.py diff --git a/examples/st_game/prompts/__init__.py b/examples/stanford_town/prompts/__init__.py similarity index 100% rename from examples/st_game/prompts/__init__.py rename to examples/stanford_town/prompts/__init__.py diff --git a/examples/st_game/prompts/action_location_object_vMar11.txt b/examples/stanford_town/prompts/action_location_object_vMar11.txt similarity index 100% rename from examples/st_game/prompts/action_location_object_vMar11.txt rename to examples/stanford_town/prompts/action_location_object_vMar11.txt diff --git a/examples/st_game/prompts/action_location_sector_v1.txt b/examples/stanford_town/prompts/action_location_sector_v1.txt similarity index 100% rename from examples/st_game/prompts/action_location_sector_v1.txt rename to examples/stanford_town/prompts/action_location_sector_v1.txt diff --git a/examples/st_game/prompts/action_object_v2.txt b/examples/stanford_town/prompts/action_object_v2.txt similarity index 100% rename from examples/st_game/prompts/action_object_v2.txt rename to examples/stanford_town/prompts/action_object_v2.txt diff --git a/examples/st_game/prompts/daily_planning_v6.txt b/examples/stanford_town/prompts/daily_planning_v6.txt similarity index 100% rename from examples/st_game/prompts/daily_planning_v6.txt rename to examples/stanford_town/prompts/daily_planning_v6.txt diff --git a/examples/st_game/prompts/decide_to_talk_v2.txt b/examples/stanford_town/prompts/decide_to_talk_v2.txt similarity index 100% rename from examples/st_game/prompts/decide_to_talk_v2.txt rename to examples/stanford_town/prompts/decide_to_talk_v2.txt diff --git a/examples/st_game/prompts/generate_event_triple_v1.txt b/examples/stanford_town/prompts/generate_event_triple_v1.txt similarity index 100% rename from examples/st_game/prompts/generate_event_triple_v1.txt rename to examples/stanford_town/prompts/generate_event_triple_v1.txt diff --git a/examples/st_game/prompts/generate_focal_pt_v1.txt b/examples/stanford_town/prompts/generate_focal_pt_v1.txt similarity index 100% rename from examples/st_game/prompts/generate_focal_pt_v1.txt rename to examples/stanford_town/prompts/generate_focal_pt_v1.txt diff --git a/examples/st_game/prompts/generate_hourly_schedule_v2.txt b/examples/stanford_town/prompts/generate_hourly_schedule_v2.txt similarity index 100% rename from examples/st_game/prompts/generate_hourly_schedule_v2.txt rename to examples/stanford_town/prompts/generate_hourly_schedule_v2.txt diff --git a/examples/st_game/prompts/generate_obj_event_v1.txt b/examples/stanford_town/prompts/generate_obj_event_v1.txt similarity index 100% rename from examples/st_game/prompts/generate_obj_event_v1.txt rename to examples/stanford_town/prompts/generate_obj_event_v1.txt diff --git a/examples/st_game/prompts/generate_pronunciatio_v1.txt b/examples/stanford_town/prompts/generate_pronunciatio_v1.txt similarity index 100% rename from examples/st_game/prompts/generate_pronunciatio_v1.txt rename to examples/stanford_town/prompts/generate_pronunciatio_v1.txt diff --git a/examples/st_game/prompts/insight_and_evidence_v1.txt b/examples/stanford_town/prompts/insight_and_evidence_v1.txt similarity index 100% rename from examples/st_game/prompts/insight_and_evidence_v1.txt rename to examples/stanford_town/prompts/insight_and_evidence_v1.txt diff --git a/examples/st_game/prompts/iterative_convo_v1.txt b/examples/stanford_town/prompts/iterative_convo_v1.txt similarity index 100% rename from examples/st_game/prompts/iterative_convo_v1.txt rename to examples/stanford_town/prompts/iterative_convo_v1.txt diff --git a/examples/st_game/prompts/memo_on_convo_v1.txt b/examples/stanford_town/prompts/memo_on_convo_v1.txt similarity index 100% rename from examples/st_game/prompts/memo_on_convo_v1.txt rename to examples/stanford_town/prompts/memo_on_convo_v1.txt diff --git a/examples/st_game/prompts/new_decomp_schedule_v1.txt b/examples/stanford_town/prompts/new_decomp_schedule_v1.txt similarity index 100% rename from examples/st_game/prompts/new_decomp_schedule_v1.txt rename to examples/stanford_town/prompts/new_decomp_schedule_v1.txt diff --git a/examples/st_game/prompts/planning_thought_on_convo_v1.txt b/examples/stanford_town/prompts/planning_thought_on_convo_v1.txt similarity index 100% rename from examples/st_game/prompts/planning_thought_on_convo_v1.txt rename to examples/stanford_town/prompts/planning_thought_on_convo_v1.txt diff --git a/examples/st_game/prompts/poignancy_action_v1.txt b/examples/stanford_town/prompts/poignancy_action_v1.txt similarity index 100% rename from examples/st_game/prompts/poignancy_action_v1.txt rename to examples/stanford_town/prompts/poignancy_action_v1.txt diff --git a/examples/st_game/prompts/poignancy_chat_v1.txt b/examples/stanford_town/prompts/poignancy_chat_v1.txt similarity index 100% rename from examples/st_game/prompts/poignancy_chat_v1.txt rename to examples/stanford_town/prompts/poignancy_chat_v1.txt diff --git a/examples/st_game/prompts/poignancy_event_v1.txt b/examples/stanford_town/prompts/poignancy_event_v1.txt similarity index 100% rename from examples/st_game/prompts/poignancy_event_v1.txt rename to examples/stanford_town/prompts/poignancy_event_v1.txt diff --git a/examples/st_game/prompts/poignancy_thought_v1.txt b/examples/stanford_town/prompts/poignancy_thought_v1.txt similarity index 100% rename from examples/st_game/prompts/poignancy_thought_v1.txt rename to examples/stanford_town/prompts/poignancy_thought_v1.txt diff --git a/examples/st_game/prompts/summarize_chat_relationship_v2.txt b/examples/stanford_town/prompts/summarize_chat_relationship_v2.txt similarity index 100% rename from examples/st_game/prompts/summarize_chat_relationship_v2.txt rename to examples/stanford_town/prompts/summarize_chat_relationship_v2.txt diff --git a/examples/st_game/prompts/summarize_conversation_v1.txt b/examples/stanford_town/prompts/summarize_conversation_v1.txt similarity index 100% rename from examples/st_game/prompts/summarize_conversation_v1.txt rename to examples/stanford_town/prompts/summarize_conversation_v1.txt diff --git a/examples/st_game/prompts/task_decomp_v3.txt b/examples/stanford_town/prompts/task_decomp_v3.txt similarity index 100% rename from examples/st_game/prompts/task_decomp_v3.txt rename to examples/stanford_town/prompts/task_decomp_v3.txt diff --git a/examples/st_game/prompts/wake_up_hour_v1.txt b/examples/stanford_town/prompts/wake_up_hour_v1.txt similarity index 100% rename from examples/st_game/prompts/wake_up_hour_v1.txt rename to examples/stanford_town/prompts/wake_up_hour_v1.txt diff --git a/examples/st_game/prompts/whisper_inner_thought_v1.txt b/examples/stanford_town/prompts/whisper_inner_thought_v1.txt similarity index 100% rename from examples/st_game/prompts/whisper_inner_thought_v1.txt rename to examples/stanford_town/prompts/whisper_inner_thought_v1.txt diff --git a/examples/st_game/reflect/__init__.py b/examples/stanford_town/reflect/__init__.py similarity index 100% rename from examples/st_game/reflect/__init__.py rename to examples/stanford_town/reflect/__init__.py diff --git a/examples/st_game/reflect/reflect.py b/examples/stanford_town/reflect/reflect.py similarity index 97% rename from examples/st_game/reflect/reflect.py rename to examples/stanford_town/reflect/reflect.py index 0c855b8f1..beec53dc2 100644 --- a/examples/st_game/reflect/reflect.py +++ b/examples/stanford_town/reflect/reflect.py @@ -5,7 +5,7 @@ import datetime import time -from examples.st_game.actions.run_reflect_action import ( +from examples.stanford_town.actions.run_reflect_action import ( AgentChatPoignancy, AgentEventPoignancy, AgentEventTriple, @@ -14,8 +14,8 @@ from examples.st_game.actions.run_reflect_action import ( AgentMemoryOnConvo, AgentPlanThoughtOnConvo, ) -from examples.st_game.memory.retrieve import new_agent_retrieve -from examples.st_game.utils.utils import get_embedding +from examples.stanford_town.memory.retrieve import new_agent_retrieve +from examples.stanford_town.utils.utils import get_embedding from metagpt.logs import logger diff --git a/examples/st_game/plan/__init__.py b/examples/stanford_town/roles/__init__.py similarity index 100% rename from examples/st_game/plan/__init__.py rename to examples/stanford_town/roles/__init__.py diff --git a/examples/st_game/roles/st_role.py b/examples/stanford_town/roles/st_role.py similarity index 96% rename from examples/st_game/roles/st_role.py rename to examples/stanford_town/roles/st_role.py index 48de34f15..414fd40b8 100644 --- a/examples/st_game/roles/st_role.py +++ b/examples/stanford_town/roles/st_role.py @@ -20,23 +20,23 @@ from typing import TYPE_CHECKING, Optional from pydantic import ConfigDict, Field, field_validator, model_validator -from examples.st_game.actions.dummy_action import DummyAction, DummyMessage -from examples.st_game.actions.inner_voice_action import AgentWhisperThoughtAction -from examples.st_game.actions.run_reflect_action import AgentEventTriple -from examples.st_game.memory.agent_memory import AgentMemory, BasicMemory -from examples.st_game.memory.scratch import Scratch -from examples.st_game.memory.spatial_memory import MemoryTree -from examples.st_game.plan.st_plan import plan -from examples.st_game.reflect.reflect import generate_poig_score, role_reflect -from examples.st_game.utils.const import STORAGE_PATH, collision_block_id -from examples.st_game.utils.mg_ga_transform import ( +from examples.stanford_town.actions.dummy_action import DummyAction, DummyMessage +from examples.stanford_town.actions.inner_voice_action import AgentWhisperThoughtAction +from examples.stanford_town.actions.run_reflect_action import AgentEventTriple +from examples.stanford_town.memory.agent_memory import AgentMemory, BasicMemory +from examples.stanford_town.memory.scratch import Scratch +from examples.stanford_town.memory.spatial_memory import MemoryTree +from examples.stanford_town.plan.st_plan import plan +from examples.stanford_town.reflect.reflect import generate_poig_score, role_reflect +from examples.stanford_town.utils.const import STORAGE_PATH, collision_block_id +from examples.stanford_town.utils.mg_ga_transform import ( get_role_environment, save_environment, save_movement, ) -from examples.st_game.utils.utils import get_embedding, path_finder +from examples.stanford_town.utils.utils import get_embedding, path_finder from metagpt.actions.add_requirement import UserRequirement -from metagpt.environment.stanford_town_env.env_space import ( +from metagpt.environment.stanford_town.env_space import ( EnvAction, EnvActionType, EnvObsParams, @@ -48,7 +48,7 @@ from metagpt.schema import Message from metagpt.utils.common import any_to_str if TYPE_CHECKING: - from metagpt.environment.stanford_town_env.stanford_town_env import ( # noqa: F401 + from metagpt.environment.stanford_town.stanford_town_env import ( # noqa: F401 StanfordTownEnv, ) @@ -63,7 +63,7 @@ class STRoleContext(RoleContext): @classmethod def model_rebuild(cls, **kwargs): - from metagpt.environment.stanford_town_env.stanford_town_env import ( # noqa: F401 + from metagpt.environment.stanford_town.stanford_town_env import ( # noqa: F401 StanfordTownEnv, ) diff --git a/examples/st_game/stanford_town.py b/examples/stanford_town/stanford_town.py similarity index 87% rename from examples/st_game/stanford_town.py rename to examples/stanford_town/stanford_town.py index f10332b60..7c39cbf04 100644 --- a/examples/st_game/stanford_town.py +++ b/examples/stanford_town/stanford_town.py @@ -4,10 +4,10 @@ from typing import Any, Optional -from examples.st_game.roles.st_role import STRole -from examples.st_game.utils.const import MAZE_ASSET_PATH +from examples.stanford_town.roles.st_role import STRole +from examples.stanford_town.utils.const import MAZE_ASSET_PATH from metagpt.context import Context -from metagpt.environment.stanford_town_env.stanford_town_env import StanfordTownEnv +from metagpt.environment.stanford_town.stanford_town_env import StanfordTownEnv from metagpt.logs import logger from metagpt.team import Team diff --git a/examples/st_game/static_dirs/assets/the_ville/agent_history_init_n25.csv b/examples/stanford_town/static_dirs/assets/the_ville/agent_history_init_n25.csv similarity index 100% rename from examples/st_game/static_dirs/assets/the_ville/agent_history_init_n25.csv rename to examples/stanford_town/static_dirs/assets/the_ville/agent_history_init_n25.csv diff --git a/examples/st_game/static_dirs/assets/the_ville/agent_history_init_n3.csv b/examples/stanford_town/static_dirs/assets/the_ville/agent_history_init_n3.csv similarity index 100% rename from examples/st_game/static_dirs/assets/the_ville/agent_history_init_n3.csv rename to examples/stanford_town/static_dirs/assets/the_ville/agent_history_init_n3.csv diff --git a/examples/st_game/static_dirs/assets/the_ville/matrix/maze/arena_maze.csv b/examples/stanford_town/static_dirs/assets/the_ville/matrix/maze/arena_maze.csv similarity index 100% rename from examples/st_game/static_dirs/assets/the_ville/matrix/maze/arena_maze.csv rename to examples/stanford_town/static_dirs/assets/the_ville/matrix/maze/arena_maze.csv diff --git a/examples/st_game/static_dirs/assets/the_ville/matrix/maze/collision_maze.csv b/examples/stanford_town/static_dirs/assets/the_ville/matrix/maze/collision_maze.csv similarity index 100% rename from examples/st_game/static_dirs/assets/the_ville/matrix/maze/collision_maze.csv rename to examples/stanford_town/static_dirs/assets/the_ville/matrix/maze/collision_maze.csv diff --git a/examples/st_game/static_dirs/assets/the_ville/matrix/maze/game_object_maze.csv b/examples/stanford_town/static_dirs/assets/the_ville/matrix/maze/game_object_maze.csv similarity index 100% rename from examples/st_game/static_dirs/assets/the_ville/matrix/maze/game_object_maze.csv rename to examples/stanford_town/static_dirs/assets/the_ville/matrix/maze/game_object_maze.csv diff --git a/examples/st_game/static_dirs/assets/the_ville/matrix/maze/sector_maze.csv b/examples/stanford_town/static_dirs/assets/the_ville/matrix/maze/sector_maze.csv similarity index 100% rename from examples/st_game/static_dirs/assets/the_ville/matrix/maze/sector_maze.csv rename to examples/stanford_town/static_dirs/assets/the_ville/matrix/maze/sector_maze.csv diff --git a/examples/st_game/static_dirs/assets/the_ville/matrix/maze/spawning_location_maze.csv b/examples/stanford_town/static_dirs/assets/the_ville/matrix/maze/spawning_location_maze.csv similarity index 100% rename from examples/st_game/static_dirs/assets/the_ville/matrix/maze/spawning_location_maze.csv rename to examples/stanford_town/static_dirs/assets/the_ville/matrix/maze/spawning_location_maze.csv diff --git a/examples/st_game/static_dirs/assets/the_ville/matrix/maze_meta_info.json b/examples/stanford_town/static_dirs/assets/the_ville/matrix/maze_meta_info.json similarity index 100% rename from examples/st_game/static_dirs/assets/the_ville/matrix/maze_meta_info.json rename to examples/stanford_town/static_dirs/assets/the_ville/matrix/maze_meta_info.json diff --git a/examples/st_game/static_dirs/assets/the_ville/matrix/special_blocks/arena_blocks.csv b/examples/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/arena_blocks.csv similarity index 100% rename from examples/st_game/static_dirs/assets/the_ville/matrix/special_blocks/arena_blocks.csv rename to examples/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/arena_blocks.csv diff --git a/examples/st_game/static_dirs/assets/the_ville/matrix/special_blocks/game_object_blocks.csv b/examples/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/game_object_blocks.csv similarity index 100% rename from examples/st_game/static_dirs/assets/the_ville/matrix/special_blocks/game_object_blocks.csv rename to examples/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/game_object_blocks.csv diff --git a/examples/st_game/static_dirs/assets/the_ville/matrix/special_blocks/sector_blocks.csv b/examples/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/sector_blocks.csv similarity index 100% rename from examples/st_game/static_dirs/assets/the_ville/matrix/special_blocks/sector_blocks.csv rename to examples/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/sector_blocks.csv diff --git a/examples/st_game/static_dirs/assets/the_ville/matrix/special_blocks/spawning_location_blocks.csv b/examples/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/spawning_location_blocks.csv similarity index 100% rename from examples/st_game/static_dirs/assets/the_ville/matrix/special_blocks/spawning_location_blocks.csv rename to examples/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/spawning_location_blocks.csv diff --git a/examples/st_game/static_dirs/assets/the_ville/matrix/special_blocks/world_blocks.csv b/examples/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/world_blocks.csv similarity index 100% rename from examples/st_game/static_dirs/assets/the_ville/matrix/special_blocks/world_blocks.csv rename to examples/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/world_blocks.csv diff --git a/examples/st_game/tests/__init__.py b/examples/stanford_town/tests/__init__.py similarity index 100% rename from examples/st_game/tests/__init__.py rename to examples/stanford_town/tests/__init__.py diff --git a/examples/st_game/roles/__init__.py b/examples/stanford_town/tests/actions/__init__.py similarity index 100% rename from examples/st_game/roles/__init__.py rename to examples/stanford_town/tests/actions/__init__.py diff --git a/examples/st_game/tests/actions/test_gen_action_details.py b/examples/stanford_town/tests/actions/test_gen_action_details.py similarity index 90% rename from examples/st_game/tests/actions/test_gen_action_details.py rename to examples/stanford_town/tests/actions/test_gen_action_details.py index 49e24481d..bf6b75c04 100644 --- a/examples/st_game/tests/actions/test_gen_action_details.py +++ b/examples/stanford_town/tests/actions/test_gen_action_details.py @@ -4,17 +4,17 @@ import pytest -from examples.st_game.actions.gen_action_details import ( +from examples.stanford_town.actions.gen_action_details import ( GenActionArena, GenActionDetails, GenActionObject, GenActionSector, GenActObjDescription, ) -from examples.st_game.roles.st_role import STRole -from examples.st_game.utils.const import MAZE_ASSET_PATH +from examples.stanford_town.roles.st_role import STRole +from examples.stanford_town.utils.const import MAZE_ASSET_PATH from metagpt.environment.api.env_api import EnvAPIAbstract -from metagpt.environment.stanford_town_env.stanford_town_env import StanfordTownEnv +from metagpt.environment.stanford_town.stanford_town_env import StanfordTownEnv @pytest.mark.asyncio diff --git a/examples/st_game/tests/actions/test_summarize_conv.py b/examples/stanford_town/tests/actions/test_summarize_conv.py similarity index 83% rename from examples/st_game/tests/actions/test_summarize_conv.py rename to examples/stanford_town/tests/actions/test_summarize_conv.py index 9174a558a..fa0de2031 100644 --- a/examples/st_game/tests/actions/test_summarize_conv.py +++ b/examples/stanford_town/tests/actions/test_summarize_conv.py @@ -4,7 +4,7 @@ import pytest -from examples.st_game.actions.summarize_conv import SummarizeConv +from examples.stanford_town.actions.summarize_conv import SummarizeConv @pytest.mark.asyncio diff --git a/examples/st_game/tests/actions/__init__.py b/examples/stanford_town/tests/plan/__init__.py similarity index 100% rename from examples/st_game/tests/actions/__init__.py rename to examples/stanford_town/tests/plan/__init__.py diff --git a/examples/st_game/tests/plan/test_conversation.py b/examples/stanford_town/tests/plan/test_conversation.py similarity index 80% rename from examples/st_game/tests/plan/test_conversation.py rename to examples/stanford_town/tests/plan/test_conversation.py index 3a158fc5f..86c2f0b94 100644 --- a/examples/st_game/tests/plan/test_conversation.py +++ b/examples/stanford_town/tests/plan/test_conversation.py @@ -6,12 +6,12 @@ from typing import Tuple import pytest -from examples.st_game.plan.converse import agent_conversation -from examples.st_game.roles.st_role import STRole -from examples.st_game.utils.const import MAZE_ASSET_PATH, STORAGE_PATH -from examples.st_game.utils.mg_ga_transform import get_reverie_meta -from examples.st_game.utils.utils import copy_folder -from metagpt.environment.stanford_town_env.stanford_town_env import StanfordTownEnv +from examples.stanford_town.plan.converse import agent_conversation +from examples.stanford_town.roles.st_role import STRole +from examples.stanford_town.utils.const import MAZE_ASSET_PATH, STORAGE_PATH +from examples.stanford_town.utils.mg_ga_transform import get_reverie_meta +from examples.stanford_town.utils.utils import copy_folder +from metagpt.environment.stanford_town.stanford_town_env import StanfordTownEnv async def init_two_roles(fork_sim_code: str = "base_the_ville_isabella_maria_klaus") -> Tuple["STRole"]: diff --git a/examples/st_game/tests/plan/test_st_plan.py b/examples/stanford_town/tests/plan/test_st_plan.py similarity index 87% rename from examples/st_game/tests/plan/test_st_plan.py rename to examples/stanford_town/tests/plan/test_st_plan.py index 82e3c56c2..ad20d3068 100644 --- a/examples/st_game/tests/plan/test_st_plan.py +++ b/examples/stanford_town/tests/plan/test_st_plan.py @@ -4,8 +4,12 @@ import pytest -from examples.st_game.plan.st_plan import _choose_retrieved, _should_react, _wait_react -from examples.st_game.tests.plan.test_converse import init_two_roles +from examples.stanford_town.plan.st_plan import ( + _choose_retrieved, + _should_react, + _wait_react, +) +from examples.stanford_town.tests.plan.test_converse import init_two_roles def test_should_react(): diff --git a/examples/st_game/tests/plan/__init__.py b/examples/stanford_town/tests/roles/__init__.py similarity index 100% rename from examples/st_game/tests/plan/__init__.py rename to examples/stanford_town/tests/roles/__init__.py diff --git a/examples/st_game/tests/roles/test_st_role.py b/examples/stanford_town/tests/roles/test_st_role.py similarity index 67% rename from examples/st_game/tests/roles/test_st_role.py rename to examples/stanford_town/tests/roles/test_st_role.py index c0844d10c..b8feecb2a 100644 --- a/examples/st_game/tests/roles/test_st_role.py +++ b/examples/stanford_town/tests/roles/test_st_role.py @@ -4,10 +4,10 @@ import pytest -from examples.st_game.memory.agent_memory import BasicMemory -from examples.st_game.roles.st_role import STRole -from examples.st_game.utils.const import MAZE_ASSET_PATH -from metagpt.environment.stanford_town_env.stanford_town_env import StanfordTownEnv +from examples.stanford_town.memory.agent_memory import BasicMemory +from examples.stanford_town.roles.st_role import STRole +from examples.stanford_town.utils.const import MAZE_ASSET_PATH +from metagpt.environment.stanford_town.stanford_town_env import StanfordTownEnv @pytest.mark.asyncio diff --git a/examples/st_game/tests/test_agent_memory.py b/examples/stanford_town/tests/test_agent_memory.py similarity index 94% rename from examples/st_game/tests/test_agent_memory.py rename to examples/stanford_town/tests/test_agent_memory.py index d5a75163c..e7ad3fc43 100644 --- a/examples/st_game/tests/test_agent_memory.py +++ b/examples/stanford_town/tests/test_agent_memory.py @@ -6,9 +6,9 @@ from datetime import datetime, timedelta import pytest -from examples.st_game.memory.agent_memory import AgentMemory -from examples.st_game.memory.retrieve import agent_retrieve -from examples.st_game.utils.const import STORAGE_PATH +from examples.stanford_town.memory.agent_memory import AgentMemory +from examples.stanford_town.memory.retrieve import agent_retrieve +from examples.stanford_town.utils.const import STORAGE_PATH from metagpt.logs import logger """ diff --git a/examples/st_game/tests/test_basic_memory.py b/examples/stanford_town/tests/test_basic_memory.py similarity index 96% rename from examples/st_game/tests/test_basic_memory.py rename to examples/stanford_town/tests/test_basic_memory.py index 25d350263..fa2a5c487 100644 --- a/examples/st_game/tests/test_basic_memory.py +++ b/examples/stanford_town/tests/test_basic_memory.py @@ -6,7 +6,7 @@ from datetime import datetime, timedelta import pytest -from examples.st_game.memory.agent_memory import BasicMemory +from examples.stanford_town.memory.agent_memory import BasicMemory from metagpt.logs import logger """ diff --git a/examples/st_game/tests/test_reflect.py b/examples/stanford_town/tests/test_reflect.py similarity index 93% rename from examples/st_game/tests/test_reflect.py rename to examples/stanford_town/tests/test_reflect.py index 6672b0545..48422d073 100644 --- a/examples/st_game/tests/test_reflect.py +++ b/examples/stanford_town/tests/test_reflect.py @@ -4,14 +4,14 @@ import pytest -from examples.st_game.actions.run_reflect_action import ( +from examples.stanford_town.actions.run_reflect_action import ( AgentEventTriple, AgentFocusPt, AgentInsightAndGuidance, ) -from examples.st_game.roles.st_role import STRole -from examples.st_game.utils.const import MAZE_ASSET_PATH -from metagpt.environment.stanford_town_env.stanford_town_env import StanfordTownEnv +from examples.stanford_town.roles.st_role import STRole +from examples.stanford_town.utils.const import MAZE_ASSET_PATH +from metagpt.environment.stanford_town.stanford_town_env import StanfordTownEnv @pytest.mark.asyncio diff --git a/examples/st_game/tests/test_spatial_memory.py b/examples/stanford_town/tests/test_spatial_memory.py similarity index 100% rename from examples/st_game/tests/test_spatial_memory.py rename to examples/stanford_town/tests/test_spatial_memory.py diff --git a/examples/st_game/tests/roles/__init__.py b/examples/stanford_town/utils/__init__.py similarity index 100% rename from examples/st_game/tests/roles/__init__.py rename to examples/stanford_town/utils/__init__.py diff --git a/examples/st_game/utils/const.py b/examples/stanford_town/utils/const.py similarity index 100% rename from examples/st_game/utils/const.py rename to examples/stanford_town/utils/const.py diff --git a/examples/st_game/utils/mg_ga_transform.py b/examples/stanford_town/utils/mg_ga_transform.py similarity index 96% rename from examples/st_game/utils/mg_ga_transform.py rename to examples/stanford_town/utils/mg_ga_transform.py index 9ff57a3b1..521199a05 100644 --- a/examples/st_game/utils/mg_ga_transform.py +++ b/examples/stanford_town/utils/mg_ga_transform.py @@ -5,7 +5,7 @@ from pathlib import Path from typing import Optional -from examples.st_game.utils.const import STORAGE_PATH, TEMP_STORAGE_PATH +from examples.stanford_town.utils.const import STORAGE_PATH, TEMP_STORAGE_PATH from metagpt.logs import logger from metagpt.utils.common import read_json_file, write_json_file diff --git a/examples/st_game/utils/utils.py b/examples/stanford_town/utils/utils.py similarity index 100% rename from examples/st_game/utils/utils.py rename to examples/stanford_town/utils/utils.py diff --git a/metagpt/environment/stanford_town/stanford_town_ext_env.py b/metagpt/environment/stanford_town/stanford_town_ext_env.py index 9bc1e1798..30a02d4db 100644 --- a/metagpt/environment/stanford_town/stanford_town_ext_env.py +++ b/metagpt/environment/stanford_town/stanford_town_ext_env.py @@ -10,11 +10,7 @@ from typing import Any, Optional from pydantic import ConfigDict, Field, model_validator from metagpt.environment.base_env import ExtEnv, mark_as_readable, mark_as_writeable -<<<<<<< HEAD:metagpt/environment/stanford_town/stanford_town_ext_env.py from metagpt.environment.stanford_town.env_space import ( -======= -from metagpt.environment.stanford_town_env.env_space import ( ->>>>>>> 5e6f2757 (add base environment action_space/observation space and update stanford_town_env):metagpt/environment/stanford_town_env/stanford_town_ext_env.py EnvAction, EnvActionType, EnvObsParams, diff --git a/metagpt/environment/stanford_town_env/env_space.py b/metagpt/environment/stanford_town_env/env_space.py deleted file mode 100644 index e100a2952..000000000 --- a/metagpt/environment/stanford_town_env/env_space.py +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# @Desc : - -from typing import Any, Optional, Union - -import numpy as np -import numpy.typing as npt -from gymnasium import spaces -from pydantic import ConfigDict, Field, field_validator - -from metagpt.environment.base_env_space import ( - BaseEnvAction, - BaseEnvActionType, - BaseEnvObsParams, - BaseEnvObsType, -) - - -class EnvActionType(BaseEnvActionType): - NONE = 0 # no action to run, just get observation - - ADD_TILE_EVENT = 1 # Add an event triple to a tile - RM_TILE_EVENT = 2 # Remove an event triple from a tile - TURN_TILE_EVENT_IDLE = 3 # Turn an event triple from a tile into idle - RM_TITLE_SUB_EVENT = 4 # Remove an event triple that has the input subject from a tile - - -class EnvAction(BaseEnvAction): - """env action type and its related params of action functions/apis""" - - model_config = ConfigDict(arbitrary_types_allowed=True) - - action_type: int = Field(default=EnvActionType.NONE, description="action type") - coord: npt.NDArray[np.int64] = Field( - default_factory=lambda: np.zeros(2, dtype=np.int64), description="tile coordinate" - ) - subject: str = Field(default="", description="subject name of first element in event") - event: tuple[str, Optional[str], Optional[str], Optional[str]] = Field( - default=["", None, None, None], description="tile event" - ) - - @field_validator("coord", mode="before") - @classmethod - def check_coord(cls, coord) -> npt.NDArray[np.int64]: - if not isinstance(coord, np.ndarray): - return np.array(coord) - - -class EnvObsType(BaseEnvObsType): - """get part observation with specific params""" - - NONE = 0 # get whole observation from env - - GET_TITLE = 1 # get the tile detail dictionary with given tile coord - TILE_PATH = 2 # get the tile address with given tile coord - TILE_NBR = 3 # get the neighbors of given tile coord and its vision radius - - -class EnvObsParams(BaseEnvObsParams): - """observation params for different EnvObsType""" - - model_config = ConfigDict(arbitrary_types_allowed=True) - - obs_type: int = Field(default=EnvObsType.NONE, description="observation type") - coord: npt.NDArray[np.int64] = Field( - default_factory=lambda: np.zeros(2, dtype=np.int64), description="tile coordinate" - ) - level: str = Field(default="", description="different level of title") - vision_radius: int = Field(default=0, description="the vision radius of current tile") - - @field_validator("coord", mode="before") - @classmethod - def check_coord(cls, coord) -> npt.NDArray[np.int64]: - if not isinstance(coord, np.ndarray): - return np.array(coord) - - -EnvObsValType = Union[list[list[str]], dict[str, set[tuple[int, int]]], list[list[dict[str, Any]]]] - - -def get_observation_space() -> spaces.Dict: - # it's a - space = spaces.Dict( - {"collision_maze": spaces.Discrete(2), "tiles": spaces.Discrete(2), "address_tiles": spaces.Discrete(2)} - ) - - return space - - -def get_action_space(maze_shape: tuple[int, int]) -> spaces.Dict: - """The fields defined by the space correspond to the input parameters of the action except `action_type`""" - space = spaces.Dict( - { - "action_type": spaces.Discrete(len(EnvActionType)), - "coord": spaces.Box( - np.array([0, 0], dtype=np.int64), np.array([maze_shape[0], maze_shape[1]], dtype=np.int64) - ), # coord of the tile - "subject": spaces.Text(256), # the first element of an tile event - "event": spaces.Tuple( - (spaces.Text(256), spaces.Text(256), spaces.Text(256), spaces.Text(256)) - ), # event is a tuple of four str - } - ) - return space