mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-10 15:06:18 +00:00
community[patch]: Invoke callback prior to yielding token (replicate) (#18626)
## PR title community[patch]: Invoke callback prior to yielding token ## PR message - Description: Invoke callback prior to yielding token in _stream_ method in llms/replicate. - Issue: #16913 - Dependencies: None
This commit is contained in:
parent
9525e392de
commit
5ac1860484
@ -177,12 +177,12 @@ class Replicate(LLM):
|
||||
if not output:
|
||||
break
|
||||
if output:
|
||||
yield GenerationChunk(text=output)
|
||||
if run_manager:
|
||||
run_manager.on_llm_new_token(
|
||||
output,
|
||||
verbose=self.verbose,
|
||||
)
|
||||
yield GenerationChunk(text=output)
|
||||
if stop_condition_reached:
|
||||
break
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user