Package org.ametys.plugins.ai.provider
Interface AIProvider
- All Known Implementing Classes:
AbstractAIProvider,GoogleAIGeminiProvider,MistralAIProvider,OllamaProvider,OpenAIProvider
public interface AIProvider
AI provider interface
-
Method Summary
Modifier and TypeMethodDescriptionaskChatbot(dev.langchain4j.memory.ChatMemory memory) Get the response from the chatbot if embedding is supportedcomputeEmbedding(String text) Get the embedding of a textintGet the dimension of the embedding vectorGet a string key identifying the embedding generator.getId()Get the id of the providergetLabel()Get the label of the providerbooleanCheck if the embedding is supportedbooleanCheck if the image generation is supportedtextToImage(String text) Get the URL of the generated imagetextToSummary(String text, int maxLength) Summarized a text
-
Method Details
-
getId
Get the id of the provider- Returns:
- the id
-
getLabel
Get the label of the provider- Returns:
- the label
-
textToSummary
Summarized a text- Parameters:
text- the text to summarizemaxLength- the max number of characters that will be generated- Returns:
- the summarized text
- Throws:
Exception- if an error occurred during summarize process
-
isImageGenerationSupported
boolean isImageGenerationSupported()Check if the image generation is supported- Returns:
- boolean true if the generation is enabled, false otherwise
-
textToImage
Get the URL of the generated image- Parameters:
text- the prompt text- Returns:
- the generated image
- Throws:
Exception- if an error occurred during the image generation
-
isEmbeddingSupported
boolean isEmbeddingSupported()Check if the embedding is supported- Returns:
- boolean true if the embedding is supported, false otherwise
-
askChatbot
Get the response from the chatbot if embedding is supported- Parameters:
memory- the chat history message- Returns:
- the response from the chatbot
-
computeEmbedding
Get the embedding of a text- Parameters:
text- The text to embed- Returns:
- The embedding vector as a list of floats or null if an error occurred or if embedding is not supported
-
getEmbeddingDimension
int getEmbeddingDimension()Get the dimension of the embedding vector- Returns:
- The embedding dimension or -1 if not supported
-
getEmbeddingKey
Get a string key identifying the embedding generator. Comparing this key between two calls allows to know if an existing embedding is still valid.- Returns:
- The embedding generator key or null if embedding is not supported
-