scorecard-ai 1.0.0 → 1.1.0

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.
@@ -7,7 +7,8 @@ import { path } from '../internal/utils/path';
7
7
 
8
8
  export class Metrics extends APIResource {
9
9
  /**
10
- * Create a new Metric for evaluating system outputs.
10
+ * Create a new Metric for evaluating system outputs. The structure of a metric
11
+ * depends on the evalType and outputType of the metric.
11
12
  *
12
13
  * @example
13
14
  * ```ts
@@ -29,6 +30,25 @@ export class Metrics extends APIResource {
29
30
  create(projectID: string, body: MetricCreateParams, options?: RequestOptions): APIPromise<Metric> {
30
31
  return this._client.post(path`/projects/${projectID}/metrics`, { body, ...options });
31
32
  }
33
+
34
+ /**
35
+ * Update an existing Metric. You must specify the evalType and outputType of the
36
+ * metric. The structure of a metric depends on the evalType and outputType of the
37
+ * metric.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const metric = await client.metrics.update('321', {
42
+ * evalType: 'ai',
43
+ * outputType: 'boolean',
44
+ * promptTemplate:
45
+ * 'Using the following guidelines, evaluate the response: {{ guidelines }}\n\nResponse: {{ outputs.response }}\n\nIdeal answer: {{ expected.idealResponse }}',
46
+ * });
47
+ * ```
48
+ */
49
+ update(metricID: string, body: MetricUpdateParams, options?: RequestOptions): APIPromise<Metric> {
50
+ return this._client.patch(path`/metrics/${metricID}`, { body, ...options });
51
+ }
32
52
  }
33
53
 
