public class OllamaClient
extends java.lang.Object
| Constructor and Description |
|---|
OllamaClient()
Constructs a client with the default host IP (127.0.0.1) and port (11434).
|
OllamaClient(java.lang.String hostIP,
int hostPort)
Constructs a client with a specified host IP and port.
|
| Modifier and Type | Method and Description |
|---|---|
Message |
chat(java.lang.String model,
java.util.List<Message> messages)
Sends a chat request to the Ollama API and returns the response.
|
Message |
chat(java.lang.String model,
java.util.List<Message> messages,
float temperature)
Sends a chat request to the Ollama API with a specified temperature and returns the response.
|
public OllamaClient()
public OllamaClient(java.lang.String hostIP,
int hostPort)
hostIP - the IP address of the hosthostPort - the port number of the hostpublic Message chat(java.lang.String model, java.util.List<Message> messages) throws java.lang.Exception
model - the name of the model to be used for the chatmessages - the list of messages to send to the modeljava.lang.Exception - if the API request failspublic Message chat(java.lang.String model, java.util.List<Message> messages, float temperature) throws java.lang.Exception
model - the name of the model to be used for the chatmessages - the list of messages to send to the modeltemperature - the temperature setting for the model (controls response creativity)java.lang.Exception - if the API request fails