Skip to main content

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: 推理引擎结果中的 status
  • result.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。

Metadata

Release files for kele-sdk 0.1

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

Built distribution (wheel)

Table of built distributions (wheels) for kele-sdk 0.1
File Interpreter ABI Platform Actions
kele_sdk-0.1-py3-none-any.whl Python 3 none any Details for kele_sdk-0.1-py3-none-any.whl

Release files / kele_sdk-0.1-py3-none-any.whl

Download URL kele_sdk-0.1-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
58867d6f084723e09bc2c40c97c9cc47e75a008b8bb199c74627465554a463f7
BLAKE2b-256 checksum
How to use checksums
a6dfd47a96c0644f8962fc550131deeba5d43947320959f3dfe1b969dc17f609
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 11, 2026.

Transparency log

Security for kele-sdk 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 1 file in this release has been uploaded with provenance metadata.

Attestation for kele_sdk-0.1-py3-none-any.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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