"""`tool_calling_judge` 스텝 -- self-consistency corrections 를 PMI 툴 루프로 판정. `multi_step.py` 의 tool_calling_judge 분기에서 이동 (2026-08-10, 동작 동일). 판정 로직 자체는 `judge.run_tool_calling_judge` 가 갖고 있고, 이 스텝은 artifacts 배선만 한다: - 입력: `sample.artifacts["corrections"][corrections_step]` (기본 basic_correction -- 교집합을 통과한 교정 제안들) - 출력: `sample.artifacts["judge_decisions"]` / `["judge_tool_calls"]` - 텍스트는 건드리지 않는다 -- 되돌리기는 `apply_judge_decisions` rule 스텝이 한다. """ import logging from solar_eval.models.sample import EvalSample from solar_eval.pipelines import judge from solar_eval.pipelines.pipeline import BaseStep, StepContext from solar_eval.pipelines.registry import register_step logger = logging.getLogger(__name__) @register_step("tool_calling_judge") class ToolCallingJudgeStep(BaseStep): async def run(self, sample: EvalSample, ctx: StepContext) -> None: step = self.config step_model = step.get("model", ctx.model) step_re = step.get("reasoning_effort", ctx.reasoning_effort) step_max_tokens = step.get("max_tokens", ctx.max_tokens) corrections_step = step.get("corrections_step", "basic_correction") corrections = sample.artifacts.get("corrections", {}).get(corrections_step, []) judge_result = await judge.run_tool_calling_judge( step, text=ctx.text, original_text=ctx.original_text, corrections=corrections, provider=ctx.provider, model=step_model, reasoning_effort=step_re, max_tokens=step_max_tokens, prompts=self.env.prompts, project_dir=self.env.project_dir, ) judge_decisions = sample.artifacts.setdefault("judge_decisions", {}) judge_decisions[self.name] = judge_result["decisions"] judge_tool_calls = sample.artifacts.setdefault("judge_tool_calls", {}) judge_tool_calls[self.name] = judge_result["tool_call_log"] ctx.add_usage(judge_result["usage"]) # ctx.text 는 그대로 둔다 -- 되돌리기는 apply_judge_decisions rule 이 한다.