mirror of
https://github.com/firebase/firebase-ios-sdk
synced 2026-11-10 22:45:59 +05:45
Default to VALIDATED function calling mode in GeminiLanguageModel and switch guided generation to responseJsonSchema. Previously, tool-calling requests mapped the default or allowed mode to AUTO, which does not strictly enforce parameter schemas. Because Swift decodes tool arguments strictly, schema malformation results in failed turns. Additionally, guided generation used responseFormat, which the Gemini backend ignores when VALIDATED mode is active during tool-calling sessions, dropping response schemas and causing structured decoding failures in respond(to:generating:). * Default unset and explicit .allowed toolCallingMode to VALIDATED mode to strictly enforce schema adherence via constrained decoding. * Throw LanguageModelError.unsupportedCapability on unrecognized future tool calling modes instead of silently falling back to allowed. * Omit functionCallingConfig entirely when requests declare no functions to avoid contradictory constrained decoding states. * Send responseJsonSchema with application/json MIME type for guided generation, which constrained decoding honors alongside VALIDATED. * Remove unused _responseJsonSchema property from GenerationConfig. * End SSE response streams and cancel tasks upon receiving terminal finish reasons or prompt feedback block reasons. * Add integration test for combined tool calling and guided generation. * Refresh cached App Check debug tokens proactively within TTL window.