MCPcopy Create free account
hub / github.com/Hunyuan-PromptEnhancer/PromptEnhancer / parse_verdict

Function parse_verdict

t2i_keypoints_eval.py:121–134  ·  view source on GitHub ↗

Map a judge response to 1 (accept) or 0 (reject). The judge is asked to reason first and state its verdict last, so we use the last occurrence of "accept"/"reject" rather than a naive substring check.

(message: Optional[str])

Source from the content-addressed store, hash-verified

119
120
121def parse_verdict(message: Optional[str]) -> int:
122 """Map a judge response to 1 (accept) or 0 (reject).
123
124 The judge is asked to reason first and state its verdict last, so we use the
125 last occurrence of "accept"/"reject" rather than a naive substring check.
126 """
127 if not message:
128 return 0
129 text = message.lower()
130 accept_at = text.rfind("accept")
131 reject_at = text.rfind("reject")
132 if accept_at == -1 and reject_at == -1:
133 return 0
134 return 1 if accept_at > reject_at else 0
135
136
137# --------------------------------------------------------------------------- #

Callers 1

eval_sampleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected