diff --git a/utils/examples.json b/utils/examples.json index 4d94779..ef213c1 100644 --- a/utils/examples.json +++ b/utils/examples.json @@ -40,5 +40,12 @@ [ {"role": "user", "content": "billybob: stop"}, {"role": "assistant", "content": "```\n// I am going to write empty code to stop whatever I am doing\n```"} + ], + + [ + {"role": "user", "content": "maya: go to the nearest oak log"}, + {"role": "assistant", "content": "```\n// I am navigating to the nearest oak log.\nawait skills.goToPosition(bot, nearestOakLog.x, nearestOakLog.y, nearestOakLog.z);\n```"}, + {"role": "system", "content": "Code output:\n!!Code threw exception!! Error: ReferenceError: nearestOakLog is not defined\n Write code to fix the problem and try again."}, + {"role": "assistant", "content": "Apologies, I made an error. Let me try that again.```\n// I am navigating to the nearest oak log.\nlet position = world.getNearestBlock(bot, 'oak_log', 20);\nawait skills.goToPosition(bot, position.x, position.y, position.z);\n```"} ] ] \ No newline at end of file diff --git a/utils/history.js b/utils/history.js index 57a901a..f770521 100644 --- a/utils/history.js +++ b/utils/history.js @@ -63,7 +63,7 @@ export class History { if (this.memory != '') { memory_prompt += ' Include information from your previous memory if it is still relevant. Your output will replace your previous memory.'; } - memory_prompt += ' Your output should use one of the following formats:\n'; + memory_prompt += ' Your output should be a brief list of things you have learned using the following formats:\n'; memory_prompt += '- When the player... output...\n'; memory_prompt += '- I learned that player [name]...\n'; @@ -85,7 +85,7 @@ export class History { for (let example of examples) { let messages = ''; for (let turn of example) { - if (turn.role == 'user') + if (turn.role != 'assistant') messages += turn.content.substring(turn.content.indexOf(':')+1).trim() + '\n'; } messages = messages.trim(); @@ -97,7 +97,7 @@ export class History { async setExamples() { let messages = ''; for (let turn of this.turns) { - if (turn.role == 'user') + if (turn.role != 'assistant') messages += turn.content.substring(turn.content.indexOf(':')+1).trim() + '\n'; } messages = messages.trim(); diff --git a/utils/world.js b/utils/world.js index bc9143a..0d1d00c 100644 --- a/utils/world.js +++ b/utils/world.js @@ -1,4 +1,4 @@ -import { getAllBlockIds, getAllBlocks, getAllItems } from './mcdata.js'; +import { getAllBlockIds } from './mcdata.js'; export function getNearestBlock(bot, block_type, distance=16) { @@ -6,7 +6,7 @@ export function getNearestBlock(bot, block_type, distance=16) { * Get the position of the nearest block of the given type. * @param {Bot} bot - The bot to get the nearest block for. * @param {string} block_type - The name of the block to search for. - * @param {number} distance - The maximum distance to search. + * @param {number} distance - The maximum distance to search, default 16. * @returns {Block} - The nearest block of the given type. * @example * let coalBlock = world.getNearestBlock(bot, 'coal_ore', 16);