Class AskOutput
java.lang.Object
de.xima.fc.prompt.ms.impl.service.generic_oai.client.model.BaseOutput
de.xima.fc.prompt.ms.impl.service.generic_oai.client.model.AskOutput
- All Implemented Interfaces:
TokenUsage
Represents a response from the "completions" endpoint of the Generic OAI service. This endpoint takes a prompt and an
optional file; and responds with a generated text based on the prompt and the file's content.
- Since:
- 8.5.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder class for constructing instances ofAskOutput. -
Method Summary
Modifier and TypeMethodDescriptionanswer()Gets the text generated by the model in response to the prompt.static AskOutput.Builderbuilder()Creates a new builder for constructing anAskOutput.static AskOutputerror(GenericOaiErrorType type, String errorMessage, Throwable cause) Creates anAskOutputrepresenting an error.longGets the number of input tokens that were used to process the prompt.longGets the number of output tokens that were used to generate the response.longGets the total number of tokens that were used to process the request.Methods inherited from class BaseOutput
errorCause, errorMessage, errorType, hasError
-
Method Details
-
answer
Gets the text generated by the model in response to the prompt.- Returns:
- The generated response text.
-
inputTokens
public long inputTokens()Description copied from interface:TokenUsageGets the number of input tokens that were used to process the prompt.- Specified by:
inputTokensin interfaceTokenUsage- Returns:
- The number of input tokens.
-
outputTokens
public long outputTokens()Description copied from interface:TokenUsageGets the number of output tokens that were used to generate the response.- Specified by:
outputTokensin interfaceTokenUsage- Returns:
- The number of output tokens.
-
totalTokens
public long totalTokens()Description copied from interface:TokenUsageGets the total number of tokens that were used to process the request.- Specified by:
totalTokensin interfaceTokenUsage- Returns:
- The total number of tokens.
-
builder
Creates a new builder for constructing anAskOutput.- Returns:
- A new builder instance.
-
error
Creates anAskOutputrepresenting an error.- Parameters:
type- The type of error.errorMessage- A descriptive error message.cause- The underlying exception that caused the error.- Returns:
- An ask response instance representing the error.
-