Skip to main content

CCP Client — Python SDK

CCP 协议(能力通约协议)的 Python 参考实现。与 JS SDK (@skillmesh-ccp/ccp-client) 功能对等。

安装

pip install ccp-client

快速开始

from ccp_client import CCPClient, search, get_trust_summary

# 创建客户端
client = CCPClient()

# 搜索能力
results = client.search("pdf text extraction")
for cap in results["results"]:
    summary = get_trust_summary(cap)
    print(f"{cap['name']} — {summary['verdict']} ({summary['weighted_score']:.2f})")

# 获取详情
detail = client.detail("pdf-extract-text-001")

# 生成适配器
adapter = client.adapter("pdf-extract-text-001", framework="dsh")

# 回传遥测
client.telemetry("pdf-extract-text-001", success=True, latency_ms=120)

API 参考

方法 说明
search(q, category?, federated?) 搜索能力锚点
detail(id) 获取能力详情
list_capabilities(category?) 列出所有能力
adapter(id, framework) 生成适配器代码
telemetry(id, success, latency_ms?) 回传调用结果
node_info() 获取节点信息
contribute(capability) 贡献新能力

信任向量

from ccp_client import compute_weighted_score, compute_uncertainty

trust = {
    "trustSource": 0.95,
    "trustUsage": 1200,
    "trustSuccess": 0.97,
    "trustRisk": 0.05,
    "trustTime": 0.95,
}

uncertainty = compute_uncertainty(1200)
score = compute_weighted_score(trust, uncertainty)
print(f"信任分: {score:.2f}")  # 信任分: 0.85

许可

MIT

Metadata

Release files for ccp-client 1.0.0

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 ccp-client 1.0.0
File Interpreter ABI Platform
ccp_client-1.0.0-py3-none-any.whl Python 3 none any Details

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

Download URL ccp_client-1.0.0-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
149d086c966abf4ff4892aa681e90f0d6a32df3dd7effc279038c7bd11b51058
BLAKE2b-256 checksum
How to use checksums
3122ec376b8be44c8b0e2fb6bf7605f6dff21a41e55fea4509480da572e3a15d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.8

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file

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