Skip to content

Commit 31a0c48

Browse files
fix json util for reward function (PrimeIntellect-ai#333)
1 parent 7ba2a7d commit 31a0c48

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/zeroband/inference/genesys/format_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ def extract_last_json(completion: str) -> dict | None:
3737
if json_str is None:
3838
return None
3939
try:
40-
return json.loads(json_str)
40+
loaded_json = json.loads(json_str)
41+
if type(loaded_json) == dict:
42+
return loaded_json
43+
return None
4144
except json.JSONDecodeError:
4245
return None

0 commit comments

Comments
 (0)