Skip to content

Commit fbccbe7

Browse files
author
zer0dss
committed
add patch for scenario nan
1 parent d02aef4 commit fbccbe7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

edsl/scenarios/scenario.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,12 +574,16 @@ def to_dict(
574574
{'food': 'wood chips'}
575575
576576
"""
577+
import math
577578
from edsl.scenarios import FileStore
578579
from edsl.prompts import Prompt
579580

580581
d = self.data.copy()
581582
for key, value in d.items():
582-
if isinstance(value, FileStore) or isinstance(value, Prompt):
583+
# Check for NaN values and replace with None for JSON serialization
584+
if isinstance(value, float) and math.isnan(value):
585+
d[key] = None
586+
elif isinstance(value, FileStore) or isinstance(value, Prompt):
583587
value_dict = value.to_dict(add_edsl_version=add_edsl_version)
584588
if (
585589
offload_base64

0 commit comments

Comments
 (0)