The Gemini API provides an alternative AI provider for a text-to-SQL application while preserving OpenAI support. Integrate it through the Google Genai Java client SDK rather than custom REST handling. section 6.4.3
A disciplined integration keeps provider choice explicit:
- Define a LanguageModelClient interface and inject provider-specific implementations into the SQL generator service. section 6.4.3
- Use ai.provider as a configuration default, preserving OpenAI when no provider is specified. section 6.4.3
- Avoid silent runtime fallback: provider failures should remain visible so benchmark precision metrics are not contaminated by an unmeasured provider. section 6.4.3
Listing 6.20 Setting the Gemini API properties
google:
ai:
api:
key: ${GOOGLE_AI_API_KEY:}
model: ${GOOGLE_AI_MODEL:gemini-2.5-flash} #A
Configure the Gemini API key and model through application properties, with environment variables supplying deployment-specific values. section 6.4.3
