A Python SDK for creating JSON-RPC servers with hybrid compute capabilities
Project description
README.md
Hybrid Compute SDK
A Python SDK for creating JSON-RPC servers with hybrid compute capabilities.
Installation
pip install hybrid_compute_sdk
Run tests
python -m pytest test.py -v --full-trace
Example Usages
Stuck? Here are some implementations:
Using the SDK
from web3 import Web3
from openai_offchain import openai_create_question
from openai_offchain import select_best_answer
from hybrid_compute_sdk import HybridComputeSDK
import logging
import os
# Initialize logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
def server_loop():
port = int(os.environ.get("PORT", os.environ.get("OC_LISTEN_PORT", 1234)))
# new sdk instance
sdk = HybridComputeSDK()
# prepare the server
sdk.create_json_rpc_server_instance()
# add a custom server action
sdk.add_server_action("createQuestion()", openai_create_question)
# add another server action
sdk.add_server_action("selectBestAnswer()", select_best_answer)
# start server
sdk.serve_forever()
server_loop()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hybrid_compute_sdk-0.2.33.tar.gz.
File metadata
- Download URL: hybrid_compute_sdk-0.2.33.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfe1cbdc1d8d3b8019b10f2fc847da21606e34c6af14b2a9005a9d7b54150161
|
|
| MD5 |
7a20727c0f409c887b39b906929ee831
|
|
| BLAKE2b-256 |
d4bcc088ee271ca52b0f3e04ae673d6e5d42b2cfb1f65570afb03268e30e88c0
|
File details
Details for the file hybrid_compute_sdk-0.2.33-py3-none-any.whl.
File metadata
- Download URL: hybrid_compute_sdk-0.2.33-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11fda99d0294a83bfdc903a4946d033a7795d6eed71ed383552a682a624249b0
|
|
| MD5 |
3c86664cbae92f3a0144a734a89c5cf9
|
|
| BLAKE2b-256 |
560f67f45ce6697f0149cba0012d5a54c6e0c06ec72a02f11a76e3a4e8d542d0
|