1818
1919import java .util .List ;
2020import java .util .Map ;
21- import java .util .Objects ;
2221import java .util .concurrent .atomic .AtomicBoolean ;
2322import java .util .function .Consumer ;
2423import java .util .function .Predicate ;
@@ -868,62 +867,16 @@ public static Object FUNCTION(String functionName) {
868867 }
869868 }
870869
871- @ JsonInclude (JsonInclude .Include .NON_NULL )
872- public static class ResponseFormat {
873-
874- @ JsonProperty ("type" )
875- private Type type ;
876-
877- private String name ;
878-
879- private String schema ;
880-
881- private Boolean strict ;
882-
883- @ JsonProperty ("json_schema" )
884- private JsonSchema jsonSchema ;
885-
886- @ JsonProperty ("type" )
887- public Type getType () {
888- return this .type ;
889- }
890-
891- @ JsonProperty ("json_schema" )
892- public JsonSchema getJsonSchema () {
893- return StringUtils .hasText (this .schema ) ? new JsonSchema (this .name , this .schema , this .strict ) : null ;
894- }
895-
896- public String getName () {
897- return this .name ;
898- }
899-
900- public void setName (String name ) {
901- this .name = name ;
902- }
903-
904- public String getSchema () {
905- return this .schema ;
906- }
907-
908- public void setSchema (String schema ) {
909- this .schema = schema ;
910- }
911-
912- public Boolean getStrict () {
913- return this .strict ;
914- }
915-
916- public void setStrict (Boolean strict ) {
917- this .strict = strict ;
918- }
919-
920- private ResponseFormat () {
921- }
922-
923- public ResponseFormat (Type type , JsonSchema jsonSchema ) {
924- this .type = type ;
925- this .jsonSchema = jsonSchema ;
926- }
870+ /**
871+ * An object specifying the format that the model must output.
872+ * @param type Must be one of 'text' or 'json_object'.
873+ * @param jsonSchema JSON schema object that describes the format of the JSON object.
874+ * Only applicable when type is 'json_schema'.
875+ */
876+ @ JsonInclude (Include .NON_NULL )
877+ public record ResponseFormat (
878+ @ JsonProperty ("type" ) Type type ,
879+ @ JsonProperty ("json_schema" ) JsonSchema jsonSchema ) {
927880
928881 public ResponseFormat (Type type ) {
929882 this (type , (JsonSchema ) null );
@@ -937,40 +890,6 @@ public ResponseFormat(Type type, String name, String schema, Boolean strict) {
937890 this (type , StringUtils .hasText (schema ) ? new JsonSchema (name , schema , strict ) : null );
938891 }
939892
940- public void setType (Type type ) {
941- this .type = type ;
942- }
943-
944- public void setJsonSchema (JsonSchema jsonSchema ) {
945- this .jsonSchema = jsonSchema ;
946- }
947-
948- @ Override
949- public boolean equals (Object o ) {
950- if (this == o ) {
951- return true ;
952- }
953- if (o == null || getClass () != o .getClass ()) {
954- return false ;
955- }
956- ResponseFormat that = (ResponseFormat ) o ;
957- return Objects .equals (this .type , that .type ) &&
958- Objects .equals (this .jsonSchema , that .jsonSchema );
959- }
960-
961- @ Override
962- public int hashCode () {
963- return Objects .hash (this .type , this .jsonSchema );
964- }
965-
966- @ Override
967- public String toString () {
968- return "ResponseFormat{" +
969- "type=" + this .type +
970- ", jsonSchema=" + this .jsonSchema +
971- '}' ;
972- }
973-
974893 public enum Type {
975894 /**
976895 * Generates a text response. (default)
@@ -1000,7 +919,7 @@ public enum Type {
1000919 * @param schema The JSON schema object that describes the format of the JSON object.
1001920 * @param strict If true, the model will only generate outputs that match the schema.
1002921 */
1003- @ JsonInclude (JsonInclude . Include .NON_NULL )
922+ @ JsonInclude (Include .NON_NULL )
1004923 public record JsonSchema (
1005924 @ JsonProperty ("name" ) String name ,
1006925 @ JsonProperty ("schema" ) Map <String , Object > schema ,
@@ -1016,7 +935,6 @@ public JsonSchema(String name, String schema, Boolean strict) {
1016935 }
1017936
1018937 }
1019-
1020938 /**
1021939 * @param includeUsage If set, an additional chunk will be streamed
1022940 * before the data: [DONE] message. The usage field on this chunk
0 commit comments