mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-27 17:08:47 +00:00
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:
parent
adcfecdb67
commit
7037ba0f06
@ -232,9 +232,9 @@ class MLXPipeline(LLM):
|
|||||||
# yield text, if any
|
# yield text, if any
|
||||||
if text:
|
if text:
|
||||||
chunk = GenerationChunk(text=text)
|
chunk = GenerationChunk(text=text)
|
||||||
yield chunk
|
|
||||||
if run_manager:
|
if run_manager:
|
||||||
run_manager.on_llm_new_token(chunk.text)
|
run_manager.on_llm_new_token(chunk.text)
|
||||||
|
yield chunk
|
||||||
|
|
||||||
# break if stop sequence found
|
# break if stop sequence found
|
||||||
if token == eos_token_id or (stop is not None and text in stop):
|
if token == eos_token_id or (stop is not None and text in stop):
|
||||||
|
Loading…
Reference in New Issue
Block a user