Skip to main content

AIGES Python Wrapper SDK – build AI engine wrappers for the AIGES loader

Project description

pyaiges

AIGES Python Wrapper SDK — 用于构建 AIGES 加载器的 Python AI 引擎插件。

安装

pip install pyaiges

快速开始

from pyaiges import WrapperBase, WrapperData, DataType, DataStatus


class MyWrapper(WrapperBase):
    def init(self, cfg: dict) -> int:
        # 初始化引擎
        return 0

    def fini(self) -> int:
        return 0

    def version(self) -> str:
        return "1.0.0"

    def exec(self, usr_tag, params, data_list, psr_ids):
        # 非流式推理
        results = [
            WrapperData(key="result", data=b"hello", status=DataStatus.ONCE)
        ]
        return (results, 0)

回调方法

在 wrapper 中可以调用框架回调(需要 AIGES 加载器环境):

# 自定义计量
self.meter_custom(handle, "my_key", count=1)

# Trace 日志
self.trace_log(handle, "latency", "100ms")

# EventLog 标签
self.eventlog(handle, "model", "gpt-4")

# 自定义指标
self.metrics_log(handle, "inference_time", {"model": "v1"}, value=150)

# 异步回调(流式模式)
self.async_callback(usr_tag, data_list=[...], err_code=0)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyaiges-0.2.0.tar.gz (19.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyaiges-0.2.0-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file pyaiges-0.2.0.tar.gz.

File metadata

  • Download URL: pyaiges-0.2.0.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for pyaiges-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0d3d8a6fad34e2f205a8ab7dd0931599935764309199ba423cd30d565f83635d
MD5 26fe625a657f25195eb55fe184883464
BLAKE2b-256 8fff6baa970e4dae9da0046a55b08bb3cb87ea36970accbaddcf75b6a9004d5b

See more details on using hashes here.

File details

Details for the file pyaiges-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pyaiges-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for pyaiges-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e2a01e1568e19e14da95501be5fc01f37516bf3c481bf7c0e6aea35f5fbffd28
MD5 7901cc88d4931ba11e9566797c96acff
BLAKE2b-256 9743c0c3a30b4310839f30a37a3824f7cafea791bf2b8afb83b18d73a126769f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page