spring-projects / spring-projects/spring-ai

The Tool Usage Of Spring AI May Have Some Change

Open
#2,379 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

I am using the latest spring-ai with my springboot project, but when building the ChatClient, I found that the functions method has be deprecated, then I called the tools method, but after I read the source code of spring-ai, I found I called the method in a wrong way.
.tools(functionNames.stream().map(name -> AgentChatHelper.FunctionInfo.wrapFunctionName( messageModel.getRequestId(), messageModel.getClientAgentServiceConfigurationId(), name)) .toList())
I call the method with a list param. but it will be handled with MethodToolCallbackProvider. So why don't we just call it with a class array and let MethodToolCallbackProvider handles it?

I think the usage of tools method now is too easy to make mistakes while calling it

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the ChatClient tools method, MethodToolCallbackProvider, and the shown AgentChatHelper.FunctionInfo.wrapFunctionName call. Trace how list arguments are handled and compare that with the requested class-array usage. Done means the intended tools API is agreed, its behavior is covered by tests, and the usage cannot silently select the wrong callback provider.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.