mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-01 02:50:47 +00:00
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
This commit is contained in:
@@ -382,13 +382,13 @@ class VertexAI(_VertexAICommon, BaseLLM):
|
|||||||
**params,
|
**params,
|
||||||
):
|
):
|
||||||
chunk = self._response_to_generation(stream_resp)
|
chunk = self._response_to_generation(stream_resp)
|
||||||
yield chunk
|
|
||||||
if run_manager:
|
if run_manager:
|
||||||
run_manager.on_llm_new_token(
|
run_manager.on_llm_new_token(
|
||||||
chunk.text,
|
chunk.text,
|
||||||
chunk=chunk,
|
chunk=chunk,
|
||||||
verbose=self.verbose,
|
verbose=self.verbose,
|
||||||
)
|
)
|
||||||
|
yield chunk
|
||||||
|
|
||||||
|
|
||||||
@deprecated(
|
@deprecated(
|
||||||
|
Reference in New Issue
Block a user