33)
44from aws_cdk .aws_lambda import Runtime
55from aws_cdk .aws_lambda_python_alpha import PythonFunction
6- from cdklabs .generative_ai_cdk_constructs .bedrock import (
7- ActionGroupExecutor ,
8- Agent ,
9- AgentActionGroup ,
10- ApiSchema ,
11- BedrockFoundationModel ,
12- )
6+ from cdklabs .generative_ai_cdk_constructs import bedrock
137from constructs import Construct
148
159
@@ -27,22 +21,20 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
2721 handler = "lambda_handler" ,
2822 )
2923
30- agent = Agent (
24+ agent = bedrock . Agent (
3125 self ,
3226 "Agent" ,
33- foundation_model = BedrockFoundationModel .ANTHROPIC_CLAUDE_INSTANT_V1_2 ,
27+ foundation_model = bedrock . BedrockFoundationModel .ANTHROPIC_CLAUDE_INSTANT_V1_2 ,
3428 instruction = "You are a helpful and friendly agent that answers questions about insurance claims." ,
3529 )
3630
37- executor_group = ActionGroupExecutor (lambda_ = action_group_function )
38-
39- action_group = AgentActionGroup (
40- self ,
41- "ActionGroup" ,
42- action_group_name = "InsureClaimsSupport" ,
31+ action_group : bedrock .AgentActionGroup = bedrock .AgentActionGroup (
32+ name = "InsureClaimsSupport" ,
4333 description = "Use these functions for insurance claims support" ,
44- action_group_executor = executor_group ,
45- action_group_state = "ENABLED" ,
46- api_schema = ApiSchema .from_asset ("./lambda/openapi.json" ), # (2)!
34+ executor = bedrock .ActionGroupExecutor .fromlambda_function (
35+ lambda_function = action_group_function ,
36+ ),
37+ enabled = True ,
38+ api_schema = bedrock .ApiSchema .from_local_asset ("./lambda/openapi.json" ), # (2)!
4739 )
4840 agent .add_action_group (action_group )
0 commit comments