Skip to content

Commit

Permalink
Updating callback for invoking prior to yielding token
Browse files Browse the repository at this point in the history
  • Loading branch information
dudesparsh committed Feb 6, 2024
1 parent f027696 commit d562e2d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,9 @@ def _stream(
generation_t=ChatGenerationChunk,
)
gen = cast(ChatGenerationChunk, _chat_result.generations[0])
yield gen
if run_manager:
run_manager.on_llm_new_token(gen.text)
yield gen

async def _astream(
self,
Expand All @@ -599,9 +599,10 @@ async def _astream(
generation_t=ChatGenerationChunk,
)
gen = cast(ChatGenerationChunk, _chat_result.generations[0])
yield gen
if run_manager:
await run_manager.on_llm_new_token(gen.text)
yield gen


def _prepare_chat(
self,
Expand Down

0 comments on commit d562e2d

Please sign in to comment.