ratty-blush•2y ago
How to split a message?
is there a way i could get the response, use an AI Step which would divide the answer into parts in correct order, then send back that response in the end?
14 Replies
plain-purple•2y ago
Yes, with the "Set AI" step this should be possible.
ratty-blushOP•2y ago
Can you specify the steps? I want it to split the message in order
plain-purple•2y ago
Depends on what is the correct order.
Can you give an example of the message and the expected result?
ratty-blushOP•2y ago
so instead of sending this message as a whole

ratty-blushOP•2y ago
i want it to send the message like that

ratty-blushOP•2y ago
@Thomas Off so basicly, i want it so that the AI will split the message into 3 different parts or maybe more, and then i want it to spit out the response in 3 in the correct order
and also, should i use the set AI after or before the response AI step?
plain-purple•2y ago
You could modify the prompt in a way that says: "Give the answer in short paragraphs (two to three sentences each) so that the user understands the answer better".
I would the use the Set AI step to catch the answer, use a function or a code block to split the answer into an array containing the paragraphs.
I'd prefer using a function as then you could return the paragraphs as single text traces which are directly shown to the user.
ratty-blushOP•2y ago
I'm not really good with coding, so i don't know how to make a good function
@Thomas Off
plain-purple•2y ago
I can help you with that. Modify the prompt so that the answer comes back as the shorter paragraphs, then send me the prompt via DM and I'll build you the function.
ratty-blushOP•2y ago
wdym by that? so do i give instructions to the response AI to give it as shorter paragraphs?
@Thomas Off
and i can't modify the prompt, i tried but it keeps giving the answer back as it was
rival-black•2y ago
You can modify the prompt to instruct the AI to respond in paragraphs and format your message in markdown (with bullet points and headers).
You can put that in the prompt or the system instructions
ratty-blushOP•2y ago
it still doesn't do the job, and i also dont want for it to respond in paragraphs, but i want it so that it puts each paragraph into a variable so i could put them in the text box as an answer
plain-purple•2y ago
Why don't you want the answer in paragpraphs? The LLM generates the text, so ith should "know" best, where to create breaks in the text.
Also, if you want a single variable for every paragraph the board will become quite "messy" as wou then need a lot of steps to check if a variable is set or not.
And you don't know how many paragraphs there will be.
With the approach of splitting the text in a function and returning traces, it does not matter how many paragraphs there are.
rival-black•2y ago
^ agree with everything Thomas said.
And if its not doing it you'll need to experiment with the prompt and model, LLMs are decent at structing things in markdown