@@ -590,7 +590,21 @@ public enum ChatModel implements ChatModelDescription {
590
590
* Context window: 4,096 tokens. Max output tokens: 4,096 tokens. Knowledge
591
591
* cutoff: September, 2021.
592
592
*/
593
- GPT_3_5_TURBO_INSTRUCT ("gpt-3.5-turbo-instruct" );
593
+ GPT_3_5_TURBO_INSTRUCT ("gpt-3.5-turbo-instruct" ),
594
+
595
+ /**
596
+ * <b>GPT-4o Search Preview</b> is a specialized model for web search in Chat
597
+ * Completions. It is trained to understand and execute web search queries. See
598
+ * the web search guide for more information.
599
+ */
600
+ GPT_4_O_SEARCH_PREVIEW ("gpt-4o-search-preview" ),
601
+
602
+ /**
603
+ * <b>GPT-4o mini Search Preview</b> is a specialized model for web search in Chat
604
+ * Completions. It is trained to understand and execute web search queries. See
605
+ * the web search guide for more information.
606
+ */
607
+ GPT_4_O_MINI_SEARCH_PREVIEW ("gpt-4o-mini-search-preview" );
594
608
595
609
public final String value ;
596
610
@@ -951,6 +965,10 @@ public enum OutputModality {
951
965
* @param parallelToolCalls If set to true, the model will call all functions in the
952
966
* tools list in parallel. Otherwise, the model will call the functions in the tools
953
967
* list in the order they are provided.
968
+ * @param reasoningEffort Constrains effort on reasoning for reasoning models.
969
+ * Currently supported values are low, medium, and high. Reducing reasoning effort can
970
+ * result in faster responses and fewer tokens used on reasoning in a response.
971
+ * @param webSearchOptions Options for web search.
954
972
*/
955
973
@ JsonInclude (Include .NON_NULL )
956
974
public record ChatCompletionRequest (// @formatter:off
@@ -980,7 +998,8 @@ public record ChatCompletionRequest(// @formatter:off
980
998
@ JsonProperty ("tool_choice" ) Object toolChoice ,
981
999
@ JsonProperty ("parallel_tool_calls" ) Boolean parallelToolCalls ,
982
1000
@ JsonProperty ("user" ) String user ,
983
- @ JsonProperty ("reasoning_effort" ) String reasoningEffort ) {
1001
+ @ JsonProperty ("reasoning_effort" ) String reasoningEffort ,
1002
+ @ JsonProperty ("web_search_options" ) WebSearchOptions webSearchOptions ) {
984
1003
985
1004
/**
986
1005
* Shortcut constructor for a chat completion request with the given messages, model and temperature.
@@ -992,7 +1011,7 @@ public record ChatCompletionRequest(// @formatter:off
992
1011
public ChatCompletionRequest (List <ChatCompletionMessage > messages , String model , Double temperature ) {
993
1012
this (messages , model , null , null , null , null , null , null , null , null , null , null , null , null , null ,
994
1013
null , null , null , false , null , temperature , null ,
995
- null , null , null , null , null );
1014
+ null , null , null , null , null , null );
996
1015
}
997
1016
998
1017
/**
@@ -1006,7 +1025,7 @@ public ChatCompletionRequest(List<ChatCompletionMessage> messages, String model,
1006
1025
this (messages , model , null , null , null , null , null , null ,
1007
1026
null , null , null , List .of (OutputModality .AUDIO , OutputModality .TEXT ), audio , null , null ,
1008
1027
null , null , null , stream , null , null , null ,
1009
- null , null , null , null , null );
1028
+ null , null , null , null , null , null );
1010
1029
}
1011
1030
1012
1031
/**
@@ -1021,7 +1040,7 @@ public ChatCompletionRequest(List<ChatCompletionMessage> messages, String model,
1021
1040
public ChatCompletionRequest (List <ChatCompletionMessage > messages , String model , Double temperature , boolean stream ) {
1022
1041
this (messages , model , null , null , null , null , null , null , null , null , null ,
1023
1042
null , null , null , null , null , null , null , stream , null , temperature , null ,
1024
- null , null , null , null , null );
1043
+ null , null , null , null , null , null );
1025
1044
}
1026
1045
1027
1046
/**
@@ -1037,7 +1056,7 @@ public ChatCompletionRequest(List<ChatCompletionMessage> messages, String model,
1037
1056
List <FunctionTool > tools , Object toolChoice ) {
1038
1057
this (messages , model , null , null , null , null , null , null , null , null , null ,
1039
1058
null , null , null , null , null , null , null , false , null , 0.8 , null ,
1040
- tools , toolChoice , null , null , null );
1059
+ tools , toolChoice , null , null , null , null );
1041
1060
}
1042
1061
1043
1062
/**
@@ -1050,7 +1069,7 @@ public ChatCompletionRequest(List<ChatCompletionMessage> messages, String model,
1050
1069
public ChatCompletionRequest (List <ChatCompletionMessage > messages , Boolean stream ) {
1051
1070
this (messages , null , null , null , null , null , null , null , null , null , null ,
1052
1071
null , null , null , null , null , null , null , stream , null , null , null ,
1053
- null , null , null , null , null );
1072
+ null , null , null , null , null , null );
1054
1073
}
1055
1074
1056
1075
/**
@@ -1063,7 +1082,7 @@ public ChatCompletionRequest streamOptions(StreamOptions streamOptions) {
1063
1082
return new ChatCompletionRequest (this .messages , this .model , this .store , this .metadata , this .frequencyPenalty , this .logitBias , this .logprobs ,
1064
1083
this .topLogprobs , this .maxTokens , this .maxCompletionTokens , this .n , this .outputModalities , this .audioParameters , this .presencePenalty ,
1065
1084
this .responseFormat , this .seed , this .serviceTier , this .stop , this .stream , streamOptions , this .temperature , this .topP ,
1066
- this .tools , this .toolChoice , this .parallelToolCalls , this .user , this .reasoningEffort );
1085
+ this .tools , this .toolChoice , this .parallelToolCalls , this .user , this .reasoningEffort , this . webSearchOptions );
1067
1086
}
1068
1087
1069
1088
/**
@@ -1145,6 +1164,61 @@ public record StreamOptions(
1145
1164
1146
1165
public static StreamOptions INCLUDE_USAGE = new StreamOptions (true );
1147
1166
}
1167
+
1168
+ /**
1169
+ * This tool searches the web for relevant results to use in a response.
1170
+ *
1171
+ * @param searchContextSize
1172
+ * @param userLocation
1173
+ */
1174
+ @ JsonInclude (Include .NON_NULL )
1175
+ public record WebSearchOptions (@ JsonProperty ("search_context_size" ) SearchContextSize searchContextSize ,
1176
+ @ JsonProperty ("user_location" ) UserLocation userLocation ) {
1177
+
1178
+ /**
1179
+ * High level guidance for the amount of context window space to use for the
1180
+ * search. One of low, medium, or high. medium is the default.
1181
+ */
1182
+ public enum SearchContextSize {
1183
+
1184
+ /**
1185
+ * Low context size.
1186
+ */
1187
+ @ JsonProperty ("low" )
1188
+ LOW ,
1189
+
1190
+ /**
1191
+ * Medium context size. This is the default.
1192
+ */
1193
+ @ JsonProperty ("medium" )
1194
+ MEDIUM ,
1195
+
1196
+ /**
1197
+ * High context size.
1198
+ */
1199
+ @ JsonProperty ("high" )
1200
+ HIGH
1201
+
1202
+ }
1203
+
1204
+ /**
1205
+ * Approximate location parameters for the search.
1206
+ *
1207
+ * @param type The type of location approximation. Always "approximate".
1208
+ * @param approximate The approximate location details.
1209
+ */
1210
+ @ JsonInclude (Include .NON_NULL )
1211
+ public record UserLocation (@ JsonProperty ("type" ) String type ,
1212
+ @ JsonProperty ("approximate" ) Approximate approximate ) {
1213
+
1214
+ @ JsonInclude (Include .NON_NULL )
1215
+ public record Approximate (@ JsonProperty ("city" ) String city , @ JsonProperty ("country" ) String country ,
1216
+ @ JsonProperty ("region" ) String region , @ JsonProperty ("timezone" ) String timezone ) {
1217
+ }
1218
+ }
1219
+
1220
+ }
1221
+
1148
1222
} // @formatter:on
1149
1223
1150
1224
/**
@@ -1163,19 +1237,22 @@ public record StreamOptions(
1163
1237
* Applicable only for {@link Role#ASSISTANT} role and null otherwise.
1164
1238
* @param refusal The refusal message by the assistant. Applicable only for
1165
1239
* {@link Role#ASSISTANT} role and null otherwise.
1166
- * @param audioOutput Audio response from the model. >>>>>>> bdb66e577 (OpenAI -
1167
- * Support audio input modality)
1240
+ * @param audioOutput Audio response from the model.
1241
+ * @param annotations Annotations for the message, when applicable, as when using the
1242
+ * web search tool.
1168
1243
*/
1169
- @ JsonInclude (Include .NON_NULL )
1170
- public record ChatCompletionMessage (// @formatter:off
1244
+ @ JsonInclude (JsonInclude .Include .NON_NULL )
1245
+ public record ChatCompletionMessage (
1246
+ // @formatter:off
1171
1247
@ JsonProperty ("content" ) Object rawContent ,
1172
1248
@ JsonProperty ("role" ) Role role ,
1173
1249
@ JsonProperty ("name" ) String name ,
1174
1250
@ JsonProperty ("tool_call_id" ) String toolCallId ,
1175
- @ JsonProperty ("tool_calls" )
1176
- @ JsonFormat (with = JsonFormat .Feature .ACCEPT_SINGLE_VALUE_AS_ARRAY ) List <ToolCall > toolCalls ,
1251
+ @ JsonProperty ("tool_calls" ) @ JsonFormat (with = JsonFormat .Feature .ACCEPT_SINGLE_VALUE_AS_ARRAY ) List <ToolCall > toolCalls ,
1177
1252
@ JsonProperty ("refusal" ) String refusal ,
1178
- @ JsonProperty ("audio" ) AudioOutput audioOutput ) { // @formatter:on
1253
+ @ JsonProperty ("audio" ) AudioOutput audioOutput ,
1254
+ @ JsonProperty ("annotations" ) List <Annotation > annotations
1255
+ ) { // @formatter:on
1179
1256
1180
1257
/**
1181
1258
* Create a chat completion message with the given content and role. All other
@@ -1184,8 +1261,7 @@ public record ChatCompletionMessage(// @formatter:off
1184
1261
* @param role The role of the author of this message.
1185
1262
*/
1186
1263
public ChatCompletionMessage (Object content , Role role ) {
1187
- this (content , role , null , null , null , null , null );
1188
-
1264
+ this (content , role , null , null , null , null , null , null );
1189
1265
}
1190
1266
1191
1267
/**
@@ -1362,6 +1438,29 @@ public record AudioOutput(// @formatter:off
1362
1438
@ JsonProperty ("transcript" ) String transcript
1363
1439
) { // @formatter:on
1364
1440
}
1441
+
1442
+ /**
1443
+ * Represents an annotation within a message, specifically for URL citations.
1444
+ */
1445
+ @ JsonInclude (JsonInclude .Include .NON_NULL )
1446
+ public record Annotation (@ JsonProperty ("type" ) String type ,
1447
+ @ JsonProperty ("url_citation" ) UrlCitation urlCitation ) {
1448
+ /**
1449
+ * A URL citation when using web search.
1450
+ *
1451
+ * @param endIndex The index of the last character of the URL citation in the
1452
+ * message.
1453
+ * @param startIndex The index of the first character of the URL citation in
1454
+ * the message.
1455
+ * @param title The title of the web resource.
1456
+ * @param url The URL of the web resource.
1457
+ */
1458
+ @ JsonInclude (JsonInclude .Include .NON_NULL )
1459
+ public record UrlCitation (@ JsonProperty ("end_index" ) Integer endIndex ,
1460
+ @ JsonProperty ("start_index" ) Integer startIndex , @ JsonProperty ("title" ) String title ,
1461
+ @ JsonProperty ("url" ) String url ) {
1462
+ }
1463
+ }
1365
1464
}
1366
1465
1367
1466
/**
0 commit comments