Skip to content

Commit

Permalink
community[patch]: callback before yield for cloudflare (#26927)
Browse files Browse the repository at this point in the history
**Description:** Moves yield to after callback for `_stream` function
for the cloudfare workersai model in the community llm package
**Issue:** #16913
  • Loading branch information
subroy13 authored Sep 27, 2024
1 parent 2d9a09d commit 7f37fd8
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 7f37fd8

Please sign in to comment.