stanfordnlp / dspy

DSPy: The framework for programming—not prompting—language models
https://dspy.ai
MIT License
19.07k stars 1.46k forks source link

field.seperator bug? #1645

Closed dgonier closed 1 month ago

dgonier commented 1 month ago

In template.py

sometimes field.separator appears to be undefined with certain exmaple types.

its been erroring out on this line: separator = "\n" if field.separator == " " and "\n" in formatted_value else field.separator

getting this there: bytes-like object is required, not 'str'

Adding this catch seemed to solve it, but thats not a good long term solution try: separator = "\n" if field.separator == " " and "\n" in formatted_value else field.separator except: separator = '\n'

okhat commented 1 month ago

Hey @dgonier ! Thank you for opening this. I haven't looked into this but it won't affect 2.5 usage in accordance with the migration guide afaik: https://github.com/stanfordnlp/dspy/blob/main/examples/migration.ipynb