Skip to content

Commit

Permalink
community[patch]: Invoke callback prior to yielding token (titan_take…
Browse files Browse the repository at this point in the history
…off) (#18560)

## PR title
community[patch]: Invoke callback prior to yielding token

## PR message
- Description: Invoke callback prior to yielding token in _stream_
method in llms/titan_takeoff.
- Issue: #16913 
- Dependencies: None
  • Loading branch information
Lord-Haji committed Mar 5, 2024
1 parent ea51cda commit 4570b47
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/community/langchain_community/llms/titan_takeoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ def _stream(
for text in response.iter_content(chunk_size=1, decode_unicode=True):
if text:
chunk = GenerationChunk(text=text)
yield chunk
if run_manager:
run_manager.on_llm_new_token(token=chunk.text)
yield chunk

@property
def _identifying_params(self) -> Mapping[str, Any]:
Expand Down

0 comments on commit 4570b47

Please sign in to comment.