Skip to content

Update Signature instructions #8059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 of 2 tasks
Francisca266 opened this issue Apr 11, 2025 · 2 comments
Open
1 of 2 tasks

Update Signature instructions #8059

Francisca266 opened this issue Apr 11, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@Francisca266
Copy link

What feature would you like to see?

When we call a Signature, like this:
class MySig(dspy.Signature): """Initial instruction""" input: str = InputField(desc="...") output: int = OutputField(desc="...")
If I update the instruction like MySig.instructions = "new prompt" it will work, but if I reload the page or restart, the instructions revert back to "Initial Instruction".

I’d prefer not to create a new Signature programmatically every time I want to update the instruction.
Is there way for overriding or replacing instructions that doesn’t involve redefining classes?
Thanks

Would you like to contribute?

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

Additional Context

No response

@Francisca266 Francisca266 added the enhancement New feature or request label Apr 11, 2025
@arnavsinghvi11
Copy link
Collaborator

Hi @Francisca266 , can you clarify what "reloading the page or restart" means here?
you can update the instruction by setting the program's internal predictor(s) instructions. Here's an example of doing so in the InferRules optimizer

@Francisca266
Copy link
Author

Hi, thanks for answering.
By "reloading the page or restart" I meant restarting the kernel in a Jupyter Notebook. The Signature class is reloaded from its original definition, so the docstring becomes the default instructions again. Any updates I made to signature.instructions are lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants