mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-01 17:13:22 +00:00
community[patch]: callback before yield for friendli (#26842)
**Description:** Moves yield to after callback for `_stream` and `_astream` function for the friendli model in the community package **Issue:** #16913
This commit is contained in:
parent
13acf9e6b0
commit
b61fb98466
@ -233,9 +233,9 @@ class Friendli(LLM, BaseFriendli):
|
||||
)
|
||||
for line in stream:
|
||||
chunk = _stream_response_to_generation_chunk(line)
|
||||
yield chunk
|
||||
if run_manager:
|
||||
run_manager.on_llm_new_token(line.text, chunk=chunk)
|
||||
yield chunk
|
||||
|
||||
async def _astream(
|
||||
self,
|
||||
@ -250,9 +250,9 @@ class Friendli(LLM, BaseFriendli):
|
||||
)
|
||||
async for line in stream:
|
||||
chunk = _stream_response_to_generation_chunk(line)
|
||||
yield chunk
|
||||
if run_manager:
|
||||
await run_manager.on_llm_new_token(line.text, chunk=chunk)
|
||||
yield chunk
|
||||
|
||||
def _generate(
|
||||
self,
|
||||
|
Loading…
Reference in New Issue
Block a user