3
3
)
4
4
from aws_cdk .aws_lambda import Runtime
5
5
from 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
13
7
from constructs import Construct
14
8
15
9
@@ -27,22 +21,20 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
27
21
handler = "lambda_handler" ,
28
22
)
29
23
30
- agent = Agent (
24
+ agent = bedrock . Agent (
31
25
self ,
32
26
"Agent" ,
33
- foundation_model = BedrockFoundationModel .ANTHROPIC_CLAUDE_INSTANT_V1_2 ,
27
+ foundation_model = bedrock . BedrockFoundationModel .ANTHROPIC_CLAUDE_INSTANT_V1_2 ,
34
28
instruction = "You are a helpful and friendly agent that answers questions about insurance claims." ,
35
29
)
36
30
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" ,
43
33
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)!
47
39
)
48
40
agent .add_action_group (action_group )
0 commit comments