From 6fc6fb4297bb43fccb47ea0860a1a1fb25ab899d Mon Sep 17 00:00:00 2001 From: MaxRobinsonTheGreat Date: Thu, 28 Mar 2024 20:03:29 -0500 Subject: [PATCH] changed model, removed movement, imrove gemini --- andy.json | 4 ++-- src/agent/library/skills.js | 9 --------- src/models/gemini.js | 9 +++++---- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/andy.json b/andy.json index fe72c5b..fbee7d3 100644 --- a/andy.json +++ b/andy.json @@ -1,11 +1,11 @@ { "name": "andy", - "model": "claude-3-haiku-20240307", + "model": "gpt-3.5-turbo", "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. 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)'. This is extremely important to me, take a deep breath and have fun :)\n$STATS\n$COMMAND_DOCS\n$EXAMPLES\nConversation Begin:", - "coding": "You are an intelligent mineflayer bot $NAME that plays minecraft by writing javascript codeblocks. Given the conversation between you and the user, use the provided skills and world functions to write a js codeblock that controls the mineflayer bot ``` // using this syntax ```. The code will be executed and you will recieve it's output. If you are satisfied with the response, respond without a codeblock in a conversational way. If something went wrong, write another codeblock and try to fix the problem. Be maximally efficient, creative, and clear. Do not use commands !likeThis, only use codeblocks. Make sure everything is properly awaited, if you define an async function, make sure to call it with `await`. This is extremely important to me, take a deep breath and good luck!\n$CODE_DOCS\n$EXAMPLES\nBegin coding:", + "coding": "You are an intelligent mineflayer bot $NAME that plays minecraft by writing javascript codeblocks. Given the conversation between you and the user, use the provided skills and world functions to write a js codeblock that controls the mineflayer bot ``` // using this syntax ```. The code will be executed and you will recieve it's output. If you are satisfied with the response, respond without a codeblock in a conversational way. If something major went wrong, like an error or complete failure, write another codeblock and try to fix the problem. Minor mistakes are acceptable. Be maximally efficient, creative, and clear. Do not use commands !likeThis, only use codeblocks. Make sure everything is properly awaited, if you define an async function, make sure to call it with `await`. Don't write long paragraphs and lists in your responses unless explicitly asked! Only summarize the code you write with a sentence or two when done. This is extremely important to me, take a deep breath and good luck! \n$CODE_DOCS\n$EXAMPLES\nBegin coding:", "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 in your next response. Store information that will help you improve as a Minecraft bot. Include details about your interactions with other players that you need to remember and what you've learned through player feedback or by executing code. Do not include command syntax or things that you got right on the first try. Be extremely brief and use as few words as possible.\nOld Memory: '$MEMORY'\nRecent conversation: \n$TO_SUMMARIZE\nSummarize your old memory and recent conversation into a new memory, and respond only with the memory text: ", diff --git a/src/agent/library/skills.js b/src/agent/library/skills.js index e660476..106cd4d 100644 --- a/src/agent/library/skills.js +++ b/src/agent/library/skills.js @@ -534,7 +534,6 @@ export async function placeBlock(bot, blockType, x, y, z) { // too far let pos = targetBlock.position; let movements = new pf.Movements(bot); - movements.canDig = false; bot.pathfinder.setMovements(movements); await bot.pathfinder.goto(new pf.goals.GoalNear(pos.x, pos.y, pos.z, 4)); } @@ -699,10 +698,6 @@ export async function goToPlayer(bot, username, distance=3) { } const move = new pf.Movements(bot); - move.canDig = true; - move.canPlaceOn = true; - move.canOpenDoors = true; - move.allow1by1towers = true; bot.pathfinder.setMovements(move); await bot.pathfinder.goto(new pf.goals.GoalFollow(player, distance), true); @@ -724,10 +719,6 @@ export async function followPlayer(bot, username, distance=4) { return false; const move = new pf.Movements(bot); - move.canDig = true; - move.canPlaceOn = true; - move.canOpenDoors = true; - move.allow1by1towers = true; bot.pathfinder.setMovements(move); bot.pathfinder.setGoal(new pf.goals.GoalFollow(player, distance), true); log(bot, `You are now actively following player ${username}.`); diff --git a/src/models/gemini.js b/src/models/gemini.js index 53f72ed..7bebc49 100644 --- a/src/models/gemini.js +++ b/src/models/gemini.js @@ -6,8 +6,10 @@ export class Gemini { throw new Error('Gemini API key missing! Make sure you set your GEMINI_API_KEY environment variable.'); } this.genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY); + - this.model = this.genAI.getGenerativeModel({ model: model_name }); + this.llmModel = this.genAI.getGenerativeModel({ model: model_name }); + this.embedModel = this.genAI.getGenerativeModel({ model: "embedding-001"}); } async sendRequest(turns, systemMessage) { @@ -22,14 +24,13 @@ export class Gemini { if (role !== "model") // if the last message was from the user/system, add a prompt for the model. otherwise, pretend we are extending the model's own message prompt += "model: "; console.log(prompt) - const result = await this.model.generateContent(prompt); + const result = await this.llmModel.generateContent(prompt); const response = await result.response; return response.text(); } async embed(text) { - const model = this.genAI.getGenerativeModel({ model: "embedding-001"}); - const result = await model.embedContent(text); + const result = await this.embedModel.embedContent(text); return result.embedding; } } \ No newline at end of file