[1.x] Keep the text of every step in a prompted response
Merged
ME
7d ago+105+105+012345678901234567890123456789-6-6-0123456789
Fixes #1221
prompt() builds text from the last step only, while stream() joins the text of every step. When the model answers in the same step as a tool call and the run ends on an empty step, prompt() returns "" and stores an empty content, although the answer is in steps.
Reproduction
$response = (new ReportingAgent)->prompt(
'Write a two-paragraph answer, and in the same reply call the log_answer tool. After the tool result, say nothing more.',
);
$response->text; // ""
$response->steps->pluck('text')->all(); // ["<the two paragraphs>", ""]