Skip to content

Add Ollama ThinkOption runtime hints#6047

Merged
sdeleuze merged 1 commit into
spring-projects:mainfrom
DragonFSKY:fix/6043-ollama-thinkoption-runtime-hints
May 18, 2026
Merged

Add Ollama ThinkOption runtime hints#6047
sdeleuze merged 1 commit into
spring-projects:mainfrom
DragonFSKY:fix/6043-ollama-thinkoption-runtime-hints

Conversation

@DragonFSKY
Copy link
Copy Markdown
Contributor

Summary

  • Register the custom Jackson serializer and deserializer used by Ollama ThinkOption for reflection hints.
  • Add focused runtime hints coverage for the two ThinkOption Jackson handler classes.

Fixes #6043.

Testing

  • ./mvnw -s <temp-empty-settings> -Dmaven.build.cache.enabled=false -pl models/spring-ai-ollama -am -Dtest=OllamaRuntimeHintsTests -Dsurefire.failIfNoSpecifiedTests=false test
  • git diff --check

@DragonFSKY
Copy link
Copy Markdown
Contributor Author

This is ready for review from my side.

I kept the change focused on the missing runtime hints for the ThinkOption Jackson serializer/deserializer and added targeted coverage in OllamaRuntimeHintsTests.

@DragonFSKY DragonFSKY marked this pull request as ready for review May 15, 2026 16:07
@sdeleuze
Copy link
Copy Markdown
Contributor

Thanks, did you double check building a small native app to be sure? You not, could you?

@sdeleuze sdeleuze self-assigned this May 15, 2026
@DragonFSKY DragonFSKY force-pushed the fix/6043-ollama-thinkoption-runtime-hints branch from 6a30e6b to 78ee22b Compare May 15, 2026 23:22
Signed-off-by: Dongliang Xie <dragonfsky@gmail.com>
@DragonFSKY DragonFSKY force-pushed the fix/6043-ollama-thinkoption-runtime-hints branch from 78ee22b to d47cb71 Compare May 15, 2026 23:29
@DragonFSKY
Copy link
Copy Markdown
Contributor Author

Thanks for the reminder. I verified this with a small Spring Boot native application using the local PR branch artifacts.

Commands run:

  • mvn -Pnative native:compile
  • ./target/ollama-thinkoption-native-smoke

The native executable starts successfully and exercises both relevant paths:

  • serializes an OllamaApi.ChatRequest built with .thinkHigh() to JSON containing "think":"high"
  • deserializes "high" back to ThinkOption.ThinkLevel.HIGH

I also pushed a small follow-up adjustment after the local check.

Targeted tests were re-run:

./mvnw -pl models/spring-ai-ollama -am -Dtest=OllamaRuntimeHintsTests,ThinkOptionTests -Dsurefire.failIfNoSpecifiedTests=false test

Result: 32 tests passed.

Please let me know if you prefer any further changes.

@sdeleuze sdeleuze merged commit 24d2cf2 into spring-projects:main May 18, 2026
1 check passed
sdeleuze pushed a commit to sdeleuze/spring-ai that referenced this pull request May 18, 2026
See spring-projects#6047
Closes spring-projects#6043
Signed-off-by: Dongliang Xie <dragonfsky@gmail.com>
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.

Ollama doesnt work in a graalvm native image

2 participants