Class AiProviderConfig

java.lang.Object
hudson.model.AbstractDescribableImpl<AiProviderConfig>
io.jenkins.plugins.changeinvestigator.ai.provider.AiProviderConfig
All Implemented Interfaces:
Describable<AiProviderConfig>, Serializable
Direct Known Subclasses:
AnthropicProviderConfig, AzureOpenAiProviderConfig, BedrockProviderConfig, GeminiProviderConfig, OllamaProviderConfig, OpenAiCompatibleProviderConfig, OpenAiProviderConfig

public abstract class AiProviderConfig extends AbstractDescribableImpl<AiProviderConfig> implements Serializable
One selectable AI provider in the "AI Provider" dropdown (rendered via f:dropdownDescriptorSelector), holding exactly the non-secret, provider-specific configuration that provider needs (endpoint, deployment, region, model, credential ID, ...). Cross-cutting settings that apply the same way to every provider - temperature, timeout, max log context characters - live once on ChangeInvestigatorGlobalConfiguration instead of being duplicated onto each subclass.

Never holds a resolved secret: subclasses store only a Jenkins credential ID (a non-secret reference) and resolve it to plaintext at call time in createProvider(com.fasterxml.jackson.databind.ObjectMapper, int), the same pattern the plugin already used before this provider abstraction existed.

See Also:
  • Constructor Details

    • AiProviderConfig

      public AiProviderConfig()
  • Method Details

    • getModel

      public abstract String getModel()
      The model identifier this configuration will request, for display purposes.
    • createProvider

      public abstract AiProvider createProvider(com.fasterxml.jackson.databind.ObjectMapper objectMapper, int timeoutSeconds)
      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.
      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)
    • testConnection

      public FormValidation testConnection(com.fasterxml.jackson.databind.ObjectMapper objectMapper, int timeoutSeconds)
      Sends a minimal, low-cost request to verify this configuration works. Deliberately does not send any real build evidence - only a fixed instruction-only exchange - so testing a connection never depends on (or leaks) actual investigation data.