Class OsgiAIPromptlibConfigurationPluginImpl
- java.lang.Object
 - 
- com.composum.ai.backend.slingbase.impl.OsgiAIPromptlibConfigurationPluginImpl
 
 
- 
- All Implemented Interfaces:
 AIConfigurationPlugin
public class OsgiAIPromptlibConfigurationPluginImpl extends Object implements AIConfigurationPlugin
This implementation sources the global GPTPromptLibrary configuration from the OSGI environment.- See Also:
 AIConfigurationPlugin,GPTPromptLibrary
 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected com.google.gson.Gsongson 
- 
Constructor Summary
Constructors Constructor Description OsgiAIPromptlibConfigurationPluginImpl() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidactivate(GPTPromptLibrary configuration)protected voiddeactivate()Map<String,String>getGPTConfigurationMap(@NotNull org.apache.sling.api.SlingHttpServletRequest request, String mapPath, String languageKey)This method tries to parse the mapPath as JSON.GPTPromptLibrarygetGPTPromptLibraryPaths(@NotNull org.apache.sling.api.SlingHttpServletRequest request, String contentPath)Reads the GPTPromptLibrary from sling context aware configurations or OSGI configurations, falling back to default values.- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface com.composum.ai.backend.slingbase.AIConfigurationPlugin
allowedServices, getGPTConfiguration, getGPTPromptLibraryPathsDefault 
 - 
 
 - 
 
- 
- 
Method Detail
- 
activate
protected void activate(GPTPromptLibrary configuration)
 
- 
deactivate
protected void deactivate()
 
- 
getGPTPromptLibraryPaths
@Nullable public GPTPromptLibrary getGPTPromptLibraryPaths(@NotNull @NotNull org.apache.sling.api.SlingHttpServletRequest request, @Nullable String contentPath) throws IllegalArgumentException
Description copied from interface:AIConfigurationPluginReads the GPTPromptLibrary from sling context aware configurations or OSGI configurations, falling back to default values.- Specified by:
 getGPTPromptLibraryPathsin interfaceAIConfigurationPlugin- Parameters:
 request- the requestcontentPath- if that's given we read the configuration for this path, otherwise we take the requests path, as long as it starts with /content/- Throws:
 IllegalArgumentException- if none of the paths is a /content/ path.
 
- 
getGPTConfigurationMap
@Nullable public Map<String,String> getGPTConfigurationMap(@NotNull @NotNull org.apache.sling.api.SlingHttpServletRequest request, @Nullable String mapPath, @Nullable String languageKey)
This method tries to parse the mapPath as JSON.- Specified by:
 getGPTConfigurationMapin interfaceAIConfigurationPlugin
 
 - 
 
 -