Package com.amalgamasimulation.llm
Class LLMClient
java.lang.Object
com.amalgamasimulation.llm.LLMClient
A client for interacting with Large Language Model (LLM) APIs. This class
provides methods to send prompts to an LLM service and receive responses
asynchronously. It handles the HTTP communication, request formatting, and
response parsing for LLM API calls.
-
Constructor Summary
ConstructorsConstructorDescriptionLLMClient(LLMConnection connection) Creates a newLLMClientwith the specifiedLLMConnectionconfiguration. -
Method Summary
Modifier and TypeMethodDescriptionSends a prompt to the LLM service and returns the response asynchronously allowing to wait for not longer than 10 seconds.Sends a prompt to the LLM service and returns the response asynchronously allowing to wait for not longer than the specified timeout.
-
Constructor Details
-
LLMClient
Creates a newLLMClientwith the specifiedLLMConnectionconfiguration.- Parameters:
connection- theLLMConnectioncontaining API endpoint, credentials, and other information to connect to the LLM.- Throws:
NullPointerException- if the provided connection is null
-
-
Method Details
-
response
Sends a prompt to the LLM service and returns the response asynchronously allowing to wait for not longer than 10 seconds.- Parameters:
prompt- the text prompt to send to the LLM service- Returns:
- a
CompletableFuturethat will complete with the LLM's response text as a String
-
response
Sends a prompt to the LLM service and returns the response asynchronously allowing to wait for not longer than the specified timeout.- Parameters:
prompt- the text prompt to send to the LLM servicetimeout- the maximum time to wait for the LLM service response- Returns:
- a
CompletableFuturethat will complete with the LLM's response text as a String
-