dspy icon indicating copy to clipboard operation
dspy copied to clipboard

Feature request: Handcraft and freeze parts of a prompt, optimize other parts

Open AriMKatz opened this issue 9 months ago • 1 comments

I don't believe this is possible. but unsure with the new backend refactor.

I'd like to be able to handcraft and "freeze" a prompt template and have DSPY fill in few shot examples, template variables and arbitrary things like that. These sections can have some initial value or just be blank.

Maybe this goes against the philosophy of Dspy and is a won't fix? I got some upvotes in discord when I posted this

AriMKatz avatar Apr 25 '24 18:04 AriMKatz

This is possible right now with one of the fixes in PR https://github.com/stanfordnlp/dspy/pull/843

Below is an example of pseudocode for doing this:

def my_optimize_fn: # load previously optimized program # re-optimize using COPRO optimizer # re-optimize using BootstrapRandomFewShot # save optimized program

drawal1 avatar Apr 25 '24 19:04 drawal1