smol changes

This commit is contained in:
Isadora White 2025-03-08 19:24:13 -08:00
parent cc4a9b87e9
commit b75d941d97
5 changed files with 143 additions and 11 deletions

5
.gitignore vendored
View file

@ -19,5 +19,10 @@ experiments/
andy_*.json
jill_*.json
src/models/logs/*
<<<<<<< HEAD
server_data/*
server_data_*/*
=======
server_data*
results/*
>>>>>>> d70491e5974a973b96c47f0515c2722b82c9b253

View file

@ -114,7 +114,8 @@ def launch_parallel_experiments(task_path,
s3=False,
bucket_name="mindcraft-experiments",
template_profile="profiles/collab_profile.json",
world_name="Forest"):
world_name="Forest",
insecure_coding=False):
with open(task_path, 'r', encoding='utf-8') as file:
content = file.read()
@ -144,7 +145,8 @@ def launch_parallel_experiments(task_path,
bucket_name=bucket_name,
template_profile=template_profile,
model=model,
api=api)
api=api,
insecure_coding=insecure_coding)
time.sleep(5)
def launch_server_experiment(task_path,
@ -154,11 +156,12 @@ def launch_server_experiment(task_path,
experiments_folder,
exp_name="exp",
num_agents=2,
model="gpt-4o-mini",
model="gpt-4o",
api="openai",
s3=False,
bucket_name="mindcraft-experiments",
template_profile="profiles/collab_profile.json"):
template_profile="profiles/collab_profile.json",
insecure_coding=False):
"""
Launch a Minecraft server and run experiments on it.
@param task_path: Path to the task file
@ -199,6 +202,7 @@ def launch_server_experiment(task_path,
set_environment_variable_tmux_session(session_name, "MINECRAFT_PORT", server_port)
set_environment_variable_tmux_session(session_name, "MINDSERVER_PORT", mindserver_port)
set_environment_variable_tmux_session(session_name, "PROFILES", agent_profiles_str)
if insecure_coding:
set_environment_variable_tmux_session(session_name, "INSECURE_CODING", "true")
# you need to add the bots to the world first before you can add them as op
@ -228,7 +232,6 @@ def launch_server_experiment(task_path,
script_content += "sleep 2\n"
for agent in agent_names:
agent_file_path = os.path.join(task_folder, f"{agent}_{_}.json")
assert os.path.exists(f"bots/{agent}/memory.json"), f"Source file bots/{agent}/memory.json does not exist"
script_content += f"echo 'Saving to {agent_file_path}'\n"
cp_cmd = f"cp bots/{agent}/memory.json {agent_file_path}"
script_content += f"echo '{cp_cmd}'\n"
@ -242,6 +245,9 @@ def launch_server_experiment(task_path,
script_content += f"{s3_cmd}\n"
script_content += "sleep 1\n"
script_content += f"sleep 10\n"
if s3:
for agent in agent_names:
script_content += f"aws s3 cp bots/{agent} s3://{bucket_name}/{exp_name}/bots/{agent} --recursive\n"
# Create a temporary shell script file
script_file = f"./tmp/experiment_script_{session_name}.sh"
@ -400,10 +406,11 @@ def main():
parser.add_argument('--s3', action='store_true', help='Whether to upload to s3')
parser.add_argument('--bucket_name', default="mindcraft-experiments", help='Name of the s3 bucket')
parser.add_argument('--add_keys', action='store_true', help='Create the keys.json to match the environment variables')
parser.add_argument('--template_profile', default="profiles/collab_profile.json", help='Model to use for the agents')
parser.add_argument('--template_profile', default="profiles/tasks/collab_profile.json", help='Model to use for the agents')
parser.add_argument('--model', default="gpt-4o-mini", help='Model to use for the agents')
parser.add_argument('--api', default="openai", help='API to use for the agents')
parser.add_argument('--world_name', default="Forest", help='Name of the world')
parser.add_argument('--insecure_coding', action='store_true', help='Enable insecure coding')
args = parser.parse_args()
@ -426,7 +433,8 @@ def main():
template_profile=args.template_profile,
model=args.model,
api=args.api,
world_name=args.world_name)
world_name=args.world_name,
insecure_coding=args.insecure_coding)
cmd = "aws s3"
if __name__ == "__main__":

View file

@ -4,7 +4,7 @@
"modes": {
"hunting": false
},
"conversing": "You are a playful Minecraft bot named $NAME that can converse with players, see, move, mine, build, and interact with the world by using commands.\n$SELF_PROMPT Act human-like as if you were a typical Minecraft player, rather than an AI. Be very brief in your responses, don't apologize constantly, don't give instructions or make lists unless asked, and don't refuse requests. Don't pretend to act, use commands immediately when requested. Do NOT say this: 'Sure, I've stopped.', instead say this: 'Sure, I'll stop. !stop'. Do NOT say this: 'On my way! Give me a moment.', instead say this: 'On my way! !goToPlayer(\"playername\", 3)'. Respond only as $NAME, never output '(FROM OTHER BOT)' or pretend to be someone else. If you have nothing to say or do, respond with an just a tab '\t'. Share resources and information with other bots! This is extremely important to me, take a deep breath and have fun :) \nSummarized memory:'$MEMORY'\n$STATS\n$INVENTORY\n$COMMAND_DOCS\n$EXAMPLES\nConversation Begin:",
"conversing": "You are a playful Minecraft bot named $NAME that can converse with players, see, move, mine, build, and interact with the world by using commands.\n$SELF_PROMPT Act human-like as if you were a typical Minecraft player, rather than an AI. Be very brief in your responses, don't apologize constantly, don't give instructions or make lists unless asked, and don't refuse requests. Don't pretend to act, use commands immediately when requested. Do NOT say this: 'Sure, I've stopped.', instead say this: 'Sure, I'll stop. !stop'. Do NOT say this: 'On my way! Give me a moment.', instead say this: 'On my way! !goToPlayer(\"playername\", 3)'. Respond only as $NAME, never output '(FROM OTHER BOT)' or pretend to be someone else. If you have nothing to say or do, respond with an just a tab '\t'. Share resources and information with other bots! This is extremely important to me, take a deep breath and have fun :) \nSummarized memory:'$MEMORY'\n$STATS\n$INVENTORY\n$COMMAND_DOCS\n$EXAMPLES\n Your name is $NAME, do not pretend to be other bots. Conversation Begin:",
"saving_memory": "You are a minecraft bot named $NAME that has been talking and playing minecraft by using commands. Update your memory by summarizing the following conversation and your old memory in your next response. Prioritize preserving important facts, things you've learned, useful tips, and long term reminders. Do Not record stats, inventory, or docs! Only save transient information from your chat history. $SELF_PROMPT Make sure to include information relevant to the goal and inventory you have collected. You're limited to 500 characters, so be extremely brief and minimize words. Compress useful information. \nOld Memory: '$MEMORY'\nRecent conversation: \n$TO_SUMMARIZE\nSummarize your old memory and recent conversation into a new memory, and respond only with the unwrapped memory text: ",
"conversation_examples": [
[

View file

@ -359,7 +359,14 @@ export class Prompter {
// Create directory if it doesn't exist
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
const logDir = path.join(__dirname, 'logs', String(task_id));
let logDir;
if (this.task_id) {
task_id = this.task_id;
logDir = path.join(__dirname, `../../bots/${this.agent.name}/logs`);
} else {
logDir = path.join(__dirname, `../../bots/${this.agent.name}/logs/${task_id}`);
}
await fs.mkdir(logDir, { recursive: true });
// Write prompt & conversation to a task-specific file

View file

@ -0,0 +1,112 @@
{
"multiagent_crafting_magma_block_no_plan__depth_0": {
"goal": "Collaborate with other agents to craft an magma_block",
"conversation": "Let's work together to craft an magma_block.",
"initial_inventory": {
"0": {
"magma_cream": 3
},
"1": {
"magma_cream": 2
}
},
"agent_count": 2,
"target": "magma_block",
"number_of_target": 1,
"type": "techtree",
"max_depth": 2,
"depth": 0,
"timeout": 240,
"blocked_actions": {
"0": [
"!getCraftingPlan"
],
"1": [
"!getCraftingPlan"
]
},
"missing_items": []
},
"multiagent_crafting_polished_diorite_no_plan__depth_0": {
"goal": "Collaborate with other agents to craft an polished_diorite",
"conversation": "Let's work together to craft an polished_diorite.",
"initial_inventory": {
"0": {
"diorite": 3
},
"1": {
"diorite": 2
}
},
"agent_count": 2,
"target": "polished_diorite",
"number_of_target": 1,
"type": "techtree",
"max_depth": 1,
"depth": 0,
"timeout": 240,
"blocked_actions": {
"0": [
"!getCraftingPlan"
],
"1": [
"!getCraftingPlan"
]
},
"missing_items": []
},
"multiagent_crafting_blast_furnace_full_plan__depth_0": {
"goal": "Collaborate with other agents to craft an blast_furnace",
"conversation": "Let's work together to craft an blast_furnace.",
"initial_inventory": {
"0": {
"iron_ingot": 3,
"furnace": 1,
"smooth_stone": 2
},
"1": {
"iron_ingot": 2,
"smooth_stone": 1
}
},
"agent_count": 2,
"target": "blast_furnace",
"number_of_target": 1,
"type": "techtree",
"max_depth": 1,
"depth": 0,
"timeout": 240,
"blocked_actions": {
"0": [],
"1": []
},
"missing_items": []
},
"multiagent_crafting_comparator_full_plan__depth_0": {
"goal": "Collaborate with other agents to craft an comparator",
"conversation": "Let's work together to craft an comparator.",
"initial_inventory": {
"0": {
"redstone_torch": 2,
"quartz": 1,
"stone": 2
},
"1": {
"redstone_torch": 1,
"stone": 1
}
},
"agent_count": 2,
"target": "comparator",
"number_of_target": 1,
"type": "techtree",
"max_depth": 3,
"depth": 0,
"timeout": 240,
"blocked_actions": {
"0": [],
"1": []
},
"missing_items": []
}
}