mirror of
https://github.com/hwchase17/langchain
synced 2024-10-31 15:20:26 +00:00
community[patch]: Invoke callback prior to yielding token (titan_takeoff_pro) (#18624)
## 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_pro. - Issue: #16913 - Dependencies: None
This commit is contained in:
parent
455a74486b
commit
7d216ad1e1
@ -207,9 +207,9 @@ class TitanTakeoffPro(LLM):
|
||||
# Yield any remaining content in the buffer.
|
||||
if buffer:
|
||||
chunk = GenerationChunk(text=buffer.replace("</s>", ""))
|
||||
yield chunk
|
||||
if run_manager:
|
||||
run_manager.on_llm_new_token(token=chunk.text)
|
||||
yield chunk
|
||||
|
||||
@property
|
||||
def _identifying_params(self) -> Mapping[str, Any]:
|
||||
|
Loading…
Reference in New Issue
Block a user