@albatrossai/albatross-sdk 0.2.0-c → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +53 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +200 -6
- package/dist/index.d.ts +200 -6
- package/dist/index.js +53 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -258,7 +258,7 @@ interface ContentSelectionResponse {
|
|
|
258
258
|
interface FilterCondition {
|
|
259
259
|
/** field name to filter on */
|
|
260
260
|
field: string;
|
|
261
|
-
/** filter condition (Match, Range, or GeoRadius) */
|
|
261
|
+
/** filter condition (Match, Range, DatetimeRange, or GeoRadius) */
|
|
262
262
|
condition: {
|
|
263
263
|
type: "Match";
|
|
264
264
|
value: string | number | boolean;
|
|
@@ -270,6 +270,14 @@ interface FilterCondition {
|
|
|
270
270
|
gt?: number;
|
|
271
271
|
lt?: number;
|
|
272
272
|
};
|
|
273
|
+
} | {
|
|
274
|
+
type: "DatetimeRange";
|
|
275
|
+
value: {
|
|
276
|
+
gte?: string;
|
|
277
|
+
lte?: string;
|
|
278
|
+
gt?: string;
|
|
279
|
+
lt?: string;
|
|
280
|
+
};
|
|
273
281
|
} | {
|
|
274
282
|
type: "GeoRadius";
|
|
275
283
|
value: {
|
|
@@ -754,7 +762,7 @@ declare class Client {
|
|
|
754
762
|
*
|
|
755
763
|
* @example
|
|
756
764
|
* ```typescript
|
|
757
|
-
* const
|
|
765
|
+
* const ranking = await client.ranking({
|
|
758
766
|
* useCase: { uuid: "ranking-use-case" },
|
|
759
767
|
* context: { user_id: "user-123" },
|
|
760
768
|
* actions: [
|
|
@@ -764,7 +772,7 @@ declare class Client {
|
|
|
764
772
|
* });
|
|
765
773
|
* ```
|
|
766
774
|
*/
|
|
767
|
-
|
|
775
|
+
ranking: (payload: PredictionPayload) => Promise<{
|
|
768
776
|
ordering: {
|
|
769
777
|
[key: string]: number;
|
|
770
778
|
};
|
|
@@ -777,7 +785,7 @@ declare class Client {
|
|
|
777
785
|
* submits outcome feedback for a previous prediction.
|
|
778
786
|
*
|
|
779
787
|
* @param payload - feedback payload
|
|
780
|
-
* @param payload.predictionUuid - id of the prediction to provide feedback for (from
|
|
788
|
+
* @param payload.predictionUuid - id of the prediction to provide feedback for (from ranking() response)
|
|
781
789
|
* @param payload.value - feedback data (e.g., { reward: 1 }, { clicked: true }, { rating: 4.5 })
|
|
782
790
|
* @param payload.modelUuid - optional specific model uuid to send feedback to
|
|
783
791
|
*
|
|
@@ -789,7 +797,7 @@ declare class Client {
|
|
|
789
797
|
*
|
|
790
798
|
* @example
|
|
791
799
|
* ```typescript
|
|
792
|
-
* const pred = await client.
|
|
800
|
+
* const pred = await client.ranking({...});
|
|
793
801
|
* // later, after user interaction
|
|
794
802
|
* await client.feedback({
|
|
795
803
|
* predictionUuid: pred.id,
|
|
@@ -891,6 +899,40 @@ declare class FilterBuilder {
|
|
|
891
899
|
gt?: number;
|
|
892
900
|
lt?: number;
|
|
893
901
|
}, type?: "must" | "should" | "must_not"): this;
|
|
902
|
+
/**
|
|
903
|
+
* add datetime range filter condition
|
|
904
|
+
*
|
|
905
|
+
* filters items where datetime field falls within specified range.
|
|
906
|
+
* values should be RFC 3339 formatted strings (e.g., "2025-12-15T00:00:00Z").
|
|
907
|
+
*
|
|
908
|
+
* @param field - datetime field name to filter on
|
|
909
|
+
* @param value - range specification with operators (RFC 3339 strings)
|
|
910
|
+
* @param value.gte - greater than or equal to
|
|
911
|
+
* @param value.lte - less than or equal to
|
|
912
|
+
* @param value.gt - greater than
|
|
913
|
+
* @param value.lt - less than
|
|
914
|
+
* @param type - filter type: "must", "should", or "must_not". default: "must"
|
|
915
|
+
*
|
|
916
|
+
* @returns this filter builder for method chaining
|
|
917
|
+
*
|
|
918
|
+
* @example
|
|
919
|
+
* ```typescript
|
|
920
|
+
* // events between two dates
|
|
921
|
+
* builder.datetimeRange("start_date", {
|
|
922
|
+
* gte: "2025-12-15T00:00:00Z",
|
|
923
|
+
* lte: "2025-12-31T23:59:59Z"
|
|
924
|
+
* });
|
|
925
|
+
*
|
|
926
|
+
* // events after a specific date
|
|
927
|
+
* builder.datetimeRange("created_at", { gt: "2025-01-01T00:00:00Z" });
|
|
928
|
+
* ```
|
|
929
|
+
*/
|
|
930
|
+
datetimeRange(field: string, value: {
|
|
931
|
+
gte?: string;
|
|
932
|
+
lte?: string;
|
|
933
|
+
gt?: string;
|
|
934
|
+
lt?: string;
|
|
935
|
+
}, type?: "must" | "should" | "must_not"): this;
|
|
894
936
|
/**
|
|
895
937
|
* add geo-radius filter condition
|
|
896
938
|
*
|
|
@@ -960,7 +1002,7 @@ declare const EventSchema: z.ZodObject<{
|
|
|
960
1002
|
* zod schema for prediction payload validation
|
|
961
1003
|
*
|
|
962
1004
|
* validates prediction request structure. ensures useCase uuid is non-empty and
|
|
963
|
-
* actions array is provided. automatically validated when calling
|
|
1005
|
+
* actions array is provided. automatically validated when calling ranking().
|
|
964
1006
|
*/
|
|
965
1007
|
declare const PredictionPayloadSchema: z.ZodObject<{
|
|
966
1008
|
useCase: z.ZodObject<{
|
|
@@ -1012,6 +1054,14 @@ declare const FilterConditionSchema: z.ZodObject<{
|
|
|
1012
1054
|
gt: z.ZodOptional<z.ZodNumber>;
|
|
1013
1055
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
1014
1056
|
}, z.core.$strip>;
|
|
1057
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1058
|
+
type: z.ZodLiteral<"DatetimeRange">;
|
|
1059
|
+
value: z.ZodObject<{
|
|
1060
|
+
gte: z.ZodOptional<z.ZodString>;
|
|
1061
|
+
lte: z.ZodOptional<z.ZodString>;
|
|
1062
|
+
gt: z.ZodOptional<z.ZodString>;
|
|
1063
|
+
lt: z.ZodOptional<z.ZodString>;
|
|
1064
|
+
}, z.core.$strip>;
|
|
1015
1065
|
}, z.core.$strip>, z.ZodObject<{
|
|
1016
1066
|
type: z.ZodLiteral<"GeoRadius">;
|
|
1017
1067
|
value: z.ZodObject<{
|
|
@@ -1035,6 +1085,14 @@ declare const ContentSelectionFilterSchema: z.ZodObject<{
|
|
|
1035
1085
|
gt: z.ZodOptional<z.ZodNumber>;
|
|
1036
1086
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
1037
1087
|
}, z.core.$strip>;
|
|
1088
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1089
|
+
type: z.ZodLiteral<"DatetimeRange">;
|
|
1090
|
+
value: z.ZodObject<{
|
|
1091
|
+
gte: z.ZodOptional<z.ZodString>;
|
|
1092
|
+
lte: z.ZodOptional<z.ZodString>;
|
|
1093
|
+
gt: z.ZodOptional<z.ZodString>;
|
|
1094
|
+
lt: z.ZodOptional<z.ZodString>;
|
|
1095
|
+
}, z.core.$strip>;
|
|
1038
1096
|
}, z.core.$strip>, z.ZodObject<{
|
|
1039
1097
|
type: z.ZodLiteral<"GeoRadius">;
|
|
1040
1098
|
value: z.ZodObject<{
|
|
@@ -1057,6 +1115,14 @@ declare const ContentSelectionFilterSchema: z.ZodObject<{
|
|
|
1057
1115
|
gt: z.ZodOptional<z.ZodNumber>;
|
|
1058
1116
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
1059
1117
|
}, z.core.$strip>;
|
|
1118
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1119
|
+
type: z.ZodLiteral<"DatetimeRange">;
|
|
1120
|
+
value: z.ZodObject<{
|
|
1121
|
+
gte: z.ZodOptional<z.ZodString>;
|
|
1122
|
+
lte: z.ZodOptional<z.ZodString>;
|
|
1123
|
+
gt: z.ZodOptional<z.ZodString>;
|
|
1124
|
+
lt: z.ZodOptional<z.ZodString>;
|
|
1125
|
+
}, z.core.$strip>;
|
|
1060
1126
|
}, z.core.$strip>, z.ZodObject<{
|
|
1061
1127
|
type: z.ZodLiteral<"GeoRadius">;
|
|
1062
1128
|
value: z.ZodObject<{
|
|
@@ -1079,6 +1145,14 @@ declare const ContentSelectionFilterSchema: z.ZodObject<{
|
|
|
1079
1145
|
gt: z.ZodOptional<z.ZodNumber>;
|
|
1080
1146
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
1081
1147
|
}, z.core.$strip>;
|
|
1148
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1149
|
+
type: z.ZodLiteral<"DatetimeRange">;
|
|
1150
|
+
value: z.ZodObject<{
|
|
1151
|
+
gte: z.ZodOptional<z.ZodString>;
|
|
1152
|
+
lte: z.ZodOptional<z.ZodString>;
|
|
1153
|
+
gt: z.ZodOptional<z.ZodString>;
|
|
1154
|
+
lt: z.ZodOptional<z.ZodString>;
|
|
1155
|
+
}, z.core.$strip>;
|
|
1082
1156
|
}, z.core.$strip>, z.ZodObject<{
|
|
1083
1157
|
type: z.ZodLiteral<"GeoRadius">;
|
|
1084
1158
|
value: z.ZodObject<{
|
|
@@ -1120,6 +1194,14 @@ declare const ContentSelectionRequestSchema: z.ZodObject<{
|
|
|
1120
1194
|
gt: z.ZodOptional<z.ZodNumber>;
|
|
1121
1195
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
1122
1196
|
}, z.core.$strip>;
|
|
1197
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1198
|
+
type: z.ZodLiteral<"DatetimeRange">;
|
|
1199
|
+
value: z.ZodObject<{
|
|
1200
|
+
gte: z.ZodOptional<z.ZodString>;
|
|
1201
|
+
lte: z.ZodOptional<z.ZodString>;
|
|
1202
|
+
gt: z.ZodOptional<z.ZodString>;
|
|
1203
|
+
lt: z.ZodOptional<z.ZodString>;
|
|
1204
|
+
}, z.core.$strip>;
|
|
1123
1205
|
}, z.core.$strip>, z.ZodObject<{
|
|
1124
1206
|
type: z.ZodLiteral<"GeoRadius">;
|
|
1125
1207
|
value: z.ZodObject<{
|
|
@@ -1142,6 +1224,14 @@ declare const ContentSelectionRequestSchema: z.ZodObject<{
|
|
|
1142
1224
|
gt: z.ZodOptional<z.ZodNumber>;
|
|
1143
1225
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
1144
1226
|
}, z.core.$strip>;
|
|
1227
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1228
|
+
type: z.ZodLiteral<"DatetimeRange">;
|
|
1229
|
+
value: z.ZodObject<{
|
|
1230
|
+
gte: z.ZodOptional<z.ZodString>;
|
|
1231
|
+
lte: z.ZodOptional<z.ZodString>;
|
|
1232
|
+
gt: z.ZodOptional<z.ZodString>;
|
|
1233
|
+
lt: z.ZodOptional<z.ZodString>;
|
|
1234
|
+
}, z.core.$strip>;
|
|
1145
1235
|
}, z.core.$strip>, z.ZodObject<{
|
|
1146
1236
|
type: z.ZodLiteral<"GeoRadius">;
|
|
1147
1237
|
value: z.ZodObject<{
|
|
@@ -1164,6 +1254,14 @@ declare const ContentSelectionRequestSchema: z.ZodObject<{
|
|
|
1164
1254
|
gt: z.ZodOptional<z.ZodNumber>;
|
|
1165
1255
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
1166
1256
|
}, z.core.$strip>;
|
|
1257
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1258
|
+
type: z.ZodLiteral<"DatetimeRange">;
|
|
1259
|
+
value: z.ZodObject<{
|
|
1260
|
+
gte: z.ZodOptional<z.ZodString>;
|
|
1261
|
+
lte: z.ZodOptional<z.ZodString>;
|
|
1262
|
+
gt: z.ZodOptional<z.ZodString>;
|
|
1263
|
+
lt: z.ZodOptional<z.ZodString>;
|
|
1264
|
+
}, z.core.$strip>;
|
|
1167
1265
|
}, z.core.$strip>, z.ZodObject<{
|
|
1168
1266
|
type: z.ZodLiteral<"GeoRadius">;
|
|
1169
1267
|
value: z.ZodObject<{
|
|
@@ -1218,6 +1316,14 @@ declare const SearchParamsSchema: z.ZodObject<{
|
|
|
1218
1316
|
gt: z.ZodOptional<z.ZodNumber>;
|
|
1219
1317
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
1220
1318
|
}, z.core.$strip>;
|
|
1319
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1320
|
+
type: z.ZodLiteral<"DatetimeRange">;
|
|
1321
|
+
value: z.ZodObject<{
|
|
1322
|
+
gte: z.ZodOptional<z.ZodString>;
|
|
1323
|
+
lte: z.ZodOptional<z.ZodString>;
|
|
1324
|
+
gt: z.ZodOptional<z.ZodString>;
|
|
1325
|
+
lt: z.ZodOptional<z.ZodString>;
|
|
1326
|
+
}, z.core.$strip>;
|
|
1221
1327
|
}, z.core.$strip>, z.ZodObject<{
|
|
1222
1328
|
type: z.ZodLiteral<"GeoRadius">;
|
|
1223
1329
|
value: z.ZodObject<{
|
|
@@ -1240,6 +1346,14 @@ declare const SearchParamsSchema: z.ZodObject<{
|
|
|
1240
1346
|
gt: z.ZodOptional<z.ZodNumber>;
|
|
1241
1347
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
1242
1348
|
}, z.core.$strip>;
|
|
1349
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1350
|
+
type: z.ZodLiteral<"DatetimeRange">;
|
|
1351
|
+
value: z.ZodObject<{
|
|
1352
|
+
gte: z.ZodOptional<z.ZodString>;
|
|
1353
|
+
lte: z.ZodOptional<z.ZodString>;
|
|
1354
|
+
gt: z.ZodOptional<z.ZodString>;
|
|
1355
|
+
lt: z.ZodOptional<z.ZodString>;
|
|
1356
|
+
}, z.core.$strip>;
|
|
1243
1357
|
}, z.core.$strip>, z.ZodObject<{
|
|
1244
1358
|
type: z.ZodLiteral<"GeoRadius">;
|
|
1245
1359
|
value: z.ZodObject<{
|
|
@@ -1262,6 +1376,14 @@ declare const SearchParamsSchema: z.ZodObject<{
|
|
|
1262
1376
|
gt: z.ZodOptional<z.ZodNumber>;
|
|
1263
1377
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
1264
1378
|
}, z.core.$strip>;
|
|
1379
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1380
|
+
type: z.ZodLiteral<"DatetimeRange">;
|
|
1381
|
+
value: z.ZodObject<{
|
|
1382
|
+
gte: z.ZodOptional<z.ZodString>;
|
|
1383
|
+
lte: z.ZodOptional<z.ZodString>;
|
|
1384
|
+
gt: z.ZodOptional<z.ZodString>;
|
|
1385
|
+
lt: z.ZodOptional<z.ZodString>;
|
|
1386
|
+
}, z.core.$strip>;
|
|
1265
1387
|
}, z.core.$strip>, z.ZodObject<{
|
|
1266
1388
|
type: z.ZodLiteral<"GeoRadius">;
|
|
1267
1389
|
value: z.ZodObject<{
|
|
@@ -1299,6 +1421,14 @@ declare const RecommendationsParamsSchema: z.ZodObject<{
|
|
|
1299
1421
|
gt: z.ZodOptional<z.ZodNumber>;
|
|
1300
1422
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
1301
1423
|
}, z.core.$strip>;
|
|
1424
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1425
|
+
type: z.ZodLiteral<"DatetimeRange">;
|
|
1426
|
+
value: z.ZodObject<{
|
|
1427
|
+
gte: z.ZodOptional<z.ZodString>;
|
|
1428
|
+
lte: z.ZodOptional<z.ZodString>;
|
|
1429
|
+
gt: z.ZodOptional<z.ZodString>;
|
|
1430
|
+
lt: z.ZodOptional<z.ZodString>;
|
|
1431
|
+
}, z.core.$strip>;
|
|
1302
1432
|
}, z.core.$strip>, z.ZodObject<{
|
|
1303
1433
|
type: z.ZodLiteral<"GeoRadius">;
|
|
1304
1434
|
value: z.ZodObject<{
|
|
@@ -1321,6 +1451,14 @@ declare const RecommendationsParamsSchema: z.ZodObject<{
|
|
|
1321
1451
|
gt: z.ZodOptional<z.ZodNumber>;
|
|
1322
1452
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
1323
1453
|
}, z.core.$strip>;
|
|
1454
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1455
|
+
type: z.ZodLiteral<"DatetimeRange">;
|
|
1456
|
+
value: z.ZodObject<{
|
|
1457
|
+
gte: z.ZodOptional<z.ZodString>;
|
|
1458
|
+
lte: z.ZodOptional<z.ZodString>;
|
|
1459
|
+
gt: z.ZodOptional<z.ZodString>;
|
|
1460
|
+
lt: z.ZodOptional<z.ZodString>;
|
|
1461
|
+
}, z.core.$strip>;
|
|
1324
1462
|
}, z.core.$strip>, z.ZodObject<{
|
|
1325
1463
|
type: z.ZodLiteral<"GeoRadius">;
|
|
1326
1464
|
value: z.ZodObject<{
|
|
@@ -1343,6 +1481,14 @@ declare const RecommendationsParamsSchema: z.ZodObject<{
|
|
|
1343
1481
|
gt: z.ZodOptional<z.ZodNumber>;
|
|
1344
1482
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
1345
1483
|
}, z.core.$strip>;
|
|
1484
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1485
|
+
type: z.ZodLiteral<"DatetimeRange">;
|
|
1486
|
+
value: z.ZodObject<{
|
|
1487
|
+
gte: z.ZodOptional<z.ZodString>;
|
|
1488
|
+
lte: z.ZodOptional<z.ZodString>;
|
|
1489
|
+
gt: z.ZodOptional<z.ZodString>;
|
|
1490
|
+
lt: z.ZodOptional<z.ZodString>;
|
|
1491
|
+
}, z.core.$strip>;
|
|
1346
1492
|
}, z.core.$strip>, z.ZodObject<{
|
|
1347
1493
|
type: z.ZodLiteral<"GeoRadius">;
|
|
1348
1494
|
value: z.ZodObject<{
|
|
@@ -1389,6 +1535,14 @@ declare const SearchByImageParamsSchema: z.ZodObject<{
|
|
|
1389
1535
|
gt: z.ZodOptional<z.ZodNumber>;
|
|
1390
1536
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
1391
1537
|
}, z.core.$strip>;
|
|
1538
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1539
|
+
type: z.ZodLiteral<"DatetimeRange">;
|
|
1540
|
+
value: z.ZodObject<{
|
|
1541
|
+
gte: z.ZodOptional<z.ZodString>;
|
|
1542
|
+
lte: z.ZodOptional<z.ZodString>;
|
|
1543
|
+
gt: z.ZodOptional<z.ZodString>;
|
|
1544
|
+
lt: z.ZodOptional<z.ZodString>;
|
|
1545
|
+
}, z.core.$strip>;
|
|
1392
1546
|
}, z.core.$strip>, z.ZodObject<{
|
|
1393
1547
|
type: z.ZodLiteral<"GeoRadius">;
|
|
1394
1548
|
value: z.ZodObject<{
|
|
@@ -1411,6 +1565,14 @@ declare const SearchByImageParamsSchema: z.ZodObject<{
|
|
|
1411
1565
|
gt: z.ZodOptional<z.ZodNumber>;
|
|
1412
1566
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
1413
1567
|
}, z.core.$strip>;
|
|
1568
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1569
|
+
type: z.ZodLiteral<"DatetimeRange">;
|
|
1570
|
+
value: z.ZodObject<{
|
|
1571
|
+
gte: z.ZodOptional<z.ZodString>;
|
|
1572
|
+
lte: z.ZodOptional<z.ZodString>;
|
|
1573
|
+
gt: z.ZodOptional<z.ZodString>;
|
|
1574
|
+
lt: z.ZodOptional<z.ZodString>;
|
|
1575
|
+
}, z.core.$strip>;
|
|
1414
1576
|
}, z.core.$strip>, z.ZodObject<{
|
|
1415
1577
|
type: z.ZodLiteral<"GeoRadius">;
|
|
1416
1578
|
value: z.ZodObject<{
|
|
@@ -1433,6 +1595,14 @@ declare const SearchByImageParamsSchema: z.ZodObject<{
|
|
|
1433
1595
|
gt: z.ZodOptional<z.ZodNumber>;
|
|
1434
1596
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
1435
1597
|
}, z.core.$strip>;
|
|
1598
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1599
|
+
type: z.ZodLiteral<"DatetimeRange">;
|
|
1600
|
+
value: z.ZodObject<{
|
|
1601
|
+
gte: z.ZodOptional<z.ZodString>;
|
|
1602
|
+
lte: z.ZodOptional<z.ZodString>;
|
|
1603
|
+
gt: z.ZodOptional<z.ZodString>;
|
|
1604
|
+
lt: z.ZodOptional<z.ZodString>;
|
|
1605
|
+
}, z.core.$strip>;
|
|
1436
1606
|
}, z.core.$strip>, z.ZodObject<{
|
|
1437
1607
|
type: z.ZodLiteral<"GeoRadius">;
|
|
1438
1608
|
value: z.ZodObject<{
|
|
@@ -1467,6 +1637,14 @@ declare const SearchByVectorParamsSchema: z.ZodObject<{
|
|
|
1467
1637
|
gt: z.ZodOptional<z.ZodNumber>;
|
|
1468
1638
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
1469
1639
|
}, z.core.$strip>;
|
|
1640
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1641
|
+
type: z.ZodLiteral<"DatetimeRange">;
|
|
1642
|
+
value: z.ZodObject<{
|
|
1643
|
+
gte: z.ZodOptional<z.ZodString>;
|
|
1644
|
+
lte: z.ZodOptional<z.ZodString>;
|
|
1645
|
+
gt: z.ZodOptional<z.ZodString>;
|
|
1646
|
+
lt: z.ZodOptional<z.ZodString>;
|
|
1647
|
+
}, z.core.$strip>;
|
|
1470
1648
|
}, z.core.$strip>, z.ZodObject<{
|
|
1471
1649
|
type: z.ZodLiteral<"GeoRadius">;
|
|
1472
1650
|
value: z.ZodObject<{
|
|
@@ -1489,6 +1667,14 @@ declare const SearchByVectorParamsSchema: z.ZodObject<{
|
|
|
1489
1667
|
gt: z.ZodOptional<z.ZodNumber>;
|
|
1490
1668
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
1491
1669
|
}, z.core.$strip>;
|
|
1670
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1671
|
+
type: z.ZodLiteral<"DatetimeRange">;
|
|
1672
|
+
value: z.ZodObject<{
|
|
1673
|
+
gte: z.ZodOptional<z.ZodString>;
|
|
1674
|
+
lte: z.ZodOptional<z.ZodString>;
|
|
1675
|
+
gt: z.ZodOptional<z.ZodString>;
|
|
1676
|
+
lt: z.ZodOptional<z.ZodString>;
|
|
1677
|
+
}, z.core.$strip>;
|
|
1492
1678
|
}, z.core.$strip>, z.ZodObject<{
|
|
1493
1679
|
type: z.ZodLiteral<"GeoRadius">;
|
|
1494
1680
|
value: z.ZodObject<{
|
|
@@ -1511,6 +1697,14 @@ declare const SearchByVectorParamsSchema: z.ZodObject<{
|
|
|
1511
1697
|
gt: z.ZodOptional<z.ZodNumber>;
|
|
1512
1698
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
1513
1699
|
}, z.core.$strip>;
|
|
1700
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1701
|
+
type: z.ZodLiteral<"DatetimeRange">;
|
|
1702
|
+
value: z.ZodObject<{
|
|
1703
|
+
gte: z.ZodOptional<z.ZodString>;
|
|
1704
|
+
lte: z.ZodOptional<z.ZodString>;
|
|
1705
|
+
gt: z.ZodOptional<z.ZodString>;
|
|
1706
|
+
lt: z.ZodOptional<z.ZodString>;
|
|
1707
|
+
}, z.core.$strip>;
|
|
1514
1708
|
}, z.core.$strip>, z.ZodObject<{
|
|
1515
1709
|
type: z.ZodLiteral<"GeoRadius">;
|
|
1516
1710
|
value: z.ZodObject<{
|
package/dist/index.js
CHANGED
|
@@ -807,6 +807,15 @@ var FilterConditionSchema = z.object({
|
|
|
807
807
|
lt: z.number().optional()
|
|
808
808
|
})
|
|
809
809
|
}),
|
|
810
|
+
z.object({
|
|
811
|
+
type: z.literal("DatetimeRange"),
|
|
812
|
+
value: z.object({
|
|
813
|
+
gte: z.string().optional(),
|
|
814
|
+
lte: z.string().optional(),
|
|
815
|
+
gt: z.string().optional(),
|
|
816
|
+
lt: z.string().optional()
|
|
817
|
+
})
|
|
818
|
+
}),
|
|
810
819
|
z.object({
|
|
811
820
|
type: z.literal("GeoRadius"),
|
|
812
821
|
value: z.object({
|
|
@@ -1027,7 +1036,7 @@ var Client = class {
|
|
|
1027
1036
|
if (request.options?.image) {
|
|
1028
1037
|
this.validateImageSize(request.options.image);
|
|
1029
1038
|
}
|
|
1030
|
-
const url = `${this.baseUrl}/
|
|
1039
|
+
const url = `${this.baseUrl}/prediction/content-selection`;
|
|
1031
1040
|
return this.makeRequest({
|
|
1032
1041
|
method: "POST",
|
|
1033
1042
|
url,
|
|
@@ -1472,7 +1481,7 @@ var Client = class {
|
|
|
1472
1481
|
*
|
|
1473
1482
|
* @example
|
|
1474
1483
|
* ```typescript
|
|
1475
|
-
* const
|
|
1484
|
+
* const ranking = await client.ranking({
|
|
1476
1485
|
* useCase: { uuid: "ranking-use-case" },
|
|
1477
1486
|
* context: { user_id: "user-123" },
|
|
1478
1487
|
* actions: [
|
|
@@ -1482,9 +1491,9 @@ var Client = class {
|
|
|
1482
1491
|
* });
|
|
1483
1492
|
* ```
|
|
1484
1493
|
*/
|
|
1485
|
-
|
|
1494
|
+
ranking = async (payload) => {
|
|
1486
1495
|
PredictionPayloadSchema.parse(payload);
|
|
1487
|
-
const url = `${this.baseUrl}/
|
|
1496
|
+
const url = `${this.baseUrl}/prediction/ranker`;
|
|
1488
1497
|
const data = this.predictionPreProcessing(payload);
|
|
1489
1498
|
return this.makeRequest({
|
|
1490
1499
|
method: "POST",
|
|
@@ -1499,7 +1508,7 @@ var Client = class {
|
|
|
1499
1508
|
* submits outcome feedback for a previous prediction.
|
|
1500
1509
|
*
|
|
1501
1510
|
* @param payload - feedback payload
|
|
1502
|
-
* @param payload.predictionUuid - id of the prediction to provide feedback for (from
|
|
1511
|
+
* @param payload.predictionUuid - id of the prediction to provide feedback for (from ranking() response)
|
|
1503
1512
|
* @param payload.value - feedback data (e.g., { reward: 1 }, { clicked: true }, { rating: 4.5 })
|
|
1504
1513
|
* @param payload.modelUuid - optional specific model uuid to send feedback to
|
|
1505
1514
|
*
|
|
@@ -1511,7 +1520,7 @@ var Client = class {
|
|
|
1511
1520
|
*
|
|
1512
1521
|
* @example
|
|
1513
1522
|
* ```typescript
|
|
1514
|
-
* const pred = await client.
|
|
1523
|
+
* const pred = await client.ranking({...});
|
|
1515
1524
|
* // later, after user interaction
|
|
1516
1525
|
* await client.feedback({
|
|
1517
1526
|
* predictionUuid: pred.id,
|
|
@@ -1609,6 +1618,44 @@ var FilterBuilder = class {
|
|
|
1609
1618
|
else this.must_not.push(condition);
|
|
1610
1619
|
return this;
|
|
1611
1620
|
}
|
|
1621
|
+
/**
|
|
1622
|
+
* add datetime range filter condition
|
|
1623
|
+
*
|
|
1624
|
+
* filters items where datetime field falls within specified range.
|
|
1625
|
+
* values should be RFC 3339 formatted strings (e.g., "2025-12-15T00:00:00Z").
|
|
1626
|
+
*
|
|
1627
|
+
* @param field - datetime field name to filter on
|
|
1628
|
+
* @param value - range specification with operators (RFC 3339 strings)
|
|
1629
|
+
* @param value.gte - greater than or equal to
|
|
1630
|
+
* @param value.lte - less than or equal to
|
|
1631
|
+
* @param value.gt - greater than
|
|
1632
|
+
* @param value.lt - less than
|
|
1633
|
+
* @param type - filter type: "must", "should", or "must_not". default: "must"
|
|
1634
|
+
*
|
|
1635
|
+
* @returns this filter builder for method chaining
|
|
1636
|
+
*
|
|
1637
|
+
* @example
|
|
1638
|
+
* ```typescript
|
|
1639
|
+
* // events between two dates
|
|
1640
|
+
* builder.datetimeRange("start_date", {
|
|
1641
|
+
* gte: "2025-12-15T00:00:00Z",
|
|
1642
|
+
* lte: "2025-12-31T23:59:59Z"
|
|
1643
|
+
* });
|
|
1644
|
+
*
|
|
1645
|
+
* // events after a specific date
|
|
1646
|
+
* builder.datetimeRange("created_at", { gt: "2025-01-01T00:00:00Z" });
|
|
1647
|
+
* ```
|
|
1648
|
+
*/
|
|
1649
|
+
datetimeRange(field, value, type = "must") {
|
|
1650
|
+
const condition = {
|
|
1651
|
+
field,
|
|
1652
|
+
condition: { type: "DatetimeRange", value }
|
|
1653
|
+
};
|
|
1654
|
+
if (type === "must") this.must.push(condition);
|
|
1655
|
+
else if (type === "should") this.should.push(condition);
|
|
1656
|
+
else this.must_not.push(condition);
|
|
1657
|
+
return this;
|
|
1658
|
+
}
|
|
1612
1659
|
/**
|
|
1613
1660
|
* add geo-radius filter condition
|
|
1614
1661
|
*
|