Class OpenAIRequestBody
java.lang.Object
com.developer.nefarious.zjoule.plugin.chat.openai.OpenAIRequestBody
Represents the request body for an OpenAI chat completion API call.
This class encapsulates the parameters required by the OpenAI API,
including chat messages, maximum tokens, temperature, penalties, and stop sequences.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
Retrieves the frequency penalty applied to the response.int
Retrieves the maximum number of tokens allowed in the response.Retrieves the list of chat messages in the request.double
Retrieves the presence penalty applied to the response.getStop()
Retrieves the stop sequence used to terminate the AI's response.double
Retrieves the temperature parameter for the AI's response.void
setFrequencyPenalty
(double frequencyPenalty) Sets the frequency penalty applied to the response.void
setMaxTokens
(int maxTokens) Sets the maximum number of tokens allowed in the response.void
setMessages
(List<IChatMessage> messages) Sets the list of chat messages in the request.void
setPresencePenalty
(double presencePenalty) Sets the presence penalty applied to the response.void
Sets the stop sequence used to terminate the AI's response.void
setTemperature
(double temperature) Sets the temperature parameter for the AI's response.toString()
Serializes this object to its JSON representation usingGson
.
-
Constructor Details
-
OpenAIRequestBody
public OpenAIRequestBody()
-
-
Method Details
-
getFrequencyPenalty
public double getFrequencyPenalty()Retrieves the frequency penalty applied to the response.- Returns:
- the frequency penalty as a
double
.
-
getMaxTokens
public int getMaxTokens()Retrieves the maximum number of tokens allowed in the response.- Returns:
- the maximum token limit as an
int
.
-
getMessages
Retrieves the list of chat messages in the request.- Returns:
- a
List
ofIChatMessage
objects.
-
getPresencePenalty
public double getPresencePenalty()Retrieves the presence penalty applied to the response.- Returns:
- the presence penalty as a
double
.
-
getStop
Retrieves the stop sequence used to terminate the AI's response.- Returns:
- the stop sequence as a
String
.
-
getTemperature
public double getTemperature()Retrieves the temperature parameter for the AI's response.- Returns:
- the temperature as a
double
.
-
setFrequencyPenalty
public void setFrequencyPenalty(double frequencyPenalty) Sets the frequency penalty applied to the response.- Parameters:
frequencyPenalty
- the frequency penalty as adouble
.
-
setMaxTokens
public void setMaxTokens(int maxTokens) Sets the maximum number of tokens allowed in the response.- Parameters:
maxTokens
- the maximum token limit as anint
.
-
setMessages
Sets the list of chat messages in the request.- Parameters:
messages
- aList
ofIChatMessage
objects.
-
setPresencePenalty
public void setPresencePenalty(double presencePenalty) Sets the presence penalty applied to the response.- Parameters:
presencePenalty
- the presence penalty as adouble
.
-
setStop
Sets the stop sequence used to terminate the AI's response.- Parameters:
stop
- the stop sequence as aString
.
-
setTemperature
public void setTemperature(double temperature) Sets the temperature parameter for the AI's response.- Parameters:
temperature
- the temperature as adouble
.
-
toString
Serializes this object to its JSON representation usingGson
. TheRole.RoleSerializer
is registered to handle role serialization.
-