From 275877980e6356c0941454dedc72fec44b4649d8 Mon Sep 17 00:00:00 2001 From: William De Vena <60664495+williamdevena@users.noreply.github.com> Date: Sun, 3 Mar 2024 23:14:40 +0100 Subject: [PATCH] community[patch]: Invoke callback prior to yielding token (#18447) ## PR title community[patch]: Invoke callback prior to yielding token ## PR message Description: Invoke callback prior to yielding token in _stream method in llms/vertexai. Issue: https://github.com/langchain-ai/langchain/issues/16913 Dependencies: None --- libs/community/langchain_community/llms/vertexai.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/community/langchain_community/llms/vertexai.py b/libs/community/langchain_community/llms/vertexai.py index 58e209f7665..b93cdbafb7f 100644 --- a/libs/community/langchain_community/llms/vertexai.py +++ b/libs/community/langchain_community/llms/vertexai.py @@ -382,13 +382,13 @@ class VertexAI(_VertexAICommon, BaseLLM): **params, ): chunk = self._response_to_generation(stream_resp) - yield chunk if run_manager: run_manager.on_llm_new_token( chunk.text, chunk=chunk, verbose=self.verbose, ) + yield chunk @deprecated(