Skip to content

The agent engineering platform.

community[patch]: Invoke callback prior to yielding token (#18447)

William De Vena275877980e63
diff --git a/libs/community/langchain_community/llms/vertexai.py b/libs/community/langchain_community/llms/vertexai.py
index 58e209f766..b93cdbafb7 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(