mirror of
https://github.com/hwchase17/langchain
synced 2024-10-31 15:20:26 +00:00
community[patch]: Invoke callback prior to yielding token (#18449)
## PR title community[patch]: Invoke callback prior to yielding token ## PR message - Description: Invoke callback prior to yielding token in _stream method in chat_models/perplexity. - Issue: https://github.com/langchain-ai/langchain/issues/16913 - Dependencies: None
This commit is contained in:
parent
eb04d0d3e2
commit
2087cbae64
@ -230,9 +230,9 @@ class ChatPerplexity(BaseChatModel):
|
||||
)
|
||||
default_chunk_class = chunk.__class__
|
||||
chunk = ChatGenerationChunk(message=chunk, generation_info=generation_info)
|
||||
yield chunk
|
||||
if run_manager:
|
||||
run_manager.on_llm_new_token(chunk.text, chunk=chunk)
|
||||
yield chunk
|
||||
|
||||
def _generate(
|
||||
self,
|
||||
|
Loading…
Reference in New Issue
Block a user