mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-31 02:11:09 +00:00
community[patch]: callback before yield for titan takeoff (#26930)
**Description:** Moves yield to after callback for `_stream` function for the titan takeoff model in the community llm package **Issue:** #16913
This commit is contained in:
parent
c6350d636e
commit
5f2cc4ecb2
@ -252,13 +252,13 @@ class TitanTakeoff(LLM):
|
||||
if buffer: # Ensure that there's content to process.
|
||||
chunk = GenerationChunk(text=buffer)
|
||||
buffer = "" # Reset buffer for the next set of data.
|
||||
yield chunk
|
||||
if run_manager:
|
||||
run_manager.on_llm_new_token(token=chunk.text)
|
||||
yield chunk
|
||||
|
||||
# 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
|
||||
|
Loading…
Reference in New Issue
Block a user