Class OpenAIRequestResponse
java.lang.Object
com.developer.nefarious.zjoule.plugin.chat.openai.OpenAIRequestResponse
Represents the response body from an OpenAI chat completion API request.
This class encapsulates information about the response, including choices,
token usage, and metadata.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Represents a single choice in the response from the OpenAI API.static class
Represents the token usage details in the OpenAI API response. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionRetrieves the list of choices returned by the OpenAI API.long
Retrieves the timestamp when the response was created.getId()
Retrieves the unique identifier for the response.getModel()
Retrieves the model used to generate the response.Retrieves the object type of the response.getUsage()
Retrieves the token usage details for the request.void
setChoices
(List<OpenAIRequestResponse.Choice> choices) Sets the list of choices returned by the OpenAI API.void
setCreated
(long created) Sets the timestamp when the response was created.void
Sets the unique identifier for the response.void
Sets the model used to generate the response.void
Sets the object type of the response.void
Sets the token usage details for the request.
-
Constructor Details
-
OpenAIRequestResponse
public OpenAIRequestResponse()
-
-
Method Details
-
getId
Retrieves the unique identifier for the response.- Returns:
- the response ID as a
String
.
-
setId
Sets the unique identifier for the response.- Parameters:
id
- the response ID as aString
.
-
getObject
Retrieves the object type of the response.- Returns:
- the object type as a
String
.
-
setObject
Sets the object type of the response.- Parameters:
object
- the object type as aString
.
-
getCreated
public long getCreated()Retrieves the timestamp when the response was created.- Returns:
- the creation timestamp as a
long
.
-
setCreated
public void setCreated(long created) Sets the timestamp when the response was created.- Parameters:
created
- the creation timestamp as along
.
-
getModel
Retrieves the model used to generate the response.- Returns:
- the model as a
String
.
-
setModel
Sets the model used to generate the response.- Parameters:
model
- the model as aString
.
-
getChoices
Retrieves the list of choices returned by the OpenAI API.- Returns:
- a
List
ofOpenAIRequestResponse.Choice
objects.
-
setChoices
Sets the list of choices returned by the OpenAI API.- Parameters:
choices
- aList
ofOpenAIRequestResponse.Choice
objects.
-
getUsage
Retrieves the token usage details for the request.- Returns:
- the
OpenAIRequestResponse.Usage
object containing token usage information.
-
setUsage
Sets the token usage details for the request.- Parameters:
usage
- theOpenAIRequestResponse.Usage
object containing token usage information.
-