Add AWS Bedrock three-tier gateway routing (LiteLLM via Colin)

Routes AI tools across three tiers based on task complexity:
- Azure GPT-4o-mini always: redact, translate, timeline-basic, search-legal (mechanical tasks)
- Claude Haiku 4.5 (Bedrock): ask, summarize, timeline-deep, citations (Norwegian nuance)
- Claude Sonnet 4.6 (Bedrock): korrespond, legal-analysis, deep-research, barnevernet-analyze,
  discrepancy-find, advocate (public-facing legal output)

No AWS credentials in app — credentials live in LiteLLM on Colin (same as nova-lite).
Rollback: DBN_BEDROCK_ENABLED=false in .env, no code push needed.

Includes extended thinking support for Pro deep-research via chatWithThinking().
Claude Opus 4.7 constant added for future premium tier (needs litellm_config.yaml entry).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-25 15:22:48 +02:00
parent 17ad54cf36
commit 8a11001bff
11 changed files with 520 additions and 43 deletions
+6 -2
View File
@@ -3,6 +3,7 @@ declare(strict_types=1);
require_once __DIR__ . '/bootstrap.php';
require_once __DIR__ . '/AzureOpenAiGateway.php';
require_once __DIR__ . '/DbnGatewayFactory.php';
require_once __DIR__ . '/LegalTools.php';
/**
@@ -22,12 +23,15 @@ final class DbnLegalAnalysisAgent
private const LEGAL_TIMEOUT = 60;
private const LEGAL_MODEL = 'dbn-legal-agent-v3';
private DbnAzureOpenAiGateway $azureMini;
private DbnAzureOpenAiGateway|DbnBedrockGateway $azureMini;
private DbnLegalToolsService $legalSvc;
public function __construct()
{
$this->azureMini = (new DbnAzureOpenAiGateway())->withDeployment('gpt-4o-mini');
// On Azure: gpt-4o-mini for extraction/synthesis. On Bedrock: factory picks Haiku/Sonnet.
$this->azureMini = DbnGatewayFactory::bedrockEnabled()
? DbnGatewayFactory::makeForTool('legal-analysis')
: (new DbnAzureOpenAiGateway())->withDeployment('gpt-4o-mini');
$this->legalSvc = new DbnLegalToolsService();
}