Skip to content

Commit

Permalink
community[patch]: callback before yield for cloudflare (langchain-ai#…
Browse files Browse the repository at this point in the history
…26927)

**Description:** Moves yield to after callback for `_stream` function
for the cloudfare workersai model in the community llm package
**Issue:** langchain-ai#16913
  • Loading branch information
subroy13 authored and Sheepsta300 committed Oct 1, 2024
1 parent 73956f7 commit 39bd931
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ def _stream(
logger.debug(chunk)
raise e
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"])
if run_manager:
run_manager.on_llm_new_token(data["response"])
logger.debug("stream end")
self.streaming = original_steaming

Expand Down

0 comments on commit 39bd931

Please sign in to comment.