unstract icon indicating copy to clipboard operation
unstract copied to clipboard

feat: [ISSUE] Create dependencies between the prompts (use prior prompt in next prompt)

Open snanatee-sfg opened this issue 4 months ago • 2 comments

Hi There Is it possible to create dependencies between the prompts? For example, if I have a prompt to extract the number of Figures (Figure_number), can I used the information from that prompt in the next prompt (i.e. For each of the Figure_number figures, extract the titles)? Thanks Shannon

snanatee-sfg avatar Aug 21 '25 07:08 snanatee-sfg

Hi @snanatee-sfg,

Yes, you can create dependencies using variable replacement. First, write a prompt that extracts the number of figures (e.g., prompt key: Figure_number).

In the next prompt, reference it with the following syntax for the prompt key - Example -

For each of the {{Figure_number}} figures, extract the titles.

Here {{Figure_number}} is replaced with the earlier prompt’s output.

If you need to enrich the value via an API, you can use the following syntax -

For each of the {{[Figure_number]https://your-api-endpoint.com}} figures, extract the titles.

Here the response of Figure_number will be passed as payload to the API, and the response will be replaced. This lets you chain prompts and pass outputs seamlessly.

harini-venkataraman avatar Sep 18 '25 13:09 harini-venkataraman

Amazing - thanks so much!

On Thu, Sep 18, 2025, 6:50 AM harini-venkataraman @.***> wrote:

harini-venkataraman left a comment (Zipstack/unstract#1492) https://github.com/Zipstack/unstract/issues/1492#issuecomment-3307574546

Hi @snanatee-sfg https://github.com/snanatee-sfg,

Yes, you can create dependencies using variable replacement. First, write a prompt that extracts the number of figures (e.g., prompt key: Figure_number).

In the next prompt, reference it with the following syntax for the prompt key - Example -

For each of the {{Figure_number}} figures, extract the titles.

Here {{Figure_number}} is replaced with the earlier prompt’s output.

If you need to enrich the value via an API, you can use the following syntax -

For each of the {{[Figure_number]https://your-api-endpoint.com}} figures, extract the titles.

Here the response of Figure_number will be passed as payload to the API, and the response will be replaced. This lets you chain prompts and pass outputs seamlessly.

— Reply to this email directly, view it on GitHub https://github.com/Zipstack/unstract/issues/1492#issuecomment-3307574546, or unsubscribe https://github.com/notifications/unsubscribe-auth/BWJULCJ2STT4PLW3HXVFA7L3TK2B3AVCNFSM6AAAAACENWGNDKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGMBXGU3TINJUGY . You are receiving this because you were mentioned.Message ID: @.***>

snanatee-sfg avatar Sep 18 '25 15:09 snanatee-sfg