How gaianet-ai/gaianet-node works
Main Components
• CLI & Node Management: The “gaianet” command-line interface, along with install.sh, uninstall.sh, and update commands that configure the node (using config.json and nodeid.json).
• Configuration & Initialization: Files like config.json determine model parameters, vector DB settings, etc. The initialization procedure (gaianet init) downloads large model files and vector snapshots.
• WASM Runtime & API Server: The core service is delivered via the WasmEdge runtime. The LlamaEdge API Server (rag-api-server.wasm) is started under WasmEdge and is responsible for handling AI chat requests, loading specific WASM modules, and preloading models (e.g., Llama-2 and MiniLM).
• Vector Database (Qdrant): The node launches a Qdrant instance to serve collection management for the retrieval augmented generation (RAG) process.
• Docker & Deployment Support: Docker-related files and workflows indicate containerization support for deployment and consistent builds. Additionally, there is a Docker directory that contains Dockerfiles (including variants for CUDA) and a run script.
• Utilities and Registry Module: Under the utils/registry directory, there is a Rust-based component (with its Cargo.toml and source files) along with a pre-built registry.wasm. This could be used for registering or interfacing with other WASM modules, providing an extensible “registry” of functionality.
Out Relationships and Interactions
• The CLI tool (gaianet) drives all operations:
• “install” triggers installation of dependencies (WasmEdge, Qdrant, etc.) and downloads configuration, identifiers, and model files.
• “init” uses config.json to initialize the node and orchestrate the download of models and vector snapshots.
• “start” creates a running instance which:
▪ Starts the Qdrant vector database
▪ Launches the LlamaEdge API Server within the WasmEdge runtime, preloading its WASM modules
▪ Optionally runs additional components (such as the registry service from utils/registry if used in that context)
• “stop” cleanly shuts down the Qdrant, WasmEdge, and any FRPC (frpc.toml) processes.
• Data Flow:
• User or external clients interact with the node via a public URL (or localhost when started “--local-only”), which routes requests to the LlamaEdge API Server.
• The API server communicates with the Qdrant vector database to retrieve context data (model inference / retrieval augmented generation).
• Updates and configurations propagate from the CLI commands to the underlying WASM modules and database.
Architectural Patterns and Technologies
• Modular Design: Separation between the CLI management layer, runtime (WasmEdge executing WASM modules) layer, and a dedicated vector DB (Qdrant) for specialized data (knowledge base retrieval).
• Containerization: Docker components and CI/CD workflows in .github indicate a container-based deployment and ongoing integration.
• Extensibility: The use of a registry module (utils/registry) and WASM-based API servers facilitates extension and integration of additional modules.
• Deployment Flexibility: Support for multiple deployment environments (native via install scripts, Docker-based, and potentially using CUDA variants) is evident.