Developer guide

Interaction with Dispatcher

API

submit task to Dispatcher

// api/job/submit POST

// request
{
    "from": "projectid", // string: the project id
    "tag": "", // enum (suspicion| malicious) :the tag of the job
    "user": "b77f1799de0148c07bc6ef630fb75ac267f31d147cd28797ad145afe72302632", // string:  the user or device id to verify
    "job": {  // json:  the job deatail of operator to verify
        "tag": "opml", // enum(opml|tee): the job type 
        "prompt": "What is AI?",
        "model": "llama-2-7b-chat.Q4_0.gguf", 
        "params": {
            "temperature": 1.0,
            "top_p": 0.5,
            "max_tokens": 1024
        }
    },
    "verify": "4cc2e1f9-0ac2-4af6-98f8-b814917b49b0" // project api token
}

// response

{
    "code": 200,
    "result": "636a5cf015a1a4c7480317f114d5b06d69476b9d0d5a67dbe53e9b59de72769b" // job id
}

Query job result of job id

api/job/result POST

// api/job/result POST

{
    "job_id": "5814075a7a4b7bc4db5450e7bc3ee2893562e3b2d9deb66a14da4e99d7276e0a" // job_id
}

// response

{
    "code": 200,
    "result": [
        {
            "id": "_9935188af8051af60e323429a88f90417eaa08319c2abb360486662538b05532_suspicion",
            "job_id": "9935188af8051af60e323429a88f90417eaa08319c2abb360486662538b05532",
            "operator": "",
            "result": "\\n What is AI?\\n Unterscheidung zwischen AI und KI\\n Introduction to AI\\n What is AI?\\n Artificial Intelligence (AI) is the simulation of human intelligence in machines that are programmed to perform tasks that typically require human intelligence. As per the definition by the National Institute of Artificial Intelligence (NIAI), AI is the ability of a computer to perform tasks that typically require human intelligence, such as understanding, learning, and problem-solving.\\nThe term AI was coined in 1956 by John McCarthy, a computer scientist who organized the first AI conference. Since then, AI has been a rapidly growing field, with many advancements in various areas, including machine learning, natural language processing, computer vision, and robotics.\\nThere are several types of AI, including:\\n1. Narrow or weak AI: This type of AI is designed to perform a specific task, such as playing chess or recognizing faces. Examples of narrow AI include Siri, Alexa, and Google Assistant.\\n2. General or strong AI: This type of AI is designed to perform any intellectual task that a human can. Examples of\\n\\n",
            "verify_id": "",
            "vrf": {
                "selected": false,
                "vrf_prompt_hash": "",
                "vrf_random_value": "",
                "vrf_verify_pubkey": "",
                "vrf_proof": ""
            },
            "clock": {
                "1": "2"
            },
            "signature": "",
            "job_type": "",
            "tag": "suspicion",
            "created_at": "2024-09-27 03:36:04"
        }
    ]
}

Query job request detail of job id. api/job/detail POST

// api/job/detail POST
{
    "job_id": "08422438b4ebd843ca8a260c8358b75e31acf0565e62b3b492370561c8c36d66"
}

// response 

{
    "code": 200,
    "result": {
        "id": "08422438b4ebd843ca8a260c8358b75e31acf0565e62b3b492370561c8c36d66",
        "job": {
            "tag": "opml",
            "prompt": "What is AI?",
            "model": "ss",
            "params": {
                "temperature": 1.0,
                "top_p": 0.5,
                "max_tokens": 1024
            }
        },
        "user": "b77f1799de0148c07bc6ef630fb75ac267f31d147cd28797ad145afe72302632tee",
        "job_type": "",
        "status": "dispatched",
        "tag": "",
        "clock": {
            "1": "1"
        },
        "created_at": "2024-09-27 06:51:09"
    }
}

Class
vCPUs (10th gen+)
Memory
Networking Capacity

General Purpose - large

2

8 GB

5 Mbps

General Purpose - xl

4

16 GB

25 Mbps

General Purpose - 4xl

16

64 GB

5 Gbps

How to deploy a Operator

before you start, ensure you have the following dependencies installed:

  • npm: Node package manager

  • Foundry: Ethereum development toolchain

  • Docker: Containerization platform

step 1

Clone the repo:

git clone <https://github.com/hetu-project/aos-operator.git>

step2

Start Docker: Use the following command to check whether docker is installed successfully

docker --version

step3

Install Dependencies:

//for opml 
1. git clone <https://github.com/hetu-project/opml-opt>
2. sudo  docker build -t opml-opt .
3. sudo docker run -p 1234:1234 -v ./config.yml:/app/config.yml -v ./llama-2-7b-chat.Q2_K.gguf:/app/llama-2-7b-chat.Q2_K.gguf -v ./llama-7b-fp32.bin:/app/opml-opt/llama-7b-fp32.bin opml-opt

// for tee
1. git clone <https://github.com/hetu-project/aos-tee-operator>

step3

Build aos-operator docker image:

sudo docker build -t aos-operator .

πŸŽ‰ Congrats, you've just spun up your own Operator and requested it to do some work!

Last updated