Skip to main content

Add your description here

Project description

KELE SDK

KELE 推理引擎的异步 Python SDK。

安装

uv sync
# 或者使用 pip
pip install .

功能与接口

基于 httpxanyio 的异步客户端 KeleClient

  • healthz() / readyz(): 服务状态检查。
  • kbs(files, uuid=None): 仅上传文件到服务器临时目录,返回或重用 uuid
  • infer(files, entrypoint, uuid=None): 上传并执行 Python 脚本,返回推理结果、日志、指标等。

files 参数支持 strPath(标准或 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

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

kele_sdk-0.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

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

Hashes for kele_sdk-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 58867d6f084723e09bc2c40c97c9cc47e75a008b8bb199c74627465554a463f7
MD5 882d3bc908fd5afb25a865f137ac7889
BLAKE2b-256 a6dfd47a96c0644f8962fc550131deeba5d43947320959f3dfe1b969dc17f609

See more details on using hashes here.

Provenance

The following attestation bundles were made for kele_sdk-0.1-py3-none-any.whl:

Publisher: pypi.yml on USTC-KnowledgeComputingLab/kele-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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