34
54
  /**
@@ -520,6 +540,229 @@ export declare namespace MetricCreateParams {
520
540
  }
521
541
  }
522
542
 
543
+ export type MetricUpdateParams =
544
+ | MetricUpdateParams.AIIntMetric
545
+ | MetricUpdateParams.HumanIntMetric
546
+ | MetricUpdateParams.HeuristicIntMetric
547
+ | MetricUpdateParams.AIBooleanMetric
548
+ | MetricUpdateParams.HumanBooleanMetric
549
+ | MetricUpdateParams.HeuristicBooleanMetric;
550
+
551
+ export declare namespace MetricUpdateParams {
552
+ export interface AIIntMetric {
553
+ /**
554
+ * AI-based evaluation type.
555
+ */
556
+ evalType: 'ai';
557
+
558
+ /**
559
+ * Integer output type.
560
+ */
561
+ outputType: 'int';
562
+
563
+ /**
564
+ * The description of the Metric.
565
+ */
566
+ description?: string | null;
567
+
568
+ /**
569
+ * The AI model to use for evaluation.
570
+ */
571
+ evalModelName?: string;
572
+
573
+ /**
574
+ * Guidelines for AI evaluation on how to score the metric.
575
+ */
576
+ guidelines?: string | null;
577
+
578
+ /**
579
+ * The name of the Metric.
580
+ */
581
+ name?: string;
582
+
583
+ /**
584
+ * The threshold for determining pass/fail from integer scores (1-5).
585
+ */
586
+ passingThreshold?: number;
587
+
588
+ /**
589
+ * The complete prompt template for AI evaluation. Should include placeholders for
590
+ * dynamic content.
591
+ */
592
+ promptTemplate?: string;
593
+
594
+ /**
595
+ * The temperature for AI evaluation (0-2).
596
+ */
597
+ temperature?: number;
598
+ }
599
+
600
+ export interface HumanIntMetric {
601
+ /**
602
+ * Human-based evaluation type.
603
+ */
604
+ evalType: 'human';
605
+
606
+ /**
607
+ * Integer output type.
608
+ */
609
+ outputType: 'int';
610
+
611
+ /**
612
+ * The description of the Metric.
613
+ */
614
+ description?: string | null;
615
+
616
+ /**
617
+ * Guidelines for human evaluators.
618
+ */
619
+ guidelines?: string;
620
+
621
+ /**
622
+ * The name of the Metric.
623
+ */
624
+ name?: string;
625
+
626
+ /**
627
+ * The threshold for determining pass/fail from integer scores (1-5).
628
+ */
629
+ passingThreshold?: number;
630
+ }
631
+
632
+ export interface HeuristicIntMetric {
633
+ /**
634
+ * Heuristic-based evaluation type.
635
+ */
636
+ evalType: 'heuristic';
637
+
638
+ /**
639
+ * Integer output type.
640
+ */
641
+ outputType: 'int';
642
+
643
+ /**
644
+ * The description of the Metric.
645
+ */
646
+ description?: string | null;
647
+
648
+ /**
649
+ * Optional guidelines for heuristic evaluation logic.
650
+ */
651
+ guidelines?: string;
652
+
653
+ /**
654
+ * The name of the Metric.
655
+ */
656
+ name?: string;
657
+
658
+ /**
659
+ * The threshold for determining pass/fail from integer scores (1-5).
660
+ */
661
+ passingThreshold?: number;
662
+ }
663
+
664
+ export interface AIBooleanMetric {
665
+ /**
666
+ * AI-based evaluation type.
667
+ */
668
+ evalType: 'ai';
669
+
670
+ /**
671
+ * Boolean output type.
672
+ */
673
+ outputType: 'boolean';
674
+
675
+ /**
676
+ * The description of the Metric.
677
+ */
678
+ description?: string | null;
679
+
680
+ /**
681
+ * The AI model to use for evaluation.
682
+ */
683
+ evalModelName?: string;
684
+
685
+ /**
686
+ * Guidelines for AI evaluation on how to score the metric.
687
+ */
688
+ guidelines?: string | null;
689
+
690
+ /**
691
+ * The name of the Metric.
692
+ */
693
+ name?: string;
694
+
695
+ /**
696
+ * The complete prompt template for AI evaluation. Should include placeholders for
697
+ * dynamic content.
698
+ */
699
+ promptTemplate?: string;
700
+
701
+ /**
702
+ * The temperature for AI evaluation (0-2).
703
+ */
704
+ temperature?: number;
705
+ }
706
+
707
+ export interface HumanBooleanMetric {
708
+ /**
709
+ * Human-based evaluation type.
710
+ */
711
+ evalType: 'human';
712
+
713
+ /**
714
+ * Boolean output type.
715
+ */
716
+ outputType: 'boolean';
717
+
718
+ /**
719
+ * The description of the Metric.
720
+ */
721
+ description?: string | null;
722
+
723
+ /**
724
+ * Guidelines for human evaluators.
725
+ */
726
+ guidelines?: string;
727
+
728
+ /**
729
+ * The name of the Metric.
730
+ */
731
+ name?: string;
732
+ }
733
+
734
+ export interface HeuristicBooleanMetric {
735
+ /**
736
+ * Heuristic-based evaluation type.
737
+ */
738
+ evalType: 'heuristic';
739
+
740
+ /**
741
+ * Boolean output type.
742
+ */
743
+ outputType: 'boolean';
744
+
745
+ /**
746
+ * The description of the Metric.
747
+ */
748
+ description?: string | null;
749
+
750
+ /**
751
+ * Optional guidelines for heuristic evaluation logic.
752
+ */
753
+ guidelines?: string;
754
+
755
+ /**
756
+ * The name of the Metric.
757
+ */
758
+ name?: string;
759
+ }
760
+ }
761
+
523
762
  export declare namespace Metrics {
524
- export { type Metric as Metric, type MetricCreateParams as MetricCreateParams };
763
+ export {
764
+ type Metric as Metric,
765
+ type MetricCreateParams as MetricCreateParams,
766
+ type MetricUpdateParams as MetricUpdateParams,
767
+ };
525
768
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.0.0'; // x-release-please-version
1
+ export const VERSION = '1.1.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.0.0";
1
+ export declare const VERSION = "1.1.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.0.0";
1
+ export declare const VERSION = "1.1.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '1.0.0'; // x-release-please-version
4
+ exports.VERSION = '1.1.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.0.0'; // x-release-please-version
1
+ export const VERSION = '1.1.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map