mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-07 14:03:26 +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:
@@ -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,
|
||||
|
Reference in New Issue
Block a user