This pull request introduces a new stream method in the AI class, enabling response streaming functionality. This method utilizes the stream method from BaseChatModel to stream generated tokens as they are returned from the model, improving the user experience by providing real-time responses.
Added necessary imports for Iterator and BaseMessageChunk.
Implemented the stream method in the AI class to stream responses.
Updated documentation and comments to reflect the new functionality.
This pull request introduces a new
stream
method in theAI
class, enabling response streaming functionality. This method utilizes thestream
method fromBaseChatModel
to stream generated tokens as they are returned from the model, improving the user experience by providing real-time responses.Iterator
andBaseMessageChunk
.stream
method in theAI
class to stream responses.