@kortexya/reasoninglayer 4.2.0 → 4.2.1

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.js CHANGED
@@ -5,7 +5,7 @@ var __export = (target, all) => {
5
5
  };
6
6
 
7
7
  // src/config.ts
8
- var SDK_VERSION = "4.2.0";
8
+ var SDK_VERSION = "4.2.1";
9
9
  function resolveConfig(config) {
10
10
  if (!config.baseUrl) {
11
11
  throw new Error("ClientConfig.baseUrl is required");
@@ -12426,7 +12426,7 @@ var Conformal = class {
12426
12426
  this.http = http;
12427
12427
  }
12428
12428
  /**
12429
- * @description Compute a split-conformal non-conformity threshold from a labeled calibration set. Returns the threshold `τ` and a coverage certificate. The returned `threshold` should be passed verbatim to `POST /api/v1/conformal/predict`.
12429
+ * @description Compute a split-conformal non-conformity threshold from a labeled calibration set. Returns `τ` and an in-sample coverage check. The returned `threshold` should be passed verbatim to `POST /api/v1/conformal/predict`.
12430
12430
  *
12431
12431
  * @tags conformal
12432
12432
  * @name CalibrateConformal
@@ -12442,7 +12442,7 @@ var Conformal = class {
12442
12442
  ...params
12443
12443
  });
12444
12444
  /**
12445
- * @description Apply a pre-computed conformal threshold to unlabeled test inputs and return prediction sets with coverage certificates. A class `y` is included in an input's prediction set iff `1 − class_scores[y] ≤ threshold` (equivalently, `class_scores[y] ≥ 1 − threshold`). When no class meets this criterion the prediction set is empty and `abstains = true` is set on that input's result.
12445
+ * @description Apply a pre-computed conformal threshold to unlabeled test inputs and return prediction sets with explicitly unverified supplied parameters. A class `y` is included in an input's prediction set iff `1 − class_scores[y] ≤ threshold`, evaluated in that score space. When no class meets this criterion the prediction set is empty and `abstains = true` is set on that input's result.
12446
12446
  *
12447
12447
  * @tags conformal
12448
12448
  * @name Predict
@@ -17601,6 +17601,7 @@ var RESPONSE_COMPONENTS = {
17601
17601
  algorithm: [1, 0],
17602
17602
  alpha: [1, 0],
17603
17603
  empirical_coverage: [1, 0],
17604
+ informative: [1, 0],
17604
17605
  meets_target_coverage: [1, 0],
17605
17606
  n_samples: [1, 0],
17606
17607
  quantile_rank: [1, 0],
@@ -17609,7 +17610,7 @@ var RESPONSE_COMPONENTS = {
17609
17610
  },
17610
17611
  ConformalPredictResponse: {
17611
17612
  object: {
17612
- coverage_certificate: [1, "CoverageCertificate"],
17613
+ calibration_parameters: [1, "SuppliedCalibrationParameters"],
17613
17614
  predictions: [1, { array: "ConformalPrediction" }]
17614
17615
  }
17615
17616
  },
@@ -17846,15 +17847,6 @@ var RESPONSE_COMPONENTS = {
17846
17847
  }
17847
17848
  },
17848
17849
  CounterfactualTraceDto: { object: { abduction: [1, 0], action: [1, 0], prediction: [1, 0] } },
17849
- CoverageCertificate: {
17850
- object: {
17851
- algorithm: [1, 0],
17852
- alpha: [1, 0],
17853
- n_calibration_samples: [1, 0],
17854
- nominal_coverage: [1, 0],
17855
- threshold: [1, 0]
17856
- }
17857
- },
17858
17850
  CoverageDetailDto: {
17859
17851
  object: {
17860
17852
  class_coverage: [1, 0],
@@ -22751,6 +22743,17 @@ var RESPONSE_COMPONENTS = {
22751
22743
  supervisor_active: [1, 0]
22752
22744
  }
22753
22745
  },
22746
+ SuppliedCalibrationParameters: {
22747
+ object: {
22748
+ algorithm: [1, 0],
22749
+ alpha: [1, 0],
22750
+ informative: [1, 0],
22751
+ n_calibration_samples: [1, 0],
22752
+ requested_coverage: [1, 0],
22753
+ threshold: [1, 0],
22754
+ verification: [1, 0]
22755
+ }
22756
+ },
22754
22757
  SuspendedQueryDto: {
22755
22758
  object: {
22756
22759
  confidence: [1, 0],
@@ -61499,6 +61502,7 @@ function ConformalCalibrateResponseFromApiToFront(dto) {
61499
61502
  algorithm: dto.algorithm,
61500
61503
  alpha: dto.alpha,
61501
61504
  empiricalCoverage: dto.empirical_coverage,
61505
+ informative: dto.informative,
61502
61506
  meetsTargetCoverage: dto.meets_target_coverage,
61503
61507
  nSamples: dto.n_samples,
61504
61508
  quantileRank: dto.quantile_rank,
@@ -61513,13 +61517,15 @@ function ConformalPredictRequestFromFrontToApi(model) {
61513
61517
  threshold: model.threshold
61514
61518
  };
61515
61519
  }
61516
- function CoverageCertificateFromApiToFront(dto) {
61520
+ function SuppliedCalibrationParametersFromApiToFront(dto) {
61517
61521
  return {
61518
61522
  algorithm: dto.algorithm,
61519
61523
  alpha: dto.alpha,
61524
+ informative: dto.informative,
61520
61525
  nCalibrationSamples: dto.n_calibration_samples,
61521
- nominalCoverage: dto.nominal_coverage,
61522
- threshold: dto.threshold
61526
+ requestedCoverage: dto.requested_coverage,
61527
+ threshold: dto.threshold,
61528
+ verification: dto.verification
61523
61529
  };
61524
61530
  }
61525
61531
  function ConformalPredictionFromApiToFront(dto) {
@@ -61533,7 +61539,7 @@ function ConformalPredictionFromApiToFront(dto) {
61533
61539
  }
61534
61540
  function ConformalPredictResponseFromApiToFront(dto) {
61535
61541
  return {
61536
- coverageCertificate: CoverageCertificateFromApiToFront(dto.coverage_certificate),
61542
+ calibrationParameters: SuppliedCalibrationParametersFromApiToFront(dto.calibration_parameters),
61537
61543
  predictions: dto.predictions.map(ConformalPredictionFromApiToFront)
61538
61544
  };
61539
61545
  }
@@ -61552,11 +61558,22 @@ var ConformalClient = class {
61552
61558
  *
61553
61559
  * @param request - The calibration set (samples + target miscoverage
61554
61560
  * `α`).
61555
- * @returns The computed threshold `τ` plus a coverage certificate and
61556
- * sanity-check coverage stats.
61561
+ * @param requestOptions - Per-request transport options.
61562
+ * @returns The computed threshold `τ`, whether it is informative, and
61563
+ * in-sample coverage statistics.
61557
61564
  *
61558
61565
  * @throws {ApiError} `400` if `alpha` is outside `(0, 1)` or the
61559
- * calibration set is empty.
61566
+ * calibration set is empty or contains invalid scores.
61567
+ * @remarks The request maps schema keys to snake_case and preserves class labels.
61568
+ * An unobserved rank returns threshold 1 and `informative: false`.
61569
+ * @example
61570
+ * ```ts
61571
+ * const calibration = await client.conformal.calibrate({
61572
+ * alpha: 0.05,
61573
+ * samples: labeledSamples,
61574
+ * });
61575
+ * console.log(calibration.informative, calibration.quantileRank);
61576
+ * ```
61560
61577
  */
61561
61578
  async calibrate(request, requestOptions) {
61562
61579
  const response = await this.api.calibrateConformal(
@@ -61567,15 +61584,30 @@ var ConformalClient = class {
61567
61584
  }
61568
61585
  /**
61569
61586
  * Apply a pre-computed conformal threshold to unlabeled test inputs
61570
- * and return prediction sets with coverage certificates.
61587
+ * and return prediction sets with unverified calibration parameters.
61571
61588
  *
61572
61589
  * @param request - The threshold `τ`, calibration `α` and sample count
61573
61590
  * (from a prior `calibrate` call), and the test inputs to predict
61574
61591
  * for.
61575
- * @returns Per-input conformal prediction results plus a coverage
61576
- * certificate, in request order.
61577
- *
61578
- * @throws {ApiError} `400` if the test-input count exceeds 10 000.
61592
+ * @param requestOptions - Per-request transport options.
61593
+ * @returns Per-input prediction results in request order and the applied
61594
+ * parameters with `verification: 'unverified'`.
61595
+ *
61596
+ * @throws {ApiError} `400` for invalid scores, parameters, rank consistency,
61597
+ * or an empty or oversized test-input batch.
61598
+ * @remarks The request maps schema keys to snake_case and preserves class labels.
61599
+ * A nonempty prediction set can still be uninformative. Parameter consistency
61600
+ * does not establish calibration provenance or prediction correctness.
61601
+ * @example
61602
+ * ```ts
61603
+ * const result = await client.conformal.predict({
61604
+ * threshold: calibration.threshold,
61605
+ * alpha: calibration.alpha,
61606
+ * nCalibrationSamples: calibration.nSamples,
61607
+ * testInputs,
61608
+ * });
61609
+ * console.log(result.calibrationParameters.verification);
61610
+ * ```
61579
61611
  */
61580
61612
  async predict(request, requestOptions) {
61581
61613
  const response = await this.api.predict(