mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-04 12:18:24 +00:00
community[patch]: Invoke callback prior to yielding token (titan_takeoff) (#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
This commit is contained in:
parent
ea51cdaede
commit
4570b477b9
@ -151,9 +151,9 @@ class TitanTakeoff(LLM):
|
|||||||
for text in response.iter_content(chunk_size=1, decode_unicode=True):
|
for text in response.iter_content(chunk_size=1, decode_unicode=True):
|
||||||
if text:
|
if text:
|
||||||
chunk = GenerationChunk(text=text)
|
chunk = GenerationChunk(text=text)
|
||||||
yield chunk
|
|
||||||
if run_manager:
|
if run_manager:
|
||||||
run_manager.on_llm_new_token(token=chunk.text)
|
run_manager.on_llm_new_token(token=chunk.text)
|
||||||
|
yield chunk
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _identifying_params(self) -> Mapping[str, Any]:
|
def _identifying_params(self) -> Mapping[str, Any]:
|
||||||
|
Loading…
Reference in New Issue
Block a user