Bryan3
Bryan32w ago

Including results from previous step in an inline string arg

Hello, in a flow I created I'm trying to include results.c[0] from the previous step into the prompt arg of my string, but the variable doesn't get added and instead just includes the text "results.c[0]". How would I add the value of results.c[0] to the prompt arg? Thanks.
No description
No description
5 Replies
rubenf
rubenf2w ago
Make it an expression not static
Bryan3
Bryan3OP2w ago
Using expression args:
({
"prompt": "summarize this text ${results.c[0]}",
"openai_api_key": "$APIKEY",
"openai_org_id": ""
})
({
"prompt": "summarize this text ${results.c[0]}",
"openai_api_key": "$APIKEY",
"openai_org_id": ""
})
But the input seems to still be
Bryan3
Bryan3OP2w ago
No description
rubenf
rubenf2w ago
You have to make it a valid javascript expression you likely have a string in javascript that correspond to a static string like ^
Bryan3
Bryan3OP2w ago
Got it working with
({
"prompt": `summarize this text ${results.c}`,
"openai_api_key": "$APIKEY",
"openai_org_id": ""
})
({
"prompt": `summarize this text ${results.c}`,
"openai_api_key": "$APIKEY",
"openai_org_id": ""
})
Thanks for the quick response!

Did you find this page helpful?