dspy icon indicating copy to clipboard operation
dspy copied to clipboard

[Bug] Adding string formatting to the docstring

Open streidarai opened this issue 1 month ago • 1 comments

What feature would you like to see?

e.g., in docstrings, when there is string formatting like f-strings, the docstring doesn't recognise the string and returns to the default: https://github.com/stanfordnlp/dspy/issues/1429

Is this possible to implement? if so, I'd love to help! For now, I've used the workaround in that issue but: a) This wasn't made clear from the docs b) the workaround isn't quite hacky

Would you like to contribute?

  • [x] Yes, I'd like to help implement this.
  • [ ] No, I just want to request it.

Additional Context

No response

streidarai avatar Nov 13 '25 07:11 streidarai

@streidarai Thanks for reporting the issue!

Do you mean building instructions dynamically? You can use dspy.make_signature(..., instructions=f"....") for this purposes. Docstring is meant to be static.

chenmoneygithub avatar Nov 13 '25 23:11 chenmoneygithub