Skip to content
Shihao Qi
ProjectsWritingNotesSearchAbout

TAG

Error Handling

Everything filed under this tag.

1 entries

01Writing

Generator Exceptions Surface on the First next(): try Around create_chat_completion(stream=True) Never Sees the Context Window Error2026-11-08Calling a generator function only builds a generator; the body, including any raise in it, runs on the first next(). llama-cpp-python checks the context window inside such a body, so the try around a streaming call, and the shrink-and-retry under it, never fire with the real library. The test double raised at call time, so the tests passed with 100% coverage.#Python#LLM#Error Handling#Testing#Autarkia
← All tagsSearch the site
© 2026 Shihao Qi
TagsRSSGitHubEmail