Skip to main content

balance-ai-wrapper

Requirements

  • python 12

setup venv

python3.12 -m venv venv
source venv/bin/activate
python
> Python 3.12.2 (...)
which python
> (...)venv/bin/python

pip install -r requirements.txt

Run all locally from sources

export PYTHONPATH=$PYTHONPATH:src
OR 
export PYTHONPATH=src

python src/balanceai/cli_runner.py init
# update generated config file
python src/balanceai/cli_runner.py dev

Other commands

python src/balanceai/cli_runner.py zkml
python src/balanceai/cli_runner.py help
python src/balanceai/cli_runner.py init --config my-ai-model-wrapper-config.json
python src/balanceai/cli_runner.py dev --config my-ai-model-wrapper-config.json

Start mocked services

python mock/chain-app.py
python mock/ipfs-app.py
python mock/ai-app.py

bai wrapper - sample call

curl --location 'http://127.0.0.1:9000/baiwrapper/aimodel' \
--header 'Content-Type: application/json' \
--data '{
    "caller_address": "CALLER_ADDR_5CSRVkQYi8P25Jidzhp9t1qzmnhEuTQim8L",
    "id": "request_id_guid_gen_by_client_4364977e-c1b0-4e85-bb35-53538fab0909",
    "model_id": "MODEL_ID_47djsnv9483ghj9idsv",
    "encryption_key": "PUB_ENC_KEY_TO_IPFS_rzyw8Hwb7KkZQGxnMgWm2EXb1zh6DmRKX22",
    "transparency": {
        "request_store": true,
        "response_store": false,
        "encrypt": true
    },
    "request": {
        "model_api_request": {
          "x": 45,
          "y": 123.45
        }
    },
    "signature": "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"
}'


# AI model
curl http://127.0.0.1:9300/ai
curl http://127.0.0.1:9300/ai/model333 -d {}

# IPFS
curl http://127.0.0.1:9100/ipfs
curl --location 'http://127.0.0.1:9100/ipfs/transaction' \
--header 'Content-Type: application/json' \
--data '{
    "model": 222,
    "timestamp": "2012-04-23T18:25:43.511Z",
    "request": {
        "p1": 2
    },
    "response": {
        "r1": "response data"
    }
}'

# CHAIN
curl http://127.0.0.1:9200/chain

curl --location 'http://127.0.0.1:9200/chain/updateModelUsageInfo' \
--header 'Content-Type: application/json' \
--data '{
    "model_address": "0123123123",
    "usage_info": "encrypted_usage"
}'

Build module

python3 -m build

install & run module

mkdir balanceai
cd balanceai
python3.12 -m venv venv
source venv/bin/activate
pip install ../../dist/balanceai-0.0.2.tar.gz

balanceai init
balanceai dev

Args & Parse

balanceai dev
balanceai zkml
balanceai help

Metadata

Release files for Balanceai 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Balanceai 0.0.2
File Size Uploaded
balanceai-0.0.2.tar.gz 34.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Balanceai 0.0.2
File Interpreter ABI Platform
balanceai-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 73.9 kB

Release files / balanceai-0.0.2.tar.gz

Download URL balanceai-0.0.2.tar.gz
Size 34.0 kB
Tags Source
SHA-256 checksum
How to use checksums
89608a7cc7aaf5f3e5add30b80aadbcdff9bc39aafd4b3673441e8bceeaf1591
BLAKE2b-256 checksum
How to use checksums
4db7e91413d60813da682a817de0caa4e87bb98155d837a6c44c205d701533ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

Release files / balanceai-0.0.2-py3-none-any.whl

Download URL balanceai-0.0.2-py3-none-any.whl
Size 39.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93cd09501bf9b2ab3e5a35d2919c4abc9da0e869600aa1261f301af945ec306e
BLAKE2b-256 checksum
How to use checksums
fd97e42cc1bd4a7dcba36c06fb2e21930f9d51d3b44a3ff4d22044e7d1845e72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page