append_to_last_tokens() — langchain Function Reference
Architecture documentation for the append_to_last_tokens() function in streaming_stdout_final_only.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 8ce35f14_977d_60d3_1288_c6ed5fd9cb8e["append_to_last_tokens()"] f95e695f_57c0_a0ed_1f28_1ea7c2b7584d["FinalStreamingStdOutCallbackHandler"] 8ce35f14_977d_60d3_1288_c6ed5fd9cb8e -->|defined in| f95e695f_57c0_a0ed_1f28_1ea7c2b7584d d608f7aa_7bee_2b7c_2da5_9d1292ea5966["on_llm_new_token()"] d608f7aa_7bee_2b7c_2da5_9d1292ea5966 -->|calls| 8ce35f14_977d_60d3_1288_c6ed5fd9cb8e style 8ce35f14_977d_60d3_1288_c6ed5fd9cb8e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/callbacks/streaming_stdout_final_only.py lines 20–26
def append_to_last_tokens(self, token: str) -> None:
"""Append token to the last tokens."""
self.last_tokens.append(token)
self.last_tokens_stripped.append(token.strip())
if len(self.last_tokens) > len(self.answer_prefix_tokens):
self.last_tokens.pop(0)
self.last_tokens_stripped.pop(0)
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does append_to_last_tokens() do?
append_to_last_tokens() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/callbacks/streaming_stdout_final_only.py.
Where is append_to_last_tokens() defined?
append_to_last_tokens() is defined in libs/langchain/langchain_classic/callbacks/streaming_stdout_final_only.py at line 20.
What calls append_to_last_tokens()?
append_to_last_tokens() is called by 1 function(s): on_llm_new_token.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free