Conquering the Flash of Incomplete Markdown (FOIM) with a Clever State Machine

2025-06-04
Conquering the Flash of Incomplete Markdown (FOIM) with a Clever State Machine

Streak encountered the 'Flash of Incomplete Markdown' (FOIM) problem while using OpenAI's streaming API to generate Markdown content with citations. Incomplete links and even AI hallucinations leading to incorrect URLs plagued their product. To solve this, they implemented a state machine on the server to buffer Markdown links until complete before sending them to the client. This not only eliminated FOIM but also reduced OpenAI token usage, sped up response times, and improved privacy—a win-win-win.

Development