File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed
functional/event_handler/required_dependencies Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 19
19
"function" : " submitVacationRequest" ,
20
20
"parameters" : [
21
21
{
22
- "name" : " startDate " ,
22
+ "name" : " start_date " ,
23
23
"type" : " string" ,
24
24
"value" : " 2024-03-15"
25
25
},
26
26
{
27
- "name" : " endDate " ,
27
+ "name" : " end_date " ,
28
28
"type" : " string" ,
29
29
"value" : " 2024-03-20"
30
30
}
31
31
]
32
- }
32
+ }
Original file line number Diff line number Diff line change @@ -218,20 +218,20 @@ def test_bedrock_agent_function_with_parameters():
218
218
received_params = {}
219
219
220
220
@app .tool (description = "Function that accepts parameters" )
221
- def vacation_request (startDate , endDate ):
221
+ def vacation_request (start_date , end_date ):
222
222
# Store received parameters for assertion
223
- received_params ["startDate " ] = startDate
224
- received_params ["endDate " ] = endDate
225
- return f"Vacation request from { startDate } to { endDate } submitted"
223
+ received_params ["start_date " ] = start_date
224
+ received_params ["end_date " ] = end_date
225
+ return f"Vacation request from { start_date } to { end_date } submitted"
226
226
227
227
# WHEN calling the event handler with parameters
228
228
raw_event = load_event ("bedrockAgentFunctionEvent.json" )
229
229
raw_event ["function" ] = "vacation_request"
230
230
result = app .resolve (raw_event , {})
231
231
232
232
# THEN parameters should be correctly passed to the function
233
- assert received_params ["startDate " ] == "2024-03-15"
234
- assert received_params ["endDate " ] == "2024-03-20"
233
+ assert received_params ["start_date " ] == "2024-03-15"
234
+ assert received_params ["end_date " ] == "2024-03-20"
235
235
assert (
236
236
"Vacation request from 2024-03-15 to 2024-03-20 submitted"
237
237
in result ["response" ]["functionResponse" ]["responseBody" ]["TEXT" ]["body" ]
You can’t perform that action at this time.
0 commit comments