Add finished reason to stream iterator
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3541471. --> Reported by: [marcus_johansson](https://www.drupal.org/user/385947) Related to !832 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>When you are iterating the stream iterator, you might have reasons to know if its finished or if its on its last iteration. We might also be interested in knowing, why something finished.</p> <p>To be able to do this, we need to be able to set a finished reason as it comes back from the stream. Currently that is not possible.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <ul> <li>Add a setFinishReason to the StreamedChatMessageIteratorInterface, that takes a string.</li> <li>Add a getFinishReason to the StreamedChatMessageIteratorInterface that returns null or a string.</li> <li>Add both to the base class.</li> </ul>
issue