diff --git a/libs/community/langchain_community/llms/deepsparse.py b/libs/community/langchain_community/llms/deepsparse.py index 9375a3f7722..6a743cd5065 100644 --- a/libs/community/langchain_community/llms/deepsparse.py +++ b/libs/community/langchain_community/llms/deepsparse.py @@ -190,10 +190,10 @@ class DeepSparse(LLM): ) for token in inference: chunk = GenerationChunk(text=token.generations[0].text) - yield chunk if run_manager: run_manager.on_llm_new_token(token=chunk.text) + yield chunk async def _astream( self, @@ -228,7 +228,7 @@ class DeepSparse(LLM): ) for token in inference: chunk = GenerationChunk(text=token.generations[0].text) - yield chunk if run_manager: await run_manager.on_llm_new_token(token=chunk.text) + yield chunk