allenai / ScienceWorld

ScienceWorld is a text-based virtual environment centered around accomplishing tasks from the standardized elementary science curriculum.
https://sciworld.apps.allenai.org/
Apache License 2.0
199 stars 24 forks source link

Raise exception if task fails to load #35

Closed aphedges closed 1 year ago

aphedges commented 1 year ago

Before this commit, passing in an invalid task name to load(), e.g., due to a typo, would fail silently but can display a cryptic error message when making another method call. It is better to fail early with a clear error message to make the user's life easier.

aphedges commented 1 year ago

I have fixed the conflicts created after #30 was merged.

PeterAJansen commented 1 year ago

This is a good idea. Currently if the task settings are incorrect, the ScienceWorld will return an error message. But, if no one is attending to that error message (say from it being exclusively piped into an agent), then a user may have configuration errors and may not have coded in error checking into their agent to know that they're running in an invalid configuration. Throwing an exception Python-side is a good way of handling this.

MarcCote commented 1 year ago

Thanks for the fix. FYI I've been working on adding more checks Python side. See upcoming changes in my branch https://github.com/allenai/ScienceWorld/blob/enh_gymnasium/scienceworld/scienceworld.py#L66-L90

I'll merge this fix for now, as I don't know when the other checks will get in.