[JS] Refactor "generate" into a pseudo-flow
Right now generate lives in a liminal space between being some code wrapped around a model action and being a heavier "built-in flow" that handles things like tool loops and eventually retries etc.
I think the latter is more the direction we should take. Ideally generate would be a built-in flow/action such that in a trace you can see:
- Each iteration of a tool/reasoning loop as a separate LLM call in the trace
- Things like retries and output healing as separate steps as well
The generate methods then become syntactical wrappers around the generate action, transforming the inputs into a serializable form.
@mbleigh I assigned it to yourself to bring it up in a discussion in Discord, and later if turned into an action item we can assign it to someone else
Done
Is this actually done? Where? @chrisraygill