Moly: a Rust AI LLM client built atop Robius
Moly is an AI LLM client written in Rust, that demonstrates the power of the Makepad UI toolkit and Project Robius, a framework for multi-platform application development in Rust.
⚠️ Moly is in early development. Please file an issue if you encounter bugs or unexpected results.
moly_chat.mov
Want to try Moly without building it from source? You can download the latest stable pre-built releases of Moly.
The following table shows which host systems can currently be used to build Moly for which target platforms.
Host OS | Target Platform | Builds? | Runs? | Packaging Support |
---|---|---|---|---|
macOS | macOS | ✅ | ✅ | .app , .dmg |
Linux | Linux | ✅ | ✅ | .deb (Debian dpkg), AppImage, pacman |
Windows | Windows (10+) | ✅ | ✅ | .exe (NSIS) |
The Moly app supports different types of AI providers:
- OpenAI-compatible AI providers: configured through the Providers Dashboard.
- Support for other clients will be added to MolyKit. To create your own custom clients, checkout the MolyKit documentation.
- If you want to contribute providers, or extend the list of supported models for a given provider, see instructions here
- Moly Server: a local LLM backend that allows exploring, downloading and running OSS LLMs locally. For usage and installation see instructions here
- MoFa Servers: MoFa is a framework for building AI agents. Using MoFa, AI agents can be constructed via templates, and then exposed via a Dora server that is OpenAI-compatible. MoFa servers can be added to the application through the Providers Dashboard. See instructions here.
Moly Server is a local HTTP server which provides capabilities for searching, downloading, and running local LLMs over an OpenAI-compatible API. While not required in order to use Moly, it can be run alongside the main Moly application for an integrated, local experience.
To get started, simply download and extract the latest version for your platform from the server releases page and run the executable in a command line from inside the directory.
Alternatively, to compile it from source, follow the setup guide and then run:
cd moly-server/
cargo run -p moly-server
-
Obtain the source code for this repository:
git clone https://github.com/moxin-org/moly.git
- Run
cargo run --release
Important
If your CPU does not support AVX512, then you should append the --noavx
option onto the above command.
To build Moly on Linux, you must install the following dependencies:
openssl
, clang
/libclang
, binfmt
, Xcursor
/X11
, asound
/pulse
.
On a Debian-like Linux distro (e.g., Ubuntu), run the following:
sudo apt-get update
sudo apt-get install libssl-dev pkg-config llvm clang libclang-dev binfmt-support libxcursor-dev libx11-dev libasound2-dev libpulse-dev
Then use cargo
to build and run Moly:
cd moly
cargo run --release
- Install Rust and cargo-makepad.
- Obtain the source code for this repository:
git clone https://github.com/moxin-org/moly.git
- Run and serve the Moly app:
cargo makepad wasm --bindgen run -p moly --release
Note
If you want to deploy it, it's recommended to optimize for size building it like this:
cargo makepad wasm --strip --brotli --bindgen build -p moly --profile=small
Note: we already have pre-built releases of Moly available for download.
Install cargo-packager
:
rustup update stable ## Rust version 1.79 or higher is required
cargo +stable install --force --locked cargo-packager
For posterity, these instructions have been tested on cargo-packager
version 0.10.1, which requires Rust v1.79.
On a Debian-based Linux distribution (e.g., Ubuntu), you can generate a .deb
Debian package, an AppImage, and a pacman installation package.
Important
You can only generate a .deb
Debian package on a Debian-based Linux distribution, as dpkg
is needed.
Note
The pacman
package has not yet been tested.
Ensure you are in the root moly
directory, and then you can use cargo packager
to generate all three package types at once:
cargo packager --release --verbose ## --verbose is optional
To install the Moly app from the .deb
package on a Debian-based Linux distribution (e.g., Ubuntu), run:
cd dist/
sudo apt install ./moly_*.deb ## Replace * with version/arch. The leading "./" part is required
We recommend using apt install
to install the .deb
file instead of dpkg -i
, because apt
will auto-install all of Moly's required dependencies, whereas dpkg
will require you to install them manually.
To run the AppImage bundle, simply set the file as executable and then run it:
cd dist/
chmod +x moly_*.AppImage ## Replace * with version/arch
./moly_*.AppImage ## Replace * with version/arch
This can only be run on an actual Windows machine, due to platform restrictions.
First, install the necessary build tools if you haven't already (e.g., Visual Studio Build Tools, LLVM as mentioned in some setups).
Ensure you are in the root moly
directory, and then you can use cargo packager
to generate a setup.exe
file using NSIS:
cargo packager --release --formats nsis --verbose ## --verbose is optional
After the command completes, you should see a Windows installer called moly_*_x64-setup.exe
(replace * with version) in the dist/
directory.
Double-click that file to install Moly on your machine, and then run it as you would a regular application.
This can only be run on an actual macOS machine, due to platform restrictions.
Ensure you are in the root moly
directory, and then you can use cargo packager
to generate an .app
bundle and a .dmg
disk image:
cargo packager --release --verbose ## --verbose is optional
Important
You will see a .dmg window pop up — please leave it alone, it will auto-close once the packaging procedure has completed.
Tip
If you receive the following error:
ERROR cargo_packager::cli: Error running create-dmg script: File exists (os error 17)
then open Finder and unmount any Moly-related disk images, then try the above cargo packager
command again.
Tip
If you receive an error like so:
Creating disk image...
hdiutil: create failed - Operation not permitted
could not access /Volumes/Moly/Moly.app - Operation not permitted
then you need to grant "App Management" permissions to the app in which you ran the cargo packager
command, e.g., Terminal, Visual Studio Code, etc.
To do this, open System Preferences
→ Privacy & Security
→ App Management
,
and then click the toggle switch next to the relevant app to enable that permission.
Then, try the above cargo packager
command again.
After the command completes, you should see both the Moly.app
and the .dmg
in the dist/
directory.
You can immediately double-click the Moly.app
bundle to run it, or you can double-click the .dmg
file to install.
Note that the
.dmg
is what should be distributed for installation on other machines, not the.app
.
If you'd like to modify the .dmg background, here is the Google Drawings file used to generate the MacOS .dmg background image.
MoFa is a software framework for building AI agents. Moly supports connecting to MoFa servers to interact with AI agents in the same way it does with local or remote LLMs.
To run Moly with a local MoFa server, you can follow these steps:
https://github.com/dora-rs/dora?tab=readme-ov-file#installation
Requires python ^3.10
git clone https://github.com/moxin-org/mofa.git
Install the required Python libraries, and mainly, the mofa library itself
cd python && pip install -r requirements.txt && pip install -e .
pip install dora-rs
Navigate to the folder of the Dora node that implements the http server
cd examples/moly_client
Run MoFa with
dora up
dora build dataflow.yml
dora start dataflow.yml
If there's any error when doing dora start, you can restart dora
dora destroy && dora up
At this point the server should be up You can verify it with a request for chat completion:
curl http://localhost:8000/v1/chat/completions \
-v -H "Content-Type: application/json" \
-d '{
"model": "moly-chat",
"messages": [
{ "role": "system", "content": "Use positive language and offer helpful solutions to their problems." },
{ "role": "user", "content": "What is the currency used in Spain?" }
],
"temperature": 0.7,
"stream": true
}'
This should return a JSON response with the completion.
Go to the Providers Dashboard and enable the MoFa entry (or add new ones if needed)
One of the easiest ways to contribute to Moly is by extending the list of predefined supported providers and their models.
- Add the provider information to supported_providers.json.
name
: The name to display in the UIurl
: The full API endpoint for this provider, including versioning, e.g. "https://api.openai.com/v1"provider_type
: The type of API format that the provider uses, e.g. the"provider_type": "OpenAI"
will use theOpenAIClient
from MolyKit. In Moly, the mapping between supported provider types and MolyKit clients can be found in src/chat/chat_screen.rs (if you were to add a custom MolyKit client and default supported provider, you would need to extend the mapping here).supported_models
: A list of model ids to be used as the whitelist of allowed/supported models in Moly for this provider.
-
Add a new icon for the provider under /resources/images/providers (in PNG format), using the same name as the provider you registered in the previous step.
-
Update the providers view, importing the new image and referencing the import:
- At the top of the live_design!{} block, add your import, e.g.:
ICON_GEMINI = dep("crate://self/resources/images/providers/gemini.png")
- Add the icon to the list of provider_icons:
provider_icons: [
...
(ICON_GEMINI), // Add this line to reference the imported file.
]