Title: Bug: SK runs his self-made function by ignoring the auto-invoke function config · Issue #281 · microsoft/semantic-kernel-java · GitHub
Open Graph Title: Bug: SK runs his self-made function by ignoring the auto-invoke function config · Issue #281 · microsoft/semantic-kernel-java
X Title: Bug: SK runs his self-made function by ignoring the auto-invoke function config · Issue #281 · microsoft/semantic-kernel-java
Description: Describe the bug I set the toolcallbehavior of allowOnlyKernelFunctions as true, and passed the functions to the kernel but the kernel make a functiontoolcall by himself and just invoke it. To Reproduce Steps to reproduce the behavior: L...
Open Graph Description: Describe the bug I set the toolcallbehavior of allowOnlyKernelFunctions as true, and passed the functions to the kernel but the kernel make a functiontoolcall by himself and just invoke it. To Repr...
X Description: Describe the bug I set the toolcallbehavior of allowOnlyKernelFunctions as true, and passed the functions to the kernel but the kernel make a functiontoolcall by himself and just invoke it. To Repr...
Opengraph URL: https://github.com/microsoft/semantic-kernel-java/issues/281
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bug: SK runs his self-made function by ignoring the auto-invoke function config","articleBody":"**Describe the bug**\nI set the toolcallbehavior of `allowOnlyKernelFunctions` as `true`, and passed the functions to the kernel\nbut the kernel make a functiontoolcall by himself and just invoke it.\n\n**To Reproduce**\nSteps to reproduce the behavior:\n```java\n List\u003cKernelFunction\u003c?\u003e\u003e functions = kernel.getPlugins().stream()\n .map(KernelPlugin::getFunctions)\n .map(Map::values)\n .flatMap(Collection::stream)\n .toList();\n FunctionResult\u003cString\u003e preResult = kernel\n .invokeAsync(function)\n .withToolCallBehavior(ToolCallBehavior.allowOnlyKernelFunctions(true, functions))\n .withArguments(\n KernelFunctionArguments.builder()\n .withInput(userInput)\n .withVariable(\"metadata\", metadata)\n .build())\n .withResultType(ContextVariableTypes.getGlobalVariableTypeForClass(String.class))\n .block(); // occur exception here, for invoke a self-make function\n``` \n\n**Expected behavior**\nOnly invoke the passed functions.\n\n**Screenshots**\n\u003cimg width=\"1183\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/45438851-1178-403d-82e2-3848783dc0c8\" /\u003e\n\n**Maven**\n - Version: 3.3.9\n - Dependencies: 1.4.3\n\n**Platform**\n - IDE: IDEA\n - JDK version: 17\n\n**Additional context**\nExcption: com.azure.core.exception.HttpResponseException: Status code 400, \"{\"error\":{\"message\":\"Invalid 'messages[1].tool_calls[1].function.name': string does not match pattern. Expected a string that matches the pattern '^[a-zA-Z0-9_-]+$'.\",\"type\":\"invalid_request_error\",\"code\":\"invalid_value\",\"param\":\"messages[1].tool_calls[1].function.name\"}}\"\n","author":{"url":"https://github.com/zzzhy","@type":"Person","name":"zzzhy"},"datePublished":"2025-01-02T12:29:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/281/semantic-kernel-java/issues/281"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e10066a8-beba-3fc4-89e4-2e8aec10ca38 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8A64:39430A:1F66B13:2D44E17:6A4CF297 |
| html-safe-nonce | 9f07818babffedb6358450dc8f7acb8483269f48a23fccae57f9177e468a50ef |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QTY0OjM5NDMwQToxRjY2QjEzOjJENDRFMTc6NkE0Q0YyOTciLCJ2aXNpdG9yX2lkIjoiNjc0NDg2NjI4MDM1ODg2NzYwNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8b2a2543502b0d44aefd54f92de5e1853d1b670ab95f5dad16016b5308847684 |
| hovercard-subject-tag | issue:2765951704 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/semantic-kernel-java/281/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fc090833a6d70d6706a4deb9644c32ddf65c3c2ab16a61e49555bf75cdbd7eea/microsoft/semantic-kernel-java/issues/281 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fc090833a6d70d6706a4deb9644c32ddf65c3c2ab16a61e49555bf75cdbd7eea/microsoft/semantic-kernel-java/issues/281 |
| og:image:alt | Describe the bug I set the toolcallbehavior of allowOnlyKernelFunctions as true, and passed the functions to the kernel but the kernel make a functiontoolcall by himself and just invoke it. To Repr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | zzzhy |
| hostname | github.com |
| expected-hostname | github.com |
| None | 299b43bca6e02ad35197ffeba30d2466846d5fb02ab96fbced5b5e6cec589fb8 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/semantic-kernel-java git https://github.com/microsoft/semantic-kernel-java.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 814249293 |
| octolytics-dimension-repository_nwo | microsoft/semantic-kernel-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 814249293 |
| octolytics-dimension-repository_network_root_nwo | microsoft/semantic-kernel-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | efec6750a5afcaeaf5dfcf629f404cf98c8371e3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width