Package edu.tufts.hrilab.llm.llama
Class LlamaClient
java.lang.Object
edu.tufts.hrilab.llm.llama.LlamaClient
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchatCompletion(Symbol prompt) Generates a chat completion using the LLaMA service and a prompt string.chatCompletion(Chat chat) Performs a chat completion using LLaMA with the set model and the given chat messages.chatCompletion(String prompt) chatCompletion(List<Message> messages) Performs an LLaMA chat completion using the specified model and the given list of messages.completion(Symbol prompt) completion(Symbol model, Symbol prompt) Generates a completion of the given prompt and model using the llama.cpp API service.completion(Prompt prompt) Generates a completion of the given prompt using the llama.cpp API service.completion(String prompt) voidsetEndpoint(String endpoint) Sets the endpoint for the llama.cpp server.voidsetStopWords(String[] stopWordsArr) Sets the stop words array for terminating token stream on matching words.voidsetTemperature(float temperatureFloat) Sets the temperature of the model.
-
Constructor Details
-
LlamaClient
public LlamaClient()
-
-
Method Details
-
setEndpoint
Sets the endpoint for the llama.cpp server.- Parameters:
endpoint- - The base endpoint to set
-
setStopWords
Sets the stop words array for terminating token stream on matching words.- Parameters:
stopWordsArr- - An array of stop words to set
-
setTemperature
public void setTemperature(float temperatureFloat) Sets the temperature of the model.- Parameters:
temperatureFloat- - The temperature value to set
-
completion
Generates a completion of the given prompt using the llama.cpp API service.- Parameters:
prompt- the prompt for which to generate the completion- Returns:
- a LlamaCompletionResponse containing the generated completion and additional information
-
completion
-
completion
Generates a completion of the given prompt and model using the llama.cpp API service.- Parameters:
prompt- the prompt for which to generate the completion- Returns:
- a LlamaCompletionResponse containing the generated completion and additional information
-
completion
-
chatCompletion
Generates a chat completion using the LLaMA service and a prompt string.- Parameters:
prompt- the prompt string provided by the user- Returns:
- the LlamaCompletionResponse containing the completed chat.
-
chatCompletion
-
chatCompletion
Performs an LLaMA chat completion using the specified model and the given list of messages. This method creates a new LlamaRequestBody object with the provided model and messages.- Parameters:
messages- a list of messages to be sent for chat completion- Returns:
- an LlamaCompletionResponse object representing the response from LLaMA
-
chatCompletion
Performs a chat completion using LLaMA with the set model and the given chat messages.- Parameters:
chat- the chat containing the messages to use for the completion- Returns:
- an LlamaCompletionResponse object representing the response from LLaMA
-