Package anlavn.ai

Class YourGPT

java.lang.Object
anlavn.ai.YourGPT
All Implemented Interfaces:
AutoCloseable

public final class YourGPT extends Object implements AutoCloseable
The YourGPT class supports to LLM (Large Language Model) inference with LLaMA.
This class provides methods to load the YourGPT module, start the server, interact with the model...
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static String
     
    static Map<String,String>
    Configurable LLaMA parameters for the YourGPT server.
    These parameters must be adjusted before starting the server.
    Read more about available parameters at: https://github.com/ggerganov/llama.cpp/blob/master/examples/server/README.md
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Use this method to cleans up the YourGPT.LLaMA module if it exists.
    static void
    Use this method to cleans up the YourGPT.Model module if it exists.
    void
     
    static void
    Use this method to forcibly destroy the YourGPT process.
    static String[]
    Use this method to retrieves a list of the latest LLaMA names available.
    static void
    Use this method to load YourGPT module using the default LLaMA "Win_CUDA12" and default LLM.
    Equivalent to calling `loadModule("Win_CUDA12")`.
    static void
    Use this method to load YourGPT module using the specified LLaMA and default LLM.
    static void
    loadModule(String llama, String model)
    Use this method to load YourGPT module using the specified LLaMA and the specified LLM.
    static void
    Use this method to starts the YourGPT server with the specified parameters.
    If the module has not been loaded, it will attempt to load using the default settings.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • YourGPT

      public YourGPT()
  • Method Details

    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception
    • loadModule

      public static void loadModule()
      Use this method to load YourGPT module using the default LLaMA "Win_CUDA12" and default LLM.
      Equivalent to calling `loadModule("Win_CUDA12")`.
      See Also:
    • loadModule

      public static void loadModule(String llama)
      Use this method to load YourGPT module using the specified LLaMA and default LLM.
      Parameters:
      llama - the name of the LLaMA file to load.
      Example: "Win_CUDA12"
      Explore more at https://anlavn-api.vercel.app/api/llama
      See Also:
    • loadModule

      public static void loadModule(String llama, String model)
      Use this method to load YourGPT module using the specified LLaMA and the specified LLM.
      Parameters:
      llama - the name of the LLaMA file to load.
      Example: "Win_CUDA12"
      Explore more at https://anlavn-api.vercel.app/api/llama
      model - the location of the specified LLM, it can be local path or link address.
      Example:
      "C:/Users/AnLaVN/mistral-7b-openorca.Q4_K_M.gguf" for file location or,
      "https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-GGUF/resolve/main/mistral-7b-openorca.Q4_K_M.gguf"

      Explore more LLM at https://huggingface.co
      See Also:
    • start

      public static void start()
      Use this method to starts the YourGPT server with the specified parameters.
      If the module has not been loaded, it will attempt to load using the default settings.
    • getLLaMA

      public static String[] getLLaMA() throws IOException
      Use this method to retrieves a list of the latest LLaMA names available.
      Returns:
      An array of the latest LLaMA names.
      Explore more at https://anlavn-api.vercel.app/api/llama
      Throws:
      IOException - if there is no internet connection or server down.
    • cleanLLaMA

      public static void cleanLLaMA()
      Use this method to cleans up the YourGPT.LLaMA module if it exists.
    • cleanModel

      public static void cleanModel()
      Use this method to cleans up the YourGPT.Model module if it exists.
    • destroy

      public static void destroy()
      Use this method to forcibly destroy the YourGPT process.