🐛 fix(utils.py): fix try_setting_streaming_options function to correctly set streaming attribute

The try_setting_streaming_options function now correctly sets the streaming attribute of the llm object to True if it is an instance of BaseLanguageModel and has the streaming attribute. This fixes a bug where the streaming attribute was not being set correctly.
This commit is contained in:
Gabriel Almeida 2023-05-28 17:25:27 -03:00
commit 5f25bb0d58

View file

@ -44,7 +44,7 @@ def try_setting_streaming_options(langchain_object, websocket):
langchain_object.llm_chain, "llm"
):
llm = langchain_object.llm_chain.llm
if isinstance(llm, BaseLanguageModel):
llm.streaming = bool(hasattr(llm, "streaming"))
if isinstance(llm, BaseLanguageModel) and hasattr(llm, "streaming"):
llm.streaming = True
return langchain_object