All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.tjake.jlama.net.openai.model.ChatCompletionStreamResponseDelta Maven / Gradle / Ivy

There is a newer version: 0.4.1
Show newest version
/*
 * 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.ChatCompletionMessageToolCallChunk;
import com.github.tjake.jlama.net.openai.model.ChatCompletionStreamResponseDeltaFunctionCall;
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;


/**
 * A chat completion delta generated by streamed model responses.
 */
@JsonPropertyOrder({
  ChatCompletionStreamResponseDelta.JSON_PROPERTY_CONTENT,
  ChatCompletionStreamResponseDelta.JSON_PROPERTY_FUNCTION_CALL,
  ChatCompletionStreamResponseDelta.JSON_PROPERTY_TOOL_CALLS,
  ChatCompletionStreamResponseDelta.JSON_PROPERTY_ROLE
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0")
public class ChatCompletionStreamResponseDelta {
  public static final String JSON_PROPERTY_CONTENT = "content";
  private String content;

  public static final String JSON_PROPERTY_FUNCTION_CALL = "function_call";
  @Deprecated
  private ChatCompletionStreamResponseDeltaFunctionCall functionCall;

  public static final String JSON_PROPERTY_TOOL_CALLS = "tool_calls";
  private List<@Valid ChatCompletionMessageToolCallChunk> toolCalls;

  /**
   * The role of the author of this message.
   */
  public enum RoleEnum {
    SYSTEM("system"),
    
    USER("user"),
    
    ASSISTANT("assistant"),
    
    TOOL("tool");

    private String value;

    RoleEnum(String value) {
      this.value = value;
    }

    @JsonValue
    public String getValue() {
      return value;
    }

    @Override
    public String toString() {
      return String.valueOf(value);
    }

    @JsonCreator
    public static RoleEnum fromValue(String value) {
      for (RoleEnum b : RoleEnum.values()) {
        if (b.value.equals(value)) {
          return b;
        }
      }
      throw new IllegalArgumentException("Unexpected value '" + value + "'");
    }
  }

  public static final String JSON_PROPERTY_ROLE = "role";
  private RoleEnum role;

  public ChatCompletionStreamResponseDelta() { 
  }

  public ChatCompletionStreamResponseDelta content(String content) {
    this.content = content;
    return this;
  }

  /**
   * The contents of the chunk message.
   * @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;
  }


  @Deprecated
  public ChatCompletionStreamResponseDelta functionCall(ChatCompletionStreamResponseDeltaFunctionCall 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 ChatCompletionStreamResponseDeltaFunctionCall getFunctionCall() {
    return functionCall;
  }


  @Deprecated
  @JsonProperty(JSON_PROPERTY_FUNCTION_CALL)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setFunctionCall(ChatCompletionStreamResponseDeltaFunctionCall functionCall) {
    this.functionCall = functionCall;
  }


  public ChatCompletionStreamResponseDelta toolCalls(List<@Valid ChatCompletionMessageToolCallChunk> toolCalls) {
    this.toolCalls = toolCalls;
    return this;
  }

  public ChatCompletionStreamResponseDelta addToolCallsItem(ChatCompletionMessageToolCallChunk toolCallsItem) {
    if (this.toolCalls == null) {
      this.toolCalls = new ArrayList<>();
    }
    this.toolCalls.add(toolCallsItem);
    return this;
  }

  /**
   * Get toolCalls
   * @return toolCalls
   */
  @jakarta.annotation.Nullable
  @Valid

  @JsonProperty(JSON_PROPERTY_TOOL_CALLS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public List<@Valid ChatCompletionMessageToolCallChunk> getToolCalls() {
    return toolCalls;
  }


  @JsonProperty(JSON_PROPERTY_TOOL_CALLS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setToolCalls(List<@Valid ChatCompletionMessageToolCallChunk> toolCalls) {
    this.toolCalls = toolCalls;
  }


  public ChatCompletionStreamResponseDelta role(RoleEnum role) {
    this.role = role;
    return this;
  }

  /**
   * The role of the author of this message.
   * @return role
   */
  @jakarta.annotation.Nullable

  @JsonProperty(JSON_PROPERTY_ROLE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public RoleEnum getRole() {
    return role;
  }


  @JsonProperty(JSON_PROPERTY_ROLE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setRole(RoleEnum role) {
    this.role = role;
  }


  /**
   * Return true if this ChatCompletionStreamResponseDelta object is equal to o.
   */
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    ChatCompletionStreamResponseDelta chatCompletionStreamResponseDelta = (ChatCompletionStreamResponseDelta) o;
    return Objects.equals(this.content, chatCompletionStreamResponseDelta.content) &&
        Objects.equals(this.functionCall, chatCompletionStreamResponseDelta.functionCall) &&
        Objects.equals(this.toolCalls, chatCompletionStreamResponseDelta.toolCalls) &&
        Objects.equals(this.role, chatCompletionStreamResponseDelta.role);
  }

  @Override
  public int hashCode() {
    return Objects.hash(content, functionCall, toolCalls, role);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class ChatCompletionStreamResponseDelta {\n");
    sb.append("    content: ").append(toIndentedString(content)).append("\n");
    sb.append("    functionCall: ").append(toIndentedString(functionCall)).append("\n");
    sb.append("    toolCalls: ").append(toIndentedString(toolCalls)).append("\n");
    sb.append("    role: ").append(toIndentedString(role)).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    ");
  }

}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy