Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion openevolve/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -2660,7 +2660,9 @@ def get_artifacts(self, program_id: str) -> Dict[str, Union[str, bytes]]:
# Load small artifacts from JSON
if program.artifacts_json:
try:
small_artifacts = json.loads(program.artifacts_json)
small_artifacts = json.loads(
program.artifacts_json, object_hook=self._artifact_deserializer
)
artifacts.update(small_artifacts)
except json.JSONDecodeError as e:
logger.warning(f"Failed to decode artifacts JSON for program {program_id}: {e}")
Expand Down
9 changes: 9 additions & 0 deletions tests/test_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ def test_store_small_artifacts(self):
program = self.database.get(self.program.id)
self.assertIsNotNone(program.artifacts_json)

def test_store_small_bytes_artifacts(self):
"""Test that small bytes artifacts round-trip as bytes"""
artifacts = {"blob": b"\x00\x01binary"}

self.database.store_artifacts(self.program.id, artifacts)

retrieved = self.database.get_artifacts(self.program.id)
self.assertEqual(retrieved, artifacts)

def test_store_large_artifacts(self):
"""Test storing large artifacts to disk"""
large_content = "x" * (50 * 1024) # 50KB
Expand Down
Loading