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

Function match

validation_examples/reward_function/validation.py:109–119  ·  view source on GitHub ↗
(generation)

Source from the content-addressed store, hash-verified

107 return 1.0 if grade_answer(answer, ground_truth) else 0.0
108
109def match(generation):
110 pattern = r"<type>(.*?)</type>.*?<question>(.*?)</question>.*?<answer>(.*?)</answer>"
111 match = re.search(pattern, generation, re.DOTALL)
112
113 if match:
114 result = {
115 "type": match.group(1).strip(),
116 "question": match.group(2).strip(),
117 "answer": match.group(3).strip()
118 }
119 return result
120
121def generate_temp_filename(prefix="temp", suffix=".json"):
122 timestamp = int(time.time() * 1000)

Callers 1

compute_scoreFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected