concept
Gemini response and error mapping
Application-specific mapper; distinguish safety blocks, incomplete, empty, tool proposals and failures before validating structured content. Not a provider API.
Formal Syntax & Structure
artificial-intelligence syntaxartificial-intelligence
app_state(normalized_outcome, text)Working Example
Example Snippetartificial-intelligence
def app_state(outcome, text): # Application vocabulary, NOT Gemini status enum values. if outcome in {"blocked", "incomplete", "tool_requested", "retryable", "fatal"}: return outcome if outcome != "complete": return "unknown" return "ready" if isinstance(text, str) and text.strip() else "empty"
for outcome, text in [("blocked", ""), ("complete", ""), ("complete", "July"), ("incomplete", "Jul")]: print(app_state(outcome, text))