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
pull/18466/head
William De Vena 4 months ago committed by GitHub
parent 67375e96e0
commit 275877980e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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(

Loading…
Cancel
Save