stair_spirit
stair_spirit5mo ago

Escape the prompt field in order to insert previous result in to to body of an OpenAI Completion?

Hi, hoping someone can provide a quick pointer. I'm trying to send a bit of JSON to a Completions model to get a text summary, but I can't seem to escape the field. Any hints?
No description
6 Replies
rubenf
rubenf5mo ago
in Test this step, you're putting the raw value, results.b doesn't exist in that context what you likely want to do is to say "Test up to <X>"
stair_spirit
stair_spiritOP5mo ago
Hey Ruben, thanks for the reply, I am sorry but I'm not following. What is <X> here? Oh - I see what you meant now. Thanks for the pointer.
stair_spirit
stair_spiritOP5mo ago
@rubenf sorry for the tag. I'm unsure how I need to properly format the "prompt" input. It either doesn't interpolate the value or the OpenAI API gives me this JSON error. To make things simpler, {results.f} is just plain-text for now.
No description
No description
rubenf
rubenf5mo ago
you need the whole object to be an expr and then it's just plain javascript no need to guess our interpolation e.g: ({"foo": results.x}) or
({"foo": `bar ${results.x}`})
({"foo": `bar ${results.x}`})
stair_spirit
stair_spiritOP5mo ago
Ah ok, so something like this?
No description
rubenf
rubenf5mo ago
yup