community[patch]: callback before yield for mlx pipeline (#26928)

**Description:** Moves yield to after callback for `_stream` function
for the MLX pipeline model in the community llm package
**Issue:** #16913
This commit is contained in:
Subhrajyoty Roy 2024-09-27 18:11:34 +05:30 committed by GitHub
parent adcfecdb67
commit 7037ba0f06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -232,9 +232,9 @@ class MLXPipeline(LLM):
# 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):