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
public final class AskOutput extends BaseOutput implements 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 Classes Modifier and Type Class Description static classAskOutput.BuilderBuilder class for constructing instances ofAskOutput.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringanswer()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.longinputTokens()Gets the number of input tokens that were used to process the prompt.longoutputTokens()Gets the number of output tokens that were used to generate the response.longtotalTokens()Gets the total number of tokens that were used to process the request.-
Methods inherited from class de.xima.fc.prompt.ms.impl.service.generic_oai.client.model.BaseOutput
errorCause, errorMessage, errorType, hasError
-
-
-
-
Method Detail
-
answer
public String 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
public static AskOutput.Builder builder()
Creates a new builder for constructing anAskOutput.- Returns:
- A new builder instance.
-
error
public static AskOutput error(GenericOaiErrorType type, String errorMessage, Throwable cause)
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.
-
-