Skip to content

feat: migrate spring-ai to v2 - #1006

Open
vladimir-a-sap wants to merge 24 commits into
mainfrom
spring-ai-v2
Open

feat: migrate spring-ai to v2#1006
vladimir-a-sap wants to merge 24 commits into
mainfrom
spring-ai-v2

Conversation

@vladimir-a-sap

@vladimir-a-sap vladimir-a-sap commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Context

AI/ai-sdk-java-backlog#404.

Updated Spring AI glue to version 2.0.1

Documentation pr - SAP/ai-sdk#687

E2E test run - https://github.com/SAP/ai-sdk-java/actions/runs/33862437258

Definition of Done

  • Code is tested (Unit, E2E)
  • Error handling created / updated & covered by the tests above
  • Documentation updated
  • Only Public APIs are allowed to be used in documentation/tutorials/sample code
  • (Optional) Aligned changes with the JS SDK (no spring ai for JS SDK)
  • (Optional) Release notes updated
  • revert version fix for dependabot

@vladimir-a-sap vladimir-a-sap changed the title migrate spring-ai to v2 feat: migrate spring-ai to v2 Aug 27, 2026
@vladimir-a-sap
vladimir-a-sap marked this pull request as ready for review August 28, 2026 13:10
@vladimir-a-sap
vladimir-a-sap enabled auto-merge (squash) August 28, 2026 13:10
Comment thread sample-code/spring-app/pom.xml Outdated
<dependency>
<groupId>com.github.victools</groupId>
<artifactId>jsonschema-module-swagger-2</artifactId>
<version>5.0.0</version>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Why do you need to update the version? if it doesn't work with 4.38.0, that would mean it doesn't work for our customers out of the box, unless you pin the version in parent pom or openai pom.
  2. Isn't this dependency already at version 5 in the parent pom? If not I would at least reuse the version number property jsonschema-generator.version, or create one in the spring app if it's unrelated.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to parent dependency management as you advised, thanks!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why did you need to update the version?

Comment thread sample-code/spring-app/pom.xml Outdated
Comment thread .github/dependabot.yaml Outdated
Comment thread docs/release_notes.md Outdated
Comment thread orchestration/pom.xml

@Jonas-Isr Jonas-Isr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are some breaking changes for our users hidden in the code changes. While I think it is correct to change it that way and I don't think we can do anything better, we need to discuss if we are okay with a breaking change in convenience code in a minor version release or if we need to push for AI SDK major version 2.

This is a discussion we have to have with Junjie once we are certain how many and what breaking changes would be necessary. (At the least, we needs to add migration steps to the Compatibility Notes section of the release notes.)

Comment thread orchestration/src/main/java/com/sap/ai/sdk/orchestration/ResponseJsonSchema.java Outdated
Comment thread docs/release_notes.md
Comment on lines +23 to +30
```java
// Before
options.setInternalToolExecutionEnabled(true);
chatModel.call(prompt);

// After
ChatClient.builder(chatModel).build().prompt(prompt).call().chatResponse();
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```java
// Before
options.setInternalToolExecutionEnabled(true);
chatModel.call(prompt);
// After
ChatClient.builder(chatModel).build().prompt(prompt).call().chatResponse();
```
```diff
-options.setInternalToolExecutionEnabled(true);
-chatModel.call(prompt);
+ChatClient.builder(chatModel).build().prompt(prompt).call().chatResponse();
Diff is the right markdown format for those code samples

Comment thread docs/release_notes.md
<!-- Add -->
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-autoconfigure-mcp-client-common</artifactId>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mention adding those dependencies but you didn't add them to the spring app, are they really needed?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants