com.github.tjake.jlama.net.openai.model.ChatCompletionRequestAssistantMessage Maven / Gradle / Ivy
/*
* OpenAI API
* The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
*
* The version of the OpenAPI document: 2.1.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.github.tjake.jlama.net.openai.model;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.github.tjake.jlama.net.openai.model.ChatCompletionMessageToolCall;
import com.github.tjake.jlama.net.openai.model.ChatCompletionRequestAssistantMessageFunctionCall;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import jakarta.validation.constraints.*;
import jakarta.validation.Valid;
import org.hibernate.validator.constraints.*;
import com.github.tjake.jlama.net.openai.JSON;
/**
* ChatCompletionRequestAssistantMessage
*/
@JsonPropertyOrder({
ChatCompletionRequestAssistantMessage.JSON_PROPERTY_CONTENT,
ChatCompletionRequestAssistantMessage.JSON_PROPERTY_ROLE,
ChatCompletionRequestAssistantMessage.JSON_PROPERTY_NAME,
ChatCompletionRequestAssistantMessage.JSON_PROPERTY_TOOL_CALLS,
ChatCompletionRequestAssistantMessage.JSON_PROPERTY_FUNCTION_CALL
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0")
public class ChatCompletionRequestAssistantMessage {
public static final String JSON_PROPERTY_CONTENT = "content";
private String content;
public static final String JSON_PROPERTY_ROLE = "role";
private String role = "assistant";
public static final String JSON_PROPERTY_NAME = "name";
private String name;
public static final String JSON_PROPERTY_TOOL_CALLS = "tool_calls";
private List<@Valid ChatCompletionMessageToolCall> toolCalls;
public static final String JSON_PROPERTY_FUNCTION_CALL = "function_call";
@Deprecated
private ChatCompletionRequestAssistantMessageFunctionCall functionCall;
public ChatCompletionRequestAssistantMessage() {
}
public ChatCompletionRequestAssistantMessage content(String content) {
this.content = content;
return this;
}
/**
* The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified.
* @return content
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_CONTENT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getContent() {
return content;
}
@JsonProperty(JSON_PROPERTY_CONTENT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setContent(String content) {
this.content = content;
}
public ChatCompletionRequestAssistantMessage role(String role) {
this.role = role;
return this;
}
/**
* The role of the messages author, in this case `assistant`.
* @return role
*/
@jakarta.annotation.Nonnull
@NotNull
@JsonProperty(JSON_PROPERTY_ROLE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getRole() {
return role;
}
@JsonProperty(JSON_PROPERTY_ROLE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setRole(String role) {
this.role = role;
}
public ChatCompletionRequestAssistantMessage name(String name) {
this.name = name;
return this;
}
/**
* An optional name for the participant. Provides the model information to differentiate between participants of the same role.
* @return name
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getName() {
return name;
}
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setName(String name) {
this.name = name;
}
public ChatCompletionRequestAssistantMessage toolCalls(List<@Valid ChatCompletionMessageToolCall> toolCalls) {
this.toolCalls = toolCalls;
return this;
}
public ChatCompletionRequestAssistantMessage addToolCallsItem(ChatCompletionMessageToolCall toolCallsItem) {
if (this.toolCalls == null) {
this.toolCalls = new ArrayList<>();
}
this.toolCalls.add(toolCallsItem);
return this;
}
/**
* The tool calls generated by the model, such as function calls.
* @return toolCalls
*/
@jakarta.annotation.Nullable
@Valid
@JsonProperty(JSON_PROPERTY_TOOL_CALLS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<@Valid ChatCompletionMessageToolCall> getToolCalls() {
return toolCalls;
}
@JsonProperty(JSON_PROPERTY_TOOL_CALLS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setToolCalls(List<@Valid ChatCompletionMessageToolCall> toolCalls) {
this.toolCalls = toolCalls;
}
@Deprecated
public ChatCompletionRequestAssistantMessage functionCall(ChatCompletionRequestAssistantMessageFunctionCall functionCall) {
this.functionCall = functionCall;
return this;
}
/**
* Get functionCall
* @return functionCall
* @deprecated
*/
@Deprecated
@jakarta.annotation.Nullable
@Valid
@JsonProperty(JSON_PROPERTY_FUNCTION_CALL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public ChatCompletionRequestAssistantMessageFunctionCall getFunctionCall() {
return functionCall;
}
@Deprecated
@JsonProperty(JSON_PROPERTY_FUNCTION_CALL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setFunctionCall(ChatCompletionRequestAssistantMessageFunctionCall functionCall) {
this.functionCall = functionCall;
}
/**
* Return true if this ChatCompletionRequestAssistantMessage object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ChatCompletionRequestAssistantMessage chatCompletionRequestAssistantMessage = (ChatCompletionRequestAssistantMessage) o;
return Objects.equals(this.content, chatCompletionRequestAssistantMessage.content) &&
Objects.equals(this.role, chatCompletionRequestAssistantMessage.role) &&
Objects.equals(this.name, chatCompletionRequestAssistantMessage.name) &&
Objects.equals(this.toolCalls, chatCompletionRequestAssistantMessage.toolCalls) &&
Objects.equals(this.functionCall, chatCompletionRequestAssistantMessage.functionCall);
}
@Override
public int hashCode() {
return Objects.hash(content, role, name, toolCalls, functionCall);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ChatCompletionRequestAssistantMessage {\n");
sb.append(" content: ").append(toIndentedString(content)).append("\n");
sb.append(" role: ").append(toIndentedString(role)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" toolCalls: ").append(toIndentedString(toolCalls)).append("\n");
sb.append(" functionCall: ").append(toIndentedString(functionCall)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}