Name each entry shape written_by_human checks, and annotate every parameter in loop_claude
This commit is contained in:
@@ -45,7 +45,7 @@ JUDGE_SCHEMA = {
|
||||
}
|
||||
|
||||
|
||||
def judge(root, task, premises, transcript, model, effects: Effects) -> Verdict | Stop:
|
||||
def judge(root: str, task: str, premises: str, transcript: str, model: str, effects: Effects) -> Verdict | Stop:
|
||||
# No tools, so the verdict rests on the transcript grounded() checks it against; no persistence, so its runs stay out of the session picker.
|
||||
args = [
|
||||
"-p",
|
||||
@@ -60,7 +60,7 @@ def judge(root, task, premises, transcript, model, effects: Effects) -> Verdict
|
||||
return retried("judge", lambda: run_judge(root, args, prompt, transcript, effects), effects)
|
||||
|
||||
|
||||
def run_judge(root, args, prompt, transcript, effects: Effects) -> Verdict | Failure:
|
||||
def run_judge(root: str, args: list[str], prompt: str, transcript: str, effects: Effects) -> Verdict | Failure:
|
||||
try:
|
||||
proc = effects.claude(args, root, prompt)
|
||||
except OSError as failure:
|
||||
@@ -75,7 +75,7 @@ def run_judge(root, args, prompt, transcript, effects: Effects) -> Verdict | Fai
|
||||
return verdict
|
||||
|
||||
|
||||
def judge_prompt(task, premises, transcript) -> str:
|
||||
def judge_prompt(task: str, premises: str, transcript: str) -> str:
|
||||
return (
|
||||
f"From README.md:\n{premises}\n\n"
|
||||
f"The task an agent was given:\n{task}\n\n"
|
||||
@@ -85,7 +85,7 @@ def judge_prompt(task, premises, transcript) -> str:
|
||||
)
|
||||
|
||||
|
||||
def verdict_from(output) -> Verdict | Failure:
|
||||
def verdict_from(output: object) -> Verdict | Failure:
|
||||
if not isinstance(output, dict):
|
||||
return Failure("the judge returned no verdict")
|
||||
for name, kind in REPLY_TYPES.items():
|
||||
@@ -99,11 +99,11 @@ def verdict_from(output) -> Verdict | Failure:
|
||||
return Finished(output["evidence"]) if output["finished"] else Unfinished(output["evidence"])
|
||||
|
||||
|
||||
def grounded(evidence, transcript) -> bool:
|
||||
def grounded(evidence: str, transcript: str) -> bool:
|
||||
quoted = plain(evidence)
|
||||
return quoted != "" and quoted in plain(transcript)
|
||||
|
||||
|
||||
def plain(text) -> str:
|
||||
def plain(text: str) -> str:
|
||||
# The judge drops markdown emphasis and reflows whitespace when it quotes.
|
||||
return " ".join(text.replace("*", "").replace("_", "").split())
|
||||
|
||||
Reference in New Issue
Block a user