fix: remove sk tool adapter plugin name (#5444)

<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

Semantic kernel prepends the plugin name to the tool name when passing
the tools to model clients and this is causing a mismatch between tool
names in SK and the AssistantAgent. Since plugin names are optional, we
have opted to remove it.

## Related issue number

<!-- For example: "Closes #1234" -->

Closes #5420 

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

---------

Co-authored-by: Leonardo Pinheiro <lpinheiro@microsoft.com>
This commit is contained in:
Leonardo Pinheiro 2025-02-08 14:54:05 +10:00 committed by GitHub
parent 51b601b6d8
commit be085567ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View File

@ -313,7 +313,7 @@ class SKChatCompletionAdapter(ChatCompletionClient):
for tool in tools:
if isinstance(tool, BaseTool):
# Convert Tool to KernelFunction using KernelFunctionFromTool
kernel_function = KernelFunctionFromTool(tool, plugin_name="autogen_tools") # type: ignore
kernel_function = KernelFunctionFromTool(tool) # type: ignore
self._tools_plugin.functions[tool.schema["name"]] = kernel_function
def _process_tool_calls(self, result: ChatMessageContent) -> list[FunctionCall]:

View File

@ -106,7 +106,7 @@ class KernelFunctionFromTool(KernelFunction):
return_parameter=return_param,
is_prompt=False,
is_asynchronous=True,
plugin_name=plugin_name or "",
plugin_name=plugin_name,
)
super().__init__(metadata=metadata)
self._tool = tool

View File

@ -71,7 +71,7 @@ def sk_client() -> AzureChatCompletion:
FunctionCallContent(
id="call_UwVVI0iGEmcPwmKUigJcuuuF",
function_name="calculator",
plugin_name="autogen_tools",
plugin_name=None,
arguments="{}",
)
],
@ -113,7 +113,7 @@ def sk_client() -> AzureChatCompletion:
FunctionCallContent(
id="call_n8135GXc2kbiaaDdpImsB1VW",
function_name="calculator",
plugin_name="autogen_tools",
plugin_name=None,
arguments="",
content_type="function_call", # type: ignore
)