davsclaus commented on code in PR #25354:
URL: https://github.com/apache/camel/pull/25354#discussion_r3719765519


##########
components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/java/org/apache/camel/component/springai/chat/SpringAiChatProducer.java:
##########
@@ -994,6 +1005,49 @@ private List<ToolCallback> getToolCallbacksForTags(String 
tags) {
         return toolCallbacks;
     }
 
+    /**
+     * Resolve the configured tool names to {@link ToolCallback} instances.
+     * <p>
+     * Spring AI 2.0 removed {@code 
ChatClient.ChatClientRequestSpec.toolNames(String...)} and the Spring bean based
+     * {@code SpringBeanToolCallbackResolver}, so the names are resolved here 
instead. Each name is looked up, in order,
+     * against:
+     * <ol>
+     * <li>a {@link ToolCallbackResolver} bound in the Camel registry - Spring 
Boot applications get Spring AI's
+     * auto-configured resolver, which covers {@link ToolCallback} and {@link 
ToolCallbackProvider} beans</li>
+     * <li>the tool callbacks already available to this endpoint, i.e. the 
ones discovered from {@code tags} and the
+     * ones configured via {@code toolCallbacks}, matched on their tool 
definition name</li>
+     * <li>a {@link ToolCallback} bound in the Camel registry under that 
name</li>
+     * </ol>
+     *
+     * @param  names                    the tool names to resolve
+     * @param  availableByName          the callbacks already available to 
this endpoint, keyed by tool name
+     * @return                          the resolved callbacks, never {@code 
null}
+     * @throws IllegalArgumentException if a name cannot be resolved
+     */
+    private List<ToolCallback> resolveToolCallbacksByName(List<String> names, 
Map<String, ToolCallback> availableByName) {
+        final ToolCallbackResolver resolver = 
getEndpoint().getCamelContext().getRegistry()
+                .findSingleByType(ToolCallbackResolver.class);
+
+        final List<ToolCallback> resolved = new ArrayList<>(names.size());
+        for (String name : names) {
+            ToolCallback callback = resolver != null ? resolver.resolve(name) 
: null;

Review Comment:
   ok



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to