vague_loop_format.py 643 B

12345678910111213141516171819202122232425262728293031
  1. from evaluator import *
  2. DESCRIPTION = "Test if the model can follow vague instructions for how to print IDs following an example."
  3. TAGS = ['code', 'python']
  4. question = """
  5. Write a python program that for ids like
  6. 2401_002
  7. For months 1..12 and ids 1..3
  8. so like 24{month}_{id}
  9. print all the ids
  10. """
  11. evaluator = SubstringEvaluator("2401_001")
  12. for month in range(1, 13):
  13. for id in range(1, 4):
  14. evaluator &= SubstringEvaluator(f"24{month:02}_{id:03}")
  15. TestVagueLoopFormat = question >> LLMRun() >> ExtractCode(keep_main=True) >> PythonRun() >> evaluator
  16. if __name__ == "__main__":
  17. print(run_test(TestVagueLoopFormat))