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
+4 -6
View File
@@ -49,7 +49,7 @@ final class DbnDiscrepancyAgent
array $sliceSelection,
?callable $emit = null
): array {
$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';
$language = dbnToolsNormalizeUiLanguage($language);
$textA = mb_substr((string)($fileA['text'] ?? ''), 0, self::MAX_DOC_CHARS, 'UTF-8');
@@ -754,11 +754,11 @@ PROMPT;
): array {
$locale = dbnToolsLanguageName($language);
$sourceCount = count($numberedSources);
$cloudDeploy = DbnBedrockModelRouter::deploymentForEngine($engine, $this->azure instanceof DbnBedrockGateway);
$deployLabel = match ($engine) {
'gpu' => 'GPU (cuttlefish)',
'dbn_legal_v3' => 'dbn-legal-agent-v3',
'azure_full' => 'gpt-4o',
default => $this->azure->chatDeployment(),
default => $cloudDeploy,
};
if (empty($numberedSources)) {
@@ -872,10 +872,8 @@ PROMPT;
} elseif ($engine === 'gpu') {
$response = dbnToolsCallGpuLlm($messages, $opts);
$raw = (string)($response['choices'][0]['message']['content'] ?? '');
} elseif ($engine === 'azure_full') {
$raw = $this->azure->withDeployment('gpt-4o')->chatText($messages, $opts);
} else {
$raw = $this->azure->chatText($messages, $opts);
$raw = $this->azure->withDeployment($cloudDeploy)->chatText($messages, $opts);
}
} catch (Throwable $e) {
dbnToolsAbort('Synthesis LLM request failed: ' . $e->getMessage(), 502, 'llm_error');