Class OpenAiChatCompletionResponse
java.lang.Object
com.sap.ai.sdk.foundationmodels.openai.OpenAiChatCompletionResponse
Represents the output of an OpenAI chat completion. *
- Since:
- 1.4.0
-
Method Summary
Modifier and TypeMethodDescriptionbooleanExecute tool calls that were suggested by the assistant response.Gets the first choice from the original response.Gets the content of the first choice.Gets theOpenAiAssistantMessagefor the first choice.The original response from the OpenAI API.Gets the token usage from the original response.inthashCode()toString()
-
Method Details
-
getTokenUsage
Gets the token usage from the original response.- Returns:
- the token usage
-
getChoice
Gets the first choice from the original response.- Returns:
- the first choice
-
getContent
Gets the content of the first choice.The content may be empty
""if the assistant did not return any content i.e. when tool calls are present.- Returns:
- the content of the first choice
- Throws:
OpenAiClientException- if the content is filtered by the content filter
-
getMessage
Gets theOpenAiAssistantMessagefor the first choice.- Returns:
- the assistant message
- Throws:
OpenAiClientException- if the content is filtered by the content filter- Since:
- 1.6.0
-
executeTools
Execute tool calls that were suggested by the assistant response.- Returns:
- the list of tool messages that were serialized for the computed results. Empty list if no tools were called.
- Since:
- 1.8.0
-
getOriginalResponse
The original response from the OpenAI API. -
equals
-
hashCode
public int hashCode() -
toString
-