TramAI - governed AI workflows for Java and Kotlin

tramai-spring-provider-ollama

Version: 0.6.0
Status: Preview
Role: Provider adapter module: Ollama configuration for Spring applications.

Purpose

This adapter registers an OllamaProvider from application properties, so a Spring application can reach a local Ollama instance without hand-built provider code. It owns provider construction only — assembly, routing, retries and fallbacks stay in the runtime.

It is the provider used by the sovereign profile examples: with tramai.profile: sovereign and a local base URL, nothing leaves the host.

What it provides

ComponentDetail
OllamaProviderAutoConfigurationRegistered through META-INF/spring/...AutoConfiguration.imports
OllamaPropertiesBinds tramai.providers.ollama.* (base-url)
ollamaProvider beanA SpringConfiguredModelProvider wrapping OllamaProvider with provider id ollama

If base-url is blank or missing, the bean is null — no provider is registered and the runtime behaves as if Ollama were absent. Under tramai.profile: sovereign that surfaces as a build-time failure if the provider is in allowed-providers but no provider bean was contributed, rather than as a silent fallback.

Dependencies

dependencies {
    implementation(platform("dev.tramai:tramai-bom:0.6.0"))
    implementation("dev.tramai:tramai-spring-boot-starter")
    implementation("dev.tramai:tramai-spring-provider-ollama")
}
tramai:
  profile: sovereign
  providers:
    ollama:
      base-url: http://localhost:11434
  sovereign:
    allowed-models: [gemma4:e2b]
    allowed-providers: [ollama]
    provider-zones:
      ollama: LOCAL
    models:
      gemma4:e2b: ollama

When to use this module

  • You serve models locally with Ollama and want the Spring runtime to route to it.
  • You are building a sovereign or offline deployment where routing must stay inside the local trust zone.

When NOT to use this module

  • You call a hosted Ollama-compatible endpoint — configure tramai.providers.openai-compatible in tramai-spring-provider-openai instead.
  • You want retry, circuit-breaker or fallback behavior configured here: that belongs to tramai.resilience.* in tramai-spring-core.
  • You are not using Spring: construct OllamaProvider directly with tramai-ollama.