Skip to content

Commit dff41d4

Browse files
Python: address review feedback - guard tools check and fix empty dict serialization
1 parent 245c2f4 commit dff41d4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

python/semantic_kernel/connectors/ai/anthropic/services/anthropic_chat_completion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def _update_function_choice_settings_callback(
143143

144144
@override
145145
def _reset_function_choice_settings(self, settings: "PromptExecutionSettings") -> None:
146-
if hasattr(settings, "tool_choice"):
146+
if hasattr(settings, "tool_choice") and getattr(settings, "tools", None):
147147
settings.tool_choice = {"type": FunctionChoiceType.NONE.value}
148148

149149
@override
@@ -384,7 +384,7 @@ def _get_tool_calls_from_message(self, message: Message) -> list[FunctionCallCon
384384
id=content_block.id,
385385
index=idx,
386386
name=content_block.name,
387-
arguments=json.dumps(content_block.input) if content_block.input else None,
387+
arguments=json.dumps(content_block.input) if content_block.input is not None else None,
388388
)
389389
)
390390

0 commit comments

Comments
 (0)