Add your description here
Project description
KELE SDK
KELE 推理引擎的异步 Python SDK。
安装
uv sync
# 或者使用 pip
pip install .
功能与接口
基于 httpx 和 anyio 的异步客户端 KeleClient:
healthz()/readyz(): 服务状态检查。kbs(files, uuid=None): 仅上传文件到服务器临时目录,返回或重用uuid。infer(files, entrypoint, uuid=None): 上传并执行 Python 脚本,返回推理结果、日志、指标等。
files 参数支持 str、Path(标准或 anyio)或 (文件名, 字节流)。
InferResult 快捷属性
infer() 返回 InferResult。除了保留原始重要字段外,还提供了一组更稳定的快捷属性,便于前端或调用方减少对服务端原始 JSON 结构的直接依赖。
保留的核心字段:
result.engine_result: 原始推理结果对象result.log: 服务端日志文本result.metric/result.metric_log: 指标日志对象result.stdout/result.stderr/result.exit_code: 脚本执行输出result.status/result.detail/result.uuid: 接口层状态信息
常用快捷属性:
result.engine_status: 推理引擎结果中的statusresult.conflict_reason: 推理冲突原因result.solution_count: 解数量result.has_solution: 是否存在解result.final_facts: 最终事实列表result.fact_num: 事实数量result.iterations: 迭代次数result.execute_steps: 执行步数result.terminated_by: 终止原因result.question: 推理问题对象result.solutions: 解列表result.include_final_facts: 服务端是否返回了最终事实
这些快捷属性会优先从当前响应中读取;如果后续服务端改为更清晰的分层响应,SDK 也会尽量继续兼容。
示例:
result = await client.infer(...)
print(result.status)
print(result.log)
print(result.metric_log)
print(result.engine_status)
print(result.conflict_reason)
print(result.solution_count)
print(result.has_solution)
使用示例
直接参考目录下的 example.py。
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 Distributions
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 kele_sdk-0.1-py3-none-any.whl.
File metadata
- Download URL: kele_sdk-0.1-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58867d6f084723e09bc2c40c97c9cc47e75a008b8bb199c74627465554a463f7
|
|
| MD5 |
882d3bc908fd5afb25a865f137ac7889
|
|
| BLAKE2b-256 |
a6dfd47a96c0644f8962fc550131deeba5d43947320959f3dfe1b969dc17f609
|
Provenance
The following attestation bundles were made for kele_sdk-0.1-py3-none-any.whl:
Publisher:
pypi.yml on USTC-KnowledgeComputingLab/kele-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kele_sdk-0.1-py3-none-any.whl -
Subject digest:
58867d6f084723e09bc2c40c97c9cc47e75a008b8bb199c74627465554a463f7 - Sigstore transparency entry: 1080391827
- Sigstore integration time:
-
Permalink:
USTC-KnowledgeComputingLab/kele-sdk@d5f64f7bce16eb0c5a743238e2264baa3f2bfbcf -
Branch / Tag:
refs/tags/v0.1 - Owner: https://github.com/USTC-KnowledgeComputingLab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@d5f64f7bce16eb0c5a743238e2264baa3f2bfbcf -
Trigger Event:
push
-
Statement type: