MoonBit is an emerging programming language optimized for WebAssembly, prioritizing small executable sizes without compromising performance. It combines a statically typed, lightweight object-functional hybrid approach, supported by a smart compiler to optimize the entire program at once. MoonBit also targets JavaScript and native backend. By describing itself as a "coding platform", MoonBit team is working on an integrated toolchain that includes an IDE, build system, and the MoonBit AI coding assistant embedded within the IDE.
MoonBit AI is currently capable of generating code, tests, documentations, and offering suggestions on fixing errors and improving code quality. It can be quite handy for those who work on MoonBit projects, but not for other languages. The developer of MoonBit reveals on their Discord channel that MoonBit AI is trained only with MoonBit.
While working on my MoonBit projects, I use MoonBit AI commands /test
and /doc
the most to save time from writing tedious tests and documentations. It turns out that the MoonBit team emphasizes the testing experience a lot by providing a built-in testing framework in its early stage. MoonBit AI will also verify the generated inline tests with type checking.
The /generate
command, used to generate MoonBit code, is still in development and may not be as stable due to the language's early stage and relatively limited codebase. It is worth noting that MoonBit might be currently the most developed language for LLMs. The language and model are designed to work together. I look forward to the complete version of MoonBit AI when the language reaches 1.0 and grows a greater ecosystem.
This article will provide a step-by-step guide on how to deploy Deepseek R1 into MoonBit AI locally.
Obtain a DeepSeek API Key
Visit the DeepSeek official website, and click on the “API Platform” in the top-right corner.
Select “API Keys” from the left-side menu to enter the API key management page.
Click “Create new API key” at the bottom of the page.
In the pop-up window, enter a name for the key and click “Create API key”.
Save it for later use.
Configure DeepSeek in MoonBit AI
Open VSCode and press Ctrl + P to open the command palette.
Search for “Preferences: Open User Settings (JSON)” and open the settings file.
Add the following configuration at the bottom, replacing <your-api-key-here>
with the API key obtained in the previous step:
{
// ...
"moonbit.ai.models": [
{
"name": "DeepSeek R1",
"baseUrl": "https://api.deepseek.com",
"apiKey": "<your-api-key-here>", // Replace with your actual API key
"model": "deepseek-reasoner"
}
]
}
After saving the settings, your configuration should look like this:
Using MoonBit AI for Documentation Generation
To generate documentation for a function using MoonBit AI:
First open your .mbt project, and click the rabbit icon on the function you want to generate documents.
In the drop-down menu, select “/doc Generate documentation for this function”.
A new window will open on the right side of the editor, displaying the documentation generation progress.
Once complete, the generated documentation will appear on the right side. To ensure the documentation generated is valid, MoonBit AI verifies the output at the same time. A green "Verified" suggests the docs pass the test. If not, MoonBit AI will also show you errors in red.
Click “Insert” to add the documentation to your code.
The final code will now include the newly generated documentation.
Conclusion
That’s it. Now you’ve deployed Deepseek R1 into MoonBit AI. Feel free to play with it!
If you want to explore more about MoonBit and its AI tool, it’s worth noting that MoonBit is still in its pre-1.0 phase, and official documentation for MoonBit AI features is not yet available. To stay updated on MoonBit AI, you might need to follow their release notes or check out demonstration videos of MoonBit AI’s capabilities on MoonBit’s Twitter and YouTube channels. As the language and its toolchain continue to develop, I believe MoonBit AI will become an even more powerful asset for MoonBit developers.
Top comments (1)
Seems like I’ve been overcomplicating things. Thanks for sharing this—will give it a go and see how it improves my workflow!"