Skip to content

Commit 72bfa27

Browse files
committed
Added control over empty tools
1 parent cba0a18 commit 72bfa27

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/strands/models/sagemaker.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,11 @@ def format_request(
191191
# Add all key-values from the model config to the payload except endpoint_name and inference_component_name
192192
**{k: v for k, v in self.config.items() if k not in ["endpoint_name", "inference_component_name"]},
193193
}
194+
195+
# Remove tools and tool_choice if tools = []
196+
if payload["tools"] == []:
197+
payload.pop("tools")
198+
payload.pop("tool_choice", None)
194199

195200
# TODO: this should be a @override of format_request_message
196201
for message in payload["messages"]:

0 commit comments

Comments
 (0)