@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 CHANGED
@@ -809,6 +809,15 @@ var FilterConditionSchema = zod.z.object({
809
809
  lt: zod.z.number().optional()
810
810
  })
811
811
  }),
812
+ zod.z.object({
813
+ type: zod.z.literal("DatetimeRange"),
814
+ value: zod.z.object({
815
+ gte: zod.z.string().optional(),
816
+ lte: zod.z.string().optional(),
817
+ gt: zod.z.string().optional(),
818
+ lt: zod.z.string().optional()
819
+ })
820
+ }),
812
821
  zod.z.object({
813
822
  type: zod.z.literal("GeoRadius"),
814
823
  value: zod.z.object({
@@ -1029,7 +1038,7 @@ var Client = class {
1029
1038
  if (request.options?.image) {
1030
1039
  this.validateImageSize(request.options.image);
1031
1040
  }
1032
- const url = `${this.baseUrl}/use-case/content-selection`;
1041
+ const url = `${this.baseUrl}/prediction/content-selection`;
1033
1042
  return this.makeRequest({
1034
1043
  method: "POST",
1035
1044
  url,
@@ -1474,7 +1483,7 @@ var Client = class {
1474
1483
  *
1475
1484
  * @example
1476
1485
  * ```typescript
1477
- * const prediction = await client.prediction({
1486
+ * const ranking = await client.ranking({
1478
1487
  * useCase: { uuid: "ranking-use-case" },
1479
1488
  * context: { user_id: "user-123" },
1480
1489
  * actions: [
@@ -1484,9 +1493,9 @@ var Client = class {
1484
1493
  * });
1485
1494
  * ```
1486
1495
  */
1487
- prediction = async (payload) => {
1496
+ ranking = async (payload) => {
1488
1497
  PredictionPayloadSchema.parse(payload);
1489
- const url = `${this.baseUrl}/use-case/prediction`;
1498
+ const url = `${this.baseUrl}/prediction/ranker`;
1490
1499
  const data = this.predictionPreProcessing(payload);
1491
1500
  return this.makeRequest({
1492
1501
  method: "POST",
@@ -1501,7 +1510,7 @@ var Client = class {
1501
1510
  * submits outcome feedback for a previous prediction.
1502
1511
  *
1503
1512
  * @param payload - feedback payload
1504
- * @param payload.predictionUuid - id of the prediction to provide feedback for (from prediction() response)
1513
+ * @param payload.predictionUuid - id of the prediction to provide feedback for (from ranking() response)
1505
1514
  * @param payload.value - feedback data (e.g., { reward: 1 }, { clicked: true }, { rating: 4.5 })
1506
1515
  * @param payload.modelUuid - optional specific model uuid to send feedback to
1507
1516
  *
@@ -1513,7 +1522,7 @@ var Client = class {
1513
1522
  *
1514
1523
  * @example
1515
1524
  * ```typescript
1516
- * const pred = await client.prediction({...});
1525
+ * const pred = await client.ranking({...});
1517
1526
  * // later, after user interaction
1518
1527
  * await client.feedback({
1519
1528
  * predictionUuid: pred.id,
@@ -1611,6 +1620,44 @@ var FilterBuilder = class {
1611
1620
  else this.must_not.push(condition);
1612
1621
  return this;
1613
1622
  }
1623
+ /**
1624
+ * add datetime range filter condition
1625
+ *
1626
+ * filters items where datetime field falls within specified range.
1627
+ * values should be RFC 3339 formatted strings (e.g., "2025-12-15T00:00:00Z").
1628
+ *
1629
+ * @param field - datetime field name to filter on
1630
+ * @param value - range specification with operators (RFC 3339 strings)
1631
+ * @param value.gte - greater than or equal to
1632
+ * @param value.lte - less than or equal to
1633
+ * @param value.gt - greater than
1634
+ * @param value.lt - less than
1635
+ * @param type - filter type: "must", "should", or "must_not". default: "must"
1636
+ *
1637
+ * @returns this filter builder for method chaining
1638
+ *
1639
+ * @example
1640
+ * ```typescript
1641
+ * // events between two dates
1642
+ * builder.datetimeRange("start_date", {
1643
+ * gte: "2025-12-15T00:00:00Z",
1644
+ * lte: "2025-12-31T23:59:59Z"
1645
+ * });
1646
+ *
1647
+ * // events after a specific date
1648
+ * builder.datetimeRange("created_at", { gt: "2025-01-01T00:00:00Z" });
1649
+ * ```
1650
+ */
1651
+ datetimeRange(field, value, type = "must") {
1652
+ const condition = {
1653
+ field,
1654
+ condition: { type: "DatetimeRange", value }
1655
+ };
1656
+ if (type === "must") this.must.push(condition);
1657
+ else if (type === "should") this.should.push(condition);
1658
+ else this.must_not.push(condition);
1659
+ return this;
1660
+ }
1614
1661
  /**
1615
1662
  * add geo-radius filter condition
1616
1663
  *