feat(starters): add Ollama Spring Boot starter#2176
Conversation
Signed-off-by: shaurya2k06 <shaurya2k06@gmail.com>
There was a problem hiding this comment.
Pull request overview
Adds a new Spring Boot starter module to auto-configure an Ollama-backed Model bean when agentscope.model.provider=ollama, aligning Ollama with the existing provider-specific starters and updating v2 documentation accordingly.
Changes:
- Introduces
agentscope-ollama-spring-boot-starterwithOllamaAutoConfiguration,OllamaProperties, andOllamaChatModelBuilderCustomizer. - Registers the new starter in the starters aggregator POM and the AgentScope BOM for dependency management.
- Updates EN/ZH v2 docs to document the new starter and removes “no Ollama starter” statements.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/v2/zh/integration/model/ollama.md | Documents Spring Boot usage for the new Ollama starter (ZH). |
| docs/v2/zh/docs/change-log.md | Adds Ollama starter to the provider starter table (ZH). |
| docs/v2/zh/docs/building-blocks/model.md | Adds Ollama starter/customizer to Spring Boot guidance and tables (ZH). |
| docs/v2/en/integration/model/ollama.md | Documents Spring Boot usage for the new Ollama starter (EN). |
| docs/v2/en/docs/change-log.md | Adds Ollama starter to the provider starter table (EN). |
| docs/v2/en/docs/building-blocks/model.md | Adds Ollama starter/customizer to Spring Boot guidance and tables (EN). |
| agentscope-extensions/agentscope-spring-boot-starters/pom.xml | Registers the new starter module in the starters reactor build. |
| agentscope-extensions/agentscope-spring-boot-starters/agentscope-ollama-spring-boot-starter/src/test/java/io/agentscope/spring/boot/ollama/OllamaAutoConfigurationTest.java | Adds Spring Boot auto-config unit tests for the Ollama starter. |
| agentscope-extensions/agentscope-spring-boot-starters/agentscope-ollama-spring-boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports | Registers OllamaAutoConfiguration for Boot auto-configuration import. |
| agentscope-extensions/agentscope-spring-boot-starters/agentscope-ollama-spring-boot-starter/src/main/java/io/agentscope/spring/boot/ollama/OllamaProperties.java | Adds agentscope.ollama.* configuration properties binding. |
| agentscope-extensions/agentscope-spring-boot-starters/agentscope-ollama-spring-boot-starter/src/main/java/io/agentscope/spring/boot/ollama/OllamaChatModelBuilderCustomizer.java | Adds a hook interface for customizing the OllamaChatModel.Builder. |
| agentscope-extensions/agentscope-spring-boot-starters/agentscope-ollama-spring-boot-starter/src/main/java/io/agentscope/spring/boot/ollama/OllamaAutoConfiguration.java | Adds conditional auto-configuration to create an OllamaChatModel bean. |
| agentscope-extensions/agentscope-spring-boot-starters/agentscope-ollama-spring-boot-starter/pom.xml | Defines the new starter artifact and its dependencies. |
| agentscope-distribution/agentscope-bom/pom.xml | Adds the new starter to the BOM for version alignment. |
| /** | ||
| * Ollama model name, for example {@code llama3}. | ||
| */ | ||
| private String modelName = "llama3"; | ||
|
|
There was a problem hiding this comment.
Keeping the default to match other provider starters (OpenAI/Anthropic/Gemini/DashScope). Blank model-name still fails via trimToNull.
| } | ||
|
|
||
| @Test | ||
| void shouldBindSupportedOllamaProperties() { |
There was a problem hiding this comment.
Matches sibling starter tests, which also set base-url but only assert modelName. Leaving as is for consistency.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…me test Rename the blank model-name failure test to match behavior with the default, and assert OllamaProperties getters so enabled/base-url binding is covered. Signed-off-by: shaurya2k06 <shaurya2k06@gmail.com>
|
Hey @jujn , could I get a review for this? Let me know if there are issues needed to be fixed. |
Thanks for your contribution! I expect to see it tomorrow. |
AgentScope-Java Version
2.0.1-SNAPSHOT
Description
Adds
agentscope-ollama-spring-boot-starterfor Spring-managed OllamaModelauto-configuration, following the same pattern as the existing OpenAI, DashScope, Gemini, and Anthropic model starters.Changes
New module:
agentscope-ollama-spring-boot-starterOllamaAutoConfiguration— creates anOllamaChatModelbean whenagentscope.model.provider=ollama, with backoff when a user-definedModelbean already existsOllamaProperties— bindsagentscope.ollama.*(enabled,model-name,base-url)OllamaChatModelBuilderCustomizer— hook for advanced builder customizationOllamaAutoConfigurationTest— 9 unit tests covering provider selection, property binding, disable flag, missing model name, bean backoff, genericAgentscopeAutoConfigurationintegration, and customizer behaviorMETA-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.importsReactor & distribution
agentscope-spring-boot-starters/pom.xmlagentscope-bom/pom.xmlDocumentation (EN + ZH)
agentscope-ollama-spring-boot-starterto model building-blocks and change-log tablesExample configuration
Validation
mvn spotless:applyon Ollama startermvn spotless:checkon Ollama startermvn teston Ollama starter (9 tests).github/scripts/check-shade-and-bom-sync.shgit diff --checkTest command used:
mvn -pl agentscope-extensions/agentscope-spring-boot-starters/agentscope-ollama-spring-boot-starter testChecklist
mvn spotless:applymvn teston Ollama starter module)Closes
#2172