Interface AIProvider

All Known Implementing Classes:
AbstractAIProvider, GoogleAIGeminiProvider, MistralAIProvider, OllamaProvider, OpenAIProvider

public interface AIProvider
AI provider interface
  • Method Details

    • getId

      Get the id of the provider
      Returns:
      the id
    • getLabel

      Get the label of the provider
      Returns:
      the label
    • textToSummary

      String textToSummary(String text, int maxLength) throws Exception
      Summarized a text
      Parameters:
      text - the text to summarize
      maxLength - the max number of characters that will be generated
      Returns:
      the summarized text
      Throws:
      Exception - if an error occurred during summarize process
    • 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

      Check if the embedding is supported
      Returns:
      boolean true if the embedding is supported, false otherwise
    • askChatbot

      String askChatbot(dev.langchain4j.memory.ChatMemory memory)
      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

      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