diff --git a/examples/stanford_town/.gitignore b/examples/stanford_town/.gitignore deleted file mode 100644 index fe77153f9..000000000 --- a/examples/stanford_town/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -storage/test* -storage/unittest* \ No newline at end of file diff --git a/examples/stanford_town/run_st_game.py b/examples/stanford_town/run_st_game.py index 4c3b3bb0e..732ae5efc 100644 --- a/examples/stanford_town/run_st_game.py +++ b/examples/stanford_town/run_st_game.py @@ -7,15 +7,15 @@ from typing import Optional import fire -from examples.stanford_town.roles.st_role import STRole -from examples.stanford_town.stanford_town import StanfordTown -from examples.stanford_town.utils.const import STORAGE_PATH -from examples.stanford_town.utils.mg_ga_transform import ( +from metagpt.ext.stanford_town.roles.st_role import STRole +from metagpt.ext.stanford_town.stanford_town import StanfordTown +from metagpt.ext.stanford_town.utils.const import STORAGE_PATH +from metagpt.ext.stanford_town.utils.mg_ga_transform import ( get_reverie_meta, write_curr_sim_code, write_curr_step, ) -from examples.stanford_town.utils.utils import copy_folder +from metagpt.ext.stanford_town.utils.utils import copy_folder from metagpt.logs import logger diff --git a/examples/stanford_town/storage/.gitignore b/examples/stanford_town/storage/.gitignore index 72b125e04..962820861 100644 --- a/examples/stanford_town/storage/.gitignore +++ b/examples/stanford_town/storage/.gitignore @@ -1,3 +1,4 @@ # path to store simulation data test_* +unittest* July* \ No newline at end of file diff --git a/examples/stanford_town/tests/__init__.py b/examples/stanford_town/tests/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/stanford_town/utils/const.py b/examples/stanford_town/utils/const.py deleted file mode 100644 index 38e80f103..000000000 --- a/examples/stanford_town/utils/const.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# @Desc : - -from pathlib import Path - -ROOT_PATH = Path(__file__).parent.parent -STORAGE_PATH = ROOT_PATH.joinpath("storage") -TEMP_STORAGE_PATH = ROOT_PATH.joinpath("temp_storage") -MAZE_ASSET_PATH = ROOT_PATH.joinpath("static_dirs/assets/the_ville") -PROMPTS_DIR = ROOT_PATH.joinpath("prompts") - -collision_block_id = "32125" diff --git a/examples/stanford_town/actions/__init__.py b/metagpt/ext/__init__.py similarity index 100% rename from examples/stanford_town/actions/__init__.py rename to metagpt/ext/__init__.py diff --git a/examples/stanford_town/README.md b/metagpt/ext/stanford_town/README.md similarity index 100% rename from examples/stanford_town/README.md rename to metagpt/ext/stanford_town/README.md diff --git a/examples/stanford_town/README_CN.md b/metagpt/ext/stanford_town/README_CN.md similarity index 100% rename from examples/stanford_town/README_CN.md rename to metagpt/ext/stanford_town/README_CN.md diff --git a/metagpt/ext/stanford_town/__init__.py b/metagpt/ext/stanford_town/__init__.py new file mode 100644 index 000000000..56ea35c9f --- /dev/null +++ b/metagpt/ext/stanford_town/__init__.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# @Desc : stanford town implement diff --git a/examples/stanford_town/plan/__init__.py b/metagpt/ext/stanford_town/actions/__init__.py similarity index 100% rename from examples/stanford_town/plan/__init__.py rename to metagpt/ext/stanford_town/actions/__init__.py diff --git a/examples/stanford_town/actions/agent_chat_sum_rel.py b/metagpt/ext/stanford_town/actions/agent_chat_sum_rel.py similarity index 95% rename from examples/stanford_town/actions/agent_chat_sum_rel.py rename to metagpt/ext/stanford_town/actions/agent_chat_sum_rel.py index 3e564a60c..98d370bb0 100644 --- a/examples/stanford_town/actions/agent_chat_sum_rel.py +++ b/metagpt/ext/stanford_town/actions/agent_chat_sum_rel.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # @Desc : summarize relationship in a agent chat -from examples.stanford_town.actions.st_action import STAction +from metagpt.ext.stanford_town.actions.st_action import STAction from metagpt.logs import logger diff --git a/examples/stanford_town/actions/decide_to_talk.py b/metagpt/ext/stanford_town/actions/decide_to_talk.py similarity index 98% rename from examples/stanford_town/actions/decide_to_talk.py rename to metagpt/ext/stanford_town/actions/decide_to_talk.py index 414ee7e36..a393f31af 100644 --- a/examples/stanford_town/actions/decide_to_talk.py +++ b/metagpt/ext/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.stanford_town.actions.st_action import STAction +from metagpt.ext.stanford_town.actions.st_action import STAction from metagpt.logs import logger diff --git a/examples/stanford_town/actions/dummy_action.py b/metagpt/ext/stanford_town/actions/dummy_action.py similarity index 100% rename from examples/stanford_town/actions/dummy_action.py rename to metagpt/ext/stanford_town/actions/dummy_action.py diff --git a/examples/stanford_town/actions/gen_action_details.py b/metagpt/ext/stanford_town/actions/gen_action_details.py similarity index 99% rename from examples/stanford_town/actions/gen_action_details.py rename to metagpt/ext/stanford_town/actions/gen_action_details.py index 0eb7cb701..3820ddc5b 100644 --- a/examples/stanford_town/actions/gen_action_details.py +++ b/metagpt/ext/stanford_town/actions/gen_action_details.py @@ -5,10 +5,9 @@ import random from metagpt.environment.stanford_town.env_space import EnvObsParams, EnvObsType +from metagpt.ext.stanford_town.actions.st_action import STAction from metagpt.logs import logger -from .st_action import STAction - class GenActionSector(STAction): name: str = "GenActionSector" diff --git a/examples/stanford_town/actions/gen_daily_schedule.py b/metagpt/ext/stanford_town/actions/gen_daily_schedule.py similarity index 97% rename from examples/stanford_town/actions/gen_daily_schedule.py rename to metagpt/ext/stanford_town/actions/gen_daily_schedule.py index 6deb6e6eb..5dffa8995 100644 --- a/examples/stanford_town/actions/gen_daily_schedule.py +++ b/metagpt/ext/stanford_town/actions/gen_daily_schedule.py @@ -3,10 +3,9 @@ # @Desc : gen_daily_schedule +from metagpt.ext.stanford_town.actions.st_action import STAction from metagpt.logs import logger -from .st_action import STAction - class GenDailySchedule(STAction): name: str = "GenDailySchedule" diff --git a/examples/stanford_town/actions/gen_hourly_schedule.py b/metagpt/ext/stanford_town/actions/gen_hourly_schedule.py similarity index 100% rename from examples/stanford_town/actions/gen_hourly_schedule.py rename to metagpt/ext/stanford_town/actions/gen_hourly_schedule.py diff --git a/examples/stanford_town/actions/gen_iter_chat_utt.py b/metagpt/ext/stanford_town/actions/gen_iter_chat_utt.py similarity index 97% rename from examples/stanford_town/actions/gen_iter_chat_utt.py rename to metagpt/ext/stanford_town/actions/gen_iter_chat_utt.py index 82104b6ca..41460afba 100644 --- a/examples/stanford_town/actions/gen_iter_chat_utt.py +++ b/metagpt/ext/stanford_town/actions/gen_iter_chat_utt.py @@ -2,9 +2,9 @@ # -*- coding: utf-8 -*- # @Desc : generate_iterative_chat_utt -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.ext.stanford_town.actions.st_action import STAction +from metagpt.ext.stanford_town.utils.utils import extract_first_json_dict from metagpt.logs import logger diff --git a/examples/stanford_town/actions/inner_voice_action.py b/metagpt/ext/stanford_town/actions/inner_voice_action.py similarity index 89% rename from examples/stanford_town/actions/inner_voice_action.py rename to metagpt/ext/stanford_town/actions/inner_voice_action.py index 121f1dcee..83cfa037b 100644 --- a/examples/stanford_town/actions/inner_voice_action.py +++ b/metagpt/ext/stanford_town/actions/inner_voice_action.py @@ -1,4 +1,8 @@ -from examples.stanford_town.actions.st_action import STAction +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# @Desc : + +from metagpt.ext.stanford_town.actions.st_action import STAction from metagpt.logs import logger diff --git a/examples/stanford_town/actions/new_decomp_schedule.py b/metagpt/ext/stanford_town/actions/new_decomp_schedule.py similarity index 98% rename from examples/stanford_town/actions/new_decomp_schedule.py rename to metagpt/ext/stanford_town/actions/new_decomp_schedule.py index c7078be9c..759ec170f 100644 --- a/examples/stanford_town/actions/new_decomp_schedule.py +++ b/metagpt/ext/stanford_town/actions/new_decomp_schedule.py @@ -4,7 +4,7 @@ import datetime -from examples.stanford_town.actions.st_action import STAction +from metagpt.ext.stanford_town.actions.st_action import STAction from metagpt.logs import logger diff --git a/examples/stanford_town/actions/run_reflect_action.py b/metagpt/ext/stanford_town/actions/run_reflect_action.py similarity index 99% rename from examples/stanford_town/actions/run_reflect_action.py rename to metagpt/ext/stanford_town/actions/run_reflect_action.py index 055c03db4..895f6828f 100644 --- a/examples/stanford_town/actions/run_reflect_action.py +++ b/metagpt/ext/stanford_town/actions/run_reflect_action.py @@ -4,7 +4,7 @@ import re -from examples.stanford_town.actions.st_action import STAction +from metagpt.ext.stanford_town.actions.st_action import STAction from metagpt.logs import logger diff --git a/examples/stanford_town/actions/st_action.py b/metagpt/ext/stanford_town/actions/st_action.py similarity index 98% rename from examples/stanford_town/actions/st_action.py rename to metagpt/ext/stanford_town/actions/st_action.py index 72ef851e0..321676374 100644 --- a/examples/stanford_town/actions/st_action.py +++ b/metagpt/ext/stanford_town/actions/st_action.py @@ -7,9 +7,9 @@ from abc import abstractmethod from pathlib import Path from typing import Any, Optional, Union -from examples.stanford_town.utils.const import PROMPTS_DIR from metagpt.actions.action import Action from metagpt.config2 import config +from metagpt.ext.stanford_town.utils.const import PROMPTS_DIR from metagpt.logs import logger diff --git a/examples/stanford_town/actions/summarize_conv.py b/metagpt/ext/stanford_town/actions/summarize_conv.py similarity index 96% rename from examples/stanford_town/actions/summarize_conv.py rename to metagpt/ext/stanford_town/actions/summarize_conv.py index f01fb36ad..5be5fcaa4 100644 --- a/examples/stanford_town/actions/summarize_conv.py +++ b/metagpt/ext/stanford_town/actions/summarize_conv.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # @Desc : summarize the content of agents' conversation -from examples.stanford_town.actions.st_action import STAction +from metagpt.ext.stanford_town.actions.st_action import STAction from metagpt.logs import logger diff --git a/examples/stanford_town/actions/task_decomp.py b/metagpt/ext/stanford_town/actions/task_decomp.py similarity index 99% rename from examples/stanford_town/actions/task_decomp.py rename to metagpt/ext/stanford_town/actions/task_decomp.py index d9d5ec9fa..a4e22c24d 100644 --- a/examples/stanford_town/actions/task_decomp.py +++ b/metagpt/ext/stanford_town/actions/task_decomp.py @@ -4,10 +4,9 @@ import datetime +from metagpt.ext.stanford_town.actions.st_action import STAction from metagpt.logs import logger -from ..actions.st_action import STAction - class TaskDecomp(STAction): name: str = "TaskDecomp" diff --git a/examples/stanford_town/actions/wake_up.py b/metagpt/ext/stanford_town/actions/wake_up.py similarity index 95% rename from examples/stanford_town/actions/wake_up.py rename to metagpt/ext/stanford_town/actions/wake_up.py index d39115854..ea44cd3a4 100644 --- a/examples/stanford_town/actions/wake_up.py +++ b/metagpt/ext/stanford_town/actions/wake_up.py @@ -3,10 +3,9 @@ # @Desc : wake_up +from metagpt.ext.stanford_town.actions.st_action import STAction from metagpt.logs import logger -from ..actions.st_action import STAction - class WakeUp(STAction): name: str = "WakeUp" diff --git a/examples/stanford_town/memory/__init__.py b/metagpt/ext/stanford_town/memory/__init__.py similarity index 100% rename from examples/stanford_town/memory/__init__.py rename to metagpt/ext/stanford_town/memory/__init__.py diff --git a/examples/stanford_town/memory/agent_memory.py b/metagpt/ext/stanford_town/memory/agent_memory.py similarity index 100% rename from examples/stanford_town/memory/agent_memory.py rename to metagpt/ext/stanford_town/memory/agent_memory.py diff --git a/examples/stanford_town/memory/retrieve.py b/metagpt/ext/stanford_town/memory/retrieve.py similarity index 97% rename from examples/stanford_town/memory/retrieve.py rename to metagpt/ext/stanford_town/memory/retrieve.py index db3a87bea..c4b32f965 100644 --- a/examples/stanford_town/memory/retrieve.py +++ b/metagpt/ext/stanford_town/memory/retrieve.py @@ -7,8 +7,8 @@ import datetime from numpy import dot from numpy.linalg import norm -from examples.stanford_town.memory.agent_memory import BasicMemory -from examples.stanford_town.utils.utils import get_embedding +from metagpt.ext.stanford_town.memory.agent_memory import BasicMemory +from metagpt.ext.stanford_town.utils.utils import get_embedding def agent_retrieve( diff --git a/examples/stanford_town/memory/scratch.py b/metagpt/ext/stanford_town/memory/scratch.py similarity index 100% rename from examples/stanford_town/memory/scratch.py rename to metagpt/ext/stanford_town/memory/scratch.py diff --git a/examples/stanford_town/memory/spatial_memory.py b/metagpt/ext/stanford_town/memory/spatial_memory.py similarity index 100% rename from examples/stanford_town/memory/spatial_memory.py rename to metagpt/ext/stanford_town/memory/spatial_memory.py diff --git a/examples/stanford_town/roles/__init__.py b/metagpt/ext/stanford_town/plan/__init__.py similarity index 100% rename from examples/stanford_town/roles/__init__.py rename to metagpt/ext/stanford_town/plan/__init__.py diff --git a/examples/stanford_town/plan/converse.py b/metagpt/ext/stanford_town/plan/converse.py similarity index 94% rename from examples/stanford_town/plan/converse.py rename to metagpt/ext/stanford_town/plan/converse.py index b0ff54b68..8eefbc9b4 100644 --- a/examples/stanford_town/plan/converse.py +++ b/metagpt/ext/stanford_town/plan/converse.py @@ -4,9 +4,9 @@ from typing import Tuple -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.ext.stanford_town.actions.agent_chat_sum_rel import AgentChatSumRel +from metagpt.ext.stanford_town.actions.gen_iter_chat_utt import GenIterChatUTT +from metagpt.ext.stanford_town.memory.retrieve import new_agent_retrieve from metagpt.logs import logger diff --git a/examples/stanford_town/plan/st_plan.py b/metagpt/ext/stanford_town/plan/st_plan.py similarity index 97% rename from examples/stanford_town/plan/st_plan.py rename to metagpt/ext/stanford_town/plan/st_plan.py index 080d87de1..6b6323b7a 100644 --- a/examples/stanford_town/plan/st_plan.py +++ b/metagpt/ext/stanford_town/plan/st_plan.py @@ -7,21 +7,20 @@ import math import random from typing import Tuple, Union +from metagpt.ext.stanford_town.actions.decide_to_talk import DecideToTalk +from metagpt.ext.stanford_town.actions.gen_action_details import GenActionDetails +from metagpt.ext.stanford_town.actions.gen_daily_schedule import GenDailySchedule +from metagpt.ext.stanford_town.actions.gen_hourly_schedule import GenHourlySchedule +from metagpt.ext.stanford_town.actions.new_decomp_schedule import NewDecompSchedule +from metagpt.ext.stanford_town.actions.summarize_conv import SummarizeConv +from metagpt.ext.stanford_town.actions.task_decomp import TaskDecomp +from metagpt.ext.stanford_town.actions.wake_up import WakeUp +from metagpt.ext.stanford_town.memory.retrieve import new_agent_retrieve +from metagpt.ext.stanford_town.plan.converse import agent_conversation +from metagpt.ext.stanford_town.utils.utils import get_embedding from metagpt.llm import LLM from metagpt.logs import logger -from ..actions.decide_to_talk import DecideToTalk -from ..actions.gen_action_details import GenActionDetails -from ..actions.gen_daily_schedule import GenDailySchedule -from ..actions.gen_hourly_schedule import GenHourlySchedule -from ..actions.new_decomp_schedule import NewDecompSchedule -from ..actions.summarize_conv import SummarizeConv -from ..actions.task_decomp import TaskDecomp -from ..actions.wake_up import WakeUp -from ..memory.retrieve import new_agent_retrieve -from ..plan.converse import agent_conversation -from ..utils.utils import get_embedding - async def plan(role: "STRole", roles: dict["STRole"], new_day: bool, retrieved: dict) -> str: # PART 1: Generate the hourly schedule. diff --git a/metagpt/ext/stanford_town/prompts/__init__.py b/metagpt/ext/stanford_town/prompts/__init__.py new file mode 100644 index 000000000..2af51b8dc --- /dev/null +++ b/metagpt/ext/stanford_town/prompts/__init__.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# @Desc : stanford town prompt templates diff --git a/examples/stanford_town/prompts/action_location_object_vMar11.txt b/metagpt/ext/stanford_town/prompts/action_location_object_vMar11.txt similarity index 100% rename from examples/stanford_town/prompts/action_location_object_vMar11.txt rename to metagpt/ext/stanford_town/prompts/action_location_object_vMar11.txt diff --git a/examples/stanford_town/prompts/action_location_sector_v1.txt b/metagpt/ext/stanford_town/prompts/action_location_sector_v1.txt similarity index 100% rename from examples/stanford_town/prompts/action_location_sector_v1.txt rename to metagpt/ext/stanford_town/prompts/action_location_sector_v1.txt diff --git a/examples/stanford_town/prompts/action_object_v2.txt b/metagpt/ext/stanford_town/prompts/action_object_v2.txt similarity index 100% rename from examples/stanford_town/prompts/action_object_v2.txt rename to metagpt/ext/stanford_town/prompts/action_object_v2.txt diff --git a/examples/stanford_town/prompts/daily_planning_v6.txt b/metagpt/ext/stanford_town/prompts/daily_planning_v6.txt similarity index 100% rename from examples/stanford_town/prompts/daily_planning_v6.txt rename to metagpt/ext/stanford_town/prompts/daily_planning_v6.txt diff --git a/examples/stanford_town/prompts/decide_to_talk_v2.txt b/metagpt/ext/stanford_town/prompts/decide_to_talk_v2.txt similarity index 100% rename from examples/stanford_town/prompts/decide_to_talk_v2.txt rename to metagpt/ext/stanford_town/prompts/decide_to_talk_v2.txt diff --git a/examples/stanford_town/prompts/generate_event_triple_v1.txt b/metagpt/ext/stanford_town/prompts/generate_event_triple_v1.txt similarity index 100% rename from examples/stanford_town/prompts/generate_event_triple_v1.txt rename to metagpt/ext/stanford_town/prompts/generate_event_triple_v1.txt diff --git a/examples/stanford_town/prompts/generate_focal_pt_v1.txt b/metagpt/ext/stanford_town/prompts/generate_focal_pt_v1.txt similarity index 100% rename from examples/stanford_town/prompts/generate_focal_pt_v1.txt rename to metagpt/ext/stanford_town/prompts/generate_focal_pt_v1.txt diff --git a/examples/stanford_town/prompts/generate_hourly_schedule_v2.txt b/metagpt/ext/stanford_town/prompts/generate_hourly_schedule_v2.txt similarity index 100% rename from examples/stanford_town/prompts/generate_hourly_schedule_v2.txt rename to metagpt/ext/stanford_town/prompts/generate_hourly_schedule_v2.txt diff --git a/examples/stanford_town/prompts/generate_obj_event_v1.txt b/metagpt/ext/stanford_town/prompts/generate_obj_event_v1.txt similarity index 100% rename from examples/stanford_town/prompts/generate_obj_event_v1.txt rename to metagpt/ext/stanford_town/prompts/generate_obj_event_v1.txt diff --git a/examples/stanford_town/prompts/generate_pronunciatio_v1.txt b/metagpt/ext/stanford_town/prompts/generate_pronunciatio_v1.txt similarity index 100% rename from examples/stanford_town/prompts/generate_pronunciatio_v1.txt rename to metagpt/ext/stanford_town/prompts/generate_pronunciatio_v1.txt diff --git a/examples/stanford_town/prompts/insight_and_evidence_v1.txt b/metagpt/ext/stanford_town/prompts/insight_and_evidence_v1.txt similarity index 100% rename from examples/stanford_town/prompts/insight_and_evidence_v1.txt rename to metagpt/ext/stanford_town/prompts/insight_and_evidence_v1.txt diff --git a/examples/stanford_town/prompts/iterative_convo_v1.txt b/metagpt/ext/stanford_town/prompts/iterative_convo_v1.txt similarity index 100% rename from examples/stanford_town/prompts/iterative_convo_v1.txt rename to metagpt/ext/stanford_town/prompts/iterative_convo_v1.txt diff --git a/examples/stanford_town/prompts/memo_on_convo_v1.txt b/metagpt/ext/stanford_town/prompts/memo_on_convo_v1.txt similarity index 100% rename from examples/stanford_town/prompts/memo_on_convo_v1.txt rename to metagpt/ext/stanford_town/prompts/memo_on_convo_v1.txt diff --git a/examples/stanford_town/prompts/new_decomp_schedule_v1.txt b/metagpt/ext/stanford_town/prompts/new_decomp_schedule_v1.txt similarity index 100% rename from examples/stanford_town/prompts/new_decomp_schedule_v1.txt rename to metagpt/ext/stanford_town/prompts/new_decomp_schedule_v1.txt diff --git a/examples/stanford_town/prompts/planning_thought_on_convo_v1.txt b/metagpt/ext/stanford_town/prompts/planning_thought_on_convo_v1.txt similarity index 100% rename from examples/stanford_town/prompts/planning_thought_on_convo_v1.txt rename to metagpt/ext/stanford_town/prompts/planning_thought_on_convo_v1.txt diff --git a/examples/stanford_town/prompts/poignancy_action_v1.txt b/metagpt/ext/stanford_town/prompts/poignancy_action_v1.txt similarity index 100% rename from examples/stanford_town/prompts/poignancy_action_v1.txt rename to metagpt/ext/stanford_town/prompts/poignancy_action_v1.txt diff --git a/examples/stanford_town/prompts/poignancy_chat_v1.txt b/metagpt/ext/stanford_town/prompts/poignancy_chat_v1.txt similarity index 100% rename from examples/stanford_town/prompts/poignancy_chat_v1.txt rename to metagpt/ext/stanford_town/prompts/poignancy_chat_v1.txt diff --git a/examples/stanford_town/prompts/poignancy_event_v1.txt b/metagpt/ext/stanford_town/prompts/poignancy_event_v1.txt similarity index 100% rename from examples/stanford_town/prompts/poignancy_event_v1.txt rename to metagpt/ext/stanford_town/prompts/poignancy_event_v1.txt diff --git a/examples/stanford_town/prompts/poignancy_thought_v1.txt b/metagpt/ext/stanford_town/prompts/poignancy_thought_v1.txt similarity index 100% rename from examples/stanford_town/prompts/poignancy_thought_v1.txt rename to metagpt/ext/stanford_town/prompts/poignancy_thought_v1.txt diff --git a/examples/stanford_town/prompts/summarize_chat_relationship_v2.txt b/metagpt/ext/stanford_town/prompts/summarize_chat_relationship_v2.txt similarity index 100% rename from examples/stanford_town/prompts/summarize_chat_relationship_v2.txt rename to metagpt/ext/stanford_town/prompts/summarize_chat_relationship_v2.txt diff --git a/examples/stanford_town/prompts/summarize_conversation_v1.txt b/metagpt/ext/stanford_town/prompts/summarize_conversation_v1.txt similarity index 100% rename from examples/stanford_town/prompts/summarize_conversation_v1.txt rename to metagpt/ext/stanford_town/prompts/summarize_conversation_v1.txt diff --git a/examples/stanford_town/prompts/task_decomp_v3.txt b/metagpt/ext/stanford_town/prompts/task_decomp_v3.txt similarity index 100% rename from examples/stanford_town/prompts/task_decomp_v3.txt rename to metagpt/ext/stanford_town/prompts/task_decomp_v3.txt diff --git a/examples/stanford_town/prompts/wake_up_hour_v1.txt b/metagpt/ext/stanford_town/prompts/wake_up_hour_v1.txt similarity index 100% rename from examples/stanford_town/prompts/wake_up_hour_v1.txt rename to metagpt/ext/stanford_town/prompts/wake_up_hour_v1.txt diff --git a/examples/stanford_town/prompts/whisper_inner_thought_v1.txt b/metagpt/ext/stanford_town/prompts/whisper_inner_thought_v1.txt similarity index 100% rename from examples/stanford_town/prompts/whisper_inner_thought_v1.txt rename to metagpt/ext/stanford_town/prompts/whisper_inner_thought_v1.txt diff --git a/examples/stanford_town/reflect/__init__.py b/metagpt/ext/stanford_town/reflect/__init__.py similarity index 100% rename from examples/stanford_town/reflect/__init__.py rename to metagpt/ext/stanford_town/reflect/__init__.py diff --git a/examples/stanford_town/reflect/reflect.py b/metagpt/ext/stanford_town/reflect/reflect.py similarity index 97% rename from examples/stanford_town/reflect/reflect.py rename to metagpt/ext/stanford_town/reflect/reflect.py index beec53dc2..954cbc1ac 100644 --- a/examples/stanford_town/reflect/reflect.py +++ b/metagpt/ext/stanford_town/reflect/reflect.py @@ -5,7 +5,7 @@ import datetime import time -from examples.stanford_town.actions.run_reflect_action import ( +from metagpt.ext.stanford_town.actions.run_reflect_action import ( AgentChatPoignancy, AgentEventPoignancy, AgentEventTriple, @@ -14,8 +14,8 @@ from examples.stanford_town.actions.run_reflect_action import ( AgentMemoryOnConvo, AgentPlanThoughtOnConvo, ) -from examples.stanford_town.memory.retrieve import new_agent_retrieve -from examples.stanford_town.utils.utils import get_embedding +from metagpt.ext.stanford_town.memory.retrieve import new_agent_retrieve +from metagpt.ext.stanford_town.utils.utils import get_embedding from metagpt.logs import logger diff --git a/examples/stanford_town/tests/actions/__init__.py b/metagpt/ext/stanford_town/roles/__init__.py similarity index 100% rename from examples/stanford_town/tests/actions/__init__.py rename to metagpt/ext/stanford_town/roles/__init__.py diff --git a/examples/stanford_town/roles/st_role.py b/metagpt/ext/stanford_town/roles/st_role.py similarity index 96% rename from examples/stanford_town/roles/st_role.py rename to metagpt/ext/stanford_town/roles/st_role.py index 414fd40b8..79f58b07d 100644 --- a/examples/stanford_town/roles/st_role.py +++ b/metagpt/ext/stanford_town/roles/st_role.py @@ -20,21 +20,6 @@ from typing import TYPE_CHECKING, Optional from pydantic import ConfigDict, Field, field_validator, model_validator -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.stanford_town.utils.utils import get_embedding, path_finder from metagpt.actions.add_requirement import UserRequirement from metagpt.environment.stanford_town.env_space import ( EnvAction, @@ -42,6 +27,23 @@ from metagpt.environment.stanford_town.env_space import ( EnvObsParams, EnvObsType, ) +from metagpt.ext.stanford_town.actions.dummy_action import DummyAction, DummyMessage +from metagpt.ext.stanford_town.actions.inner_voice_action import ( + AgentWhisperThoughtAction, +) +from metagpt.ext.stanford_town.actions.run_reflect_action import AgentEventTriple +from metagpt.ext.stanford_town.memory.agent_memory import AgentMemory, BasicMemory +from metagpt.ext.stanford_town.memory.scratch import Scratch +from metagpt.ext.stanford_town.memory.spatial_memory import MemoryTree +from metagpt.ext.stanford_town.plan.st_plan import plan +from metagpt.ext.stanford_town.reflect.reflect import generate_poig_score, role_reflect +from metagpt.ext.stanford_town.utils.const import STORAGE_PATH, collision_block_id +from metagpt.ext.stanford_town.utils.mg_ga_transform import ( + get_role_environment, + save_environment, + save_movement, +) +from metagpt.ext.stanford_town.utils.utils import get_embedding, path_finder from metagpt.logs import logger from metagpt.roles.role import Role, RoleContext from metagpt.schema import Message diff --git a/examples/stanford_town/stanford_town.py b/metagpt/ext/stanford_town/stanford_town.py similarity index 91% rename from examples/stanford_town/stanford_town.py rename to metagpt/ext/stanford_town/stanford_town.py index 17364f7c8..96f6a4b4e 100644 --- a/examples/stanford_town/stanford_town.py +++ b/metagpt/ext/stanford_town/stanford_town.py @@ -4,10 +4,10 @@ from typing import Any, Optional -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 import StanfordTownEnv +from metagpt.ext.stanford_town.roles.st_role import STRole +from metagpt.ext.stanford_town.utils.const import MAZE_ASSET_PATH from metagpt.logs import logger from metagpt.team import Team diff --git a/examples/stanford_town/static_dirs/assets/the_ville/agent_history_init_n25.csv b/metagpt/ext/stanford_town/static_dirs/assets/the_ville/agent_history_init_n25.csv similarity index 100% rename from examples/stanford_town/static_dirs/assets/the_ville/agent_history_init_n25.csv rename to metagpt/ext/stanford_town/static_dirs/assets/the_ville/agent_history_init_n25.csv diff --git a/examples/stanford_town/static_dirs/assets/the_ville/agent_history_init_n3.csv b/metagpt/ext/stanford_town/static_dirs/assets/the_ville/agent_history_init_n3.csv similarity index 100% rename from examples/stanford_town/static_dirs/assets/the_ville/agent_history_init_n3.csv rename to metagpt/ext/stanford_town/static_dirs/assets/the_ville/agent_history_init_n3.csv diff --git a/examples/stanford_town/static_dirs/assets/the_ville/matrix/maze/arena_maze.csv b/metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/maze/arena_maze.csv similarity index 100% rename from examples/stanford_town/static_dirs/assets/the_ville/matrix/maze/arena_maze.csv rename to metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/maze/arena_maze.csv diff --git a/examples/stanford_town/static_dirs/assets/the_ville/matrix/maze/collision_maze.csv b/metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/maze/collision_maze.csv similarity index 100% rename from examples/stanford_town/static_dirs/assets/the_ville/matrix/maze/collision_maze.csv rename to metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/maze/collision_maze.csv diff --git a/examples/stanford_town/static_dirs/assets/the_ville/matrix/maze/game_object_maze.csv b/metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/maze/game_object_maze.csv similarity index 100% rename from examples/stanford_town/static_dirs/assets/the_ville/matrix/maze/game_object_maze.csv rename to metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/maze/game_object_maze.csv diff --git a/examples/stanford_town/static_dirs/assets/the_ville/matrix/maze/sector_maze.csv b/metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/maze/sector_maze.csv similarity index 100% rename from examples/stanford_town/static_dirs/assets/the_ville/matrix/maze/sector_maze.csv rename to metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/maze/sector_maze.csv diff --git a/examples/stanford_town/static_dirs/assets/the_ville/matrix/maze/spawning_location_maze.csv b/metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/maze/spawning_location_maze.csv similarity index 100% rename from examples/stanford_town/static_dirs/assets/the_ville/matrix/maze/spawning_location_maze.csv rename to metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/maze/spawning_location_maze.csv diff --git a/examples/stanford_town/static_dirs/assets/the_ville/matrix/maze_meta_info.json b/metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/maze_meta_info.json similarity index 100% rename from examples/stanford_town/static_dirs/assets/the_ville/matrix/maze_meta_info.json rename to metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/maze_meta_info.json diff --git a/examples/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/arena_blocks.csv b/metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/arena_blocks.csv similarity index 100% rename from examples/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/arena_blocks.csv rename to metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/arena_blocks.csv diff --git a/examples/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/game_object_blocks.csv b/metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/game_object_blocks.csv similarity index 100% rename from examples/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/game_object_blocks.csv rename to metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/game_object_blocks.csv diff --git a/examples/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/sector_blocks.csv b/metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/sector_blocks.csv similarity index 100% rename from examples/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/sector_blocks.csv rename to metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/sector_blocks.csv diff --git a/examples/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/spawning_location_blocks.csv b/metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/spawning_location_blocks.csv similarity index 100% rename from examples/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/spawning_location_blocks.csv rename to metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/spawning_location_blocks.csv diff --git a/examples/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/world_blocks.csv b/metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/world_blocks.csv similarity index 100% rename from examples/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/world_blocks.csv rename to metagpt/ext/stanford_town/static_dirs/assets/the_ville/matrix/special_blocks/world_blocks.csv diff --git a/examples/stanford_town/tests/plan/__init__.py b/metagpt/ext/stanford_town/utils/__init__.py similarity index 100% rename from examples/stanford_town/tests/plan/__init__.py rename to metagpt/ext/stanford_town/utils/__init__.py diff --git a/metagpt/ext/stanford_town/utils/const.py b/metagpt/ext/stanford_town/utils/const.py new file mode 100644 index 000000000..7a5c6fd24 --- /dev/null +++ b/metagpt/ext/stanford_town/utils/const.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# @Desc : + +from pathlib import Path + +from metagpt.const import EXAMPLE_PATH + +ST_ROOT_PATH = Path(__file__).parent.parent +STORAGE_PATH = EXAMPLE_PATH.joinpath("stanford_town/storage") +TEMP_STORAGE_PATH = EXAMPLE_PATH.joinpath("stanford_town/temp_storage") +MAZE_ASSET_PATH = ST_ROOT_PATH.joinpath("static_dirs/assets/the_ville") +PROMPTS_DIR = ST_ROOT_PATH.joinpath("prompts") + +collision_block_id = "32125" diff --git a/examples/stanford_town/utils/mg_ga_transform.py b/metagpt/ext/stanford_town/utils/mg_ga_transform.py similarity index 96% rename from examples/stanford_town/utils/mg_ga_transform.py rename to metagpt/ext/stanford_town/utils/mg_ga_transform.py index 521199a05..e0de76a6b 100644 --- a/examples/stanford_town/utils/mg_ga_transform.py +++ b/metagpt/ext/stanford_town/utils/mg_ga_transform.py @@ -5,7 +5,7 @@ from pathlib import Path from typing import Optional -from examples.stanford_town.utils.const import STORAGE_PATH, TEMP_STORAGE_PATH +from metagpt.ext.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/stanford_town/utils/utils.py b/metagpt/ext/stanford_town/utils/utils.py similarity index 100% rename from examples/stanford_town/utils/utils.py rename to metagpt/ext/stanford_town/utils/utils.py diff --git a/examples/stanford_town/tests/roles/__init__.py b/tests/metagpt/ext/__init__.py similarity index 100% rename from examples/stanford_town/tests/roles/__init__.py rename to tests/metagpt/ext/__init__.py diff --git a/examples/stanford_town/utils/__init__.py b/tests/metagpt/ext/stanford_town/__init__.py similarity index 100% rename from examples/stanford_town/utils/__init__.py rename to tests/metagpt/ext/stanford_town/__init__.py diff --git a/examples/stanford_town/prompts/__init__.py b/tests/metagpt/ext/stanford_town/actions/__init__.py similarity index 61% rename from examples/stanford_town/prompts/__init__.py rename to tests/metagpt/ext/stanford_town/actions/__init__.py index cb4131c76..2bcf8efd0 100644 --- a/examples/stanford_town/prompts/__init__.py +++ b/tests/metagpt/ext/stanford_town/actions/__init__.py @@ -1,3 +1,3 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# @Desc : prompt templates +# @Desc : diff --git a/examples/stanford_town/tests/actions/test_gen_action_details.py b/tests/metagpt/ext/stanford_town/actions/test_gen_action_details.py similarity index 92% rename from examples/stanford_town/tests/actions/test_gen_action_details.py rename to tests/metagpt/ext/stanford_town/actions/test_gen_action_details.py index af4d94c4d..5dc5cbbe3 100644 --- a/examples/stanford_town/tests/actions/test_gen_action_details.py +++ b/tests/metagpt/ext/stanford_town/actions/test_gen_action_details.py @@ -4,17 +4,17 @@ import pytest -from examples.stanford_town.actions.gen_action_details import ( +from metagpt.environment import StanfordTownEnv +from metagpt.environment.api.env_api import EnvAPIAbstract +from metagpt.ext.stanford_town.actions.gen_action_details import ( GenActionArena, GenActionDetails, GenActionObject, GenActionSector, GenActObjDescription, ) -from examples.stanford_town.roles.st_role import STRole -from examples.stanford_town.utils.const import MAZE_ASSET_PATH -from metagpt.environment import StanfordTownEnv -from metagpt.environment.api.env_api import EnvAPIAbstract +from metagpt.ext.stanford_town.roles.st_role import STRole +from metagpt.ext.stanford_town.utils.const import MAZE_ASSET_PATH @pytest.mark.asyncio diff --git a/examples/stanford_town/tests/actions/test_summarize_conv.py b/tests/metagpt/ext/stanford_town/actions/test_summarize_conv.py similarity index 82% rename from examples/stanford_town/tests/actions/test_summarize_conv.py rename to tests/metagpt/ext/stanford_town/actions/test_summarize_conv.py index fa0de2031..5dfabcab9 100644 --- a/examples/stanford_town/tests/actions/test_summarize_conv.py +++ b/tests/metagpt/ext/stanford_town/actions/test_summarize_conv.py @@ -4,7 +4,7 @@ import pytest -from examples.stanford_town.actions.summarize_conv import SummarizeConv +from metagpt.ext.stanford_town.actions.summarize_conv import SummarizeConv @pytest.mark.asyncio diff --git a/tests/metagpt/ext/stanford_town/memory/__init__.py b/tests/metagpt/ext/stanford_town/memory/__init__.py new file mode 100644 index 000000000..2bcf8efd0 --- /dev/null +++ b/tests/metagpt/ext/stanford_town/memory/__init__.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# @Desc : diff --git a/examples/stanford_town/tests/test_agent_memory.py b/tests/metagpt/ext/stanford_town/memory/test_agent_memory.py similarity index 94% rename from examples/stanford_town/tests/test_agent_memory.py rename to tests/metagpt/ext/stanford_town/memory/test_agent_memory.py index e7ad3fc43..d17014898 100644 --- a/examples/stanford_town/tests/test_agent_memory.py +++ b/tests/metagpt/ext/stanford_town/memory/test_agent_memory.py @@ -6,9 +6,9 @@ from datetime import datetime, timedelta import pytest -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.ext.stanford_town.memory import AgentMemory +from metagpt.ext.stanford_town.memory.retrieve import agent_retrieve +from metagpt.ext.stanford_town.utils.const import STORAGE_PATH from metagpt.logs import logger """ diff --git a/examples/stanford_town/tests/test_basic_memory.py b/tests/metagpt/ext/stanford_town/memory/test_basic_memory.py similarity index 95% rename from examples/stanford_town/tests/test_basic_memory.py rename to tests/metagpt/ext/stanford_town/memory/test_basic_memory.py index fa2a5c487..36a9b2f99 100644 --- a/examples/stanford_town/tests/test_basic_memory.py +++ b/tests/metagpt/ext/stanford_town/memory/test_basic_memory.py @@ -6,7 +6,7 @@ from datetime import datetime, timedelta import pytest -from examples.stanford_town.memory.agent_memory import BasicMemory +from metagpt.ext.stanford_town.memory.agent_memory import BasicMemory from metagpt.logs import logger """ diff --git a/examples/stanford_town/tests/test_spatial_memory.py b/tests/metagpt/ext/stanford_town/memory/test_spatial_memory.py similarity index 77% rename from examples/stanford_town/tests/test_spatial_memory.py rename to tests/metagpt/ext/stanford_town/memory/test_spatial_memory.py index 822db753e..e05b273fd 100644 --- a/examples/stanford_town/tests/test_spatial_memory.py +++ b/tests/metagpt/ext/stanford_town/memory/test_spatial_memory.py @@ -2,8 +2,8 @@ # -*- coding: utf-8 -*- # @Desc : the unittest of MemoryTree -from ..memory.spatial_memory import MemoryTree -from ..utils.const import STORAGE_PATH +from metagpt.ext.stanford_town.memory.spatial_memory import MemoryTree +from metagpt.ext.stanford_town.utils.const import STORAGE_PATH def test_spatial_memory(): diff --git a/tests/metagpt/ext/stanford_town/plan/__init__.py b/tests/metagpt/ext/stanford_town/plan/__init__.py new file mode 100644 index 000000000..2bcf8efd0 --- /dev/null +++ b/tests/metagpt/ext/stanford_town/plan/__init__.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# @Desc : diff --git a/examples/stanford_town/tests/plan/test_conversation.py b/tests/metagpt/ext/stanford_town/plan/test_conversation.py similarity index 83% rename from examples/stanford_town/tests/plan/test_conversation.py rename to tests/metagpt/ext/stanford_town/plan/test_conversation.py index ff8664538..35dd216f9 100644 --- a/examples/stanford_town/tests/plan/test_conversation.py +++ b/tests/metagpt/ext/stanford_town/plan/test_conversation.py @@ -6,12 +6,12 @@ from typing import Tuple import pytest -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 import StanfordTownEnv +from metagpt.ext.stanford_town.plan.converse import agent_conversation +from metagpt.ext.stanford_town.roles.st_role import STRole +from metagpt.ext.stanford_town.utils.const import MAZE_ASSET_PATH, STORAGE_PATH +from metagpt.ext.stanford_town.utils.mg_ga_transform import get_reverie_meta +from metagpt.ext.stanford_town.utils.utils import copy_folder async def init_two_roles(fork_sim_code: str = "base_the_ville_isabella_maria_klaus") -> Tuple["STRole"]: diff --git a/examples/stanford_town/tests/plan/test_st_plan.py b/tests/metagpt/ext/stanford_town/plan/test_st_plan.py similarity index 90% rename from examples/stanford_town/tests/plan/test_st_plan.py rename to tests/metagpt/ext/stanford_town/plan/test_st_plan.py index ad20d3068..18663a066 100644 --- a/examples/stanford_town/tests/plan/test_st_plan.py +++ b/tests/metagpt/ext/stanford_town/plan/test_st_plan.py @@ -4,12 +4,12 @@ import pytest -from examples.stanford_town.plan.st_plan import ( +from metagpt.ext.stanford_town.plan.st_plan import ( _choose_retrieved, _should_react, _wait_react, ) -from examples.stanford_town.tests.plan.test_converse import init_two_roles +from tests.metagpt.ext.stanford_town.plan.test_conversation import init_two_roles def test_should_react(): diff --git a/tests/metagpt/ext/stanford_town/roles/__init__.py b/tests/metagpt/ext/stanford_town/roles/__init__.py new file mode 100644 index 000000000..2bcf8efd0 --- /dev/null +++ b/tests/metagpt/ext/stanford_town/roles/__init__.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# @Desc : diff --git a/examples/stanford_town/tests/roles/test_st_role.py b/tests/metagpt/ext/stanford_town/roles/test_st_role.py similarity index 75% rename from examples/stanford_town/tests/roles/test_st_role.py rename to tests/metagpt/ext/stanford_town/roles/test_st_role.py index b2e4c6969..affa6e87f 100644 --- a/examples/stanford_town/tests/roles/test_st_role.py +++ b/tests/metagpt/ext/stanford_town/roles/test_st_role.py @@ -4,10 +4,10 @@ import pytest -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 import StanfordTownEnv +from metagpt.ext.stanford_town.memory.agent_memory import BasicMemory +from metagpt.ext.stanford_town.roles.st_role import STRole +from metagpt.ext.stanford_town.utils.const import MAZE_ASSET_PATH @pytest.mark.asyncio diff --git a/examples/stanford_town/tests/test_reflect.py b/tests/metagpt/ext/stanford_town/test_reflect.py similarity index 94% rename from examples/stanford_town/tests/test_reflect.py rename to tests/metagpt/ext/stanford_town/test_reflect.py index dbcbd974f..0be23166c 100644 --- a/examples/stanford_town/tests/test_reflect.py +++ b/tests/metagpt/ext/stanford_town/test_reflect.py @@ -4,14 +4,14 @@ import pytest -from examples.stanford_town.actions.run_reflect_action import ( +from metagpt.environment import StanfordTownEnv +from metagpt.ext.stanford_town.actions.run_reflect_action import ( AgentEventTriple, AgentFocusPt, AgentInsightAndGuidance, ) -from examples.stanford_town.roles.st_role import STRole -from examples.stanford_town.utils.const import MAZE_ASSET_PATH -from metagpt.environment import StanfordTownEnv +from metagpt.ext.stanford_town.roles.st_role import STRole +from metagpt.ext.stanford_town.utils.const import MAZE_ASSET_PATH @pytest.mark.asyncio