Package com.sap.ai.sdk.orchestration
Class OrchestrationChatResponse
java.lang.Object
com.sap.ai.sdk.orchestration.OrchestrationChatResponse
Orchestration chat completion output.
-
Method Details
-
getContent
Get the message content from the output.Note: If there are multiple choices only the first one is returned
- Returns:
- the message content or empty string.
- Throws:
OrchestrationFilterException.Output- if the content filter filtered the output.
-
getTokenUsage
Get the token usage.- Returns:
- The token usage.
-
getAllMessages
Get all messages. This can be used for subsequent prompts as a message history.- Returns:
- A list of all messages.
- Throws:
IllegalArgumentException- if the MultiChatMessage type message in chat.
-
getChoice
Get the LLM response. Useful for accessing the finish reason or further data like logprobs.- Returns:
- The (first, in case of multiple)
LLMChoice.
-
asEntity
Transform a JSON response into an entity of the given type.This is possible on a request with a
OrchestrationTemplate.withJsonSchemaResponse(com.sap.ai.sdk.orchestration.ResponseJsonSchema)configured intoOrchestrationModuleConfig.withTemplateConfig(com.sap.ai.sdk.orchestration.TemplateConfig).- Type Parameters:
T- the type of the entity to deserialize to.- Parameters:
type- the class type to deserialize the JSON content into.- Returns:
- the deserialized entity of type T.
- Throws:
OrchestrationClientException- if the model refused to answer the question or if the content
-
getOriginalResponse
-
equals
-
hashCode
public int hashCode() -
toString
-