Class BaseAIProvider
java.lang.Object
hudson.model.AbstractDescribableImpl<BaseAIProvider>
io.jenkins.plugins.explain_error.provider.BaseAIProvider
- All Implemented Interfaces:
ExtensionPoint,Describable<BaseAIProvider>
- Direct Known Subclasses:
AzureOpenAIProvider,BedrockProvider,CustomOktaAIProvider,DeepSeekProvider,GeminiProvider,OllamaProvider,OpenAIProvider,QwenProvider
public abstract class BaseAIProvider
extends AbstractDescribableImpl<BaseAIProvider>
implements ExtensionPoint
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic classNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final Stringprotected final StringbuildUserPrompt(String errorLogs, String language, String customContext) abstract BaseAIProvider.AssistantcreateAssistant(Item item, org.springframework.security.core.Authentication authentication) abstract FixAssistantcreateFixAssistant(Item item, org.springframework.security.core.Authentication authentication) final StringexplainError(String errorLogs, TaskListener listener) Explain error logs using the configured AI provider.final StringexplainError(String errorLogs, TaskListener listener, String language) Explain error logs using the configured AI provider.final StringexplainError(String errorLogs, TaskListener listener, String language, String customContext) Explain error logs using the configured AI provider.final StringexplainError(String errorLogs, TaskListener listener, String language, String customContext, Item item, org.springframework.security.core.Authentication authentication) Explain error logs using the configured AI provider with item-scoped credentials context.getModel()getUrl()abstract booleanisNotValid(TaskListener listener) booleanisNotValid(TaskListener listener, Item item, org.springframework.security.core.Authentication authentication) protected final HttpClient.Builderprotected final dev.langchain4j.http.client.HttpClientBuilder
-
Field Details
-
SYSTEM_PROMPT
- See Also:
-
USER_PROMPT_TEMPLATE
- See Also:
-
url
-
model
-
-
Constructor Details
-
BaseAIProvider
-
-
Method Details
-
createAssistant
-
createFixAssistant
-
isNotValid
-
getUrl
-
getModel
-
explainError
public final String explainError(String errorLogs, TaskListener listener) throws ExplanationException Explain error logs using the configured AI provider.- Parameters:
errorLogs- the error logs to explain- Returns:
- the AI explanation
- Throws:
ExplanationException- if there's a communication error
-
explainError
public final String explainError(String errorLogs, TaskListener listener, String language) throws ExplanationException Explain error logs using the configured AI provider.- Parameters:
errorLogs- the error logs to explainlanguage- the preferred response language- Returns:
- the AI explanation
- Throws:
ExplanationException- if there's a communication error
-
explainError
public final String explainError(String errorLogs, TaskListener listener, String language, String customContext) throws ExplanationException Explain error logs using the configured AI provider.- Parameters:
errorLogs- the error logs to explainlistener- the task listener for logginglanguage- the preferred response languagecustomContext- additional custom context/instructions for the AI- Returns:
- the AI explanation
- Throws:
ExplanationException- if there's a communication error
-
explainError
public final String explainError(String errorLogs, TaskListener listener, String language, String customContext, @CheckForNull Item item, @CheckForNull org.springframework.security.core.Authentication authentication) throws ExplanationException Explain error logs using the configured AI provider with item-scoped credentials context.- Parameters:
errorLogs- the error logs to explainlistener- the task listener for logginglanguage- the preferred response languagecustomContext- additional custom context/instructions for the AIitem- the item defining credentials scopeauthentication- the authentication used for credentials lookup- Returns:
- the AI explanation
- Throws:
ExplanationException- if there's a communication error
-
getDescriptor
- Specified by:
getDescriptorin interfaceDescribable<BaseAIProvider>
-
createAssistant
public BaseAIProvider.Assistant createAssistant(@CheckForNull Item item, @CheckForNull org.springframework.security.core.Authentication authentication) -
createFixAssistant
public FixAssistant createFixAssistant(@CheckForNull Item item, @CheckForNull org.springframework.security.core.Authentication authentication) -
isNotValid
public boolean isNotValid(@CheckForNull TaskListener listener, @CheckForNull Item item, @CheckForNull org.springframework.security.core.Authentication authentication) -
buildSystemPrompt
-
buildUserPrompt
-
newJenkinsHttpClientBuilder
-
newLangChainHttpClientBuilder
protected final dev.langchain4j.http.client.HttpClientBuilder newLangChainHttpClientBuilder() -
getProviderName
-