Skip to content

fix: resolve Semantic Kernel tool call names#7786

Open
meaqua9420 wants to merge 1 commit into
microsoft:mainfrom
meaqua9420:fix-sk-tool-call-name-resolution
Open

fix: resolve Semantic Kernel tool call names#7786
meaqua9420 wants to merge 1 commit into
microsoft:mainfrom
meaqua9420:fix-sk-tool-call-name-resolution

Conversation

@meaqua9420
Copy link
Copy Markdown

Why are these changes needed?

Semantic Kernel / Bedrock can return tool calls with the AutoGen tool plugin prefix or with hyphenated function names, for example autogen-tools_get_weather or get-weather. AutoGen workbenches register the original tool names, such as get_weather, so those calls fail exact-name lookup even though the requested tool exists.

This changes SKChatCompletionAdapter to resolve returned function-call names against the tools passed to the request. Exact matches still win first; then the adapter handles the AutoGen-managed plugin prefix and hyphen/underscore normalization only when it maps unambiguously to a registered tool. Calls from external kernel plugins keep the existing plugin-function name when there is no matching AutoGen tool.

Related issue number

Fixes #5439

Checks

  • I have included any doc changes needed for https://microsoft.github.io/autogen/.
  • I have added tests corresponding to the changes introduced in this PR.
  • I have made sure local checks have passed.

Local validation:

  • uv run --extra semantic-kernel-core pytest packages/autogen-ext/tests/models/test_sk_chat_completion_adapter.py -q
  • uv run ruff format --check packages/autogen-ext/src/autogen_ext/models/semantic_kernel/_sk_chat_completion_adapter.py packages/autogen-ext/tests/models/test_sk_chat_completion_adapter.py
  • uv run ruff check packages/autogen-ext/src/autogen_ext/models/semantic_kernel/_sk_chat_completion_adapter.py packages/autogen-ext/tests/models/test_sk_chat_completion_adapter.py
  • uv run pyright packages/autogen-ext/src/autogen_ext/models/semantic_kernel/_sk_chat_completion_adapter.py packages/autogen-ext/tests/models/test_sk_chat_completion_adapter.py
  • git diff --check origin/main...HEAD

@meaqua9420
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When using SemanticKernel adapter with AWS Bedrock Claude, got Tool Call Error: The tool 'autogen-tools_get_weather' is not available.

1 participant