Skip to main content

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)

Metadata

Release files for pyaiges 0.2.0

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

Source distribution (sdist)

Source distribution for pyaiges 0.2.0
File Size Uploaded
pyaiges-0.2.0.tar.gz 19.4 kB Details

Built distribution (wheel)

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

Total release size: 40.9 kB

Release files / pyaiges-0.2.0.tar.gz

Download URL pyaiges-0.2.0.tar.gz
Size 19.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0d3d8a6fad34e2f205a8ab7dd0931599935764309199ba423cd30d565f83635d
BLAKE2b-256 checksum
How to use checksums
8fff6baa970e4dae9da0046a55b08bb3cb87ea36970accbaddcf75b6a9004d5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release files / pyaiges-0.2.0-py3-none-any.whl

Download URL pyaiges-0.2.0-py3-none-any.whl
Size 21.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2a01e1568e19e14da95501be5fc01f37516bf3c481bf7c0e6aea35f5fbffd28
BLAKE2b-256 checksum
How to use checksums
9743c0c3a30b4310839f30a37a3824f7cafea791bf2b8afb83b18d73a126769f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

0.2.0 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