Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1209,10 +1209,19 @@ def _get_tools(
if agent.tools:
tools.extend(agent.tools)

# TODO(evmattso): make sure to respect filters on FCB
if kernel.plugins:
funcs = kernel.get_full_list_of_function_metadata()
tools.extend([kernel_function_metadata_to_response_function_call_format(f) for f in funcs])
if not function_choice_behavior.enable_kernel_functions:
return tools

if not kernel.plugins:
return tools

funcs = (
kernel.get_list_of_function_metadata(function_choice_behavior.filters)
if function_choice_behavior.filters
else kernel.get_full_list_of_function_metadata()
)

tools.extend([kernel_function_metadata_to_response_function_call_format(f) for f in funcs])

return tools

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from semantic_kernel.agents.open_ai.openai_responses_agent import OpenAIResponsesAgent
from semantic_kernel.agents.open_ai.responses_agent_thread_actions import ResponsesAgentThreadActions
from semantic_kernel.connectors.ai.function_choice_behavior import FunctionChoiceBehavior
from semantic_kernel.contents.chat_message_content import ChatMessageContent
from semantic_kernel.contents.streaming_chat_message_content import StreamingChatMessageContent
from semantic_kernel.contents.streaming_text_content import StreamingTextContent
Expand Down Expand Up @@ -499,11 +500,11 @@ async def mock_invoke_function_call(*args, **kwargs):

def test_get_tools(mock_agent, kernel, custom_plugin_class):
kernel.add_plugin(custom_plugin_class)

fcb = FunctionChoiceBehavior()
tools = ResponsesAgentThreadActions._get_tools(
agent=mock_agent,
kernel=kernel,
function_choice_behavior=MagicMock(),
function_choice_behavior=fcb,
)

assert len(tools) == len(mock_agent.tools) + len(kernel.get_full_list_of_function_metadata())
Expand Down
Loading