mirror of
https://github.com/microsoft/autogen.git
synced 2025-12-13 16:01:10 +00:00
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:
parent
51b601b6d8
commit
be085567ea
@ -313,7 +313,7 @@ class SKChatCompletionAdapter(ChatCompletionClient):
|
|||||||
for tool in tools:
|
for tool in tools:
|
||||||
if isinstance(tool, BaseTool):
|
if isinstance(tool, BaseTool):
|
||||||
# Convert Tool to KernelFunction using KernelFunctionFromTool
|
# 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
|
self._tools_plugin.functions[tool.schema["name"]] = kernel_function
|
||||||
|
|
||||||
def _process_tool_calls(self, result: ChatMessageContent) -> list[FunctionCall]:
|
def _process_tool_calls(self, result: ChatMessageContent) -> list[FunctionCall]:
|
||||||
|
|||||||
@ -106,7 +106,7 @@ class KernelFunctionFromTool(KernelFunction):
|
|||||||
return_parameter=return_param,
|
return_parameter=return_param,
|
||||||
is_prompt=False,
|
is_prompt=False,
|
||||||
is_asynchronous=True,
|
is_asynchronous=True,
|
||||||
plugin_name=plugin_name or "",
|
plugin_name=plugin_name,
|
||||||
)
|
)
|
||||||
super().__init__(metadata=metadata)
|
super().__init__(metadata=metadata)
|
||||||
self._tool = tool
|
self._tool = tool
|
||||||
|
|||||||
@ -71,7 +71,7 @@ def sk_client() -> AzureChatCompletion:
|
|||||||
FunctionCallContent(
|
FunctionCallContent(
|
||||||
id="call_UwVVI0iGEmcPwmKUigJcuuuF",
|
id="call_UwVVI0iGEmcPwmKUigJcuuuF",
|
||||||
function_name="calculator",
|
function_name="calculator",
|
||||||
plugin_name="autogen_tools",
|
plugin_name=None,
|
||||||
arguments="{}",
|
arguments="{}",
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@ -113,7 +113,7 @@ def sk_client() -> AzureChatCompletion:
|
|||||||
FunctionCallContent(
|
FunctionCallContent(
|
||||||
id="call_n8135GXc2kbiaaDdpImsB1VW",
|
id="call_n8135GXc2kbiaaDdpImsB1VW",
|
||||||
function_name="calculator",
|
function_name="calculator",
|
||||||
plugin_name="autogen_tools",
|
plugin_name=None,
|
||||||
arguments="",
|
arguments="",
|
||||||
content_type="function_call", # type: ignore
|
content_type="function_call", # type: ignore
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user