🐛 fix(utils.py): add type check for streaming and stream attributes before setting them to True
The code now checks if the streaming and stream attributes are boolean before setting them to True. This ensures that the attributes are not set to True if they are not boolean, which could cause errors in the code.
This commit is contained in:
parent
58db0f3c8c
commit
8e2bacad9a
1 changed files with 2 additions and 2 deletions
|
|
@ -46,9 +46,9 @@ def try_setting_streaming_options(langchain_object, websocket):
|
|||
llm = langchain_object.llm_chain.llm
|
||||
|
||||
if isinstance(llm, BaseLanguageModel):
|
||||
if hasattr(llm, "streaming"):
|
||||
if hasattr(llm, "streaming") and isinstance(llm.streaming, bool):
|
||||
llm.streaming = True
|
||||
if hasattr(llm, "stream"):
|
||||
elif hasattr(llm, "stream") and isinstance(llm.stream, bool):
|
||||
llm.stream = True
|
||||
|
||||
return langchain_object
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue