Class OllamaProviderConfig

All Implemented Interfaces:
Describable<AiProviderConfig>, Serializable

public class OllamaProviderConfig extends AiProviderConfig
A local (or self-hosted) Ollama instance, via its OpenAI-compatibility layer ({baseUrl}/chat/completions). No Jenkins credential is required - Ollama itself does not check the Authorization header - but one may optionally be selected for a reverse-proxied Ollama setup that adds its own auth in front, in which case it is sent as a Bearer token exactly like every other OpenAI-compatible provider in this plugin.

There is deliberately no hardcoded default of http://localhost:11434/v1: on a containerized Jenkins controller or agent, "localhost" inside the container is not the Docker host running Ollama, and defaulting to it would silently fail in exactly the setup most users running Ollama actually have. The base URL is required input instead, with guidance in the README on the container-networking values that typically work (e.g. http://host.docker.internal:11434/v1 for Docker Desktop, or the host's LAN IP).

See Also:
  • Field Details

  • Constructor Details

    • OllamaProviderConfig

      @DataBoundConstructor public OllamaProviderConfig(String baseUrl, String model)
  • Method Details

    • getBaseUrl

      public String getBaseUrl()
    • getModel

      public String getModel()
      Description copied from class: AiProviderConfig
      The model identifier this configuration will request, for display purposes.
      Specified by:
      getModel in class AiProviderConfig
    • getCredentialsId

      public String getCredentialsId()
    • setCredentialsId

      @DataBoundSetter public void setCredentialsId(String credentialsId)
    • createProvider

      public AiProvider createProvider(com.fasterxml.jackson.databind.ObjectMapper objectMapper, int timeoutSeconds)
      Description copied from class: AiProviderConfig
      Builds a provider bound to this configuration's resolved settings, ready to make one (or more) AiProvider.chatCompletion(io.jenkins.plugins.changeinvestigator.ai.AiAnalysisRequest) calls. Resolving the credential happens inside this method, not before it, so the plaintext secret's lifetime is limited to the call that actually needs it.
      Specified by:
      createProvider in class AiProviderConfig
      Parameters:
      objectMapper - shared Jackson mapper for building/parsing request and response JSON
      timeoutSeconds - administrator-configured connect/request timeout (a global, not per-provider, setting - see ChangeInvestigatorGlobalConfiguration)