mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-08 04:25:46 +00:00
community[patch]: callback before yield for cloudflare (#26927)
**Description:** Moves yield to after callback for `_stream` function for the cloudfare workersai model in the community llm package **Issue:** #16913
This commit is contained in:
parent
2d9a09dfa4
commit
7f37fd8b80
@ -105,9 +105,9 @@ class CloudflareWorkersAI(LLM):
|
|||||||
logger.debug(chunk)
|
logger.debug(chunk)
|
||||||
raise e
|
raise e
|
||||||
if data is not None and "response" in data:
|
if data is not None and "response" in data:
|
||||||
|
if run_manager:
|
||||||
|
run_manager.on_llm_new_token(data["response"])
|
||||||
yield GenerationChunk(text=data["response"])
|
yield GenerationChunk(text=data["response"])
|
||||||
if run_manager:
|
|
||||||
run_manager.on_llm_new_token(data["response"])
|
|
||||||
logger.debug("stream end")
|
logger.debug("stream end")
|
||||||
self.streaming = original_steaming
|
self.streaming = original_steaming
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user