Closed hwvenancio closed 2 months ago
Only tested it with local Ollama instances, so most likely a bug :)
It tries to get the installed Ollama models in the class com.devoxx.genie.service.OllamaService in method getModels() So it should throw an UnsuccessfulRequestException("Unexpected code " + response);
/**
* Get the models from the Ollama service.
*
* @return array of model names
* @throws IOException if there is an error
*/
public OllamaModelEntryDTO[] getModels() throws IOException {
String baseUrl = ensureEndsWithSlash(DevoxxGenieStateService.getInstance().getOllamaModelUrl());
Request request = new Request.Builder()
.url(baseUrl + "api/tags")
.build();
try (Response response = client.newCall(request).execute()) {
if (!response.isSuccessful()) {
throw new UnsuccessfulRequestException("Unexpected code " + response);
}
assert response.body() != null;
OllamaModelDTO ollamaModelDTO = new Gson().fromJson(response.body().string(), OllamaModelDTO.class);
return ollamaModelDTO != null && ollamaModelDTO.getModels() != null ? ollamaModelDTO.getModels() : new OllamaModelEntryDTO[0];
}
}
Can you confirm this curl command returns a list of models?
Please run the curl command on the local machine accessing the remote Ollama instance?
curl http://[remote ip address]:11434/api/tags
It returns something like this:
$ curl http://[remote ip address]:11434/api/tags | jq .
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 991 100 991 0 0 51757 0 --:--:-- --:--:-- --:--:-- 52157
{
"models": [
{
"name": "llama3:8b",
"model": "llama3:8b",
"modified_at": "2024-07-25T16:31:05.852972867-03:00",
"size": 4661224676,
"digest": "365c0bd3c000a25d28ddbf732fe1c6add414de7275464c4e4d1c3b5fcb5d8ad1",
"details": {
"parent_model": "",
"format": "gguf",
"family": "llama",
"families": [
"llama"
],
"parameter_size": "8.0B",
"quantization_level": "Q4_0"
}
},
{
"name": "codellama:13b",
"model": "codellama:13b",
"modified_at": "2024-07-25T16:25:39.193006661-03:00",
"size": 7365960935,
"digest": "9f438cb9cd581fc025612d27f7c1a6669ff83a8bb0ed86c94fcf4c5440555697",
"details": {
"parent_model": "",
"format": "gguf",
"family": "llama",
"families": null,
"parameter_size": "13B",
"quantization_level": "Q4_0"
}
},
{
"name": "mistral:latest",
"model": "mistral:latest",
"modified_at": "2024-05-13T08:22:09.008741305-03:00",
"size": 4109865159,
"digest": "61e88e884507ba5e06c49b40e6226884b2a16e872382c2b44a42f2d119d804a5",
"details": {
"parent_model": "",
"format": "gguf",
"family": "llama",
"families": [
"llama"
],
"parameter_size": "7B",
"quantization_level": "Q4_0"
}
}
]
}
I don't know if it's the same bug or if it's another, but here it's using a hard-coded localhost: https://github.com/devoxx/DevoxxGenieIDEAPlugin/blob/91c6882f069c037ea89f5eef0d1b217757cfc814/src/main/java/com/devoxx/genie/service/OllamaApiService.java#L23
Request request = new Request.Builder()
.url(OLLAMA_API_URL)
.post(body)
.build();
Great find, that's obviously the issue.
Can you confirm with this new version of the plugin?
Worked like a charm, thanks!
I'm getting the following error when trying to use Ollama running on another machine:
Looks like I cannot select the model when I try to use a remote Ollama, and it uses the one from when Exo was selected.
It show the models drop down when a local Ollama is running.