https://www.boundaryml.com logo
🟡 Best Pattern for Streaming 'Plan' in Model Flow
# questions
a
Hello everyone I am wondering what the best pattern is that people have for streaming the “plan” / what the model is working on. My flow involves 1) finding relevant websites and then calling o3 to analyze and do a deep report. Could I use BAML semantic streaming and have a “current step” string state in my class? I know there’s also the reasoning trace i could maybe use? This is intended to give the user a ui update on what’s happening so they don’t think it’s broken and more sophisticated than just “preparing your report” perplexity does a similar thing where it says “looking at and then the site name etc” Thanks!
b
Semantic streaming is pretty much exactly what you're looking for, yeah, or even just basic streaming!
"current step" doesn't make a lot of sense to me, because it wouldn't change as the response comes back, it would only go from partially filled in to complete - unless you're suggesting doing that as a post-process step
a
Thanks!!
b
Oh, I forgot to mention: structs in BAML have a defined field order, because (1) that’s the order in which you ask the model for the info in ctx.output_format, (2) that’s the order in which the model fills out the response which means (3) that’s the order in which we parse partial values
So that’s the other thing to think about wrt streaming