Skip to content

Commit

Permalink
community[patch]: callback before yield for mlx pipeline (#26928)
Browse files Browse the repository at this point in the history
**Description:** Moves yield to after callback for `_stream` function
for the MLX pipeline model in the community llm package
**Issue:** #16913
  • Loading branch information
subroy13 committed Sep 27, 2024
1 parent adcfecd commit 7037ba0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/community/langchain_community/llms/mlx_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 7037ba0

Please sign in to comment.