Skip to content

Introduce ToolSpec fluent API#6085

Closed
tzolov wants to merge 1 commit into
spring-projects:mainfrom
tzolov:chat-client-tool-spec-api-2
Closed

Introduce ToolSpec fluent API#6085
tzolov wants to merge 1 commit into
spring-projects:mainfrom
tzolov:chat-client-tool-spec-api-2

Conversation

@tzolov
Copy link
Copy Markdown
Contributor

@tzolov tzolov commented May 20, 2026

Replace scattered tool-registration methods with a single ToolSpec consumer:

  • tools(Consumer) / defaultTools(Consumer) as the primary entry points; old toolCallbacks/toolNames/toolContext overloads are deprecated in favour of ToolSpec
  • ToolSpec exposes: instances(Object...|List), callbacks(ToolCallback...|List, ToolCallbackProvider...), context(Map|key+value), advisor(ToolAdvisor)
  • advisor(ToolAdvisor) co-locates a custom ToolAdvisor with its tools; suppresses auto-registration of ToolCallAdvisor, consistent with the existing .advisors() path
  • toolNames() are deprecated. For java.util.function tools with ToolSpec use explicit ToolCallback instances and FunctionToolCallback.
  • Update tests and docs accordingly

Replace scattered tool-registration methods with a single ToolSpec consumer:

- tools(Consumer<ToolSpec>) / defaultTools(Consumer<ToolSpec>) as the
  primary entry points; old toolCallbacks/toolNames/toolContext overloads
  are deprecated in favour of ToolSpec
- ToolSpec exposes: instances(Object...|List), callbacks(ToolCallback...|List,
  ToolCallbackProvider...), context(Map|key+value), advisor(ToolAdvisor)
- advisor(ToolAdvisor) co-locates a custom ToolAdvisor with its tools;
  suppresses auto-registration of ToolCallAdvisor, consistent with the
  existing .advisors() path
- toolNames() are deprecated. For java.util.function tools with ToolSpec
  use explicit ToolCallback instances and FunctionToolCallback.
- Update tests and docs accordingly

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
@tzolov tzolov added this to the 2.0.0-M7 milestone May 20, 2026
@ilayaperumalg ilayaperumalg self-assigned this May 20, 2026
@ilayaperumalg ilayaperumalg added openai enhancement New feature or request labels May 20, 2026
@sdeleuze sdeleuze changed the title feat(ChatClient): introduce ToolSpec fluent API Introduce ToolSpec fluent API May 20, 2026
@ilayaperumalg
Copy link
Copy Markdown
Member

Rebased and merged via 4d0bb7b

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

Labels

enhancement New feature or request openai

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants