You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using streaming output to call Qianfan chat models, the pre-bound AbortController doesn't work as expected. Instead, the message continues streaming until completion.
After reviewing the code, I think this might be because the _streamResponseChunks function doesn't handle the abort signal from the options parameter, causing the externally bound controller's signal to have no effect.
Hey there, @stanoswald! 👋 I'm here to help you with bugs, questions, and becoming a contributor. Let's squash those bugs together!
I found a similar open issue related to abort signals in the LangChain JS codebase. The issue discusses how the AgentExecutor class does not currently support the use of an AbortController signal in its invoke method. However, it mentions that the AgentExecutor class has a mechanism to handle abort signals through the earlyStoppingMethod property and the _stop method within the AgentExecutorIterator class [1].
Regarding the Qianfan chat models, the _streamResponseChunks function does handle abort signals by passing the abortSignal from the options to the client.send method. This should allow the request to be aborted if needed [2]. If the abort signal is not working as expected, it might be worth checking if the signal is correctly passed and if there are any specific conditions in your environment that could affect its behavior.
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
No response
Description
When using streaming output to call Qianfan chat models, the pre-bound AbortController doesn't work as expected. Instead, the message continues streaming until completion.
After reviewing the code, I think this might be because the
_streamResponseChunks
function doesn't handle the abort signal from the options parameter, causing the externally bound controller's signal to have no effect.System Info
@langchain/[email protected] | MIT | deps: 4 | versions: 5
Node v22.11.0
pnpm 9.9.0
The text was updated successfully, but these errors were encountered: