Patch Changes
-
#9900
a9b5059Thanks @hntrl! - fix(core): update method signatures to usePartial<CallOptions>for options parametersUpdated
invoke,stream,generate, andgeneratePromptmethod signatures acrossRunnable,BaseChatModel, andBaseLLMto correctly acceptPartial<CallOptions>instead of fullCallOptions. This aligns the implementation with theRunnableInterfacespecification and allows users to pass partial options (e.g.,{ signal: abortedSignal }) without TypeScript errors. -
#9900
a9b5059Thanks @hntrl! - Improved abort signal handling for chat models:- Added
ModelAbortErrorclass in@langchain/core/errorsthat contains partial output when a model invocation is aborted mid-stream invoke()now throwsModelAbortErrorwith accumulatedpartialOutputwhen aborted during streaming (when using streaming callback handlers)stream()throws a regularAbortErrorwhen aborted (since chunks are already yielded to the caller)- All provider implementations now properly check and propagate abort signals in both
_generate()and_streamResponseChunks()methods - Added standard tests for abort signal behavior
- Added