Logo

dev-resources.site

for different kinds of informations.

MINDcraft: Unleashing Novita AI LLM API in Minecraft

Published at
12/4/2024
Categories
ai
llm
llama3
Author
novita_ai
Categories
3 categories in total
ai
open
llm
open
llama3
open
Author
9 person written this
novita_ai
open
MINDcraft: Unleashing Novita AI LLM API in Minecraft

MINDcraft is a groundbreaking open-source project that integrates large language models (LLMs) to control Minecraft bots, offering a new dimension of interaction and creativity within the game. It utilizes the Mineflayer library to enable these bots to perform complex tasks by generating high-level code. This project not only showcases the potential of AI in gaming but also pushes the boundaries of what can be achieved with language models in virtual environments. Novita AI is recommended as one of the project's API providers.

Project Overview of MINDcraft

At its core, MINDcraft is a node.js application that integrates LLMs to guide Minecraft bots in performing various tasks. The primary bot, named Andy, can communicate with players and autonomously set goals, such as gathering resources or constructing buildings. This capability allows Andy to play the game independently, continuously adapting and setting new objectives without human intervention. The project's architecture enables Andy to execute commands efficiently and interact with the game environment in a meaningful way.

Key Features

  • Language Model Integration: MINDcraft employs LLMs to generate code that directs the bot's actions within Minecraft. This integration enables Andy to execute complex tasks efficiently by interpreting natural language instructions and translating them into actionable game commands.

  • Autonomous Gameplay: Andy can independently set goals and navigate the game world, enhancing its ability to perform tasks without direct player input. This autonomy allows Andy to explore new strategies and adapt its behavior based on environmental feedback.

  • Parameterized Commands: The project incorporates commands similar to those found in Toolformer, allowing Andy to execute tasks like resource collection more reliably. These parameterized commands simplify task execution by providing predefined actions that can be customized based on specific requirements.

MINDcraft Development and Implementation

Development

Inspiration and Initial Work

MINDcraft's development began after the release of a notable paper on Voyager, which introduced the Mineflayer library for creating Minecraft bots in Node.js. Unlike previous AI research that used image inputs and low-level outputs, Mineflayer allows AI systems to interact with Minecraft using high-level code, simplifying tasks like navigation and resource acquisition without needing reinforcement learning.

Leveraging LLMs for Instruction Following

Modern LLMs excel at code generation and instruction following, making it easy to condition an LLM to generate Mineflayer code based on human instructions, leading to the creation of Andy. Parameterized commands were implemented to enhance Andy's reliability in executing common skills. For example, Andy can output !collectBlocks("oak_log", 1) instead of generating complex code.

Enhancements and Future Directions

Over time, Andy's command set has been expanded, and automatic behaviors like avoiding aggressive mobs have been added. Recently, Andy can play Minecraft independently by setting natural language goals (e.g., "Collect materials to build a house"). Future plans include code reuse, experience reflection, improved spatial awareness, vision inputs, and multi-agent interactions.

Implementation

Implementation of MINDcraft

Agent Class and Main Logic Loop

The main class of MINDcraft is an Agent class that instantiates whenever Andy is not logged in. The main logic loop in handleMessage executes when a player sends a message to Andy:

handleMessage(message):
    history.add(message)
    while true:
        hist = history.getHistory()
        response = prompter.promptConvo(hist)
        if containsCommand(response):
            cleanChat(response)
            history.add(response)
            result = executeCommand(this, response)
            history.add(result)
        else:
            cleanChat(response)
            history.add(response)
            break
Enter fullscreen mode Exit fullscreen mode

Handling Responses and Commands

Andy can return a single conversational response or iteratively call query or action commands. Queries provide world state information (e.g., !inventory, !nearbyBlocks ), while actions cause in-game behaviors (e.g., !followPlayer(name) , !collectBlocks(block) ). All actions are executed using the execute method in the Coder class.

Custom Code Generation

For complex behaviors like building, Andy can write custom code by outputting the newAction command to enter coding mode. Using the generateCode method from the Coder class, Andy writes custom JavaScript code with access to Mineflayer and a library of useful functions. The method includes a loop for multiple debugging attempts.

Role of In-Context Examples

In-context examples are crucial for the quality of Andy’s responses. An embedding model finds similar examples to the current history and adds them to the LLM context, ensuring Andy uses commands correctly and queries information before completing tasks.

How to Run MINDcraft

Requirements

  • Minecraft Java Edition (up to v1.21.1, recommend v1.20.4)

  • Node.js Installed (at least v14)

  • One of these: OpenAI API Key | Gemini API Key | Anthropic API Key | Replicate API Key | Hugging Face API Key | Groq API Key | Ollama Installed. | Qwen API Key | Novita AI API Key |

Install and Run

Make sure you have the requirements above.

  1. Clone or download this repository (big green button)

  2. Rename keys.example.json to keys.json and fill in your API keys (you only need one). The desired model is set in andy.json or other profiles. For other models refer to the table below.

  3. In terminal/command prompt, run npm install from the installed directory

  4. Start a minecraft world and open it to LAN on localhost port 55916

  5. Run node main.js from the installed directory

Customization

You can configure project details in settings.js. See file.You can configure the agent's name, model, and prompts in their profile like andy.json.

API Config Variable Example Model name
OpenAI OPENAI_API_KEY gpt-4o-mini
Google GEMINI_API_KEY gemini-pro
Anthropic ANTHROPIC_API_KEY claude-3-haiku-20240307
Replicate REPLICATE_API_KEY meta/meta-llama-3-70b-instruct
Ollama (local) n/a llama3
Groq GROQCLOUD_API_KEY groq/mixtral-8x7b-32768
Hugging Face HUGGINGFACE_API_KEY huggingface/mistralai/Mistral-Nemo-Instruct-2407
Novita AI NOVITA_API_KEY gryphe/mythomax-l2-13b
Qwen QWEN_API_KEY qwen-max
xAI XAI_API_KEY grok-beta

How to access the Novita AI API Key

Step 1: Go to novita.ai and log in

You can log in on Novita AI with Google or GitHub, which will create a new account on your first login. Alternatively, you can register using your email address.

Screenshoot of log in page on Novita AI

Step 2: Manage Novita AI LLM API Key

Novita AI secures API access through Bearer authentication by including an API Key in the request header, such as “Authorization: Bearer {API Key}”.To manage your keys, navigate to “Key Management” in the settings. A default key is automatically generated upon your first login. You can create additional keys by clicking “+ Add New Key”.

Screenshoot of API access page on Novita AI

Step 3: Top Up Credit

Novita AI offers new users a voucher with some credit to try our products. To add more credit, please visit Billing and Payments and follow the guide on Payment Methods.

Useful Links and Resources

Conclusion

MINDcraft represents a significant step forward in AI research within gaming environments. By harnessing the power of LLMs, it opens new possibilities for creativity and interaction in Minecraft. As the project continues to evolve, community participation and feedback will play a crucial role in shaping its future developments. The project's open-source nature encourages collaboration among developers and researchers interested in exploring the intersection of AI and gaming.

Originally published at Novita AI

Novita AI is the All-in-one cloud platform that empowers your AI ambitions. Integrated APIs, serverless, GPU Instance — the cost-effective tools you need. Eliminate infrastructure, start free, and make your AI vision a reality.

llama3 Article's
30 articles in total
Favicon
Novita AI API on gptel: Supercharge Emacs with LLMs
Favicon
How to Effectively Fine-Tune Llama 3 for Optimal Results?
Favicon
L3 8B Lunaris: Generalist Roleplay Model Merges on Llama-3
Favicon
Accessing Novita AI API through Portkey AI Gateway: A Comprehensive Guide
Favicon
Llama 3 vs Qwen 2: The Best Open Source AI Models of 2024
Favicon
Llama 3.3 vs GPT-4o: Choosing the Right Model
Favicon
Meta's Llama 3.3 70B Instruct: Powering AI Innovation on Novita AI
Favicon
MINDcraft: Unleashing Novita AI LLM API in Minecraft
Favicon
How to Access Llama 3.2: Streamlining Your AI Development Process
Favicon
Are Llama 3.1 Free? A Comprehensive Guide for Developers
Favicon
How Much RAM Memory Does Llama 3.1 70B Use?
Favicon
How to Install Llama-3.3 70B Instruct Locally?
Favicon
Arcee.ai Llama-3.1-SuperNova-Lite is officially the 8-billion parameter model
Favicon
LLM Inference using 100% Modern Java ☕️🔥
Favicon
Enhance Your Projects with Llama 3.1 API Integration
Favicon
Llama 3.2 Running Locally in VSCode: How to Set It Up with CodeGPT and Ollama
Favicon
Llama 3.2 is Revolutionizing AI for Edge and Mobile Devices
Favicon
Two new models: Arcee-Spark and Arcee-Agent
Favicon
How to deploy Llama 3.1 405B in the Cloud?
Favicon
ChatPDFLocal: Chat with Your PDFs Offline with Llama3.1 locally,privately and safely.
Favicon
How to deploy Llama 3.1 in the Cloud: A Comprehensive Guide
Favicon
How to fine tune a model which is available in ollama
Favicon
Theoretical Limits and Scalability of Extra-LLMs: Do You Need Llama 405B
Favicon
Milvus Adventures July 29, 2024
Favicon
Lightning-Fast Code Assistant with Groq in VSCode
Favicon
Journey towards self hosted AI code completion
Favicon
Blossoming Intelligence: How to Run Spring AI Locally with Ollama
Favicon
Setup REST-API service of AI by using Local LLMs with Ollama
Favicon
Hindi-Language AI Chatbot for Enterprises Using Qdrant, MLFlow, and LangChain
Favicon
#SemanticKernel: Local LLMs Unleashed on #RaspberryPi 5

Featured ones: