JIT Protocol Synthesis Framework - Python Engine (jit-api-python)
基於 TypeSafe (Jev) 與 Cactus Needle 3.0 的原生 Python 動態至靜態 API 合成引擎
Pythonic Native Host Engine for Just-In-Time Protocol Synthesis
🌟 特色
- 同進程 Cactus Needle 3.0 端側推論:
在無
TYPESAFE_API_KEY或離線狀態下,直接調用進程內的 Needle 3 SAN (2-bit, 35MB) 進行毫秒級 Tool Calling 與結構萃取,0 網路轉發延遲、0 API 費用。 - 極致優雅的裝飾器語法:
使用
@engine.route(...)宣告語意意圖,無縫支援async def與同步def函式。 - Pydantic v2 動態模型極速路徑: 當路由結構在過去 N 次請求中穩定後,自動生成動態 Pydantic v2 BaseModel,Phase 3 靜態驗證僅需 0.03ms (0ms AI 延遲)!
- 自動版本演進與降級保護: 若遇到型態漂移(Schema Drift),自動降級回 Phase 1 並開啟 v2 / v3 版本的觀測與合約重新凍結。
- 多語言程式碼生成積木: 凍結時同步輸出 TypeScript (Zod)、Golang (.proto / struct) 與 Python (Pydantic / FastAPI)。
🚀 快速上手 (Quick Start)
1. 安裝套件
pip install jit-protocol
2. 宣告端點與執行
import asyncio
from jit_api import JITEngine
engine = JITEngine(stability_threshold=3)
@engine.route(
name="create_invoice",
description="Issue a customer billing invoice",
intent="Bill or invoice a customer for items",
enum_fields={"currency": {"USD": "US Dollar", "EUR": "Euro"}}
)
async def create_invoice(payload, ctx):
return {
"invoice_id": "INV-100",
"customer": payload.get("customer"),
"amount": payload.get("amount"),
"phase": ctx.phase,
}
async def main():
# 支援自然語言或鬆散 JSON
res = await engine.execute({
"message": "Please bill Wayne Corp for 500 dollars urgently",
"customer": "Wayne Corp",
"amount": 500,
"currency": "USD"
})
print(res.data)
if __name__ == "__main__":
asyncio.run(main())
🧪 執行測試與演示
# 執行全套 pytest 測試
PYTHONPATH=python pytest python/tests/ -v
# 執行端到端生命週期演示
PYTHONPATH=python python3 python/examples/demo_lifecycle.py
Metadata
Release files for jit-protocol 1.4.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jit_protocol-1.4.6.tar.gz | 27.4 kB | Without provenance | Details for jit_protocol-1.4.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jit_protocol-1.4.6-py3-none-any.whl | Python 3 | none | any | Details for jit_protocol-1.4.6-py3-none-any.whl |
Total release size: 55.0 kB
Release files / jit_protocol-1.4.6.tar.gz
| Download URL | jit_protocol-1.4.6.tar.gz |
|---|---|
| Size | 27.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
907849731a4e9ea7806331ebcc8da89f6118f661aaf387afb22ddba5dc6179c1
|
|
BLAKE2b-256 checksum How to use checksums |
da1fc8168ee3ebfb188b7907e18d3cfbf099d9ee9c57b02931175f1e4e6bc2cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Release files / jit_protocol-1.4.6-py3-none-any.whl
| Download URL | jit_protocol-1.4.6-py3-none-any.whl |
|---|---|
| Size | 27.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0a2a0a6eef4f6beae89b813875ce21dade72be5d95395b1b8ec59fbb9fa3fd0e
|
|
BLAKE2b-256 checksum How to use checksums |
2c062b5f5daa31a2cf0bece60af12bb127ea22d482213466b9298663b37e76de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Security for jit-protocol 1.4.6
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.