Class GenericOaiClient

    • Method Detail

      • ask

        public AskOutput ask​(AskInput request)
        Sends a request to the "completions" endpoint of a Generic OAI service. This endpoint takes a prompt and an optional file; and responds with a generated text based on the prompt and the file's content.
        Parameters:
        request - The request parameters including the prompt and optional file.
        Returns:
        The response containing the generated text.
      • listModelIds

        public ListModelsOutput listModelIds()
        Fetches all available models from a generic OAI service.
        Returns:
        A list of model IDs.
      • testConnection

        public TestConnectionOutput testConnection​(String model)
        Attempts to check whether the generic OAI like service is reachable and the provided API configuration is valid. Currently, we make a simple request to the "chat/completions" endpoint with a test prompt.
      • newClient

        public static GenericOaiClient newClient​(GenericOaiClientConfig config)
        Creates a new Generic OAI client instance with the provided configuration.
        Parameters:
        config - The configuration for the Generic OAI connection, with the API key and other parameters.
        Returns:
        A new Generic OAI client instance if the configuration is valid, or null if the configuration is invalid or incomplete.