OrangeTrace Python SDK - 检索和贡献 AI Agent 执行轨迹
Project description
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
检查后端服务是否可用。
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 Distribution
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 orangetrace_client-1.0.0.tar.gz.
File metadata
- Download URL: orangetrace_client-1.0.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6412b49db9dbc010452c09b5d71eb5c66fcf33b298ca2258ceb130648728d4b9
|
|
| MD5 |
303c70b145f99dba872288d5fa4cfbfc
|
|
| BLAKE2b-256 |
375542b7cb496e8d2f2c82eb2d7bb319cd8888f662790adad93b5698a873eb4d
|
File details
Details for the file orangetrace_client-1.0.0-py3-none-any.whl.
File metadata
- Download URL: orangetrace_client-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
145d611fe93b0dd7657e136a625beff60e8e96fe5e7e058e0478e1fdcf42a81f
|
|
| MD5 |
8b49348c19a15dac72ae36d71ffc8b74
|
|
| BLAKE2b-256 |
24e41b508f3d60dd08720fb57404fa81c7aee2b91de807b4d3334461869c282a
|