Croway opened a new pull request, #25354:
URL: https://github.com/apache/camel/pull/25354

   Fixes [CAMEL-24212](https://issues.apache.org/jira/browse/CAMEL-24212).
   
   ## Why
   
   Spring AI 1.1 targets Spring Boot 3.5 and Spring Framework 6. Camel is 
already on Spring Boot 4.1 and Spring Framework 7, which is the baseline Spring 
AI 2.0 was designed for, so `camel-spring-ai` currently ships an unsupported 
pairing.
   
   It also fixes a version split that already exists in the build: 
`parent/pom.xml` manages `mcp-java-sdk-version` 2.0.0 for `camel-mcp-server`, 
`camel-mcp-server-api` and `camel-openai`, but `camel-spring-ai-chat` drags in 
MCP SDK **0.18.2** transitively through Spring AI 1.1.7. After this change both 
are on 2.0.0.
   
   This picks up where dependabot's #24009 stopped — that PR was closed because 
the artifact rename below needs a manual change, not because the upgrade was 
rejected.
   
   ## Changes
   
   * `spring-ai-advisors-vector-store` → `spring-ai-vector-store-advisor` (the 
old artifact was last published at 2.0.0-M8). This is the error that stopped 
#24009.
   * `SpringAiChatMcpManager` no longer binds to a Jackson generation. The 
stdio transport takes `McpJsonDefaults.getMapper()` instead of constructing a 
Jackson 2 `ObjectMapper`, so it works with whichever MCP JSON provider is on 
the classpath (Spring AI 2.0 moved to Jackson 3).
   * `ChatClient.ChatClientRequestSpec.options()` now takes the options 
**builder**.
   * `ImageOptionsBuilder.N()` → `n()`.
   
   ### toolNames
   
   Spring AI 2.0 removed `ChatClientRequestSpec.toolNames(String...)` together 
with `SpringBeanToolCallbackResolver`, so the component resolves the names 
itself. Each name is looked up, in order, against:
   
   1. a `ToolCallbackResolver` bound in the registry — Spring Boot applications 
get Spring AI's auto-configured one, which is built from the `ToolCallback` and 
`ToolCallbackProvider` beans;
   2. the tools discovered via `tags` and configured via `toolCallbacks`, 
matched on tool definition name;
   3. a `ToolCallback` bound in the registry under that name.
   
   An unresolvable name now fails the exchange with a message listing the 
available tools, rather than being silently dropped.
   
   Tool callbacks from all sources are also **deduplicated by tool name**. 
Spring AI 2.0 added `ToolCallingChatOptions.validateToolCallbacks`, which 
rejects two tools with the same name — without the dedup, an endpoint combining 
`toolCallbacks` with a `toolNames` entry that names one of them fails with 
`Multiple tools with the same name`.
   
   ## Tests
   
   New `SpringAiChatToolNamesTest` covers name selection, the header override, 
the registry fallback, the duplicate-registration case and the 
unresolvable-name error. Existing tests were updated for `options()` vs 
`defaultOptions()`, the now-mandatory non-null `ChatModel.getOptions()`, Spring 
Framework 7 core retry, and the openai-java SDK client that `spring-ai-openai` 
is now built on.
   
   Verified against a local Ollama (`granite4:3b`, `embeddinggemma:300m`, 
`qwen3-vl:2b-instruct` for the multimodal IT):
   
   | Module | Result |
   |---|---|
   | chat | 91 tests pass (5 skipped — `SpringAiChatWrappedFileIT` is 
`@Disabled`) |
   | embeddings | 7 pass |
   | vector store | 16 pass, including the Qdrant testcontainers IT |
   | image | see below |
   
   `SpringAiImageOllamaIT` is the one I rewrote for the SDK change; its result 
is noted in a comment below.
   
   ## Upgrade notes
   
   `docs/.../camel-4x-upgrade-guide-4_22.adoc` gains a section covering the 
Jackson 3 move, the `.options.` property-key flattening, the removal of Spring 
AI's default `temperature=0.7`, and the `toolNames` change.
   
   ---
   _Claude Code on behalf of Federico Mariani_


-- 
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