# Introduction

## 1.1 What is Lumo Labs?

Lumo Labs is a vibrant, open-source community dedicated to pushing the boundaries of Solana by developing cutting-edge AI models specifically tailored for the Solana ecosystem. We believe that AI has the potential to revolutionize how we interact with and build on the Solana blockchain.

***

## LumoKit: The Fastest Python AI Toolkit for Solana

A lightweight AI Toolkit Framework offering a multitude of on-chain actions and researching abilities created by Lumo Labs catering to Solana.

{% embed url="<https://lumokit.ai>" %}

***

### Model: Lumo-70B-Instruct

{% embed url="<https://huggingface.co/lumolabs-ai/Lumo-70B-Instruct>" %}

**Try out Lumo-70B-Instruct:** <https://try-lumo70b.lumolabs.ai>

### Model: Lumo-8B-Instruct

{% embed url="<https://huggingface.co/lumolabs-ai/Lumo-8B-Instruct>" %}

**Try out Lumo-8B-Instruct:** [https://try-lumo8b.lumolabs.ai](https://try-lumo8b.lumolabs.ai/)

***

### DeepSeek Integrated Model: Lumo-DeepSeek-R1-8B

{% embed url="<https://huggingface.co/lumolabs-ai/Lumo-DeepSeek-R1-8B>" %}

**Try out Lumo-8B-Instruct:** <https://try-deepseek-lumo8b.lumolabs.ai>

***

### Dataset: Lumo-Novel-DS-Instruct (LATEST)

{% embed url="<https://huggingface.co/datasets/lumolabs-ai/Lumo-Novel-DS-Instruct>" %}

### Dataset: Lumo-Iris-DS-Instruct

{% embed url="<https://huggingface.co/datasets/lumolabs-ai/Lumo-Iris-DS-Instruct>" %}

### Dataset: Lumo-8B-DS-Instruct

{% embed url="<https://huggingface.co/datasets/lumolabs-ai/Lumo-8B-DS-Instruct>" %}

***

### 1.1.1 Vision

Our vision is to empower developers and researchers within the Solana community by providing them with access to state-of-the-art AI tools. We envision a future where AI seamlessly integrates with Solana, unlocking new possibilities for decentralized applications (dApps), DeFi, and Web3.

### 1.1.2 Mission

Our mission is to:

* **Develop and openly share innovative AI models** specifically designed for the Solana ecosystem.
* **Foster a collaborative and inclusive community** where developers, researchers, and enthusiasts can contribute, learn, and grow together.
* **Advance the state-of-the-art in AI for blockchain** by conducting research and exploring novel applications.

### 1.1.3 Community Values

* **Openness and Transparency:** We prioritize open-source principles and believe in the power of sharing knowledge and resources.
* **Collaboration and Inclusivity:** We foster a welcoming and inclusive environment for all members of the community, regardless of their background or experience.
* **Excellence and Innovation:** We strive for excellence in all our endeavors and are committed to pushing the boundaries of AI research and development.
* **Community-Driven Development:** We value the input and contributions of the community and strive to build models that meet their needs.

***


# Roadmap

This section outlines the exciting milestones and future developments planned for Lumo Labs.

{% stepper %}
{% step %}

### ✅ Dataset Launch&#x20;

<figure><img src="/files/DhOQ5PexRBcZTcqPHXM1" alt=""><figcaption></figcaption></figure>

* The **Lumo-8B-DS-Instruct dataset \[Completion: 15th January, 2025]** comprising 5,502 high-quality question-answer pairs has been successfully launched on the Hugging Face Hub as an open-source resource.
* This dataset provides a valuable foundation for researchers and developers interested in training and fine-tuning AI models specifically for the Solana ecosystem.
  {% endstep %}

{% step %}

### ✅ Model Launch

* The **Lumo-8B-Instruct model \[Completion: 15th January, 2025]**, trained on the Lumo-8B-DS-Instruct dataset and leveraging the powerful Llama 3.1 8B parameter foundation, has been successfully launched on the Hugging Face Hub as an open-source resource.
* This marks a significant achievement for the Lumo Labs community, making Lumo-8B-Instruct readily accessible for developers and researchers to experiment with and build upon.
  {% endstep %}

{% step %}

### ✅  $LUMO Token Launch

* $LUMO: 4FkNq8RcCYg4ZGDWh14scJ7ej3m5vMjYTcWoJVkupump **\[Completion: 15th January, 2025]**
  {% endstep %}

{% step %}

### ✅ Native Listing on Ollama

* Getting the model 'Lumo-8B-Instruct' natively listed on Ollama, this enables users to directly inference the model and plug and play it locally. **\[Completion: 15th January, 2025]**\
  <https://ollama.com/lumolabs/Lumo-8B-Instruct>
  {% endstep %}

{% step %}

### ✅ Lumo Rooms

* Lumo Rooms set base for establishing a tight bond within the community, we hosted our first ever Lumo Room event on this day. **\[Completion: 16th January, 2025]**

<div><figure><img src="/files/TJ1Bo5MnVOs3L7NbrhGs" alt=""><figcaption></figcaption></figure> <figure><img src="/files/UrNRVDHwFLF1wMoxn7Eg" alt=""><figcaption></figcaption></figure></div>

{% endstep %}

{% step %}

### ✅ Launching the Lumo Chatbot

[https://try-lumo8b.lumolabs.ai](https://try-lumo8b.lumolabs.ai/) **\[Completion: 16th January, 2025]**

* While **Lumo-8B-Instruct can be readily accessed and used through the Hugging Face Hub and inferenced locally and on servers**, we have developed a chatbot interface so that users can try out Lumo without having to inference it themself.
* This chatbot will provide an intuitive and accessible way for users to interact with the model, enabling seamless exploration of its capabilities.
  {% endstep %}

{% step %}

### ✅ Launch of Lumo-Iris-DS-Instruct Dataset

* Lumo has set a milestone by launching a dataset that is unmatched and the largest ever dataset for a Solana model. **\[Completion: 18th January, 2025]**\
  \
  *\[Knowledge cut-off date: 17th January, 2025]*<br>
* **Lumo-Iris-DS-Instruct** is the ultimate powerhouse of Solana-related knowledge, featuring a groundbreaking **28,518 high-quality question-answer pairs**. This dataset is **5x larger**, more comprehensive, and meticulously refined compared to its predecessor, **Lumo-8B-DS-Instruct**. With cutting-edge enhancements and superior coverage, it sets the gold standard for fine-tuning large language models for Solana.\
  \
  <https://huggingface.co/datasets/lumolabs-ai/Lumo-Iris-DS-Instruct>
  {% endstep %}

{% step %}

### ✅ Scaling to 70B+ Parameters and Expanding the Dataset

* Solana's largest ever language model has been launched on 21st January, 2025. Lumo-70B-Instruct, fine-tuned with the great Lumo Iris Dataset on Meta Llama 3.3 70B Intruct. **\[Completion: 21st January, 2025]**
* Lumo-70B-Instruct is capable of developing code for Solana stronger than ever, conversing better than ever, and is the most suitable model for building agents on Solana.
* We are committed to continuous improvement and are actively working on training a larger, more powerful model with over 70 billion parameters.
* This ambitious project will involve the creation of an expanded dataset comprising over 25,000 high-quality question-answer pairs, further enhancing the model's understanding and capabilities within the Solana ecosystem.

<https://huggingface.co/lumolabs-ai/Lumo-70B-Instruct>
{% endstep %}

{% step %}

### ✅ Launch of Lumo-DeepSeek-R1-8B

* First ever blockchain project to launch their AI model fine-tuned over DeepSeek's R1 8B flagship model, this is a researching prowess that is trained over Lumo's Iris dataset.\
  **\[Completion: 27th January, 2025]**
  {% endstep %}

{% step %}

### ✅ Lumo Hackathon \[>$25,000]

* Lumo organised one of the biggest prize pools for a hackathon that a memecoin project had ever seen, the hackathon was a week-long activity where users had to build over Lumo's resources and showcase their technical abilities.\
  **\[Completion: 31st January, 2025]**
* A total of 78 submissions were made over a very tight deadline with several notable submissions showcasing the abilities of Lumo, visit the link below to get more information:\
  <https://x.com/lumolabsdotai/status/1885032741130944842>
  {% endstep %}

{% step %}

### ✅ Lumo-Novel-DS-Instruct

* The largest ever blockchain AI Dataset was launched on this date, an extremely powerful dataset that was trained over several official Solana Documentation sources, Solana StackExchange Data Dumps, etc. (19+ authoritative references).\
  **\[Completion: 1st February, 2025]**
* It consists of **95,127 high-quality question-answer pairs**. This dataset is **3.3x larger** than its predecessor, Lumo-Iris-DS-Instruct, with enhanced precision, comprehensive coverage, and an optimized architecture for large-scale AI fine-tuning in the Solana ecosystem.
  {% endstep %}

{% step %}

### ❌ Building the Ultimate Solana AI Agents Toolkit

* Lumo Labs envisions creating the most comprehensive open-source library of AI agents specifically designed for the Solana ecosystem.
* This toolkit will empower developers to build sophisticated AI-powered applications on Solana, including:
  * Decentralized AI agents
  * Autonomous market makers
  * Predictive analytics tools
  * And much more.
    {% endstep %}
    {% endstepper %}


# Partnerships and Listings

Lumo collaborates with organizations and researchers to expand access to high-quality AI datasets and models. Through strategic partnerships, we ensure diverse, open-source contributions that drive in

### Our Partners

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>NVIDIA Inception Program</strong></td><td></td><td></td><td><a href="/files/0dVq3L5foJ7GKGfGdaF6">/files/0dVq3L5foJ7GKGfGdaF6</a></td><td><a href="https://x.com/lumolabsdotai/status/1893004785965580795">https://x.com/lumolabsdotai/status/1893004785965580795</a></td></tr><tr><td><strong>Solana Foundation</strong></td><td></td><td></td><td><a href="/files/X4lW8IHClK1XDaOADwys">/files/X4lW8IHClK1XDaOADwys</a></td><td><a href="https://x.com/lumolabsdotai/status/1886043923681849405">https://x.com/lumolabsdotai/status/1886043923681849405</a></td></tr><tr><td><strong>SWARMS</strong></td><td></td><td></td><td><a href="/files/o4pfOP2LxUTcNtmMLXeK">/files/o4pfOP2LxUTcNtmMLXeK</a></td><td><a href="https://x.com/lumolabsdotai/status/1882858436813283503">https://x.com/lumolabsdotai/status/1882858436813283503</a></td></tr><tr><td><strong>NUIT</strong></td><td></td><td></td><td><a href="/files/6DXj6IJbpgDXqM3F33c7">/files/6DXj6IJbpgDXqM3F33c7</a></td><td><a href="https://x.com/lumolabsdotai/status/1883842592867025333">https://x.com/lumolabsdotai/status/1883842592867025333</a></td></tr></tbody></table>

### Our Listings

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Crypto.com Onchain</strong></td><td><a href="/files/BUkqIXYa6XNK7eXjje4o">/files/BUkqIXYa6XNK7eXjje4o</a></td><td><a href="https://x.com/onchain_wallet/status/1887325734785442035">https://x.com/onchain_wallet/status/1887325734785442035</a></td></tr><tr><td><strong>CoinEx</strong></td><td><a href="/files/NuQixj3lMpP7y8tmIpdx">/files/NuQixj3lMpP7y8tmIpdx</a></td><td><a href="https://x.com/lumolabsdotai/status/1887079850512646534">https://x.com/lumolabsdotai/status/1887079850512646534</a></td></tr><tr><td><strong>BingX</strong></td><td><a href="/files/YCCQIV3R7M5TiEdnnpFV">/files/YCCQIV3R7M5TiEdnnpFV</a></td><td><a href="https://bingx.com/en/spot/LUMOUSDT/">https://bingx.com/en/spot/LUMOUSDT/</a></td></tr><tr><td><strong>CoinGecko</strong></td><td><a href="/files/EejvUxSaYv95X6XzEN3o">/files/EejvUxSaYv95X6XzEN3o</a></td><td><a href="https://x.com/lumolabsdotai/status/1882793517917089938">https://x.com/lumolabsdotai/status/1882793517917089938</a></td></tr><tr><td><strong>Poloniex Exchange</strong></td><td><a href="/files/rs5TQY4clKb1fuoyBzLf">/files/rs5TQY4clKb1fuoyBzLf</a></td><td><a href="https://x.com/Poloniex/status/1882648458982764811">https://x.com/Poloniex/status/1882648458982764811</a></td></tr><tr><td><strong>LBank.com</strong></td><td><a href="/files/2JurHw3Naq5OTk16Grmg">/files/2JurHw3Naq5OTk16Grmg</a></td><td><a href="https://x.com/LBank_Exchange/status/1881921985476968656">https://x.com/LBank_Exchange/status/1881921985476968656</a></td></tr><tr><td><strong>BitMart Exchange</strong></td><td><a href="/files/zOUL7Yf42dXWyGZDHdPK">/files/zOUL7Yf42dXWyGZDHdPK</a></td><td><a href="https://x.com/lumolabsdotai/status/1882312221252002118">https://x.com/lumolabsdotai/status/1882312221252002118</a></td></tr><tr><td><strong>Bitget</strong></td><td><a href="/files/zA2QhTUH5aFZS4BnYXtj">/files/zA2QhTUH5aFZS4BnYXtj</a></td><td><a href="https://x.com/bitgetglobal/status/1882021770754236631">https://x.com/bitgetglobal/status/1882021770754236631</a></td></tr><tr><td><strong>NEVERLESS APP</strong></td><td><a href="/files/UjHKN2t3Xoi9z2eVqa9i">/files/UjHKN2t3Xoi9z2eVqa9i</a></td><td><a href="https://x.com/lumolabsdotai/status/1889765327526932569">https://x.com/lumolabsdotai/status/1889765327526932569</a></td></tr><tr><td><strong>MEXC</strong></td><td><a href="/files/iKH99U8YNiNdthvV0w6w">/files/iKH99U8YNiNdthvV0w6w</a></td><td><a href="https://x.com/MEXC_Listings/status/1881905594652864530">https://x.com/MEXC_Listings/status/1881905594652864530</a></td></tr><tr><td><strong>XT Exchange</strong></td><td><a href="/files/tHtW1z8OzBEOqW4nmroJ">/files/tHtW1z8OzBEOqW4nmroJ</a></td><td><a href="https://x.com/XTexchange/status/1880143371395911773">https://x.com/XTexchange/status/1880143371395911773</a></td></tr><tr><td><strong>KCEX</strong></td><td><a href="/files/j1Owx6shknPeWtYiJnOm">/files/j1Owx6shknPeWtYiJnOm</a></td><td><a href="https://x.com/KCEX_Official/status/1914196830503817578">https://x.com/KCEX_Official/status/1914196830503817578</a></td></tr><tr><td><strong>PHEMEX</strong></td><td><a href="/files/7EWPoXP7Vrg0qecmLWFb">/files/7EWPoXP7Vrg0qecmLWFb</a></td><td><a href="https://x.com/Phemex_official/status/1914278061622845681">https://x.com/Phemex_official/status/1914278061622845681</a></td></tr><tr><td><strong>WEEX</strong></td><td><a href="/files/cXlnMc4nkanwFNgaeYd1">/files/cXlnMc4nkanwFNgaeYd1</a></td><td><a href="https://x.com/WEEX_Official/status/1914501503089566106">https://x.com/WEEX_Official/status/1914501503089566106</a></td></tr><tr><td><strong>BITVERSE</strong></td><td><a href="/files/zoirLnmbARautW66Nacz">/files/zoirLnmbARautW66Nacz</a></td><td><a href="https://x.com/BitverseApp/status/1914857383828054453">https://x.com/BitverseApp/status/1914857383828054453</a></td></tr></tbody></table>


# Introduction to LumoKit

<figure><img src="/files/x9s6AKvVU3xcPNlcQeUp" alt=""><figcaption></figcaption></figure>

LumoKit is a lightweight AI Toolkit Framework built by Lumo Labs, providing a comprehensive suite of on-chain actions and research capabilities specifically designed for the Solana blockchain ecosystem. \
\
The framework enables developers and users to interact with blockchain data, perform token identifications, manage wallet portfolios, and execute various blockchain operations through an intuitive API interface.

At its core, LumoKit serves as a bridge between artificial intelligence capabilities and blockchain functionality, allowing for seamless integration of AI-powered features into blockchain applications. This toolkit simplifies complex blockchain interactions by providing pre-built tools that handle common tasks while maintaining the flexibility needed for customization.

***

## Try out LumoKit

{% embed url="<https://lumokit.ai>" %}

***

### LumoKit Core Repository

{% embed url="<https://github.com/Lumo-Labs-AI/lumokit>" %}

### Front-end Repository

{% embed url="<https://github.com/Lumo-Labs-AI/lumokit-frontend>" %}

### Key Features

* **Blockchain Data Access**: Query and analyze on-chain data from the Solana ecosystem
* **Wallet Management**: View detailed portfolio information including token balances and values
* **Token Information**: Identify tokens by name or ticker and retrieve contract addresses
* **Extensible Tool System**: Add custom tools to extend functionality for specific use cases
* **FastAPI Backend**: Robust API architecture with comprehensive error handling
* **Cross-Origin Support**: Configured for secure cross-domain requests


# Installation Guide

Explore the pages in the Installation Guide to gain a clearer understanding of how to install LumoKit on your local machine.

### [Pre-requisites](/lumokit-solana-ai-toolkit-framwork/installation-guide/pre-requisites)

***

### [Environment Configuration](/lumokit-solana-ai-toolkit-framwork/installation-guide/environment-configuration)

***

### [ Local Installation](/lumokit-solana-ai-toolkit-framwork/installation-guide/local-installation)


# Pre-requisites

Before you begin the installation process for LumoKit (v1.0.0), please ensure your system meets the following requirements. These are essential for both the frontend and backend components to function correctly.

***

**1. Frontend Pre-requisites (`lumokit-frontend`)**

* **Node.js:** Version 18.x or later is recommended. You can download it from [nodejs.org](https://nodejs.org/).
* **Package Manager:** You'll need either `npm` (which comes with Node.js) or `yarn`.
  * `npm`: Typically installed with Node.js.
  * `yarn`: Can be installed via npm: `npm install --global yarn`.

***

**2. Backend Pre-requisites (`LumoKit` Backend)**

* **Python:** Version 3.11 or later. You can download it from [python.org](https://python.org/).
* **PostgreSQL:** Version 13 or later. This is the database used by LumoKit. Download it from [postgresql.org](https://www.postgresql.org/download/).
* **Makefile:** LumoKit uses a `Makefile` to simplify common development tasks such as setting up the environment, running the backend server, running tests, and linting the code.
* **Poetry:** Poetry is used as the dependency and package manager for Python projects in LumoKit. It ensures deterministic builds and simplified virtual environment handling.
* **Docker & Docker Compose:** Required for building and running the backend services, especially for a consistent development and production environment.
  * **Docker Desktop** (which includes Docker Compose) is recommended: [docker.com/products/docker-desktop](https://www.docker.com/products/docker-desktop).

***

**3. Essential Services & Keys**

To utilize the full capabilities of LumoKit, especially its AI and blockchain interaction features, you will need:

* **Solana RPC Endpoint:** A URL to connect to the Solana blockchain.
  * For development, `https://api.mainnet-beta.solana.com` can be used, but for more intensive use or production, a dedicated RPC provider (e.g., Helius, QuickNode, Alchemy) is highly recommended. This will be configured in your environment variables.
* **API Keys:** For various third-party services integrated into LumoKit.
  * **OpenAI API Key:** Essential for the LLM capabilities. You'll need to obtain this from [OpenAI](https://openai.com/). This will be configured in your backend environment variables.
  * Other keys might be required depending on the tools you enable or develop.


# Environment Configuration

Proper environment configuration is crucial for LumoKit (v1.0.0) to connect to services, interact with the blockchain, and function as expected. Both the frontend and backend require their own environment variable files.

***

**1. Frontend Environment (`lumokit-frontend`)**

The frontend uses a `.env.local` file to store its environment variables.

**Setup Steps:**

1. In the root of your `lumokit-frontend` project directory, rename the example file `.env.example` to `.env.local`.
2. Modify the variables in `.env.local` with your specific configuration.

**Frontend Environment Variables (`.env.local`):**

| Variable                               | Description                                                                                                   | Default/Example from `.env.example`            |
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
| `NEXT_PUBLIC_API_URL`                  | The URL of your running LumoKit backend instance.                                                             | `http://localhost`                             |
| `NEXT_PUBLIC_LUMO_TOKEN_ADDRESS`       | The contract address of the $LUMO token on Solana.                                                            | `4FkNq8RcCYg4ZGDWh14scJ7ej3m5vMjYTcWoJVkupump` |
| `NEXT_PUBLIC_PRO_SUBSCRIPTION_AMOUNT`  | The amount of $LUMO tokens required for a pro subscription.                                                   | `22000`                                        |
| `NEXT_PUBLIC_PAYMENT_RECEIVER_ADDRESS` | The Solana wallet address that will receive subscription payments. **Ensure this is an address you control.** | `CsTmcGZ5UMRzM2DmWLjayc2sTK2zumwfS4E8yyCFtK51` |
| `NEXT_PUBLIC_SOLANA_RPC_URL`           | The RPC URL for connecting to the Solana blockchain. A dedicated provider is highly recommended.              | `https://api.mainnet-beta.solana.com`          |

**Important Notes for Frontend:**

* ⚠️ **Backend Dependency:** The `NEXT_PUBLIC_API_URL` must point to your operational LumoKit backend instance.
* 💰 **Payment Address:** If you intend to receive payments, ensure `NEXT_PUBLIC_PAYMENT_RECEIVER_ADDRESS` is a Solana wallet address that you control.

***

**2. Backend Environment (`LumoKit` Backend)**

The backend uses a `.env` file for its configuration.

**Setup Steps:**

1. In the root of your `LumoKit` backend project directory, copy the example file: `cp .env.example .env`.
2. Modify the variables in the newly created `.env` file with your specific settings.

**Backend Environment Variables (`.env`):**

| Variable                 | Description                                                | Example from `.env.example`                    |
| ------------------------ | ---------------------------------------------------------- | ---------------------------------------------- |
| `POSTGRES_*`             | Database connection details (user, password, db name etc.) | `lumokit_db`, `lumokit_root`, etc.             |
| `SOLANA_RPC_URL`         | URL for Solana RPC node.                                   | `https://api.mainnet-beta.solana.com`          |
| `OPENAI_API_KEY`         | API key for OpenAI services.                               | `sk-...`                                       |
| `WALLET_ENCRYPTION_SALT` | Salt for wallet encryption.                                | `random_salt_value`                            |
| `PRO_MEMBERSHIP_WALLET`  | Wallet receiving pro membership payments.                  | `CsTmcGZ5UMRzM2DmWLjayc2sTK2zumwfS4E8yyCFtK51` |
| `PRO_MEMBERSHIP_TOKEN`   | Token address for pro membership payments.                 | `4FkNq8RcCYg4ZGDWh14scJ7ej3m5vMjYTcWoJVkupump` |
| `PRO_MEMBERSHIP_COST`    | Cost of pro membership in $LUMO.                           | `22000`                                        |
| `FREE_USER_DAILY_LIMIT`  | Daily message limit for free users.                        | `10`                                           |
| `PRO_USER_DAILY_LIMIT`   | Daily message limit for pro users.                         | `200`                                          |

***

{% hint style="warning" %}
**Note:** Ensure all `POSTGRES_*` variables are correctly set up for database connectivity. The `WALLET_ENCRYPTION_SALT` should be a secure, random string.
{% endhint %}


# &#x20;Local Installation

This section provides step-by-step instructions to install and run LumoKit locally.

***

**🚨 Important: Installation Order**

The LumoKit frontend depends on a running LumoKit backend instance. Therefore, you **must install and start the backend first** before running the frontend.

**1. Backend Installation (`LumoKit` Backend)**

Follow these steps to set up the LumoKit backend:

1. **Clone the Repository:**
   * (The documentation provided does not specify the backend repository URL. Assuming you have access to it, clone it to your local machine.)
   * Example: `git clone https://github.com/Lumo-Labs-AI/lumo-frontend.git`
   * `cd lumokit`
2. **Ensure Pre-requisites:**
   * Verify Python 3.11+, PostgreSQL 13+, Makefile, Poetry, Docker, and Docker Compose are installed.
   * Ensure your PostgreSQL server is running.
3. **Environment Configuration:**
   * Copy the example environment file: `cp .env.example .env`
   * Edit the `.env` file with your specific configurations (Database details, API keys, Solana RPC URL, etc.) as detailed in the "Environment Configuration" page.
4. **Running the Application (using Docker and Make commands):**
   * **Ensure Docker is running on your system.**
   * **First-time setup** (builds containers and applies database migrations):Bash

     ```
     make build migrate
     ```
   * **To build the Docker containers** (if not the first time, or after changes):Bash

     ```
     make build
     ```
   * **To start the services:**&#x42;ash

     ```
     make up
     ```
   * **To check logs:**&#x42;ash

     ```
     make logs
     ```
   * **Convenience command to stop, rebuild, start, and view logs:**&#x42;ash

     ```
     make down build up logs
     ```
5. **Verify Backend Operation:**
   * Once the backend is running (`make up`), you can access the API documentation in your browser:
     * Swagger UI: `http://localhost/docs`
     * ReDoc: `http://localhost/redoc`
   * (Note: `http://localhost` implies the Docker setup maps the service to port 80 on your host, or you have a reverse proxy. Check `docker-compose.prod.yml` for exact port mappings if needed.)

***

**2. Frontend Installation (`lumokit-frontend`)**

Once the backend is running and accessible, proceed with the frontend installation:

1. **Clone the Repository:**

   Bash

   ```bash
   git clone https://github.com/Lumo-Labs-AI/lumokit-frontend.git
   ```
2. **Navigate to the Project Directory:**

   Bash

   ```bash
   cd lumokit-frontend
   ```
3. **Install Dependencies:**
   * Using `npm`:Bash

     ```bash
     npm install
     ```
   * Or using `yarn`:Bash

     ```bash
     yarn install
     ```
4. **Set up Environment Variables:**
   * Rename the `.env.example` file (located in the root of the `lumokit-frontend` project) to `.env.local`.
   * Update the variables within `.env.local`, ensuring `NEXT_PUBLIC_API_URL` points to your running backend (e.g., `http://localhost` if your backend is correctly mapped by Docker). Refer to the "Environment Configuration" page for details on all variables.
5. **Run the Development Server:**
   * Using `npm`:Bash

     ```bash
     npm run dev
     ```
   * Or using `yarn`:Bash

     ```bash
     yarn dev
     ```
6. **Access LumoKit Frontend:**
   * Open your browser and navigate to `http://localhost:3000` (or the port specified in your terminal, usually 3000 for Next.js applications).

***

{% hint style="success" %}
You should now have a locally running instance of LumoKit Frontend connected to your LumoKit Backend!
{% endhint %}


# How to Add Tools

<figure><img src="/files/1FInDb0NvqVHWEIb2BJO" alt=""><figcaption></figcaption></figure>

### 🛠️ How to Add New Tools to LumoKit (v1.0.0)

LumoKit's power lies in its extensible tools system, allowing you to integrate new on-chain actions and research capabilities. Adding a new tool involves implementing its logic in the backend, registering it within the core system and chat controller, and then making it available and configurable in the frontend. This guide will walk you through the comprehensive process.

***

#### 🌟 Overview of the Process

Adding a new tool to LumoKit generally follows these steps:

1. **Plan Your Tool:** Define its purpose, functionality, required inputs, and a unique identifier.
2. **Backend Implementation & Registration:** Create the core logic for your tool and integrate it into the LumoKit backend's tool system and chat controller.
3. **Frontend Configuration:** Define the tool's metadata and add its icon to the LumoKit frontend.
4. **Thorough Testing:** Ensure the tool works as expected end-to-end.

Let's break down each step:

***

#### **Step 1: Backend Implementation & Registration (`LumoKit` Backend)**

The backend is where your tool's core functionality resides and where it's made available to the AI agent.

**A. Create Your Tool Class**

1. **File Location:**

   * Create a new Python file in the `src/tools/` directory (e.g., `src/tools/my_new_tool.py`).
   * Alternatively, you can add your tool to an existing relevant file within `src/tools/`.

2. **Define Input Schema (Pydantic):**

   * If your tool requires specific input parameters, define a Pydantic `BaseModel` for its arguments. This ensures data validation.

   ```python
   # Example: src/tools/my_new_tool.py
   from pydantic import BaseModel, Field

   class MyNewToolInput(BaseModel):
       """Input schema for My New Tool."""
       target_address: str = Field(..., description="The Solana address to query.")
       some_parameter: int = Field(default=10, description="An optional parameter with a default value.")
   ```

3. **Implement the Tool Class:**

   * Your tool class must inherit from `langchain.tools.BaseTool`.
   * Define class variables:
     * `name`: A unique string identifier for the tool (e.g., `"my_new_tool_identifier"`). **This is crucial and will be used by the AI agent and for linking with the frontend.**
     * `description`: A clear explanation of what the tool does, its inputs, and expected outputs. **This description is vital for the LLM to understand when and how to use your tool.**
     * `args_schema`: Link to your Pydantic input schema class.
   * Implement the `_arun` asynchronous method for the tool's main logic.
   * Implement a `_run` synchronous method (often, this can just state that only async is supported if that's the case).

   ```python
   # Example: src/tools/my_new_tool.py (continued)
   from typing import ClassVar, Type
   from langchain.tools import BaseTool

   class MyNewTool(BaseTool):
       """
       My New Tool processes data for a given Solana address and an optional parameter.
       It returns a summary string based on the inputs.
       """
       name: ClassVar[str] = "my_new_tool_identifier" # Crucial identifier for the AI and frontend
       description: ClassVar[str] = (
           "Use this tool to get a processed summary for a specific Solana address. "
           "Input should be the target_address (string) and optionally some_parameter (integer)."
       )
       args_schema: ClassVar[Type[BaseModel]] = MyNewToolInput

       async def _arun(self, target_address: str, some_parameter: int = 10) -> str:
           """Execute the tool asynchronously."""
           # Your tool's core logic here
           return f"Successfully processed {target_address} with parameter {some_parameter}."

       def _run(self, target_address: str, some_parameter: int = 10) -> str:
           """Synchronous version."""
           return "This tool primarily supports asynchronous execution."
   ```

**B. Register Your Tool in the Backend System**

This involves making your tool recognizable by the LumoKit system.

1. **Export from `src/tools/__init__.py`:**

   * Open `src/tools/__init__.py`.
   * Import your new tool class.
   * Add your tool class name to the `__all__` list. This makes it easier to import tools from the `tools` module.

   ```python
   # Example: src/tools/__init__.py
   # ... other imports
   from .my_new_tool import MyNewTool # Assuming your file is my_new_tool.py

   # Add to __all__
   __all__ = [
       # ... other tools
       "MyNewTool",
       # ... other common exports like get_tools_system_message
   ]
   ```

   * **LLM Tool Descriptions:** The backend README previously mentioned adding tool descriptions to `TOOL_DESCRIPTIONS` in `init.py` (or a similar central mapping). This dictionary helps the LLM understand available tools. Ensure your tool's `name` and its AI-facing `description` are correctly registered here if this pattern is used in your project version. This is often vital for the AI agent's tool selection process.
2. **Integrate into Chat Controller (`src/api/chat/controllers.py`):** This is a critical step to make your tool available to the chat interface and the AI agent processing chat requests.

   * **Import your tool:** Add an import statement for your new tool class at the top of `src/api/chat/controllers.py` alongside other tool imports.

     ```python
     # Example: At the top of src/api/chat/controllers.py
     from tools import (
         # ... other existing tool imports
         MyNewTool # Your new tool
     )
     ```

   * **Instantiate your tool:** Within the relevant function or method where other tools are initialized (often in the main chat request handler), create an instance of your tool.

     ```python
     # Example: Inside a function/method in src/api/chat/controllers.py
     # ...
     my_new_tool_instance = MyNewTool()
     # ... other tool instantiations
     ```

   * **Add to `available_tools` dictionary:** Add your instantiated tool to the `available_tools` dictionary. The key for the dictionary entry **must be the string identifier of your tool** (i.e., `MyNewTool.name`, which is `"my_new_tool_identifier"` in our example). This dictionary is used to dynamically provide tools to the AI agent based on user selections or requests.

     Python

   ```python
   # Example: Continuing inside the function/method in src/api/chat/controllers.py

   # Instantiate other tools as per existing code
   rugcheck_token_information_tool = RugcheckTokenInformationTool()
   fluxbeam_token_price_tool = FluxBeamTokenPriceTool()
   # ... and so on for all tools

   # Your new tool instance
   my_new_tool_instance = MyNewTool() # Ensure this is done if not above

   # Process requested additional tools (or however tools are gathered)
   available_tools = {
       "rugcheck_token_information_tool": rugcheck_token_information_tool,
       "fluxbeam_token_price_tool": fluxbeam_token_price_tool,
       # ... other existing tools mapped by their string identifiers

       "my_new_tool_identifier": my_new_tool_instance # Add your new tool here
   }

   # The rest of the logic that uses available_tools...
   # active_tools = [available_tools[tool_name] for tool_name in requested_tools if tool_name in available_tools]
   ```

***

#### **Step 2: Frontend Configuration (`lumokit-frontend`)**

Once the backend logic is in place and registered, you need to make the tool accessible and configurable from the LumoKit frontend.

**A. Define the Tool in `data/tools.json`**

1. **Locate the File:**
   * Open the `data/tools.json` file in the root of your `lumokit-frontend` project.
2. **Add a New Tool Entry:**

   * Add a new JSON object to the array in `data/tools.json` for your tool.

   ```json
   // Example entry in data/tools.json
   {
     "icon_url": "/icons/my_new_tool_icon.svg",
     "default_status": false,
     "tool_identifier": "my_new_tool_identifier", // MUST MATCH backend tool 'name' and controller key
     "name": "My New Awesome Tool",
     "category": "Data Analysis",
     "description": "Fetches and processes data from a Solana address.",
     "read_more": "https://your-docs-link.com/my-new-tool"
   }
   ```

**Key Fields Explained:**

* `icon_url`: Path to the tool's icon (relative to `/public`).
* `default_status`: Boolean (`true` if enabled by default, `false` otherwise).
* `tool_identifier`: **String. Critical field.** Must exactly match the `name` class variable in your backend tool class (e.g., `"my_new_tool_identifier"`) AND the key used in the `available_tools` dictionary in `src/api/chat/controllers.py`.
* `name`: String. User-friendly display name in the UI.
* `category`: String. Groups tools in "Tools & Settings".
* `description`: String. Short (10-15 words) user-facing explanation.
* `read_more`: String. Optional URL to detailed documentation.

**B. Add the Tool's Icon**

1. **Create/Obtain Icon:** SVG or PNG recommended.
2. **Place Icon:** In `/public/` or a subdirectory (e.g., `/public/icons/`) in `lumokit-frontend`.
3. Ensure `icon_url` in `data/tools.json` points to it correctly.

***

#### **Step 3: Testing Your New Tool**

Thorough testing is essential.

1. **Backend Tests:** Write unit/integration tests for your tool's logic.
2. **Restart Services:** Rebuild and restart both the LumoKit backend and frontend development server to load all changes.
3. **End-to-End Frontend UI Testing:**
   * Open LumoKit in your browser.
   * Navigate to "Tools & Settings" and verify your tool appears correctly.
   * Enable your tool.
   * Use the chat interface with prompts designed to trigger your new tool. Check:
     * Correct tool selection by the AI.
     * Proper argument passing.
     * Successful execution in the backend (check logs).
     * Correct results/display in the frontend.
4. **Iterate:** Debug and refine as necessary. Pay close attention to logs and console outputs.

***

#### ✨ Best Practices & Important Considerations

* **Consistent Naming:** Use lowercase with underscores for the shared `tool_identifier`/`name`.
* **Clear Descriptions:**
  * **Backend `description` (in tool class):** Explicit for the LLM (capabilities, inputs, use cases).
  * **Frontend `description` (in `tools.json`):** Concise and user-friendly.
* **Robust Error Handling:** Implement in your backend tool's `_arun` method.
* **Performance:** Be mindful of tool execution time. Limit default tools.
* **Security:** Adhere to security best practices if handling sensitive data or actions.
* **Documentation:** Use `read_more` for complex tools.

***

{% hint style="success" %}
By following these updated and detailed steps, you can effectively extend LumoKit's capabilities by adding new, powerful tools tailored to your needs within the Solana ecosystem!
{% endhint %}


# Tools

<figure><img src="/files/QYqHBBkpvsTJIH5GA5Sf" alt=""><figcaption></figcaption></figure>

### 🌟 Explore the Sidebar to Discover More

Browse through the sidebar and choose any tool to learn more about the powerful tools.


# Wallet Portfolio tool

#### Wallet Portfolio Tool (`wallet_portfolio_tool`)

Provides a quick overview of token balances and their USD values for a specified Solana wallet. Ideal for checking a user's current holdings.

{% hint style="info" %}
**Input:** Requires a Solana wallet public key (`agent_public`).
{% endhint %}

```python
class WalletPortfolioInput(BaseModel):
    agent_public: Optional[str] # The public key of the wallet
```

**Key Functionality:**

* Displays detailed info for tokens valued at $0.20 USD or more.
* Summarizes tokens below this value, showing count and total worth.
* Calculates and shows the total portfolio value in USD.
* Data is fetched via the `get_wallet_portfolio_ds()` .

***

**Sample Usage Queries (How an AI might use it):**

* "What's my portfolio"
* "How much LUMO do I hold?"
* "What are my Solana balances?" (Note: While this is SOL's mint, the tool expects a wallet address)
* "What's the value of the assets?"
* "Display the holdings for the connected wallet." (If `agent_public` is pre-filled)
* "Check my token balances." (If wallet is known)
* "What's the current portfolio status?"
* "List all tokens and their values."
* "How much is worth?"
* "Provide a summary of assets for wallet."

***

**Quick Code Glance:**

```python
class WalletPortfolioTool(BaseTool):
    name: ClassVar[str] = "wallet_portfolio_tool"
    description: ClassVar[str] = "Get detailed information about all tokens held in a wallet..."
    args_schema: ClassVar[Type[BaseModel]] = WalletPortfolioInput
```

***

**Important:**

* This tool operates **asynchronously** (`_arun`).
* Output accuracy depends on the external data provider.


# Token Identification Tool

#### Token Identification Tool (`token_identification_tool`)

Helps find the contract address and other basic information (name, ticker) for a Solana token by searching its name or ticker symbol. Essential for when you need a token's address.

{% hint style="info" %}
**Input:** Requires a token `identifier` (name or ticker).
{% endhint %}

```python
class TokenIdentificationInput(BaseModel):
    identifier: str # e.g., 'Raydium', 'RAY', '$RAY'
```

**Key Functionality:**

* Searches for tokens using the provided name or ticker (e.g., "Bonk", "RAY", "$USDC").
* Looks up information from a **predefined, internal list** of known tokens (`TOKEN_DATA`).
* Returns the token's full name, ticker, and Solana contract address if found.
* Supports exact and partial matches (case-insensitive).

***

**Sample Usage Queries (How an AI might use it):**

* "What is the contract address for Raydium?"
* "Find the token address for $WIF."
* "Identify the token with ticker SOL." (Note: This tool is primarily for SPL tokens; SOL itself doesn't have a contract address in the same way)
* "Get me the details for the 'Bonk' token."
* "Look up token info for 'USDC'."
* "Search for a token named 'Jupiter Perpetuals'."
* "What's the mint address for 'mSOL'?"
* "Find token 'dogwifhat'."
* "Can you identify the 'RENDER' token?"
* "I need the address for 'LUMO'."

***

**Quick Code Glance:**

```python
class TokenIdentificationTool(BaseTool):
    name: ClassVar[str] = "token_identification_tool"
    description: ClassVar[str] = "Get token information by name or ticker..."
    args_schema: ClassVar[Type[BaseModel]] = TokenIdentificationInput
    # TOKEN_DATA: ClassVar[Dict[str, Dict[str, str]]] = { ... } # Internal list
```

**Important:**

* This tool operates **asynchronously** (`_arun`).
* The list of identifiable tokens is based on a **static, hardcoded dictionary** within the tool. It will only find tokens present in this internal list.


# Rugcheck Token Information Tool

#### Rugcheck Token Information Tool (`rugcheck_token_information_tool`)

Fetches a detailed token analysis report from `rugcheck.xyz`. This tool is essential for assessing a token's fundamentals, including potential risks, holder distribution, and liquidity.

{% hint style="info" %}
**Input:** Requires a Solana token contract `token_address`.
{% endhint %}

```python
class RugcheckTokenInformationInput(BaseModel):
    token_address: str # The token address to check on rugcheck.xyz
```

**Key Functionality:**

* Retrieves a comprehensive report for the given token address from the `rugcheck.xyz` API.
* Provides insights on:
  * Creator details (address, balance).
  * Token supply and distribution (top holders, insider status).
  * Liquidity market information.
  * Rugcheck score and a list of identified potential risks.

***

**Sample Usage Queries (How an AI might use it):**

* "Get the rugcheck report for token `EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm`."
* "Run a rugcheck on `DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263`."
* "What does rugcheck.xyz say about `4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R`?"
* "Analyze token `HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3` for risks."
* "Fetch rugcheck details for mint address `token_mint_address_placeholder`."
* "Show me the top holders and liquidity for `another_token_address` via rugcheck."
* "What is the rugcheck score for `contract_addr_here`?"
* "Check `mint_XYZ` on rugcheck."
* "How does FARTCOIN look like on rugcheck?"

***

```python
class RugcheckTokenInformationTool(BaseTool):
    name: ClassVar[str] = "rugcheck_token_information_tool"
    description: ClassVar[str] = "Get detailed token information including creator details, supply, top holders..."
    args_schema: ClassVar[Type[BaseModel]] = RugcheckTokenInformationInput
```

***

**Important:**

* This tool operates **asynchronously** (`_arun`).
* Relies entirely on the external `rugcheck.xyz` API; its availability and the data's accuracy depend on this third-party service.


# &#x20;Fluxbeam Token Price

#### FluxBeam Token Price Tool (`fluxbeam_token_price_tool`)

Fetches the current price of a specified Solana token in USD, utilizing the FluxBeam API. Useful for quick price checks.

{% hint style="info" %}
**Input:** Requires a Solana token contract `token_address`.
{% endhint %}

```python
class FluxBeamTokenPriceInput(BaseModel):
    token_address: str # The token address to check price on FluxBeam
```

**Key Functionality:**

* Retrieves the token's current price in USD from `data.fluxbeam.xyz`.
* Formats the price to 5 decimal places for consistency.

***

**Sample Usage Queries (How an AI might use it):**

* "What's the FluxBeam price for token `EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm`?"
* "Get the current price of `DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263` from FluxBeam."
* "Fetch the FluxBeam USD price for `4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R`."
* "Use FluxBeam to find the price of `HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3`."
* "Check FluxBeam for the price of mint `token_mint_address_placeholder`."
* "Price check `another_token_address` via FluxBeam."
* "FluxBeam price for `contract_addr_here`?"

***

```python
class FluxBeamTokenPriceTool(BaseTool):
    name: ClassVar[str] = "fluxbeam_token_price_tool"
    description: ClassVar[str] = "Get the current price of a token in USD (USD) from FluxBeam."
    args_schema: ClassVar[Type[BaseModel]] = FluxBeamTokenPriceInput
```

***

**Important:**

* Primarily designed for **asynchronous** execution (`_arun`). The synchronous version will return an informational message.
* Relies on the external `data.fluxbeam.xyz` API; functionality and data accuracy depend on this third-party service.


# BirdEye Token Trending

#### BirdEye Token Trending Tool (`birdeye_token_trending_tool`)

Fetches a list of the top trending tokens on the Solana network directly from the BirdEye API, providing insights into current market movers.

***

```python
class BirdeyeTokenTrendingInput(BaseModel):
    limit: int = 10 # Number of tokens (default 10, max 20)
```

**Key Functionality:**

* Retrieves top trending Solana tokens from `public-api.birdeye.so`.
* Includes key metrics for each token: price, 24h price change (with visual emoji), market cap, 24h volume, liquidity, and contract address.
* The number of results can be specified (up to a maximum of 20).

***

**Sample Usage Queries (How an AI might use it):**

* "What are the top 10 trending tokens on Solana right now according to BirdEye?"
* "Show me the 5 hottest tokens on Solana."
* "Get BirdEye's trending list for Solana tokens."
* "List the top trending tokens with a limit of 15."
* "Which tokens are currently trending on Solana via BirdEye?"
* "Fetch the top 20 trending Solana coins from BirdEye."
* "Can you show me BirdEye's trending tokens?"
* "What's hot on Solana according to BirdEye?"

***

**Quick Code Glance:**

```python
class BirdeyeTokenTrendingTool(BaseTool):
    name: ClassVar[str] = "birdeye_token_trending_tool"
    description: ClassVar[str] = "Get a list of top trending tokens on Solana..."
    args_schema: ClassVar[Type[BaseModel]] = BirdeyeTokenTrendingInput
```

***

**Important:**

* This tool operates **asynchronously** (`_arun`) only.
* Requires a valid BirdEye API key (`CONFIG.BIRDEYE_API_KEY`) to be configured in the backend.
* The `limit` parameter defaults to 10 and is capped at a maximum of 20 tokens.


# Birdeye All Time Trades

**BirdEye All Time Trades Tool (`birdeye_all_time_trades_tool`)**

Retrieves comprehensive all-time trade statistics for a specific Solana token using the BirdEye API. This offers insights into a token's historical trading activity, including volumes and buy/sell pressure.

```python
class BirdeyeAllTimeTradesInput(BaseModel):
    token_address: str # The token address for all-time trade data
```

***

**Key Functionality:**

* Fetches all-time trade data for the specified token from `public-api.birdeye.so`.
* Provides statistics like total trades, buy/sell counts, total volume (in token and USD), and a buy-to-sell ratio.

***

**Sample Usage Queries (How an AI might use it):**

* "Get the all-time trade stats for token `EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm` from BirdEye."
* "Show me the historical trade data for `DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263`."
* "What are the lifetime buy/sell volumes for `4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R` on BirdEye?"
* "Analyze the all-time trading activity for `HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3`."
* "Fetch BirdEye's all-time trade summary for mint address `token_mint_address_placeholder`."
* "What's the buy/sell ratio for `another_token_address` based on its entire history?"
* "Retrieve all-time trade volumes for `contract_addr_here` via BirdEye."

***

**Quick Code Glance:**

```python
class BirdeyeAllTimeTradesTool(BaseTool):
    name: ClassVar[str] = "birdeye_all_time_trades_tool"
    description: ClassVar[str] = "Get comprehensive trade statistics (buys, sells, volumes) of all time..."
    args_schema: ClassVar[Type[BaseModel]] = BirdeyeAllTimeTradesInput
```

***

**Important:**

* This tool operates **asynchronously** (`_arun`) only.
* Requires a valid BirdEye API key (`CONFIG.BIRDEYE_API_KEY`) to be configured in the backend.
* A valid Solana token address is necessary for meaningful results.


# CoinMarketCap Crypto News

#### CMC Crypto News Tool (`cmc_crypto_news_tool`)

Fetches the latest general cryptocurrency news articles by scraping CoinMarketCap's news headlines. Keeps you updated with recent happenings in the crypto space.

***

```python
class CMCCryptoNewsInput(BaseModel):
    limit: int = 8 # Number of articles (default 8, max 8)
```

***

**Key Functionality:**

* Scrapes the latest crypto news headlines and summaries from `coinmarketcap.com/headlines/news/`.
* For each article, it attempts to extract the heading, a brief body/summary, associated crypto tickers, and how long ago it was posted.
* The number of articles returned is controlled by `limit`, effectively capped at 8.

***

**Sample Usage Queries (How an AI might use it):**

* "What's the latest crypto news from CoinMarketCap?"
* "Fetch the top 5 recent crypto news articles."
* "Get today's crypto headlines via CMC."
* "Show me the newest updates in the cryptocurrency world."
* "Can you retrieve some crypto news for me?"
* "What are the current news stories on CoinMarketCap?"
* "Give me a summary of recent crypto events."
* "Fetch 3 crypto news items."

***

**Quick Code Glance:**

```python
class CMCCryptoNewsTool(BaseTool):
    name: ClassVar[str] = "cmc_crypto_news_tool"
    description: ClassVar[str] = "Get the latest crypto news from CoinMarketCap."
    args_schema: ClassVar[Type[BaseModel]] = CMCCryptoNewsInput
```

***

**Important:**

* This tool operates **asynchronously** (`_arun`) only.
* Relies on **web scraping** CoinMarketCap, which means its functionality can be affected by changes to the website's structure.
* The `limit` for news articles defaults to 8 and is also capped at a maximum of 8.


# Crypto.news Memecoin News

#### Crypto.news Memecoins News Tool (`cn_memecoins_news_tool`)

Fetches the latest news articles specifically tagged under "meme-coin" from `crypto.news`. Ideal for staying updated on developments in the memecoin sector.

***

```python
class CNMemecoinsNewsInput(BaseModel):
    limit: int = 8 # Number of articles (default 8, max 8)
```

***

**Key Functionality:**

* Scrapes the latest memecoin-specific news from `crypto.news/tag/meme-coin/`.
* For each article, it extracts the heading, a summary, any associated tickers mentioned, and the time it was posted.
* The number of articles returned is controlled by `limit`, effectively capped at 8.

***

**Sample Usage Queries (How an AI might use it):**

* "What's the latest news about memecoins from Crypto.news?"
* "Get me the top 5 recent memecoin articles."
* "Fetch today's memecoin headlines from Crypto.news."
* "Show me the newest updates in the memecoin space."
* "Can you retrieve some memecoin news for me via Crypto.news?"
* "What are the current news stories about meme coins on Crypto.news?"
* "Give me a summary of recent memecoin events reported by Crypto.news."
* "Fetch 3 memecoin news items from Crypto.news."

***

```python
class CNMemecoinsNewsTool(BaseTool):
    name: ClassVar[str] = "cn_memecoins_news_tool"
    description: ClassVar[str] = "Get the latest memecoin news from Crypto.news."
    args_schema: ClassVar[Type[BaseModel]] = CNMemecoinsNewsInput
```

***

**Important:**

* This tool operates **asynchronously** (`_arun`) only.
* Relies on **web scraping** `crypto.news`, so functionality may be impacted by website changes.
* The `limit` for news articles defaults to 8 and is also capped at a maximum of 8.


# GeckoTerminal Trending Pump.Fun Tool

#### GeckoTerminal Trending Pump.fun Tokens Tool (`geckoterminal_trending_pumpfun_tool`)

Fetches the latest top 10 trending tokens from the Pump.fun category (PumpSwap DEX) on GeckoTerminal, sorted by 24-hour trading volume. Useful for discovering currently active Pump.fun tokens.

{% hint style="info" %}
**Input:** Accepts an optional `limit`, but note the implementation currently **always fetches the top 10 tokens** regardless of this input.
{% endhint %}

```
class GTPumpFunTrendingInput(BaseModel):
    limit: int = 10 # Number of tokens (currently fixed to 10 in execution)
```

***

**Key Functionality:**

* Retrieves the top 10 trending Pump.fun (PumpSwap) tokens from the GeckoTerminal API, sorted by 24-hour USD volume.
* Provides details for each token: name, price, price change percentages (5m, 1h, 6h, 24h), 24h volume, liquidity, and FDV.

***

**Sample Usage Queries (How an AI might use it):**

* "What are the current trending tokens on Pump.fun according to GeckoTerminal?"
* "Show me the top 10 Pump.fun tokens by volume from GeckoTerminal."
* "Get GeckoTerminal's trending list for Pump.fun."
* "Which Pump.fun tokens are hot right now on GeckoTerminal?"
* "Fetch trending PumpSwap pools from GeckoTerminal."
* "List the most active Pump.fun tokens via GeckoTerminal."
* "Can you show me GeckoTerminal's trending Pump.fun tokens?"

***

```
class GTPumpFunTrendingTool(BaseTool):
    name: ClassVar[str] = "geckoterminal_trending_pumpfun_tool"
    description: ClassVar[str] = "Get the latest trending tokens from the Pump.fun category on GeckoTerminal."
    args_schema: ClassVar[Type[BaseModel]] = GTPumpFunTrendingInput
```

***

**Important:**

* This tool operates primarily **asynchronously** (`_arun`). The synchronous version returns an informational message.
* Relies on the external `api.geckoterminal.com` API.
* The number of tokens returned is **fixed at 10** in the current implementation, regardless of the `limit` input.


# CoinGecko Global Crypto Data Tool

#### CoinGecko Global Crypto Data Tool (`coingecko_global_crypto_data_tool`)

Fetches an overview of the global cryptocurrency market from CoinGecko, including total market capitalization, trading volume, and dominance percentages for major coins.

***

{% hint style="info" %}
**Input:** This tool requires **no specific input**.
{% endhint %}

```python
class CoinGeckoGlobalCryptoDataInput(BaseModel):
    pass # No input needed
```

***

**Key Functionality:**

* Retrieves overall global cryptocurrency market statistics from the `api.coingecko.com`.
* Provides data such as:
  * Total market cap (USD) and its 24h change.
  * 24h trading volume (USD).
  * Market dominance of coins like BTC, ETH, etc.
  * Number of active cryptocurrencies and markets.
  * Last data update time.

***

**Sample Usage Queries (How an AI might use it):**

* "What's the current global crypto market cap according to CoinGecko?"
* "Show me the overall cryptocurrency market status."
* "Get global crypto data from CoinGecko."
* "What is Bitcoin's current market dominance?"
* "Fetch the total trading volume for the crypto market."
* "Give me a global cryptocurrency market overview from CoinGecko."
* "How many active cryptocurrencies are there globally?"
* "What's the 24-hour change in the total crypto market cap?"

***

```python
class CoinGeckoGlobalCryptoDataTool(BaseTool):
    name: ClassVar[str] = "coingecko_global_crypto_data_tool"
    description: ClassVar[str] = "Get global cryptocurrency market data including market cap, volume, and dominance percentages."
    args_schema: ClassVar[Type[BaseModel]] = CoinGeckoGlobalCryptoDataInput
```

***

**Important:**

* This tool operates **asynchronously** (`_arun`) only.
* Relies on the external CoinGecko API (`api.coingecko.com`); its functionality and data accuracy depend on this third-party service.


# CoinGecko Trending Crypto Tool

#### CoinGecko Trending Tool (`coingecko_trending_tool`)

Fetches the top 7 trending cryptocurrencies (most searched by users) and top 5 trending NFTs (by trading volume) from CoinGecko. Provides a snapshot of what's currently popular.

{% hint style="info" %}
**Input:** This tool requires **no specific input**.
{% endhint %}

```python
class CoinGeckoTrendingInput(BaseModel):
    pass # No input needed
```

***

**Key Functionality:**

* Retrieves trending coins and NFTs directly from the `api.coingecko.com`.
* For trending coins, it lists name, symbol, rank, price in BTC, and 24h USD price change.
* For trending NFTs, it lists name, symbol, floor price, and 24h floor price change.

***

**Sample Usage Queries (How an AI might use it):**

* "What are the trending coins and NFTs on CoinGecko right now?"
* "Show me CoinGecko's top trending searches."
* "Get the list of trending cryptocurrencies from CoinGecko."
* "Which NFTs are trending on CoinGecko today?"
* "Fetch the current trending crypto assets according to CoinGecko."
* "What's popular on CoinGecko?"
* "List CoinGecko's trending coins and NFTs."

***

```python
class CoinGeckoTrendingTool(BaseTool):
    name: ClassVar[str] = "coingecko_trending_tool"
    description: ClassVar[str] = "Get top trending coins and NFTs on CoinGecko based on user searches and trading volume."
    args_schema: ClassVar[Type[BaseModel]] = CoinGeckoTrendingInput
```

***

**Important:**

* This tool operates **asynchronously** (`_arun`) only.
* Relies on the external CoinGecko API (`api.coingecko.com`); functionality and data accuracy depend on this third-party service.


# CoinGecko Exchange Rates Tool

#### CoinGecko Exchange Rates Tool (`coingecko_exchange_rates_tool`)

Fetches current exchange rates for 1 Bitcoin (BTC) against a list of major cryptocurrencies, fiat currencies, and commodities, as provided by CoinGecko.

***

```python
class CoinGeckoExchangeRatesInput(BaseModel):
    pass # No input needed
```

***

**Key Functionality:**

* Retrieves Bitcoin's exchange rates against other assets from `api.coingecko.com`.
* Displays how many units of selected major cryptocurrencies (e.g., ETH, SOL), fiat currencies (e.g., USD, EUR), and commodities (e.g., Gold) are equivalent to 1 BTC.

***

**Sample Usage Queries (How an AI might use it):**

* "What are the current Bitcoin exchange rates from CoinGecko?"
* "Show me BTC's value against major currencies and cryptos."
* "Get the CoinGecko exchange rates for Bitcoin."
* "How much ETH or USD is 1 Bitcoin worth right now?"
* "Fetch current BTC exchange rates."
* "What are the Bitcoin rates against fiat and other top coins on CoinGecko?"
* "Provide a summary of Bitcoin's exchange rates."

***

```python
class CoinGeckoExchangeRatesTool(BaseTool):
    name: ClassVar[str] = "coingecko_exchange_rates_tool"
    description: ClassVar[str] = "Get Bitcoin-to-currency exchange rates for major cryptocurrencies, fiat currencies, and commodities."
    args_schema: ClassVar[Type[BaseModel]] = CoinGeckoExchangeRatesInput
```

***

**Important:**

* This tool operates **asynchronously** (`_arun`) only.
* Relies on the external CoinGecko API (`api.coingecko.com`); functionality and data accuracy depend on this third-party service.


# CoinGecko Coin Data Tool

#### CoinGecko Coin Data Tool (`coingecko_coin_data_tool`)

Fetches detailed market data (price, volume, market cap, etc.) for one or more specific cryptocurrencies from CoinGecko. Accepts common coin names or tickers.

***

```python
class CoinGeckoCoinDataInput(BaseModel):
    coinname: str # e.g., "bitcoin", "sol", "ethereum,cardano"
```

***

**Key Functionality:**

* Retrieves current market data for specified cryptocurrencies from `api.coingecko.com`.
* Handles common names (e.g., "bitcoin", "solana") and tickers (e.g., "BTC", "SOL") using an internal mapping to CoinGecko IDs.
* Provides price, market cap, rank, 24h volume, 24h price range, and 24h price change.

***

**Sample Usage Queries (How an AI might use it):**

* "Get the CoinGecko data for Bitcoin."
* "What's the current price and market cap of Ethereum and Solana?"
* "Fetch market details for $SOL."
* "Show me the CoinGecko info for Cardano, Polkadot, and Avalanche."
* "Get data for dogecoin."
* "What are the stats for Wrapped Bitcoin (WBTC) from CoinGecko?"
* "Find CoinGecko market data for Bonk."
* "Fetch details for 'shiba inu'."

***

```python
class CoinGeckoCoinDataTool(BaseTool):
    name: ClassVar[str] = "coingecko_coin_data_tool"
    description: ClassVar[str] = "Get detailed market data (price, volume, market cap) for specific cryptocurrencies..."
    args_schema: ClassVar[Type[BaseModel]] = CoinGeckoCoinDataInput
```

***

**Important:**

* This tool operates **asynchronously** (`_arun`) only.
* Relies on the external CoinGecko API; functionality and data accuracy depend on this service.
* Uses an internal list to map common coin names/tickers to CoinGecko IDs; for less common coins, the exact CoinGecko ID might be needed if not in the mapping.


# CoinMarketCap Trending Coins Tool

**CMC Trending Coins Tool (`cmc_trending_coins_tool`)**

Fetches a list of the top active cryptocurrencies ranked by market capitalization from the CoinMarketCap (CMC) Pro API, providing key market data for each.

{% hint style="info" %}
**Input:** Accepts an optional `limit` for the number of coins to retrieve.
{% endhint %}

```python
class CMCTrendingCoinsInput(BaseModel):
    limit: int = 20 # Number of coins (default 20, max 100)
```

***

**Key Functionality:**

* Retrieves a list of top cryptocurrencies (e.g., Bitcoin, Ethereum) sorted by market cap from the `pro-api.coinmarketcap.com`.
* For each coin, it provides its CMC rank, name, symbol, current price in USD, market capitalization, and 24-hour price change percentage.
* The number of results can be specified using `limit`, up to a maximum of 100.

***

**Sample Usage Queries (How an AI might use it):**

* "What are the top 10 cryptocurrencies by market cap from CoinMarketCap?"
* "Show me the leading 25 coins according to CMC."
* "Get CoinMarketCap's list of top cryptocurrencies."
* "List the top coins with a limit of 50 from CMC."
* "Which coins are currently at the top of CoinMarketCap rankings?"
* "Fetch the top 100 crypto listings from CMC."
* "Can you show me CoinMarketCap's main cryptocurrency list?"
* "What are the leading cryptocurrencies today via CMC?"

***

```python
class CMCTrendingCoinsTool(BaseTool):
    name: ClassVar[str] = "cmc_trending_coins_tool"
    description: ClassVar[str] = "Get a list of all active cryptocurrencies with latest market data from CoinMarketCap."
    args_schema: ClassVar[Type[BaseModel]] = CMCTrendingCoinsInput
```

***

**Important:**

* This tool operates **asynchronously** (`_arun`) only.
* Requires a valid CoinMarketCap Pro API Key (`CONFIG.CMC_API_KEY`) to be configured in the backend.
* The `limit` parameter defaults to 20 and is capped at a maximum of 100 coins.


# DexScreener Top Boosts Tool

#### DexScreener Top Boosts Tool (`dexscreener_top_boosts_tool`)

Fetches a list of tokens that currently have the most active "boosts" on DexScreener. This can indicate trending projects or tokens gaining community attention across various blockchains.

{% hint style="info" %}
**Input:** Accepts an optional `limit` for the number of boosted tokens to retrieve.
{% endhint %}

```python
class DexScreenerTopBoostsInput(BaseModel):
    limit: int = 10 # Number of tokens (default 10, max 30)
```

***

**Key Functionality:**

* Retrieves the top boosted tokens from the `api.dexscreener.com`.
* For each token, it provides the chain, token address, total boost amount, a brief description, and associated links (like website or socials).
* The number of results can be specified using `limit`, up to a maximum of 30.

***

**Sample Usage Queries (How an AI might use it):**

* "What are the top boosted tokens on DexScreener right now?"
* "Show me the 15 most boosted tokens via DexScreener."
* "Get DexScreener's list of top token boosts."
* "Which tokens are currently being boosted heavily on DexScreener?"
* "Fetch the top boosted tokens with a limit of 5 from DexScreener."
* "List projects with the most active boosts on DexScreener."
* "Can you show me DexScreener's top boosts?"

***

```python
class DexScreenerTopBoostsTool(BaseTool):
    name: ClassVar[str] = "dexscreener_top_boosts_tool"
    description: ClassVar[str] = "Get the tokens with most active boosts on DexScreener..."
    args_schema: ClassVar[Type[BaseModel]] = DexScreenerTopBoostsInput
```

***

**Important:**

* This tool operates primarily **asynchronously** (`_arun`). The synchronous version returns an informational message.
* Relies on the external DexScreener API (`api.dexscreener.com`); its functionality and data accuracy depend on this third-party service.
* The `limit` parameter defaults to 10 and is capped at a maximum of 30 tokens.


# DexScreener Token Information

#### DexScreener Token Information Tool (`dexscreener_token_information_tool`)

Fetches detailed Decentralized Exchange (DEX) market data for one or more specified token addresses from DexScreener. Provides insights into price, volume, liquidity, and trading activity on a given blockchain (defaults to Solana).

{% hint style="info" %}
**Input:** Requires a comma-separated list of `token_addresses` and an optional `chain_id`.
{% endhint %}

```python
class DexScreenerTokenInformationInput(BaseModel):
    token_addresses: str  # e.g., "So1111...1112,EPjF...TDt1v" (max 10)
    chain_id: str = "solana" # Blockchain ID (e.g., "ethereum", "bsc")
```

***

**Key Functionality:**

* Retrieves detailed DEX information for up to 10 token addresses from `api.dexscreener.com`.
* For each token/pair found, it includes: price (USD & native), 24h price change, 24h volume, liquidity, transaction counts, market cap (if available), and a link to the pair on DexScreener.
* Supports various blockchains via the `chain_id` parameter.

***

**Sample Usage Queries (How an AI might use it):** *(Note: For queries using names/tickers, the system would first use a token identification tool to get addresses.)*

* "Get DexScreener info for token `DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263` on Solana."
* "Show me the DexScreener data for Wrapped SOL and USDC on the solana chain."
* "Fetch DEX details for Raydium and Serum from DexScreener."
* "What's the trading activity for Jito (`jtojt...mCL`) according to DexScreener?"
* "Look up details for mint `token_mint_address_placeholder` on Ethereum using DexScreener."
* "Get DexScreener info for LUMO, FARTCOIN, and GOAT." (Defaults to Solana if chain not specified)
* "DexScreener details for `contract_addr1,contract_addr2` on bsc chain?"

***

**Quick Code Glance:**

```python
class DexScreenerTokenInformationTool(BaseTool):
    name: ClassVar[str] = "dexscreener_token_information_tool"
    description: ClassVar[str] = "Get detailed DEX information about Solana tokens including price, volume, liquidity, and trading activity."
    args_schema: ClassVar[Type[BaseModel]] = DexScreenerTokenInformationInput
```

***

**Important:**

* This tool operates primarily **asynchronously** (`_arun`). The synchronous version returns an informational message.
* Relies on the external DexScreener API (`api.dexscreener.com`); functionality and data accuracy depend on this service.
* Can query a maximum of 10 token addresses per call.
* Ensure the `chain_id` is correct if querying tokens outside of Solana.


# Jupiter Token Price

#### Jupiter Token Price Tool (`jupiter_token_price_tool`)

Fetches the current price in USD for one or more Solana tokens using their contract addresses, via the Jupiter API. Essential for getting up-to-date pricing information.

{% hint style="info" %}
**Input:** Requires one or more comma-separated Solana `token_addresses`.
{% endhint %}

```python
class JupiterTokenPriceInput(BaseModel):
    token_addresses: str # e.g., "So1111...1112,EPjF...TDt1v"
```

***

**Key Functionality:**

* Retrieves current USD prices for the provided Solana token addresses from `lite-api.jup.ag`.
* Can fetch prices for multiple token addresses in a single call.
* Prices are formatted to 6 decimal places.

***

**Sample Usage Queries (How an AI might use it):** *(Note: For queries using names/tickers, the system would first use a token identification tool to get addresses.)*

* "What's the Jupiter price for token `DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263`?"
* "Get the current price of Wrapped SOL (`So1111...1112`) and USDC (`EPjF...TDt1v`) from Jupiter."
* "Fetch Jupiter USD prices for Raydium and Serum."
* "Use Jupiter to find the price of Jito (`jtojt...mCL`)."
* "Check Jupiter for the price of mint `token_mint_address_placeholder`."
* "What are the current Jupiter prices for LUMO, FARTCOIN, and GOAT?"
* "Jupiter price check for `contract_addr1,contract_addr2`."

***

```python
class JupiterTokenPriceTool(BaseTool):
    name: ClassVar[str] = "jupiter_token_price_tool"
    description: ClassVar[str] = "Get the current price of one or more Solana tokens in USD from Jupiter..."
    args_schema: ClassVar[Type[BaseModel]] = JupiterTokenPriceInput
```

***

**Important:**

* This tool operates primarily **asynchronously** (`_arun`). The synchronous version returns an informational message.
* Relies on the external Jupiter API (`lite-api.jup.ag`); functionality and data accuracy depend on this service.
* Input must be valid Solana token contract addresses, comma-separated if multiple.


# Jupiter Token Metadata Tool

**Jupiter Token Information Tool (`jupiter_token_information_tool`)**

Fetches detailed metadata and information for a specific Solana token using its contract address, via the Jupiter API. Provides insights into a token's attributes and characteristics.

{% hint style="info" %}
**Input:** Requires a Solana `token_address`.
{% endhint %}

```python
class JupiterTokenInformationInput(BaseModel):
    token_address: str # The token address to get information about
```

***

**Key Functionality:**

* Retrieves comprehensive information for the provided Solana token address from `lite-api.jup.ag`.
* Includes details like the token's name, symbol, decimals, logo URI, daily volume, creation/minting timestamps, tags, and any additional metadata/extensions.

***

**Sample Usage Queries (How an AI might use it):** *(Note: For queries using names/tickers, the system would first use a token identification tool to get addresses.)*

* "Get Jupiter token information for `DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263`."
* "Show me the details for Wrapped SOL (`So1111...1112`) from Jupiter."
* "Fetch token metadata for Raydium using Jupiter."
* "What information does Jupiter have on the Jito token (`jtojt...mCL`)?"
* "Look up details for mint `token_mint_address_placeholder` on Jupiter."
* "Get token info for LUMO, FARTCOIN, and GOAT via Jupiter."
* "Jupiter token details for `contract_addr_here`?"

***

```python
class JupiterTokenInformationTool(BaseTool):
    name: ClassVar[str] = "jupiter_token_information_tool"
    description: ClassVar[str] = "Get detailed token information and metadata for a specific Solana token from Jupiter..."
    args_schema: ClassVar[Type[BaseModel]] = JupiterTokenInformationInput
```

***

**Important:**

* This tool operates primarily **asynchronously** (`_arun`). The synchronous version returns an informational message.
* Relies on the external Jupiter API (`lite-api.jup.ag`); functionality and data accuracy depend on this service.
* Input must be a valid Solana token contract address.


# Solana Send SOL Tool

#### Solana Send SOL Tool (`solana_send_sol_tool`)

Performs an **on-chain transaction** to send a specified amount of SOL from the agent's (user's) wallet to a recipient's Solana address. Exercise caution as this involves real fund transfers.

{% hint style="info" %}
**Inputs:** Requires sender's wallet details, recipient, and amount.
{% endhint %}

```python
class SolanaSendSolInput(BaseModel):
    agent_public: str      # Sender's public key
    agent_private: str     # Sender's ENCRYPTED private key
    recipient_address: str # Recipient's Solana address
    amount_sol: float      # Amount of SOL to send (e.g., 0.1)
```

***

**Key Functionality:**

* Securely decrypts the provided agent's private key.
* Validates the amount and checks the sender's SOL balance.
* Constructs and sends a versioned transaction to the Solana network to transfer SOL.
* Returns a confirmation with the transaction signature and an explorer link upon success.

***

**Sample Usage Queries (How an AI might use it):** *(These imply the agent has access to or will securely prompt for necessary wallet details)*

* "Send 0.5 SOL to `RecipientPublicKeyHere` from my wallet."
* "Transfer 1.2 SOL from my primary account to `FriendAddress`."
* "I need to send `AmountX` SOL to `DestinationAddress`."
* "Initiate a SOL payment of `Y` to address `Z`."
* "Execute a transaction: send `0.05` SOL to `AnotherWalletAddress`."
* "Help me send SOL from my wallet." (Agent would then gather parameters)

***

**Quick Code Glance:**

```python
class SolanaSendSolTool(BaseTool):
    name: ClassVar[str] = "solana_send_sol_tool"
    description: ClassVar[str] = "Send SOL from agent wallet to a specified Solana address."
    args_schema: ClassVar[Type[BaseModel]] = SolanaSendSolInput
```

***

**⚠️ CRITICAL INFORMATION & SECURITY:**

* **Real Transactions:** This tool executes actual SOL transfers on the Solana blockchain. **Transactions are irreversible.**
* **Encrypted Private Key:** Requires the agent's **encrypted** private key. The security of the encryption/decryption mechanism (`WalletDecryptor`) is paramount. Never expose raw private keys.
* **Network Dependent:** Relies on a connection to a Solana RPC node (`CONFIG.SOLANA_RPC_URL`).
* **Asynchronous:** Primarily designed for asynchronous execution (`_arun`).


# Solana Send SPL Tokens Tool

#### Solana Send SPL Tokens Tool (`solana_send_spl_tokens_tool`)

Performs an **on-chain transaction** to send a specified amount of a specific SPL token (like USDC, Bonk, etc.) from the agent's (user's) wallet to a recipient's Solana address. Exercise extreme caution as this involves real fund transfers.

{% hint style="info" %}
**Inputs:** Requires sender's wallet, recipient, token details, and amount.
{% endhint %}

```python
class SolanaSendSplTokensInput(BaseModel):
    agent_public: str      # Sender's public key
    agent_private: str     # Sender's ENCRYPTED private key
    recipient_address: str # Recipient's Solana address
    token_address: str     # SPL token mint address (e.g., for USDC)
    amount: float          # Amount of the token to send
```

***

**Key Functionality:**

* Securely decrypts the sender's private key.
* Validates the amount and checks the sender's balance for the specified SPL token.
* Handles Associated Token Account (ATA) creation for the recipient if one doesn't exist.
* Constructs and sends a versioned transaction to the Solana network for the SPL token transfer.
* Returns a confirmation with the transaction signature and an explorer link on success.

***

**Sample Usage Queries (How an AI might use it):** *(These imply the agent has access to or will securely prompt for necessary wallet details, and can use a token identification tool to get `token_address` if a name like "USDC" or "LUMO" is given.)*

* "Send 100 USDC to `RecipientPublicKeyHere` from my wallet."
* "Transfer 500 Bonk from my account to `FriendAddress`."
* "I need to send 25.5 of token `TokenMintAddressHere` to `DestinationAddress`."
* "Initiate a payment of 1000 LUMO to address `Z`."
* "Execute a transaction: send `75` FARTCOIN to `AnotherWalletAddress`."
* "Help me send some GOAT tokens from my wallet." (Agent would then gather all parameters)
* "Send `AmountX` of `$TOKEN_SYMBOL` to `wallet_address`."

***

**Quick Code Glance:**

```python
class SolanaSendSplTokensTool(BaseTool):
    name: ClassVar[str] = "solana_send_spl_tokens_tool"
    description: ClassVar[str] = "Send SPL tokens from agent wallet to a specified Solana address."
    args_schema: ClassVar[Type[BaseModel]] = SolanaSendSplTokensInput
```

***

**⚠️ CRITICAL INFORMATION & SECURITY:**

* **Real Transactions:** This tool executes actual SPL token transfers on the Solana blockchain. **Transactions are irreversible.**
* **Encrypted Private Key:** Requires the agent's **encrypted** private key. The security of the encryption/decryption mechanism is vital.
* **Token & Wallet Addresses:** Ensure correct SPL token mint address and recipient wallet address are used.
* **Network Dependent:** Relies on a connection to a Solana RPC node (`CONFIG.SOLANA_RPC_URL`).
* **Asynchronous:** Primarily designed for asynchronous execution (`_arun`).


# Solana Burn Tokens Tool

#### Solana Burn Token Tool (`solana_burn_token_tool`)

Performs an **on-chain transaction** to **permanently burn (destroy)** a specified amount of an SPL token from the agent's (user's) wallet, removing them from circulation forever. **This action is irreversible.**

{% hint style="info" %}
**Inputs:** Requires owner's wallet, token details, and amount to burn.
{% endhint %}

```
class SolanaBurnTokenInput(BaseModel):
    agent_public: str      # Owner's public key
    agent_private: str     # Owner's ENCRYPTED private key
    token_address: str     # SPL token mint address to burn
    amount: float          # Amount of the token to burn
```

***

**Key Functionality:**

* Securely decrypts the owner's private key.
* Validates the amount and checks the owner's balance for the specified SPL token.
* Constructs and sends a versioned transaction to the Solana network to execute the burn instruction.
* Returns a confirmation with the transaction signature and an explorer link upon success.

***

**Sample Usage Queries (How an AI might use it):** *(These imply the agent has access to or will securely prompt for necessary wallet details, and can use a token identification tool to get `token_address` if a name like "USDC" or "LUMO" is given.)*

* "Burn 100 of my unwanted tokens with mint address `TokenMintAddressHere`."
* "I want to destroy 50 of my FARTCOIN tokens."
* "Help me burn `AmountX` of `TOKEN_SYMBOL` from my wallet."
* "Initiate a token burn for `N` units of LUMO."
* "Execute a transaction: burn `0.5` of GOAT tokens."
* "Permanently remove `Z` amount of token `SomeMintAddress` from my holdings."

***

**Quick Code Glance:**

```python
class SolanaBurnTokenTool(BaseTool):
    name: ClassVar[str] = "solana_burn_token_tool"
    description: ClassVar[str] = "Burn SPL tokens from agent wallet, permanently removing them from circulation."
    args_schema: ClassVar[Type[BaseModel]] = SolanaBurnTokenInput
```

***

**⚠️ CRITICAL INFORMATION / WARNING:**

* **Permanent & Irreversible:** Burning tokens permanently removes them from circulation. **This action cannot be undone.** Double-check all details before proceeding.
* **Encrypted Private Key:** Requires the agent's **encrypted** private key. The security of the encryption/decryption mechanism is vital.
* **Token & Wallet Addresses:** Ensure correct SPL token mint address and owner wallet details are used.
* **Network Dependent:** Relies on a connection to a Solana RPC node (`CONFIG.SOLANA_RPC_URL`).
* **Asynchronous:** Primarily designed for asynchronous execution (`_arun`).


# Jupiter Swap (Buy/Sell) Tool

#### Jupiter Swap Tool (`jupiter_swap_tool`)

Executes an **on-chain token swap** on the Solana network using the Jupiter aggregator. This tool allows for trading one SPL token (or SOL) for another. **This involves real fund movements and market risks like slippage.**

{% hint style="info" %}
**Inputs:** Requires wallet details, input/output tokens, amount, and optional slippage
{% endhint %}

```python
class JupiterSwapInput(BaseModel):
    agent_public: str      # Swapper's public key
    agent_private: str     # Swapper's ENCRYPTED private key
    input_mint: str      # Mint address of token to sell (e.g., SOL or USDC mint)
    output_mint: str     # Mint address of token to buy
    amount: float          # Amount of input token to swap
    slippage: float = 10.0 # Slippage tolerance % (e.g., 0.5 for 0.5%)
```

***

**Key Functionality:**

* Securely decrypts the swapper's private key.
* Fetches optimal swap routes and quotes from the Jupiter API.
* Validates balances and constructs a transaction based on the quote and specified slippage.
* Signs and sends the transaction to the Solana network to perform the swap.
* Handles SOL as a native asset (using its mint address `So1111...1112`).

***

**Sample Usage Queries (How an AI might use it):** *(These imply the agent has access to or will securely prompt for necessary wallet details, and can use a token identification tool to get mint addresses if names like "USDC" or "LUMO" are given.)*

* "Swap 1 SOL for USDC using Jupiter with 0.5% slippage."
* "Trade 100 USDC for BONK, max 1% slippage."
* "I want to convert my `AmountX` of `InputTokenName/Mint` to `OutputTokenName/Mint` using Jupiter."
* "Sell 50 LUMO, allow up to 2% slippage."
* "Help me swap some GOAT tokens for SOL on Jupiter." (Agent would then gather all parameters)
* "Swap `N` units of `MintAddr1` for `MintAddr2` with default slippage on Jupiter."

***

**Quick Code Glance:**

```python
class JupiterSwapTool(BaseTool):
    name: ClassVar[str] = "jupiter_swap_tool"
    description: ClassVar[str] = "Swap tokens on Solana using Jupiter. Provide the input token, output token, amount, and slippage..."
    args_schema: ClassVar[Type[BaseModel]] = JupiterSwapInput
```

***

**⚠️ CRITICAL INFORMATION / WARNINGS:**

* **Real Transactions & Market Risk:** This tool executes actual token swaps. Prices can change rapidly (slippage), and the final received amount may differ from the quote. **Transactions are irreversible.**
* **Encrypted Private Key:** Requires the agent's **encrypted** private key. Secure handling is paramount.
* **Correct Mint Addresses:** Ensure accurate SPL token mint addresses for `input_mint` and `output_mint`. Using "SOL" for mints will be auto-corrected to the native SOL address.
* **Slippage Setting:** Understand and set the `slippage` tolerance carefully to protect against unfavorable price changes during execution. The default in this tool is 10%, which is very high and should likely be adjusted for most swaps.
* **Network & API Dependent:** Relies on Solana RPC and the Jupiter API.
* **Asynchronous:** Primarily designed for asynchronous execution (`_arun`).


# Pump.Fun Launch Coin Tool

#### Pump.fun Launch Coin Tool (`pumpfun_launch_coin_tool`)

Launches a **brand new SPL token directly onto the Pump.fun platform**. This involves creating the token, setting its metadata (name, symbol, image, socials), and optionally making an initial SOL purchase. **This is an on-chain action with real costs and creates a publicly tradable token.**

{% hint style="info" %}
**Inputs:** Requires creator's wallet, new token details, and image URL. Social links and initial SOL buy-in are optional.
{% endhint %}

```python
class PumpFunLaunchCoinInput(BaseModel):
    agent_public: str     # Creator's public key
    agent_private: str    # Creator's ENCRYPTED private key
    token_name: str       # Name for the new token (e.g., "Lumo Test Coin")
    token_symbol: str     # Symbol for the new token (e.g., "LTC01")
    description: str      # Description of the new token
    image_url: str        # URL to the token's image (must be valid)
    twitter_url: Optional[str]  # Optional Twitter link
    telegram_url: Optional[str] # Optional Telegram link
    website: Optional[str]      # Optional website link
    amount: float = 0.0   # Optional SOL amount to buy into the new token
```

***

**Key Functionality:**

* Securely decrypts the creator's private key.
* Validates all provided token metadata and URLs.
* Uploads token metadata (name, symbol, description, image, socials) to IPFS via Pump.fun's API.
* Constructs and executes the on-chain transaction to create the new token and its bonding curve on Pump.fun, including any initial SOL investment specified.

***

**Sample Usage Queries (How an AI might use it):** *(These imply the agent has access to or will securely prompt for necessary wallet details)*

* "Launch a new token on Pump.fun named 'Awesome Token' with symbol 'AWSM', description 'An awesome new token!', and image `image_url_here`."
* "I want to create a coin called 'FARTCOIN' (FRT) on Pump.fun. Description: 'The next big thing'. Image: `url_to_fart_image`. Also add Twitter `twitter_link` and buy 0.1 SOL worth."
* "Help me launch 'GOAT Token' (GOAT) on Pump.fun with description 'Greatest Of All Tokens', image `goat_pic_url`, and Telegram `tg_link`."
* "Create a Pump.fun coin: Name 'Lumo Launcher', Symbol 'LLAUNCH', Desc 'Test launch by LumoKit', Image `lumo_logo_url`, Website `lumolabs.ai`."
* "Launch a token with these details: Name: ..., Symbol: ..., Description: ..., Image: ..., and invest 0.05 SOL."

***

**Quick Code Glance:**

```python
class PumpFunLaunchCoinTool(BaseTool):
    name: ClassVar[str] = "pumpfun_launch_coin_tool"
    description: ClassVar[str] = "Launch a new token on Pump.fun platform. Requires token details and agent wallet information."
    args_schema: ClassVar[Type[BaseModel]] = PumpFunLaunchCoinInput
```

***

**⚠️ CRITICAL INFORMATION / WARNINGS:**

* **Real Token Creation & Costs:** This tool launches a live SPL token on Pump.fun. This is an **irreversible on-chain action** and will incur Solana network fees and any fees associated with Pump.fun's service. The optional `amount` is real SOL spent.
* **Encrypted Private Key:** Requires the creator's **encrypted** private key. Secure handling is essential.
* **Metadata & Image:** All required metadata (name, symbol, description, image URL) must be valid and appropriate. The image URL must be publicly accessible.
* **Pump.fun Platform:** Relies on Pump.fun's APIs and platform rules.
* **Network Dependent:** Interacts with Solana RPC and Pump.fun's infrastructure.
* **Asynchronous:** Primarily designed for asynchronous execution (`_arun`).


# Model Overview

<figure><img src="/files/fnbmzFkFjAOrV1HrP701" alt=""><figcaption></figcaption></figure>

**Lumo-8B-Instruct** is the first-ever cutting-edge AI model specifically designed to empower developers and users within the Solana ecosystem. Built upon the foundation of the robust LLaMa 3.1 8B parameter language model, Lumo is fine-tuned on a comprehensive dataset of Solana-related questions and answers, enabling it to provide exceptional assistance in various domains.

{% hint style="info" %}
**Lumo is the first ever to launch a fine-tuned model tailored for the Solana ecosystem.**
{% endhint %}

### About the Model

```python
import torch
from transformers import LlamaForCausalLM, AutoTokenizer
from llama_recipes.configs import train_config as TRAIN_CONFIG

train_config = TRAIN_CONFIG()
train_config.model_name = "meta-llama/Meta-Llama-3.1-8B-Instruct"
train_config.num_epochs = 2
train_config.run_validation = False
train_config.gradient_accumulation_steps = 4
train_config.batch_size_training = 1
train_config.lr = 3e-4
train_config.use_fast_kernels = True
train_config.use_fp16 = True
train_config.context_length = 4096
train_config.batching_strategy = "packing"
train_config.output_dir = "Lumo-8B-Instruct"

from transformers import BitsAndBytesConfig
config = BitsAndBytesConfig(
    load_in_8bit=True,
)

model = LlamaForCausalLM.from_pretrained(
    train_config.model_name,
    device_map="auto",
    quantization_config=config,
    use_cache=False,
    attn_implementation="sdpa" if train_config.use_fast_kernels else None,
    torch_dtype=torch.float16,
)

tokenizer = AutoTokenizer.from_pretrained(train_config.model_name)
tokenizer.pad_token = tokenizer.eos_token
```

* **Base Model:** Lumo is founded upon the LLaMa 3.1 8B parameter model, a state-of-the-art decoder-only transformer architecture renowned for its exceptional language generation capabilities.
  * **Key Architectural Features:**
    * **Transformer Architecture:** Lumo leverages the attention mechanism of transformers to effectively capture long-range dependencies within the input sequence and generate coherent and contextually relevant responses.
    * **Decoder-Only Model:** Lumo is designed as a decoder-only model, focusing on generating text outputs based on given inputs, making it well-suited for tasks like text completion, summarization, and question answering.
    * **8 Billion Parameters:** The model boasts 8 billion parameters, enabling it to learn complex patterns and relationships within the data and generate highly sophisticated outputs.

```python
from peft import get_peft_model, prepare_model_for_kbit_training, LoraConfig
from dataclasses import asdict
from llama_recipes.configs import lora_config as LORA_CONFIG

lora_config = LORA_CONFIG()
lora_config.r = 8
lora_config.lora_alpha = 32
lora_dropout: float = 0.01

peft_config = LoraConfig(**asdict(lora_config))

model = prepare_model_for_kbit_training(model)
model = get_peft_model(model, peft_config)
```

* **Fine-tuning:** To specialize Lumo for the Solana ecosystem, the base model undergoes a fine-tuning process on the Lumo-8B-DS-Instruct dataset. This dataset comprises over 28,518 high-quality question-answer pairs specifically curated for Solana, covering a wide range of topics:
  * **Solana Fundamentals:** Blockchain architecture, consensus mechanisms (Proof-of-History, Proof-of-Stake), tokenomics.
  * **Development:** Smart contract development (using languages like Rust, Solidity), interacting with the Solana RPC, using Solana developer tools.
  * **Ecosystem:** DeFi protocols, NFTs, dApps, governance, and the broader Solana ecosystem.
  * **Technical Concepts:** Cryptography, cryptography algorithms used in Solana (e.g., Ed25519), data structures (e.g., Merkle trees).

```python
import torch.optim as optim
from llama_recipes.utils.train_utils import train
from torch.optim.lr_scheduler import StepLR

# Initialize wandb with new project name
wandb_run = wandb.init(project="finetune-llama-lumo-8b")
wandb_run.config.update(train_config)

model.train()

# Initialize optimizer with potentially adjusted hyperparameters for Lumo dataset
optimizer = optim.AdamW(
    model.parameters(),
    lr=train_config.lr,
    weight_decay=train_config.weight_decay,
)

# Keep the same scheduler structure
scheduler = StepLR(optimizer, step_size=1, gamma=train_config.gamma)

# Start training with updated dataloaders
results = train(
    model,
    train_dataloader,
    eval_dataloader,
    tokenizer,
    optimizer,
    scheduler,
    train_config.gradient_accumulation_steps,
    train_config,
    None,
    None,
    None,
    wandb_run,
)
```

* **Parameter-Efficient Fine-Tuning (PEFT):** To optimize the fine-tuning process and enhance efficiency, Lumo employs PEFT techniques. Specifically, we utilize **LoRA (Low-Rank Adaptation)**, a method that introduces trainable rank-decomposition matrices to the model's attention layers.
  * **LoRA Parameters:**
    * **Rank:** 8 (r = 8)
    * **Alpha:** 32 (alpha = 32)
    * **Dropout:** 0.01
  * **Benefits of LoRA:**
    * **Reduced Training Time:** Trains significantly faster than fine-tuning all model parameters.
    * **Reduced Memory Footprint:** Requires significantly less memory during training.
    * **Preserves Pre-trained Knowledge:** Minimizes the risk of catastrophic forgetting, where the model loses its pre-trained knowledge during fine-tuning.

### Check out the model

Lumo-8B-Instruct is open-source, and deployed on HuggingFace, click the embedding below to check out the model.

{% embed url="<https://huggingface.co/lumolabs-ai/Lumo-8B-Instruct>" %}


# Capabilities and Limitations

## Capabilities

**Solana Expertise:**

* **Explain Solana Concepts:** Lumo can provide clear and concise explanations of complex Solana concepts, such as Proof-of-History, staking, and the role of validators.
* **Answer Questions:** Lumo effectively answers a wide range of questions related to Solana, including technical questions about smart contract development, market data, and the latest developments within the ecosystem.
* **Code Generation:** Lumo can generate code snippets in various languages (e.g., Rust, JavaScript) for common Solana development tasks, such as:
  * Creating and transferring tokens
  * Interacting with on-chain programs
  * Building simple dApps
  * **Example Code Snippet (Rust):**

```rust
use solana_program::{
    account_info::{next_account_info, AccountInfo},
    entrypoint,
    entrypoint::ProgramResult,
    msg,
    pubkey::Pubkey,
};

entrypoint!(process_instruction(
    program_id: &Pubkey,
    accounts: &[AccountInfo],
    instruction_data: &[u8],
));

fn process_instruction(
    program_id: &Pubkey,
    accounts: &[AccountInfo],
    _instruction_data: &[u8],
) -> ProgramResult {
    msg!("Hello from Solana!");
    Ok(())
}
```

* **Information Retrieval:** Lumo can efficiently search through and summarize relevant information from Solana documentation, research papers, and news articles.
* **Debugging Assistance:** Lumo can help developers debug their Solana code by identifying potential errors, suggesting solutions, and explaining error messages.

## Limitations

* **Hallucinations:** Like other large language models, Lumo may occasionally generate incorrect or misleading information. It's crucial to critically evaluate the model's output and verify information from reliable sources.
* **Bias and Fairness:** Lumo may reflect biases present in its training data. Continuous efforts are needed to mitigate biases and ensure fair and equitable outcomes.
* **Data Limitations:** Lumo's knowledge is primarily based on the data it was trained on. It may not have the most up-to-date information on the rapidly evolving Solana ecosystem.
* **Computational Resources:** Running Lumo can be computationally expensive, especially for complex tasks or long sequences.


# Use Cases

<figure><img src="/files/uzoXdX2fkJU98Lqo2CsP" alt=""><figcaption></figcaption></figure>

Lumo offers a wide range of practical applications within the Solana ecosystem:

* **Developers:**
  * **Development Acceleration:** Lumo can significantly accelerate the development process by assisting with code generation, debugging, and research.
  * **Learning and Education:** Lumo can serve as an invaluable learning resource for developers new to the Solana ecosystem, providing explanations of complex concepts and answering their questions.
* **Researchers:**
  * **Literature Reviews:** Lumo can help researchers quickly summarize and analyze research papers related to Solana and blockchain technology.
  * **Hypothesis Generation:** Lumo can assist in generating new research hypotheses and exploring novel applications within the Solana ecosystem.
* **Community Members:**
  * **Staying Informed:** Lumo can keep users updated on the latest news and developments within the Solana ecosystem.
  * **Community Engagement:** Lumo can facilitate discussions and knowledge sharing within the Solana community by answering questions and providing insights.

**4. Future Directions**

* **Continuous Improvement:** Lumo will undergo continuous refinement through ongoing research and development. This includes:
  * **Data Expansion:** Expanding the training dataset with more diverse and up-to-date information.
  * **Model Scaling:** Exploring larger model sizes to further enhance Lumo's capabilities.
  * **Advanced Fine-tuning Techniques:** Implementing more sophisticated fine-tuning methods to improve model performance and efficiency.
* **Integration with Solana Tools:** Integrating Lumo with popular Solana development tools and platforms (e.g., CLI, wallets, IDEs) to provide a seamless user experience.
* **Multilingual Support:** Expanding Lumo's language capabilities to support a broader range of languages within the Solana ecosystem.

By continuously evolving and expanding its capabilities, Lumo aims to become an indispensable tool for developers, researchers, and users within the vibrant Solana ecosystem.


# About Lumo-Iris

<figure><img src="/files/7WIourfH1ijvs3aYIRun" alt=""><figcaption></figcaption></figure>

The Lumo Iris DS Instruct dataset is a cornerstone for the Lumo large language model, designed to empower the model with a deep understanding of the Solana ecosystem. This next-generation dataset is 5x larger and more comprehensive than its predecessor, providing the foundation for Lumo's capabilities to answer questions, generate code, and assist users within the Solana domain.

**Knowledge cut-off date: 17th January, 2025**

{% hint style="info" %}
The dataset draws from an expanded and diverse range of authoritative sources within the Solana ecosystem, offering unparalleled depth and breadth of knowledge.
{% endhint %}

### Data Sources

The dataset integrates information from 15+ authoritative sources to ensure comprehensive coverage of the Solana ecosystem:

1. **Official Solana Documentation**\
   Comprehensive resources covering Solana's core concepts, protocols, and development tools.\
   Includes sections on.

* **Fundamentals:** Blockchain architecture, consensus mechanisms (Proof-of-History, Proof-of-Stake), tokenomics.
* **Development:** Smart contract development (using languages like Rust, Solidity), interacting with the Solana RPC, and using Solana developer tools.
* **Ecosystem:** DeFi protocols, NFTs, dApps, governance, and the broader Solana ecosystem.
* **Terminology:** Definitions of key terms and concepts within the Solana ecosystem.

2. **Project-Specific Documentation**

* **Jito:** Documentation for the Jito wallet and its associated features.
* **Raydium:** Documentation for the Raydium decentralized exchange (DEX) on Solana.
* **Jupiter:** Documentation for the Jupiter decentralized exchange aggregator.
* **Helius:** Documentation for the Helius Solana developer tools.
* **QuickNode:** Documentation for the QuickNode Solana infrastructure platform.
* **ChainStack:** Documentation for the ChainStack Solana infrastructure platform.
* **Meteora:** Documentation for the Meteora Solana infrastructure platform.
* **PumpPortal:** Documentation for the PumpPortal Solana-focused platform.
* **DexScreener:** Documentation for the DexScreener decentralized exchange explorer.
* **MagicEden:** Documentation for the MagicEden NFT marketplace.
* **Tatum:** Documentation for the Tatum blockchain APIs and tools.
* **Alchemy:** Documentation for Alchemy's blockchain infrastructure services.
* **Bitquery:** Documentation for Bitquery's blockchain data solutions.

<figure><img src="/files/zkLMuMbC6sT9DldOm1LN" alt=""><figcaption></figcaption></figure>

### Data Extraction and Processing

* **Data Extraction:**
  * Data was meticulously extracted from the designated sources using a combination of manual curation and automated techniques.
  * **Note:** The dataset was compiled with a strong emphasis on data integrity and accuracy. No automated scraping techniques were employed to avoid potential biases or inaccuracies.
* **Data Cleaning:**
  * **Removal of HTML/Markdown:** HTML tags, Markdown formatting, and other irrelevant formatting elements were removed to ensure clean and consistent text.
  * **Deduplication:** Duplicate entries were identified and removed to prevent redundancy and ensure data quality.
  * **Error Correction:** Minor spelling and grammatical errors were corrected to improve data consistency.
  * **Standardization:** Terminology was standardized across different sources to maintain consistency and improve data coherence.
* **Text Chunking:**
  * The extracted text was divided into smaller, manageable chunks of 1,500 characters with an overlap of 200 characters.
* **Question-Answer Pair Generation:**
  * For each chunk, 10 high-quality question-answer pairs were generated using a powerful language model (e.g., GPT-4).
  * The model was instructed to:
    * Generate questions that are relevant to the provided text chunk.
    * Ensure that the questions are answerable based solely on the information within the chunk.
    * Generate concise and informative answers that accurately reflect the content of the chunk.

<figure><img src="/files/8XF2mYNUIWqntGuClNnS" alt=""><figcaption></figcaption></figure>

### Dataset Structure

The Lumo Iris DS Instruct dataset is structured as a JSONL file, where each line represents a single question-answer pair. Each line contains the following fields:

* **`question`:** The question generated from the given text chunk.
* **`answer`:** The corresponding answer to the generated question.
* **`chunk`:** The original text chunk from which the question-answer pair was derived.


# About Lumo-8B

<figure><img src="/files/XPYvAYPb6XfTVncTLt0J" alt=""><figcaption></figcaption></figure>

The **Lumo 8B Instruct dataset** is a cornerstone for the Lumo large language model, specifically designed to empower the model with a deep understanding of the Solana ecosystem. This meticulously curated dataset provides the foundation for Lumo's ability to answer questions, generate code, and assist users within the Solana domain.

{% hint style="info" %}
The dataset draws from a diverse range of authoritative sources within the Solana ecosystem.
{% endhint %}

### Data Sources

The dataset draws from a diverse range of authoritative sources within the Solana ecosystem:

* **Official Solana Documentation:**
  * Comprehensive documentation covering Solana's core concepts, protocols, and development tools.
  * Includes sections on:
    * **Fundamentals:** Blockchain architecture, consensus mechanisms (Proof-of-History, Proof-of-Stake), tokenomics.
    * **Development:** Smart contract development (using languages like Rust, Solidity), interacting with the Solana RPC, using Solana developer tools.
    * **Ecosystem:** DeFi protocols, NFTs, dApps, governance, and the broader Solana ecosystem.
    * **Terminology:** Definitions of key terms and concepts within the Solana ecosystem.
* **Project-Specific Documentation:**
  * **Jito:** Documentation for the Jito wallet and its associated features.
  * **Raydium:** Documentation for the Raydium decentralized exchange (DEX) on Solana.
  * **Jupiter:** Documentation for the Jupiter decentralized exchange aggregator.
  * **Helius:** Documentation for the Helius Solana developer tools.
  * **QuickNode:** Documentation for the QuickNode Solana infrastructure platform.
  * **ChainStack:** Documentation for the ChainStack Solana infrastructure platform.
  * **Meteora:** Documentation for the Meteora Solana infrastructure platform.
  * **PumpPortal:** Documentation for the PumpPortal Solana-focused platform.
  * **DexScreener:** Documentation for the DexScreener decentralized exchange explorer.
  * **MagicEden:** Documentation for the MagicEden NFT marketplace.

<figure><img src="/files/zkLMuMbC6sT9DldOm1LN" alt=""><figcaption></figcaption></figure>

### Data Extraction and Processing

* **Data Extraction:**
  * Data was meticulously extracted from the designated sources using a combination of manual curation and automated techniques.
  * **Note:** The dataset was compiled with a strong emphasis on data integrity and accuracy. No automated scraping techniques were employed to avoid potential biases or inaccuracies.
* **Data Cleaning:**
  * **Removal of HTML/Markdown:** HTML tags, Markdown formatting, and other irrelevant formatting elements were removed to ensure clean and consistent text.
  * **Deduplication:** Duplicate entries were identified and removed to prevent redundancy and ensure data quality.
  * **Error Correction:** Minor spelling and grammatical errors were corrected to improve data consistency.
  * **Standardization:** Terminology was standardized across different sources to maintain consistency and improve data coherence.
* **Text Chunking:**
  * The extracted text was divided into smaller, manageable chunks of 2000 characters with an overlap of 200 characters. This approach ensures that each chunk contains sufficient information for generating meaningful questions and answers while maintaining context.
* **Question-Answer Pair Generation:**
  * For each chunk, three high-quality question-answer pairs were generated using a powerful language model (e.g., GPT-4).
  * The model was instructed to:
    * Generate questions that are relevant to the provided text chunk.
    * Ensure that the questions are answerable based solely on the information within the chunk.
    * Generate concise and informative answers that accurately reflect the content of the chunk.

<figure><img src="/files/8XF2mYNUIWqntGuClNnS" alt=""><figcaption></figcaption></figure>

### Dataset Structure

The Lumo 8B Instruct dataset is structured as a JSONL file, where each line represents a single question-answer pair. Each line contains the following fields:

* **`question`:** The question generated from the given text chunk.
* **`answer`:** The corresponding answer to the generated question.
* **`chunk`:** The original text chunk from which the question-answer pair was derived.


# Dataset Preparation

```python
N = 3

API_REFERENCE_PATHS = [
    "**/*.txt",
]

QUESTION_GENERATION_SYSTEM_PROMPT = """You are Lumo, a helpful AI assistant. Your task is to help a user understand everything about Solana, from fundamentals, to coding, or anything at all. Carefully examine the function documentation snippet and generate {} questions a medium to experienced Solana user could ask. Questions must be answerable from the information in the snippet. Do not assume anything about Solana that is not discussed in the snippet, make sure you include complete code contents in your answers when it might add value. If the snippet is too short or contains too little information, output an empty JSON array.""".format(
    N
)

QUESTION_ANSWERING_SYSTEM_PROMPT = """You are a Lumo, helpful AI assistant. Your task is to help a user understand everything about Solana, from fundamentals, to coding, or anything at all. Carefully examine the function documentation and generate an explanatory response based on the user's question which showcases usage and examples. Do not assume anything about Solana that is not discussed in the reference documentation snippet, make sure you include complete code contents in your answers when it might add value."""

def chunk_text(text, chunk_size=2000, overlap=200):
    """Split text into overlapping chunks."""
    chunks = []
    start = 0
    while start < len(text):
        end = min(start + chunk_size, len(text))
        chunk = text[start:end]
        chunks.append(chunk)
        if end >= len(text):
            break
        start = end - overlap
        if start < 0:
            start = 0
    return chunks
```

**Data Loading and Preprocessing**

* **Loading the Dataset:** The dataset is loaded using the Hugging Face `datasets` library, providing a convenient and efficient way to handle and process the data.
* **Tokenization:** The text data (questions and answers) is tokenized using the LLaMa 3.1 tokenizer, which converts the text into a sequence of numerical tokens.
* **Chat Template Application:** The `apply_chat_template()` function from the `transformers` library is used to format the input data according to the LLaMa 3.1 chat template. This involves creating a sequence of messages with roles: "system" (for the system prompt), "user" (for the question), and "assistant" (for the answer).

**2. Data Splitting**

The dataset is split into three subsets:

* **Training set:** Used to train the Lumo model. Typically constitutes the majority of the dataset.
* **Validation set:** Used to monitor the model's performance during training and tune hyperparameters.
* **Test set:** Used to evaluate the final performance of the trained model on unseen data.

```python
api_reference_chunks = []
for wcpath in API_REFERENCE_PATHS:
    for path in glob.glob(os.path.join(args.input, wcpath), recursive=True):
        with open(path) as f:
            content = f.read()
            splitted_chunks = chunk_text(content, 2000, 200)
            api_reference_chunks.extend(splitted_chunks)
print(f"Found {len(api_reference_chunks)} chunks of documentation")

client = OpenAI()

def process_chunk(chunk, client, args):
    completion = client.chat.completions.create(
        model=args.model,
        temperature=0.3,
        messages=[
            {"role": "system", "content": QUESTION_GENERATION_SYSTEM_PROMPT},
            {"role": "user", "content": chunk},
        ],
        response_format={
            "type": "json_schema",
            "json_schema": {
                "name": "questions",
                "schema": {
                    "type": "object",
                    "required": ["questions"],
                    "properties": {
                        "questions": {
                            "type": "array",
                            "items": {"type": "string"},
                        }
                    },
                    "additionalProperties": False,
                },
                "strict": True,
            },
        },
    )
    questions = json.loads(completion.choices[0].message.content)["questions"]
    prompt_tokens_used = completion.usage.prompt_tokens
    completion_tokens_used = completion.usage.completion_tokens
    results = []
    for question in questions[:N]:
        completion = client.chat.completions.create(
            model=args.model,
            temperature=0.3,
            messages=[
                {
                    "role": "system",
                    "content": QUESTION_ANSWERING_SYSTEM_PROMPT,
                },
                {"role": "assistant", "content": chunk},
                {"role": "user", "content": question},
            ],
        )
        answer = completion.choices[0].message.content
        prompt_tokens_used += completion.usage.prompt_tokens
        completion_tokens_used += completion.usage.completion_tokens
        results.append({"question": question, "answer": answer, "chunk": chunk})
    return results, prompt_tokens_used, completion_tokens_used
```

The dataset is split using the `train_test_split()` function from the `datasets` library, ensuring a random and representative distribution of data across the three subsets.

**3. Data Collation**

* **Collation Function:** A custom collation function is defined to handle the batching of data during training. This function ensures that batches have consistent lengths and are efficiently processed by the model.


# Training Metrics

<figure><img src="/files/p14PKVfTyUcrO6FBweE8" alt=""><figcaption></figcaption></figure>

The Lumo 8B Instruct dataset was used to fine-tune the Lumo model. The following metrics were closely monitored during the training process:

* **Training Loss:**
  * The primary metric used to evaluate the model's performance during training.
  * Calculated using the cross-entropy loss function, which measures the difference between the model's predicted probabilities and the true probabilities of the next token in the sequence.
  * Lower training loss generally indicates better model performance.
* **Validation Loss:**
  * Calculated on the validation set during each training epoch.
  * Used to monitor the model's performance on unseen data and detect overfitting.
* **Perplexity:**
  * Measures the average probability of the next token in the sequence.
  * Lower perplexity indicates that the model is better at predicting the next token, suggesting a better understanding of the data.

**Training Process**

* **Optimizer:** The AdamW optimizer was used to update the model's parameters during training.
* **Learning Rate:** The learning rate was set to 3e-4.
* **Gradient Accumulation:** Gradient accumulation was used to effectively train the model with smaller batch sizes, which can improve training stability and reduce memory consumption.
* **Learning Rate Scheduler:** A StepLR scheduler was used to adjust the learning rate during training, allowing the model to converge more effectively.

By carefully monitoring these metrics and adjusting training hyperparameters as needed, the Lumo model was successfully fine-tuned on the Lumo 8B Instruct dataset, achieving state-of-the-art performance on Solana-related tasks.


# HuggingFace Hub

The intention behind Lumo is to keep it open-source, and a public project. Hence, the project is published in the HuggingFace Hub where it can be publicly reviewed and used.

### Lumo Community

{% embed url="<https://huggingface.co/lumolabs-ai>" %}

### Lumo AI Model

{% embed url="<https://huggingface.co/lumolabs-ai/Lumo-8B-Instruct>" %}

### Lumo Dataset

{% embed url="<https://huggingface.co/datasets/lumolabs-ai/Lumo-8B-DS-Instruct>" %}


# How to Inference

Lumo-8B-Instruct is currently published to the HuggingFace Hub, from where it can be downloaded/used by any user locally or on inferenced on a server. Lumo is not yet published as a chatbot for mass use, however it can be run locally.

The information on how to run it locally is shared below.

{% hint style="info" %}
**You can try out the Lumo-8B-Instruct live on** [**https://try-lumo8b.lumolabs.ai**](https://try-lumo8b.lumolabs.ai/)
{% endhint %}

<figure><img src="https://usercontent.one/wp/www.ralgar.one/wp-content/uploads/2024/07/ollama_hero-e1721322967117-1024x387.webp" alt=""><figcaption></figcaption></figure>

## STEP 1: Install Ollama

### Windows Installation

1. **Download**: Go to the [Ollama website](https://ollama.com/) and download the Windows installer (`OllamaSetup.exe`).
2. **Install**: Double-click the downloaded file and follow the installation prompts.
3. **Verify**: Open Command Prompt and run:

```
ollama --version
```

### macOS Installation

1. **Download**: Visit the [Ollama website](https://ollama.com/) and download the macOS installer.
2. **Install**: Open the downloaded file and follow the instructions.
3. **Verify**: Open Terminal and run:

```
ollama --version
```

### Linux Installation

1. **Open Terminal**.
2. **Run Command**:

   ```
   curl -fsSL https://ollama.com/install.sh | sh
   ```
3. **Verify**: Run:

   ```
   ollama --version
   ```

***

## STEP 2: Initiate the model on Ollama

Run the command on your terminal:

```
ollama run lumolabs/Lumo-8B-Instruct
```

or

```sh
ollama run hf.co/lumolabs-ai/Lumo-8B-Instruct
```

<figure><img src="/files/JQNeQqlLFvA9P3AK1jGt" alt=""><figcaption></figcaption></figure>

The first time you run the command, it may take some time depending on the network speed. It will only take time the first time you run the command.

***

## STEP 3: Start Conversing

Feel free to ask Lumo anything about the ecosystem, even code!

<figure><img src="/files/1EKi4zshYkiSRbg6sFTp" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/el4Ce7Ytn9kPTGyRMo0x" alt=""><figcaption></figcaption></figure>


# How to Contribute

We welcome and encourage contributions from the entire Solana community! Here are a few ways you can get involved:

<details>

<summary>Contribute to the model</summary>

* **Improve the Dataset:**
  * **Identify and report issues:** Help us identify and report any errors, inconsistencies, or biases within the Lumo-8B-DS-Instruct dataset.
  * **Suggest improvements:** Propose new data sources, suggest improvements to data cleaning and preprocessing techniques, or contribute additional high-quality question-answer pairs.
* **Enhance Model Performance:**
  * Experiment with different fine-tuning techniques and hyperparameters to improve model accuracy and efficiency.
  * Conduct research and development on novel approaches to fine-tuning large language models for the Solana ecosystem.

</details>

<details>

<summary>Contribute to the community</summary>

* **Provide Feedback:** Share your feedback and suggestions on the Lumo model and the documentation.
* **Engage in Discussions:** Participate in community forums and discussions related to Lumo and the Solana ecosystem.
* **Spread the Word:** Share Lumo with your friends, colleagues, and the broader Solana community.

</details>

<details>

<summary>Join the Lumo Community</summary>

Connect with other members of the Lumo community through our official channels:

<https://x.com/lumolabsdotai>

</details>

### Use the form to communicate with us

{% embed url="<https://docs.google.com/forms/d/e/1FAIpQLScV4mwtheB7s3ryzuAM3CMuw_PSuVUZxMk3KI3QAUN7AfZi6g/viewform?usp=dialog>" %}


# Report Bugs/Issues

We appreciate your help in making Lumo the best it can be! If you encounter any bugs, issues, or unexpected behavior with the Lumo model or its associated tools, please report them using the form below.

{% embed url="<https://docs.google.com/forms/d/e/1FAIpQLSeUu2q_6lNpqPp2KukvgIpraNqz9s61CbxylH1yPBpWnCrCRQ/viewform?usp=dialog>" %}


