PromptExecutorExt
Utility object providing extensions for working with PromptExecutor
and processing language model responses.
Functions
Link copied to clipboard
Executes a given prompt using the specified language model and returns a single response.
Link copied to clipboard
Retrieves the first response from the list of Message.Response
. If the list is empty, a NoSuchElementException
is thrown.
Link copied to clipboard
Retrieves the first response from the list if it exists and there is only one response; otherwise, returns null. Logs a warning if there are multiple responses in the list.
Link copied to clipboard
Retrieves the single response from a list of Message.Response
objects.
Link copied to clipboard
Retrieves a single response from the list if the list contains exactly one response. If the list contains more than one response, a warning is logged, and null is returned.