Files
rune/scripts/gen_provider_format_truth.py
T
Nick 76430ca71f
Auto-version and Release / release (push) Successful in 10s
CI Pipeline / lint (push) Failing after 28s
CI Pipeline / go-surface (push) Failing after 30s
CI Pipeline / rust-surface (push) Successful in 4m14s
CI Pipeline / unit-tests (push) Failing after 5m16s
CI Pipeline / best-practices (push) Successful in 7s
CI Pipeline / documentation (push) Successful in 7s
CI Pipeline / canary (push) Successful in 1m2s
CI Pipeline / type-check (push) Successful in 35s
CI Pipeline / gitea-offline (push) Successful in 20s
deploy / deploy (push) Failing after 15m11s
CI Pipeline / required-checks (push) Failing after 0s
CI Pipeline / CI Pipeline / notify-event-bridge (push) Successful in 10s
feat(go): factory batch 5 — provider tool-format adapters (contract BUILDER-2026-10-07T23:14:45Z-635b00)
FormatToolsOI/FormatToolsAnthropic ported: the provider-facing shape
transforms with default-parameters fallback. 2-case battery from the
live oracle (with and without the parameters key). The [OI] in the
original name was literal Go generic syntax — invalid; renamed to OI.
2026-10-08 00:20:44 +01:00

36 lines
1.2 KiB
Python

#!/usr/bin/env python3
"""gen_provider_format_truth.py — factory batch 5 truth battery (live
provider_registry._format_tools_* oracles)."""
import json
import sys
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
sys.path.insert(0, str(REPO / "src" / "rune"))
import provider_registry as pr # noqa: E402
def main():
tools = [
{"name": "read_file", "description": "Read a file",
"parameters": {"type": "object", "properties": {"path": {"type": "string"}}}},
{"name": "write_file", "description": "Write a file"}, # no parameters key
]
cases = [
{"fn": "openai", "name": "shape", "input": {"tools": tools},
"expected": pr._format_tools_openai(tools)},
{"fn": "anthropic", "name": "shape", "input": {"tools": tools},
"expected": pr._format_tools_anthropic(tools)},
]
out = {"oracle": "provider_registry._format_tools_*", "generated": "2026-10-07", "cases": cases}
target = REPO / "src/go/provider-registry" / "truth_format.json"
target.write_text(json.dumps(out, indent=1) + "\n")
print(f"wrote {target} ({len(cases)} cases)")
if __name__ == "__main__":
main()