spring-ai icon indicating copy to clipboard operation
spring-ai copied to clipboard

When adding the defaultTool tool callback mcp tool in 1.0.0-M7 and 1.0.0-M8, an error occurs. The used version is springai-openai.

Open liu-zhen-wei opened this issue 1 year ago • 9 comments

Please do a quick search on GitHub issues first, there might be already a duplicate issue for the one you are about to create. If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:

Bug description 1.0.0-M7和1.0.0-M8在添加defaultTool工具回调mcp工具的时候,报错,使用是的springai-openai

Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type java.lang.String from Object value (token JsonToken.START_OBJECT) at [Source: REDACTED (StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION disabled); line: 1, column: 689] (through reference chain: org.springframework.ai.openai.api.OpenAiApi$ChatCompletion["choices"]->java.util.ArrayList[0]->org.springframework.ai.openai.api.OpenAiApi$ChatCompletion$Choice["message"]->org.springframework.ai.openai.api.OpenAiApi$ChatCompletionMessage["tool_calls"]->java.util.ArrayList[0]->org.springframework.ai.openai.api.OpenAiApi$ChatCompletionMessage$ToolCall["function"]->org.springframework.ai.openai.api.OpenAiApi$ChatCompletionMessage$ChatCompletionFunction["arguments"])

Environment 1.0.0-M7和1.0.0-M8在添加defaultTool工具回调mcp工具的时候,报错,使用是的springai-openai ,jdk17 ,springboot3.24

Steps to reproduce @Bean public ChatClient chatClient(OpenAiChatModel siliconflowChatModel, ToolCallbackProvider mcpTools) { return ChatClient.builder(siliconflowChatModel).defaultToolCallbacks(mcpTools).build(); }

Expected behavior 不调用工具正常,调用mcp工具报错

Minimal Complete Reproducible example Please provide a failing test or a minimal complete verifiable example that reproduces the issue. Bug reports that are reproducible will take priority in resolution over reports that are not reproducible.

liu-zhen-wei avatar May 07 '25 06:05 liu-zhen-wei

Image

liu-zhen-wei avatar May 07 '25 06:05 liu-zhen-wei

Which model are you using? Is it an OpenAI model or a OpenAI-compatible model?

dev-jonghoonpark avatar May 07 '25 06:05 dev-jonghoonpark

Which model are you using? Is it an OpenAI model or a OpenAI-compatible model?

I am using a model that is compatible with the OpenAI protocol, and it utilizes silicon-based flow.

liu-zhen-wei avatar May 07 '25 06:05 liu-zhen-wei

Which model are you using? Is it an OpenAI model or a OpenAI-compatible model?

Could you please provide a solution?

liu-zhen-wei avatar May 07 '25 06:05 liu-zhen-wei

Please provide specific information. Without detailed information, it is difficult for others to assist you.

For example, the following details can be helpful:

  • Let us know which model you are using.
  • Provide the response body received from the server.

dev-jonghoonpark avatar May 07 '25 06:05 dev-jonghoonpark

Please provide specific information. Without detailed information, it is difficult for others to assist you.

For example, the following details can be helpful:

  • Let us know which model you are using.
  • Provide the response body received from the server.

Manufacturer: SiliconFlow https://cloud.siliconflow.cn/models Model: Qwen/Qwen3-32B Unable to obtain return parameters. Both springai versions M7 and M8 are ineffective. The same error occurs. JDK 17, Spring Boot 3.3.2

liu-zhen-wei avatar May 07 '25 07:05 liu-zhen-wei

你的MCP Server是不是配置有问题?

hbsjz-swl avatar May 07 '25 07:05 hbsjz-swl

你的MCP Server是不是配置有问题?

我在其他软件调用我写的这个mcp server是正常的,例如cursor dify

liu-zhen-wei avatar May 07 '25 07:05 liu-zhen-wei

你的MCP Server是不是配置有问题?

我在其他软件调用我写的这个mcp server是正常的,例如cursor dify

我在另一个issues中回复了你,此问题的原因:https://github.com/spring-projects/spring-ai/issues/3016

hbsjz-swl avatar May 08 '25 01:05 hbsjz-swl