MCPcopy Create free account
hub / github.com/bruno686/VisPlay / extract_description

Function extract_description

validation_examples/reward_function/validation.py:82–91  ·  view source on GitHub ↗

Extracts the content of the … block from `predict`. Returns the inner text (with leading/trailing whitespace stripped), or None if no tag is found.

(predict: str)

Source from the content-addressed store, hash-verified

80 return 1.0 if pattern.fullmatch(predict.strip()) else 0.0
81
82def extract_description(predict: str) -> Optional[str]:
83 """
84 Extracts the content of the <answer>…</answer> block from `predict`.
85 Returns the inner text (with leading/trailing whitespace stripped),
86 or None if no <answer> tag is found.
87 """
88 match = re.search(r"<description>([\s\S]*?)</description>", predict, re.DOTALL)
89 if not match:
90 return predict
91 return match.group(1).strip()
92
93def extract_answer(predict: str) -> Optional[str]:
94 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected