Amith Koujalgi 9070597c17 updated docs
2023-12-26 17:43:18 +05:30

592 B

sidebar_position
sidebar_position
1

List Models

This API lets you list available models on the Ollama server.

public class ListModels {

    public static void main(String[] args) {

        String host = "http://localhost:11434/";

        OllamaAPI ollamaAPI = new OllamaAPI(host);

        List<Model> models = ollamaAPI.listModels();

        models.forEach(model -> System.out.println(model.getName()));
    }
}

If you have any models already downloaded on Ollama server, you would have them listed as follows:

llama2:latest
sqlcoder:latest