fixResponse: Removes last response and adds a corrected response.craftPrompt: A helper method to append a prompt to a context, to be sent to the model.resetContext: Removes all interactions from the context, effectively resetting the context.If the NPC does something wrong, you can say "unlearn" to have this function invoked. removeLastInteraction: Remove the last call + response from the context.This happens automatically as you interact with the NPC. addInteraction: Appends the last call + response to the existing context.The Context class exposes a few functions: To enable an interface for learning and "unlearning" from previous interactions.To append past interactions to future prompts.This project includes a Context class, which you can find in Context.js in the root directory.
In the index.js, we run the code by simply calling JavaScript's "eval" function on it. "Go Forward") and the model will generate the next line - the code that satisfies the command (e.g. When calling the model, we can now simply pass a comment with our command (e.g. chat ( "Yo! How's it going?" ) Īs you can see, we give commands in the form of comments, which is followed by the code that should be executed to satisfy the command.
setControlState ( 'back', true ) // "Hello!" bot. Pulling from the context/commands.js file, here is a subset of our context: Our contexts live in the context directory and are intended to give the model a sense for the shape of the API we're using ( mineflayer), along with the structure of the calls we will make. Instead, it relies on engineered context and prompts. Introductory Demo Introduction.mp4 How it Worksįor now, this prototype uses zero-shot learning and no fine-tuning to generate code. You should now see an NPC appear that you can interact with! To type commands or messages to the NPC, press "t" to open the chat window, and type the command or message. You can see the code produced by the bot in the console window.To automatically re-run the bot as you make code changes, consider installing nodemon and running nodemon index.js To avoid being killed in-game while programming, set mode to "Creative" Select "Open to LAN", selecting "Allow Cheats" again. Enter the world and open settings (hitting the escape key).Open Minecraft and create a one player new world.