feat(heretic2-nvfp4): stage soong-lab v0.3.13 live 9-tool schema for the NVFP4 calib tool-call-XML slice
Extracted from the deployed backend (bifrost/tools.py) via the venv with a capturing mock register_tool — the LIVE schema, not a stale copy. OpenAI-function form for brokkr/Dvalin's ~128-row tool-call-XML calib slice (R36 #355 anchor).
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Extract soong-lab's live 9 design-tool schemas as OpenAI-function form.
|
||||
|
||||
Run inside the deployed soong-lab venv (backend/.venv) with cwd=backend so
|
||||
`soong_lab` imports. Monkeypatches register_tool to capture each tool's
|
||||
name/input_schema/description at registration (handlers are never invoked, so
|
||||
dummy store/portrait_service are fine). Emits a `tools` array in the shape the
|
||||
NVFP4 calib tool-call-XML slice needs (brokkr R36 spec, 2026-07-14).
|
||||
"""
|
||||
import json
|
||||
import soong_lab.bifrost.tools as T
|
||||
|
||||
captured = []
|
||||
|
||||
|
||||
def _fake_register_tool(registry, name, input_schema, handler=None, description=None, **kw):
|
||||
captured.append({
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": name,
|
||||
"description": description or "",
|
||||
"parameters": input_schema,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
T.register_tool = _fake_register_tool
|
||||
|
||||
|
||||
class _Dummy:
|
||||
def __getattr__(self, k):
|
||||
return _Dummy()
|
||||
|
||||
def __call__(self, *a, **k):
|
||||
return _Dummy()
|
||||
|
||||
|
||||
T.register_design_tools(_Dummy(), _Dummy(), _Dummy())
|
||||
|
||||
out = "/tmp/soong_tools_v0313.json"
|
||||
with open(out, "w") as f:
|
||||
json.dump(captured, f, indent=2)
|
||||
print(f"captured {len(captured)} tools -> {out}")
|
||||
print("names:", [c["function"]["name"] for c in captured])
|
||||
Reference in New Issue
Block a user