$modelName ?? (string)dbnToolsEnv('DBN_BEDROCK_CHAT_MODEL', DbnBedrockModelRouter::LITELLM_SONNET), ]); } /** * Returns a gateway pre-configured with the best model for the given tool and tier. * * Three-tier routing: * - Azure-pinned tools (redact, translate, timeline, search-legal) → always Azure, Bedrock flag ignored. * - Haiku tools (ask, summarize, timeline-deep, citations) → Haiku when Bedrock on, Azure when off. * - Sonnet tools (korrespond, legal-analysis, deep-research, etc.) → Sonnet when on, Azure when off. */ public static function makeForTool( string $tool, string $tier = 'free' ): DbnAzureOpenAiGateway|DbnBedrockGateway { $route = DbnBedrockModelRouter::routeForTool($tool, $tier); // Azure-pinned tools bypass the Bedrock flag entirely if ($route['gateway'] === 'azure') { return new DbnAzureOpenAiGateway(); } // Bedrock tools fall back to Azure when disabled if (!self::bedrockEnabled()) { return new DbnAzureOpenAiGateway(); } return self::make($route['model']); } }