Skip to main content

OrangeTrace Python SDK

OrangeTrace 的 Python 客户端 SDK,提供检索和贡献 AI Agent 执行轨迹的能力。

安装

pip install orangetrace-client

快速开始

from orangetrace import Client

client = Client(api_key="sk_live_xxxx", base_url="https://www.orangetrace.com")

# 检索相似问题
result = client.search("如何用 Python 读取 CSV 文件?")
for item in result.items:
    print(f"相似度 {item.quality_score:.2f}: {item.question}")

# 贡献执行经验
client.contribute(
    question="如何用 Python 读取 CSV 文件?",
    tool_calls=[
        {"tool": "read_file", "args": {"path": "data.csv"}, "result": "文件读取成功"},
        {"tool": "pandas.read_csv", "args": {"filepath": "data.csv"}, "result": "DataFrame"}
    ],
    confidence=0.95
)

# 查看配额
quota = client.quota()
print(quota.message)

积分/配额系统

操作 配额变化
新客户端 +50 次检索
检索 1 次 -1 次
贡献 1 条轨迹 +10 次检索

配额耗尽时 search() 抛出 QuotaExhausted 异常。

API 文档

Client(api_key=None, base_url="https://www.orangetrace.com", timeout=30, confidence_threshold=0.5)

创建客户端实例。

client.search(question, page=1, per_page=5) -> SearchResult

检索相似问题及其解决方案。

client.contribute(question, tool_calls, confidence=0.8, ...) -> ContributionResult

贡献一条执行轨迹。

client.quota() -> QuotaInfo

查看当前配额信息。

client.health() -> bool

检查后端服务是否可用。

Metadata

Release files for orangetrace-client 1.0.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 orangetrace-client 1.0.0
File Size Uploaded Provenance Actions
orangetrace_client-1.0.0.tar.gz 7.8 kB Without provenance Details for orangetrace_client-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for orangetrace-client 1.0.0
File Interpreter ABI Platform Actions
orangetrace_client-1.0.0-py3-none-any.whl Python 3 none any Details for orangetrace_client-1.0.0-py3-none-any.whl

Total release size: 16.2 kB

Release files / orangetrace_client-1.0.0.tar.gz

Download URL orangetrace_client-1.0.0.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6412b49db9dbc010452c09b5d71eb5c66fcf33b298ca2258ceb130648728d4b9
BLAKE2b-256 checksum
How to use checksums
375542b7cb496e8d2f2c82eb2d7bb319cd8888f662790adad93b5698a873eb4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / orangetrace_client-1.0.0-py3-none-any.whl

Download URL orangetrace_client-1.0.0-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
145d611fe93b0dd7657e136a625beff60e8e96fe5e7e058e0478e1fdcf42a81f
BLAKE2b-256 checksum
How to use checksums
24e41b508f3d60dd08720fb57404fa81c7aee2b91de807b4d3334461869c282a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for orangetrace-client 1.0.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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