@@ -993,24 +993,25 @@ class JsonFormatsSpecs extends AnyWordSpecLike with Matchers {
993
993
)
994
994
}
995
995
996
- " serialize Input.ofInputTextMessage" in {
996
+ " serialize and deserialize Input.ofInputTextMessage" in {
997
997
val input = Input .ofInputTextMessage(
998
998
content = " Hello, world!" ,
999
999
role = ChatRole .User
1000
1000
)
1001
1001
1002
- testSerialization [Input ](
1002
+ testCodec [Input ](
1003
1003
input,
1004
1004
""" {
1005
1005
| "content" : "Hello, world!",
1006
- | "role" : "user"
1006
+ | "role" : "user",
1007
+ | "type" : "message"
1007
1008
|}""" .stripMargin,
1008
1009
Pretty
1009
1010
)
1010
1011
}
1011
1012
1012
- " serialize Input.ofInputMessage" in {
1013
- testSerialization [Input ](
1013
+ " serialize and deserialize Input.ofInputMessage" in {
1014
+ testCodec [Input ](
1014
1015
Input .ofInputMessage(
1015
1016
content = Seq (
1016
1017
InputMessageContent .Text (" Hello, I have a question about my data." ),
@@ -1026,12 +1027,13 @@ class JsonFormatsSpecs extends AnyWordSpecLike with Matchers {
1026
1027
| "file_id" : "file_abc123",
1027
1028
| "type" : "input_file"
1028
1029
| } ],
1029
- | "role" : "user"
1030
+ | "role" : "user",
1031
+ | "type" : "message"
1030
1032
|}""" .stripMargin,
1031
1033
Pretty
1032
1034
)
1033
1035
1034
- testSerialization [Input ](
1036
+ testCodec [Input ](
1035
1037
Input .ofInputMessage(
1036
1038
content = Seq (
1037
1039
InputMessageContent .Text (" Hello, I have a question about my data." ),
@@ -1049,13 +1051,14 @@ class JsonFormatsSpecs extends AnyWordSpecLike with Matchers {
1049
1051
| "type" : "input_file"
1050
1052
| } ],
1051
1053
| "role" : "user",
1052
- | "status" : "completed"
1054
+ | "status" : "completed",
1055
+ | "type" : "message"
1053
1056
|}""" .stripMargin,
1054
1057
Pretty
1055
1058
)
1056
1059
}
1057
1060
1058
- " serialize Input.ofOutputMessage" in {
1061
+ " serialize and deserialize Input.ofOutputMessage" in {
1059
1062
val input = Input .ofOutputMessage(
1060
1063
content = Seq (
1061
1064
OutputMessageContent .OutputText (text = " Here's the analysis of your data." )
@@ -1064,7 +1067,7 @@ class JsonFormatsSpecs extends AnyWordSpecLike with Matchers {
1064
1067
status = ModelStatus .Completed
1065
1068
)
1066
1069
1067
- testSerialization [Input ](
1070
+ testCodec [Input ](
1068
1071
input,
1069
1072
""" {
1070
1073
| "content" : [ {
@@ -1073,13 +1076,14 @@ class JsonFormatsSpecs extends AnyWordSpecLike with Matchers {
1073
1076
| "type" : "output_text"
1074
1077
| } ],
1075
1078
| "id" : "output_abc123",
1076
- | "status" : "completed"
1079
+ | "status" : "completed",
1080
+ | "type" : "message"
1077
1081
|}""" .stripMargin,
1078
1082
Pretty
1079
1083
)
1080
1084
}
1081
1085
1082
- " serialize Input.ofFileSearchToolCall" in {
1086
+ " serialize and deserialize Input.ofFileSearchToolCall" in {
1083
1087
val input = Input .ofFileSearchToolCall(
1084
1088
id = " search_abc123" ,
1085
1089
queries = Seq (" Find documents about machine learning" ),
@@ -1095,7 +1099,7 @@ class JsonFormatsSpecs extends AnyWordSpecLike with Matchers {
1095
1099
)
1096
1100
)
1097
1101
1098
- testSerialization [Input ](
1102
+ testCodec [Input ](
1099
1103
input,
1100
1104
""" {
1101
1105
| "id" : "search_abc123",
@@ -1135,7 +1139,7 @@ class JsonFormatsSpecs extends AnyWordSpecLike with Matchers {
1135
1139
status = ModelStatus .InProgress
1136
1140
)
1137
1141
1138
- testSerialization [Input ](
1142
+ testCodec [Input ](
1139
1143
input,
1140
1144
""" {
1141
1145
| "action" : {
@@ -1158,7 +1162,7 @@ class JsonFormatsSpecs extends AnyWordSpecLike with Matchers {
1158
1162
)
1159
1163
}
1160
1164
1161
- " serialize Input.ofComputerToolCallOutput" in {
1165
+ " serialize and deserialize Input.ofComputerToolCallOutput" in {
1162
1166
val input = Input .ofComputerToolCallOutput(
1163
1167
callId = " computer_call_abc123" ,
1164
1168
output = ComputerScreenshot (
@@ -1176,7 +1180,7 @@ class JsonFormatsSpecs extends AnyWordSpecLike with Matchers {
1176
1180
status = Some (ModelStatus .Completed )
1177
1181
)
1178
1182
1179
- testSerialization [Input ](
1183
+ testCodec [Input ](
1180
1184
input,
1181
1185
""" {
1182
1186
| "call_id" : "computer_call_abc123",
@@ -1191,19 +1195,20 @@ class JsonFormatsSpecs extends AnyWordSpecLike with Matchers {
1191
1195
| "message" : "Action confirmed"
1192
1196
| } ],
1193
1197
| "id" : "output_abc123",
1194
- | "status" : "completed"
1198
+ | "status" : "completed",
1199
+ | "type" : "computer_call_output"
1195
1200
|}""" .stripMargin,
1196
1201
Pretty
1197
1202
)
1198
1203
}
1199
1204
1200
- " serialize Input.ofWebSearchToolCall" in {
1205
+ " serialize and deserialize Input.ofWebSearchToolCall" in {
1201
1206
val input = Input .ofWebSearchToolCall(
1202
1207
id = " web_search_abc123" ,
1203
1208
status = ModelStatus .InProgress
1204
1209
)
1205
1210
1206
- testSerialization [Input ](
1211
+ testCodec [Input ](
1207
1212
input,
1208
1213
""" {
1209
1214
| "id" : "web_search_abc123",
@@ -1214,7 +1219,7 @@ class JsonFormatsSpecs extends AnyWordSpecLike with Matchers {
1214
1219
)
1215
1220
}
1216
1221
1217
- " serialize Input.ofFunctionToolCall" in {
1222
+ " serialize and deserialize Input.ofFunctionToolCall" in {
1218
1223
val input = Input .ofFunctionToolCall(
1219
1224
arguments = """ {"location":"San Francisco, CA"}""" ,
1220
1225
callId = " function_call_abc123" ,
@@ -1223,7 +1228,7 @@ class JsonFormatsSpecs extends AnyWordSpecLike with Matchers {
1223
1228
status = Some (ModelStatus .Completed )
1224
1229
)
1225
1230
1226
- testSerialization [Input ](
1231
+ testCodec [Input ](
1227
1232
input,
1228
1233
""" {
1229
1234
| "arguments" : "{\"location\":\"San Francisco, CA\"}",
@@ -1237,27 +1242,28 @@ class JsonFormatsSpecs extends AnyWordSpecLike with Matchers {
1237
1242
)
1238
1243
}
1239
1244
1240
- " serialize Input.ofFunctionToolCallOutput" in {
1245
+ " serialize and deserialize Input.ofFunctionToolCallOutput" in {
1241
1246
val input = Input .ofFunctionToolCallOutput(
1242
1247
callId = " function_call_abc123" ,
1243
1248
output = """ {"temperature":72,"unit":"F"}""" ,
1244
1249
id = Some (" output_abc123" ),
1245
1250
status = Some (ModelStatus .Completed )
1246
1251
)
1247
1252
1248
- testSerialization [Input ](
1253
+ testCodec [Input ](
1249
1254
input,
1250
1255
""" {
1251
1256
| "call_id" : "function_call_abc123",
1252
1257
| "output" : "{\"temperature\":72,\"unit\":\"F\"}",
1253
1258
| "id" : "output_abc123",
1254
- | "status" : "completed"
1259
+ | "status" : "completed",
1260
+ | "type" : "function_call_output"
1255
1261
|}""" .stripMargin,
1256
1262
Pretty
1257
1263
)
1258
1264
}
1259
1265
1260
- " serialize Input.ofReasoning" in {
1266
+ " serialize and deserialize Input.ofReasoning" in {
1261
1267
val input = Input .ofReasoning(
1262
1268
id = " reasoning_abc123" ,
1263
1269
summary = Seq (
@@ -1267,7 +1273,7 @@ class JsonFormatsSpecs extends AnyWordSpecLike with Matchers {
1267
1273
status = Some (ModelStatus .Completed )
1268
1274
)
1269
1275
1270
- testSerialization [Input ](
1276
+ testCodec [Input ](
1271
1277
input,
1272
1278
""" {
1273
1279
| "id" : "reasoning_abc123",
@@ -1276,21 +1282,23 @@ class JsonFormatsSpecs extends AnyWordSpecLike with Matchers {
1276
1282
| }, {
1277
1283
| "text" : "Second step: Draw conclusions"
1278
1284
| } ],
1279
- | "status" : "completed"
1285
+ | "status" : "completed",
1286
+ | "type" : "reasoning"
1280
1287
|}""" .stripMargin,
1281
1288
Pretty
1282
1289
)
1283
1290
}
1284
1291
1285
- " serialize Input.ofItemReference" in {
1292
+ " serialize and deserialize Input.ofItemReference" in {
1286
1293
val input = Input .ofItemReference(
1287
1294
id = " item_abc123"
1288
1295
)
1289
1296
1290
- testSerialization [Input ](
1297
+ testCodec [Input ](
1291
1298
input,
1292
1299
""" {
1293
- | "id" : "item_abc123"
1300
+ | "id" : "item_abc123",
1301
+ | "type" : "item_reference"
1294
1302
|}""" .stripMargin,
1295
1303
Pretty
1296
1304
)
0 commit comments