Download src/cpptai/phases/phase4.py from Fra150/Cpptai: direct link, hf CLI and curl.
- Browser
- Download file 1.14 kB
-
https://huggingface.co/spaces/Fra150/Cpptai/resolve/main/src/cpptai/phases/phase4.py
- Command line
-
hf download hf://spaces/Fra150/Cpptai/src/cpptai/phases/phase4.py
-
curl -L -o phase4.py https://huggingface.co/spaces/Fra150/Cpptai/resolve/main/src/cpptai/phases/phase4.py
1.14 kB
| """Phase IV: External Convergence.""" | |
| from __future__ import annotations | |
| import time | |
| from ..core import ConvergenceProtocol | |
| from ..types import PhaseOutput, RunConfig, SolutionState | |
| def run(state: SolutionState, config: RunConfig) -> tuple[SolutionState, PhaseOutput]: | |
| t0 = time.perf_counter() | |
| conv = ConvergenceProtocol() | |
| external = {"external_synthesis": "", "responses": {}, "confidence": 0.0} | |
| if config.external_enabled: | |
| # Pass blocks for topic extraction | |
| context = { | |
| "problem": state.problem, | |
| "blocks": state.blocks, | |
| "building_height": state.building_height, | |
| } | |
| external = conv.convene_meeting(context) | |
| dt = time.perf_counter() - t0 | |
| state.extra["external"] = external | |
| return ( | |
| state, | |
| PhaseOutput( | |
| name="phase4_external_convergence", | |
| input={"external_enabled": config.external_enabled, "blocks_count": len(state.blocks)}, | |
| output={"confidence": external.get("confidence", 0.0), "external_synthesis": external.get("external_synthesis", "")}, | |
| duration_sec=dt, | |
| ), | |
| ) | |