File size: 940 Bytes
c0e3412 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | """Phase V: Presentation."""
from __future__ import annotations
import time
from ..presentation import arrange_solution_simple
from ..types import PhaseOutput, RunConfig, SolutionState
def run(state: SolutionState, config: RunConfig) -> tuple[SolutionState, PhaseOutput]:
t0 = time.perf_counter()
descent = state.extra.get("descent_result") or {}
external = state.extra.get("external") or {}
raw = (descent.get("final_answer", "") + "\n" + external.get("external_synthesis", "")).strip()
arranged = arrange_solution_simple(raw, context="technical")
dt = time.perf_counter() - t0
state.extra["final_answer"] = raw
state.extra["final_arranged"] = arranged
return (
state,
PhaseOutput(
name="phase5_presentation",
input={"context": "technical"},
output={"final_answer": raw, "final_arranged": arranged},
duration_sec=dt,
),
)
|