Class OllamaLoginClient
java.lang.Object
com.developer.nefarious.zjoule.plugin.login.api.OllamaLoginClient
- All Implemented Interfaces:
IOllamaLoginClient
A client for handling Ollama login-related API interactions.
The OllamaLoginClient
communicates with the Ollama API to retrieve
available models. It uses an HttpClient
for HTTP requests and
an IOllamaLoginClientHelper
for handling request construction and response parsing.
-
Constructor Summary
ConstructorsConstructorDescriptionOllamaLoginClient
(IOllamaLoginClientHelper ollamaLoginClientHelper) Constructs anOllamaLoginClient
with the specified helper. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the available Ollama models from the specified endpoint.
-
Constructor Details
-
OllamaLoginClient
Constructs anOllamaLoginClient
with the specified helper.Initializes an
HttpClient
instance for sending HTTP requests.- Parameters:
ollamaLoginClientHelper
- an instance ofIOllamaLoginClientHelper
for request and response handling.
-
-
Method Details
-
getModels
Retrieves the available Ollama models from the specified endpoint.This method sends a GET request to the Ollama API's `/api/tags` endpoint and parses the response into a
GetOllamaModelsResponse
object.- Specified by:
getModels
in interfaceIOllamaLoginClient
- Parameters:
endpoint
- the base URL of the Ollama API.- Returns:
- a
GetOllamaModelsResponse
containing the list of available models. - Throws:
IOException
- if an I/O error occurs while sending the request.InterruptedException
- if the request is interrupted while waiting for a response.
-