Skip to content

Commit 1b57d35

Browse files
committed
Fix function choice behavior handling in ResponsesAgentThreadActions
1 parent 7f4c45e commit 1b57d35

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

python/semantic_kernel/agents/open_ai/responses_agent_thread_actions.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,10 +1242,19 @@ def _get_tools(
12421242
if agent.tools:
12431243
tools.extend(agent.tools)
12441244

1245-
# TODO(evmattso): make sure to respect filters on FCB
1246-
if kernel.plugins:
1247-
funcs = kernel.get_full_list_of_function_metadata()
1248-
tools.extend([kernel_function_metadata_to_response_function_call_format(f) for f in funcs])
1245+
if not function_choice_behavior.enable_kernel_functions:
1246+
return tools
1247+
1248+
if not kernel.plugins:
1249+
return tools
1250+
1251+
funcs = (
1252+
kernel.get_list_of_function_metadata(function_choice_behavior.filters)
1253+
if function_choice_behavior.filters
1254+
else kernel.get_full_list_of_function_metadata()
1255+
)
1256+
1257+
tools.extend([kernel_function_metadata_to_response_function_call_format(f) for f in funcs])
12491258

12501259
return tools
12511260

0 commit comments

Comments
 (0)