Skip to content

Wrap chat in an iterator always when requested

Marcus Johansson requested to merge mock-stream-response into 1.0.x

Check if this solution would be ok, otherwise I'll implement it as in the ticket (or we can still have the method). Code wise we could move this code to be more generic and have an generic stream iterator interface for all outputs.

What this does is that it will see in the reflection class when a chat provider has been asked to stream, but it has not returned a streamed interface because the provider can't do it or the provider integration has not created a solution for it. If that happen, it will wrap the whole response in an iterator with one single iteration.

This means that its not streaming it all, its just dumping the whole response as one iteration, but it will be in the requested format.

This will make sure that you can still create a third party provider without having to know about iterators/traversables and a third party implementation can just do streaming all the time, even for providers that does not support it.

Merge request reports

Loading