Switch to Claude Sonnet 4.5 cross-region inference profile
- Update foundation model to us.anthropic.claude-sonnet-4-5-20250929-v1:0 (cross-region inference profile required for Claude 4.x on Bedrock Agents) - Broaden agent role IAM policy to cover wildcard-region foundation model ARN and inference profile ARN - Force alias version bump via description change so CloudFormation creates agent version 2 with the updated model - Remove invalid includedType: 'contractor' from Google Maps Places API request (caused 400 Bad Request — not a valid place type for searchText endpoint)
This commit is contained in:
parent
f01c3f81ce
commit
635e712966
3 changed files with 9 additions and 9 deletions
|
|
@ -17,7 +17,7 @@ slack-webhook Lambda ← verifies Slack signature, returns 200 immediat
|
|||
slack-processor Lambda ← calls Bedrock Agent, logs to DynamoDB, posts reply
|
||||
│
|
||||
▼
|
||||
Bedrock Agent (Claude 3.5 Sonnet)
|
||||
Bedrock Agent (Claude Sonnet 4.5)
|
||||
├── Knowledge Base (AOSS + S3) ← SA8000 docs, SOPs, employee handbook
|
||||
├── QBO_Lookup action group ← QuickBooks vendor search
|
||||
└── Google_Maps_Lookup action group ← fallback vendor search
|
||||
|
|
@ -34,7 +34,7 @@ Bedrock Agent (Claude 3.5 Sonnet)
|
|||
|---|---|
|
||||
| AWS Account | 328440206208, us-east-1 |
|
||||
| CDK | TypeScript, v2 |
|
||||
| LLM | Claude 3.5 Sonnet v2 (`anthropic.claude-3-5-sonnet-20241022-v2:0`) |
|
||||
| LLM | Claude Sonnet 4.5 (`anthropic.claude-sonnet-4-5-20250929-v1:0`) |
|
||||
| Embeddings | Amazon Titan Embed Text V2 (1024 dimensions) |
|
||||
| Vector Store | OpenSearch Serverless (VECTORSEARCH) |
|
||||
| Conversation Log | DynamoDB `seahaven-conversations` (90-day TTL) |
|
||||
|
|
|
|||
|
|
@ -97,8 +97,6 @@ async function searchPlaces(
|
|||
body: JSON.stringify({
|
||||
textQuery: `${trade} near ${location}`,
|
||||
maxResultCount: 5,
|
||||
// Bias toward business results
|
||||
includedType: 'contractor',
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ export class BedrockAgentConstruct extends Construct {
|
|||
public readonly qboLambda: lambdaNodejs.NodejsFunction;
|
||||
public readonly mapsLambda: lambdaNodejs.NodejsFunction;
|
||||
|
||||
// Foundation model used for orchestration
|
||||
private static readonly MODEL_ID = 'anthropic.claude-3-5-sonnet-20241022-v2:0';
|
||||
// Cross-region inference profile — required for Claude 4.x on Bedrock Agents
|
||||
private static readonly MODEL_ID = 'us.anthropic.claude-sonnet-4-5-20250929-v1:0';
|
||||
|
||||
constructor(scope: Construct, id: string, props: BedrockAgentProps) {
|
||||
super(scope, id);
|
||||
|
|
@ -80,9 +80,11 @@ export class BedrockAgentConstruct extends Construct {
|
|||
});
|
||||
|
||||
agentRole.addToPolicy(new iam.PolicyStatement({
|
||||
actions: ['bedrock:InvokeModel'],
|
||||
actions: ['bedrock:InvokeModel', 'bedrock:InvokeModelWithResponseStream'],
|
||||
resources: [
|
||||
`arn:aws:bedrock:${props.region}::foundation-model/${BedrockAgentConstruct.MODEL_ID}`,
|
||||
// Cross-region inference profile (us.*) routes to multiple regions — wildcard region required
|
||||
`arn:aws:bedrock:*::foundation-model/anthropic.claude-sonnet-4-5-20250929-v1:0`,
|
||||
`arn:aws:bedrock:${props.region}:${props.accountId}:inference-profile/${BedrockAgentConstruct.MODEL_ID}`,
|
||||
],
|
||||
}));
|
||||
|
||||
|
|
@ -203,7 +205,7 @@ Keep responses concise, professional, and actionable.`;
|
|||
this.agentAlias = new bedrock.CfnAgentAlias(this, 'AgentAlias', {
|
||||
agentId: this.agent.attrAgentId,
|
||||
agentAliasName: 'live',
|
||||
description: 'Production alias — seahaven-assistant',
|
||||
description: 'Production alias — seahaven-assistant v2 (Claude Sonnet 4.5)',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue