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) (langchain-ai#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: langchain-ai#16913 
- Dependencies: None
  • Loading branch information
Lord-Haji authored and thebhulawat committed Mar 6, 2024
1 parent 198de73 commit a1fa4be
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 a1fa4be

Please sign in to comment.