mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-06 21:43:44 +00:00
community[patch]: add missing chunk parameter for _stream/_astream (#17807)
- Description: Add missing chunk parameter for _stream/_astream for some chat models, make all chat models in a consistent behaviour. - Issue: N/A - Dependencies: N/A
This commit is contained in:
@@ -327,9 +327,10 @@ class ChatZhipuAI(BaseChatModel):
|
||||
for r in response.events():
|
||||
if r.event == "add":
|
||||
delta = r.data
|
||||
yield ChatGenerationChunk(message=AIMessageChunk(content=delta))
|
||||
chunk = ChatGenerationChunk(message=AIMessageChunk(content=delta))
|
||||
yield chunk
|
||||
if run_manager:
|
||||
run_manager.on_llm_new_token(delta)
|
||||
run_manager.on_llm_new_token(delta, chunk=chunk)
|
||||
|
||||
elif r.event == "error":
|
||||
raise ValueError(f"Error from ZhipuAI API response: {r.data}")
|
||||
|
Reference in New Issue
Block a user