mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-31 02:11:09 +00:00
community[patch]: callback before yield for deepsparse llm (#26822)
**Description:** Moves yield to after callback for `_stream` and `_astream` function for the deepsparse model in the community package **Issue:** #16913
This commit is contained in:
parent
de70a64e3a
commit
b1da532522
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user