fix(tools): route quick/pro tiers to Haiku/Sonnet on Bedrock

Tier engine strings (claude_haiku/claude_sonnet) were stripped back to
azure_mini by per-method whitelists, so both tiers ran gpt-4o-mini and Pro
charged 2x for the same model. Add a shared DbnBedrockModelRouter::
deploymentForEngine() helper and route the cloud path through it across
summarize, ask, barnevernet, discrepancy, deep-research, and korrespond.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-15 17:35:22 +02:00
parent a8b1bb87a6
commit a4b5b6e3f2
6 changed files with 37 additions and 27 deletions
+7 -9
View File
@@ -212,7 +212,7 @@ final class DbnLegalToolsService
public function ask(string $question, string $language = 'en', string $engine = 'azure_mini', ?string $persona = null): array
{
$engine = in_array($engine, ['azure_mini', 'azure_full'], true) ? $engine : 'azure_mini';
$engine = in_array($engine, ['azure_mini', 'azure_full', 'claude_haiku', 'claude_sonnet'], true) ? $engine : 'azure_mini';
$client = dbnToolsRequireClient();
$personaResolved = dbnToolsResolvePersona((int)$client['id'], $persona);
$search = $this->search($question, $language, 7, 'disabled', null, 'both', $personaResolved['slug']);
@@ -1231,7 +1231,7 @@ PROMPT;
error_log('[dbn-persona] gateway init failed for model ' . $model . ': ' . $e->getMessage());
}
}
return [$this->azure, ($engine === 'azure_full') ? 'gpt-4o' : 'gpt-4o-mini'];
return [$this->azure, DbnBedrockModelRouter::deploymentForEngine($engine, $this->azure instanceof DbnBedrockGateway)];
}
/**
@@ -2060,7 +2060,7 @@ PROMPT;
string $depth = 'standard'
): array {
$text = $this->requirePasteText($text);
$engine = in_array($engine, ['azure_mini', 'azure_full', 'gpu'], true) ? $engine : 'azure_mini';
$engine = in_array($engine, ['azure_mini', 'azure_full', 'gpu', 'claude_haiku', 'claude_sonnet'], true) ? $engine : 'azure_mini';
$locale = dbnToolsLanguageName($language);
@@ -2114,7 +2114,7 @@ PROMPT;
['role' => 'system', 'content' => $system],
['role' => 'user', 'content' => $prompt],
];
$maxTok = ($engine === 'azure_full') ? 8000 : 4000;
$maxTok = in_array($engine, ['azure_full', 'claude_sonnet'], true) ? 8000 : 4000;
$chatOpts = ['json' => true, 'temperature' => 0.1, 'max_tokens' => $maxTok, 'timeout' => 120];
$deployLabel = $this->azure->chatDeployment();
@@ -2122,12 +2122,10 @@ PROMPT;
if ($engine === 'gpu') {
$response = $this->callGpuLlm($messages, $chatOpts);
$deployLabel = 'GPU (local)';
} elseif ($engine === 'azure_full') {
$response = $this->azure->withDeployment('gpt-4o')->chat($messages, $chatOpts);
$deployLabel = 'gpt-4o';
} else {
$response = $this->azure->withDeployment('gpt-4o-mini')->chat($messages, $chatOpts);
$deployLabel = 'gpt-4o-mini';
$deploy = DbnBedrockModelRouter::deploymentForEngine($engine, $this->azure instanceof DbnBedrockGateway);
$response = $this->azure->withDeployment($deploy)->chat($messages, $chatOpts);
$deployLabel = $deploy;
}
} catch (Throwable $e) {
dbnToolsAbort('LLM request failed: ' . $e->getMessage(), 502, 'llm_error');