Return streamed message on the OpenAiBasedProviderClientBase
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3541472. --> Reported by: [marcus_johansson](https://www.drupal.org/user/385947) Related to !830 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>Currently the OpenAiBasedProviderClientBase doesn't actually return the streamed response, making it not work. See,</p> <pre>if ($this-&gt;streamed &amp;&amp; in_array(AiProviderCapability::StreamChatOutput, $this-&gt;getSupportedCapabilities())) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $payload['stream_options'] = [<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'include_usage' =&gt; TRUE,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $response = $this-&gt;client-&gt;chat()-&gt;createStreamed($payload);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $message = new OpenAiTypeStreamedChatMessageIterator($response);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>}<br>...nothing happens here</pre><h4 id="summary-steps-reproduce">Steps to reproduce (required for bugs, but not feature requests)</h4> <p>Try adding a streamed solution.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Add a return at the end.</p>
issue