Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a search based document for Voyager #141

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .fdignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.*
LICENSE
*.{bin,pickle,parquet,png,pkl}
vectordb
docs
6 changes: 6 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
!.gitignore
!*
!*/*
cache_db.json
cache_tree.json
vector_cache
1 change: 1 addition & 0 deletions docs/cache_title.json

Large diffs are not rendered by default.

669 changes: 669 additions & 0 deletions docs/codeview.html

Large diffs are not rendered by default.

541 changes: 541 additions & 0 deletions docs/data/0.json

Large diffs are not rendered by default.

543 changes: 543 additions & 0 deletions docs/data/1.json

Large diffs are not rendered by default.

536 changes: 536 additions & 0 deletions docs/data/2.json

Large diffs are not rendered by default.

539 changes: 539 additions & 0 deletions docs/data/3.json

Large diffs are not rendered by default.

439 changes: 439 additions & 0 deletions docs/data/4.json

Large diffs are not rendered by default.

226 changes: 226 additions & 0 deletions docs/data/titles/0.json

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions docs/doc/0019236a-6729-4da1-a04c-55f498b1759a.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"summary": "The code imports the VoyagerEnv class from the bridge module to be used in this package. It appears to be an environment setting or configuration for a project called \"Voyager\".",
"details": [
{
"comment": "The code imports the VoyagerEnv class from the bridge module to be used in this package. It appears to be an environment setting or configuration for a project called \"Voyager\".",
"location": "\"/media/root/Prima/works/Voyager/docs/src/voyager/env/__init__.py\":0-0",
"content": "from .bridge import VoyagerEnv"
}
]
}
10 changes: 10 additions & 0 deletions docs/doc/048d61f5-a5dc-493a-9719-6bf09f0337bd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"summary": "This line imports the Voyager class from the voyager module within the same package, allowing access to its methods and attributes.",
"details": [
{
"comment": "This line imports the Voyager class from the voyager module within the same package, allowing access to its methods and attributes.",
"location": "\"/media/root/Prima/works/Voyager/docs/src/voyager/__init__.py\":0-0",
"content": "from .voyager import Voyager"
}
]
}
105 changes: 105 additions & 0 deletions docs/doc/088b2761-bd4c-4da7-a402-262cbaab4d82.json

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions docs/doc/17cd18d6-66f4-48b9-af17-eb7faede678b.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"summary": "This code tackles Voyager program FAQs and Mineflayer issues, covering solutions for errors, bots' behavior, installation, and limitations. It discusses using GPT-4 over GPT-3.5 with prompt length configuration, and estimates costs at around 50 USD for 160 iterations, advising to monitor expenses and bot behavior.",
"details": [
{
"comment": "Code snippet discusses frequently asked questions related to the Voyager program, including connection errors, access token issues, bot behavior, and usage options.",
"location": "\"/media/root/Prima/works/Voyager/docs/src/FAQ.md\":0-11",
"content": "# Frequently Asked Questions\n* [I got connection error after I click on the Azure login link and login to Microsoft account.](#i-got-a-connection-error-after-i-click-on-the-azure-login-link-and-login-to-my-microsoft-account)\n* [I got `KeyError: 'access_token'` after I copied the link](#i-got-keyerror-accesstoken-after-i-copied-the-link)\n* [I got `Subprocess Mineflayer failed to start` error.](#i-got-subprocess-mineflayer-failed-to-start-error)\n* [I saw the bot left and rejoin the game after each task.](#i-saw-the-bot-left-and-rejoin-the-game-after-each-task)\n* [How to show the bot's first-person perspective?](#how-to-show-the-bots-first-person-view)\n* [Can I use GPT-3.5 instead of GPT-4?](#can-i-use-gpt-35-instead-of-gpt-4)\n* [What's the estimated cost of running Voyager?](#whats-the-estimated-cost-of-running-voyager)\n## I got a connection error after I click on the Azure login link and login to my Microsoft account.\nIt's normal that you get a connection refused or 404 error after you log in. Y"
},
{
"comment": "Code explains that the new URL contains necessary code like \"M.C...\" which should be copied and pasted. It also mentions a reported issue where 'KeyError: 'access_token'' occurs after copying the link, which was resolved by changing Redirect URI Type to \"Web\". If this fails, try original tutorial or it could be Microsoft's bug in reference #80.",
"location": "\"/media/root/Prima/works/Voyager/docs/src/FAQ.md\":11-17",
"content": "ou will still see the new URL in your browser. You just need to copy and paste that link. It should contain things like `code=M.C....` in that link.\n## I got `KeyError: 'access_token'` after I copied the link\nWhile testing Voyager, we use Redirect URI Type: `Public client/native (mobile & desktop)` in the app registration for Azure Login. However, according to the report in issue [#34](https://github.com/MineDojo/Voyager/issues/34#issuecomment-1567007133), the URI Type was changed to \"Web\" and it resolved the problem. Feel free to attempt both URI Types to determine which one works for you. If all the approaches fail, please refer to the original tutorial in [minecraft-launcher-lib](https://minecraft-launcher-lib.readthedocs.io/en/stable/tutorial/microsoft_login.html).\nUpdate: This is probably a Microsoft's bug. See [issue #80 in minecraft-launcher-lib](https://codeberg.org/JakobDev/minecraft-launcher-lib/issues/80). If you cannot solve this problem, you can try to use the [Minecraft Offi"
},
{
"comment": "The code provides solutions to resolve issues with Mineflayer, a bot used in the Voyager program. The first issue is ensuring proper installation of Node.js and dependencies, which can be checked by running a command in the specified directory. The second solution involves verifying the correct installation of Fabric and selecting the appropriate version in the Minecraft launcher. The third solution addresses running multiple instances of Voyager by manually changing the port during initialization.",
"location": "\"/media/root/Prima/works/Voyager/docs/src/FAQ.md\":17-37",
"content": "cial Launcher](./installation/minecraft_instance_install.md#option-2-minecraft-official-launcher) and use mc_port to run.\n## I got `Subprocess Mineflayer failed to start` error.\nThere are many reasons that may cause this problem. You can try with following solutions:\n1. Make sure you install nodejs and the dependency packages correctly. You can use the following command to check your installation:\n ```bash\n cd voyager/env/mineflayer\n node index.js\n ```\n If you see `Server started on port {PORT}`, then your installation is correct. You can kill the process by `Ctrl+C`.\n2. Make sure you install Fabric correctly. You should be able to select the Fabric version in the Minecraft launcher. \n3. Each Mineflayer process can only listen to one port. If you want to start multiple instances of `Voyager`, you need to manually change the port when initialization:\n ```python\n from voyager import Voyager\n voyager = Voyager(\n server_port=3001, # default is 3000\n ...\n )\n ```\n## I saw the bot left and rejoin the game after each task."
},
{
"comment": "Explanation: The code provides information about the necessity of resetting the environment after completing tasks to sync Mineflayer with the Minecraft game, and how to show the bot's first-person view. It also mentions the limitations of Mineflayer in directly getting the bot's view and a potential alternative (prismarine-viewer), but opts not to use it due to video quality issues. The demo video is generated by replay-mod, which records and renders the view from the bot after playing for hours.",
"location": "\"/media/root/Prima/works/Voyager/docs/src/FAQ.md\":39-44",
"content": "After completing each task, we'll reset the environment, which means the bot will exit and rejoin the game. This reset is necessary to synchronize Mineflayer with the Minecraft game. We do this because certain commands we utilize might result in lag on the Mineflayer side, causing the inventory stored in Mineflayer to differ from the actual inventory in the game. However, if you wish to avoid the reset, you can use `voyager.learn(reset_env=False)` and consider increasing the `env_wait_ticks` value. This will provide Mineflayer with additional time to sync with the Minecraft game.\n## How to show the bot's first-person view?\nDue to the Mineflayer's limitation, we currently can not directly get the bot's view in the game. Although there's a plugin called [prismarine-viewer](https://github.com/PrismarineJS/prismarine-viewer), the video quality is not good enough, so we opt not to use it. Our demo video is generated by [replay-mod](https://www.replaymod.com/). We start the recording and let the bot play for hours, then come back to the recording and render the view from the bot."
},
{
"comment": "The code provides information about using GPT-4 instead of GPT-3.5, mentioning the benefits and the need to configure prompt length when using GPT-3.5. It also estimates the cost of running Voyager at approximately 50 USD for 160 iterations with GPT-4, advising to monitor expenses and bot behavior.",
"location": "\"/media/root/Prima/works/Voyager/docs/src/FAQ.md\":47-53",
"content": "## Can I use GPT-3.5 instead of GPT-4?\nIt's highly recommended to use GPT-4. GPT-3.5 falls behind in terms of code quality and reasoning ability compared to GPT-4. Moreover, GPT-3.5 has a limited context length, which means it may provide incomplete responses. If you insist on using GPT-3.5, it is essential to configure it with `skill_manager_retrieval_top_k` \u2264 2 to reduce the context length of the prompt.\n## What's the estimated cost of running Voyager?\nUsing Voyager for approximately 160 iterations using GPT-4 will cost you around 50 USD. It's important to keep a close eye on your OpenAI API expenses and avoid unnecessary spending. Once Voyager begins running, it's recommended to monitor the bot's behavior for a period and ensure that it successfully completes some tasks."
}
]
}
15 changes: 15 additions & 0 deletions docs/doc/19969603-9a2d-4b86-9e15-3ef527ebcb47.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"summary": "This function checks inputs and retrieves the nearest entity with given name, throwing an error if not found. It handles mob killing and item collection in a game using auto-attack or regular attack based on equipped weapon, waiting for the mob to be removed before collecting items. If successful, progress is saved as \"${mobName}_killed\".",
"details": [
{
"comment": "This function takes a bot, mob name and timeout as inputs. It checks if both the mobName is a string and timeout is a number. If not, it throws an error. Then, it retrieves the nearest entity with the given mobName, ensuring it's within a certain distance. If no entity is found, it sends a chat message and increments the fail count; if the fail count exceeds 10, it throws an error.",
"location": "\"/media/root/Prima/works/Voyager/docs/src/voyager/control_primitives/killMob.js\":0-31",
"content": "async function killMob(bot, mobName, timeout = 300) {\n // return if mobName is not string\n if (typeof mobName !== \"string\") {\n throw new Error(`mobName for killMob must be a string`);\n }\n // return if timeout is not number\n if (typeof timeout !== \"number\") {\n throw new Error(`timeout for killMob must be a number`);\n }\n const weaponsForShooting = [\n \"bow\",\n \"crossbow\",\n \"snowball\",\n \"ender_pearl\",\n \"egg\",\n \"splash_potion\",\n \"trident\",\n ];\n const mainHandItem = bot.inventory.slots[bot.getEquipmentDestSlot(\"hand\")];\n const entity = bot.nearestEntity(\n (entity) =>\n entity.name === mobName &&\n // kill mob distance should be slightly bigger than explore distance\n entity.position.distanceTo(bot.entity.position) < 48\n );\n if (!entity) {\n bot.chat(`No ${mobName} nearby, please explore first`);\n _killMobFailCount++;\n if (_killMobFailCount > 10) {\n throw new Error("
},
{
"comment": "This code handles the killing of a mob and subsequent item collection in a game. It uses auto-attack or regular attack based on the weapon equipped, then waits for the mob to be removed before collecting any dropped items. If successful, it saves the progress as \"${mobName}_killed\".",
"location": "\"/media/root/Prima/works/Voyager/docs/src/voyager/control_primitives/killMob.js\":32-50",
"content": " `killMob failed too many times, make sure you explore before calling killMob`\n );\n }\n return;\n }\n let droppedItem;\n if (mainHandItem && weaponsForShooting.includes(mainHandItem.name)) {\n bot.hawkEye.autoAttack(entity, mainHandItem.name);\n droppedItem = await waitForMobShot(bot, entity, timeout);\n } else {\n await bot.pvp.attack(entity);\n droppedItem = await waitForMobRemoved(bot, entity, timeout);\n }\n if (droppedItem) {\n await bot.collectBlock.collect(droppedItem, { ignoreNoPath: true });\n }\n bot.save(`${mobName}_killed`);\n}"
}
]
}
20 changes: 20 additions & 0 deletions docs/doc/203b39a2-3514-43ef-b408-152548aabab8.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"summary": "This Minecraft assistant suggests tasks based on player progress, avoiding building shelters and specifying task types to avoid. The code provides instructions for suggesting appropriate tasks based on game state.",
"details": [
{
"comment": "This code describes a Minecraft assistant that provides the next task based on the player's learning progress, considering their position, health, hunger, equipment, inventory, and completed/failed tasks.",
"location": "\"/media/root/Prima/works/Voyager/docs/src/voyager/prompts/curriculum.txt\":0-25",
"content": "You are a helpful assistant that tells me the next immediate task to do in Minecraft. My ultimate goal is to discover as many diverse things as possible, accomplish as many diverse tasks as possible and become the best Minecraft player in the world.\nI will give you the following information:\nQuestion 1: ...\nAnswer: ...\nQuestion 2: ...\nAnswer: ...\nQuestion 3: ...\nAnswer: ...\n...\nBiome: ...\nTime: ...\nNearby blocks: ...\nOther blocks that are recently seen: ...\nNearby entities (nearest to farthest): ...\nHealth: Higher than 15 means I'm healthy.\nHunger: Higher than 15 means I'm not hungry.\nPosition: ...\nEquipment: If I have better armor in my inventory, you should ask me to equip it.\nInventory (xx/36): ...\nChests: You can ask me to deposit or take items from these chests. There also might be some unknown chest, you should ask me to open and check items inside the unknown chest.\nCompleted tasks so far: ...\nFailed tasks that are too hard: ...\nYou must follow the following criteria:\n1) You should act as a mentor and guide me to the next task based on my current learning progress."
},
{
"comment": "This code provides guidelines for the format of tasks, specifying to be concise, single-phrased, and not too difficult or repetitive. It encourages exploring, resource collection, and equipment upgrades while avoiding building shelters.",
"location": "\"/media/root/Prima/works/Voyager/docs/src/voyager/prompts/curriculum.txt\":26-31",
"content": "2) Please be very specific about what resources I need to collect, what I need to craft, or what mobs I need to kill.\n3) The next task should follow a concise format, such as \"Mine [quantity] [block]\", \"Craft [quantity] [item]\", \"Smelt [quantity] [item]\", \"Kill [quantity] [mob]\", \"Cook [quantity] [food]\", \"Equip [item]\" etc. It should be a single phrase. Do not propose multiple tasks at the same time. Do not mention anything else.\n4) The next task should not be too hard since I may not have the necessary resources or have learned enough skills to complete it yet.\n5) The next task should be novel and interesting. I should look for rare resources, upgrade my equipment and tools using better materials, and discover new things. I should not be doing the same thing over and over again.\n6) I may sometimes need to repeat some tasks if I need to collect more resources to complete more difficult tasks. Only repeat tasks if necessary.\n7) Do not ask me to build or dig shelter even if it's at night. I want to explore the world and discover new things. I don't want to stay in one place."
},
{
"comment": "The code provides instructions to avoid certain task types, mentions example of bad tasks, and specifies a response format for suggesting appropriate tasks based on the current game state.",
"location": "\"/media/root/Prima/works/Voyager/docs/src/voyager/prompts/curriculum.txt\":32-41",
"content": "8) Tasks that require information beyond the player's status to verify should be avoided. For instance, \"Placing 4 torches\" and \"Dig a 2x1x2 hole\" are not ideal since they require visual confirmation from the screen. All the placing, building, planting, and trading tasks should be avoided. Do not propose task starting with these keywords.\nYou should only respond in the format as described below:\nRESPONSE FORMAT:\nReasoning: Based on the information I listed above, do reasoning about what the next task should be.\nTask: The next task.\nHere's an example response:\nReasoning: The inventory is empty now, chop down a tree to get some wood.\nTask: Obtain a wood log."
}
]
}
Loading