diff --git a/libs/community/langchain_community/llms/mlx_pipeline.py b/libs/community/langchain_community/llms/mlx_pipeline.py index 3856a80658ecb..1e320a24f9b82 100644 --- a/libs/community/langchain_community/llms/mlx_pipeline.py +++ b/libs/community/langchain_community/llms/mlx_pipeline.py @@ -232,9 +232,9 @@ def _stream( # yield text, if any if text: chunk = GenerationChunk(text=text) - yield chunk if run_manager: run_manager.on_llm_new_token(chunk.text) + yield chunk # break if stop sequence found if token == eos_token_id or (stop is not None and text in stop):