Skip to content

Commit 30d70c1

Browse files
committed
Fix function choice behavior handling in ResponsesAgentThreadActions
1 parent 5272beb commit 30d70c1

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
@@ -1209,10 +1209,19 @@ def _get_tools(
12091209
if agent.tools:
12101210
tools.extend(agent.tools)
12111211

1212-
# TODO(evmattso): make sure to respect filters on FCB
1213-
if kernel.plugins:
1214-
funcs = kernel.get_full_list_of_function_metadata()
1215-
tools.extend([kernel_function_metadata_to_response_function_call_format(f) for f in funcs])
1212+
if not function_choice_behavior.enable_kernel_functions:
1213+
return tools
1214+
1215+
if not kernel.plugins:
1216+
return tools
1217+
1218+
funcs = (
1219+
kernel.get_list_of_function_metadata(function_choice_behavior.filters)
1220+
if function_choice_behavior.filters
1221+
else kernel.get_full_list_of_function_metadata()
1222+
)
1223+
1224+
tools.extend([kernel_function_metadata_to_response_function_call_format(f) for f in funcs])
12161225

12171226
return tools
12181227

0 commit comments

Comments
 (0)