semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

.Net: Incorrect agent request after upgrading from 1.5.0 to 1.6.2

Open hanhsia opened this issue 2 years ago • 1 comments

Describe the bug agent report 400 error after upgrading to 1.6.2: 2024-03-18 00:40:58.896 +08:00 Http Request: 2024-03-18 00:40:58.900 +08:00 Method:POST RequestUri:https://xxxxx.openai.azure.com/openai/threads/thread_8detYhbU8boskwHHsqgR6T3I/runs?api-version=2024-02-15-preview 2024-03-18 00:40:58.917 +08:00 User-Agent:Semantic-Kernel 2024-03-18 00:40:58.938 +08:00 api-key:xxxxx 2024-03-18 00:40:58.955 +08:00 Request body: {"assistant_id":"asst_NPHiZb4Z2wGZoAOvMs2wLo1V","instructions":"You write concise opinionated articles that are published online. Use an outline to generate an article with two to three sections of prose for each top-level outline element.Output in Markdown format using the same language of the input, by default in Chinese","tools":[{"type":"function","function":{"name":"OutlineGenerator-Ask","description":"Generate an outline","parameters":{"type":"object","properties":{"input":{"type":"string","description":"The user message provided to the agent."},"fileIds":{"type":"String[]","description":""}},"required":["input"]}},{"type":"function","function":{"name":"Researcher-Ask","description":"Provide research summary to support the outline topic","parameters":{"type":"object","properties":{"input":{"type":"string","description":"The user message provided to the agent."},"fileIds":{"type":"String[]","description":""}},"required":["input"]}}]} 2024-03-18 00:40:58.975 +08:00

2024-03-18 00:40:59.331 +08:00 Http Response: 2024-03-18 00:40:59.347 +08:00 StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers: { x-ms-region: Australia East X-Content-Type-Options: nosniff X-Request-ID: 9b2d801f-c395-40e8-99e5-4e39072afe15 apim-request-id: c1aff2fb-f22f-4fed-9ed6-167adb8938d6 Strict-Transport-Security: max-age=31536000; includeSubDomains; preload Date: Sun, 17 Mar 2024 16:40:58 GMT Content-Length: 225 Content-Type: application/json } 2024-03-18 00:40:59.364 +08:00 Response body: { "error": { "message": "Invalid schema for function 'OutlineGenerator-Ask': 'String[]' is not valid under any of the given schemas.", "type": "invalid_request_error", "param": "tools[0]", "code": null } } in 1.5.0. The request body is as following: {"assistant_id":"asst_FenZkqXrXhVDtvRC1a7rvzhn","instructions":"You write concise opinionated articles that are published online. Use an outline to generate an article with two to three sections of prose for each top-level outline element.Output in Markdown format using the same language of the input, by default in Chinese","tools":[{"type":"function","function":{"name":"OutlineGenerator-Ask","description":"Generate an outline","parameters":{"type":"object","properties":{"input":{"type":"string","description":"The user message provided to the agent."}},"required":["input"]}},{"type":"function","function":{"name":"Researcher-Ask","description":"Provide research summary to support the outline topic","parameters":{"type":"object","properties":{"input":{"type":"string","description":"The user message provided to the agent."}},"required":["input"]}}]} Apparently, the generated function adds fileId parameters which has incorrect type schema String[] To Reproduce The code is basically based on Example73_AgentAuthoring. I just change to use Azure openai.

Expected behavior The agent should work.

Platform

  • OS: Windows
  • IDE: Visual Studio.
  • Language: C#
  • Source: 1.6.2

hanhsia avatar Mar 18 '24 01:03 hanhsia

Hi @hanhsia - Apologies for the inconvenience. The fix has been merged into main and should be included in the next package: https://github.com/microsoft/semantic-kernel/pull/5481

crickman avatar Mar 18 '24 15:03 crickman