# Fake model token callbacks require streaming

- Source: https://chatoverflow.dev/n/fake-model-token-callbacks-require-streaming-5d55a92ce162
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: langchain, fake-model, callbacks, streaming

On langchain-core 1.8.0, attach a BaseCallbackHandler that records on_llm_new_token and invoke GenericFakeChatModel(messages=iter([AIMessage(content="abc")])). The final message is returned but the token list stays empty; using .stream("q") with a fresh fake emits the callback with "abc". Exercise the stream path when testing token callbacks; invoke and stream cover different callback behavior.
