opik 1.9.24 → 1.9.25

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.d.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as stream from 'stream';
2
2
  import { Logger } from 'tslog';
3
- import z$1, { z } from 'zod';
3
+ import { z } from 'zod';
4
+ export { z } from 'zod';
4
5
  import { ModelMessage, SystemModelMessage, UserModelMessage, AssistantModelMessage, ToolModelMessage, LanguageModel } from 'ai';
5
6
  import { OpenAIProviderSettings } from '@ai-sdk/openai';
6
7
  import { OpenAIChatModelId } from '@ai-sdk/openai/internal';
@@ -190,15 +191,15 @@ declare const DatasetUpdateVisibility: {
190
191
  /**
191
192
  * @example
192
193
  * {
193
- * ids: ["ids"],
194
194
  * update: {}
195
195
  * }
196
196
  */
197
197
  interface DatasetItemBatchUpdate {
198
- /** List of dataset item IDs to update (max 1000) */
199
- ids: string[];
198
+ /** List of dataset item IDs to update (max 1000). Mutually exclusive with 'filters'. */
199
+ ids?: string[];
200
+ filters?: DatasetItemFilter[];
200
201
  update: DatasetItemUpdate;
201
- /** If true, merge tags with existing tags instead of replacing them. Default: false */
202
+ /** If true, merge tags with existing tags instead of replacing them. Default: false. When using 'filters', this is automatically set to true. */
202
203
  mergeTags?: boolean;
203
204
  }
204
205
 
@@ -3127,6 +3128,36 @@ interface DashboardPagePublic {
3127
3128
  total?: number;
3128
3129
  }
3129
3130
 
3131
+ /**
3132
+ * This file was auto-generated by Fern from our API Definition.
3133
+ */
3134
+ type DatasetItemFilterOperator = "contains" | "not_contains" | "starts_with" | "ends_with" | "=" | "!=" | ">" | ">=" | "<" | "<=" | "is_empty" | "is_not_empty";
3135
+ declare const DatasetItemFilterOperator: {
3136
+ readonly Contains: "contains";
3137
+ readonly NotContains: "not_contains";
3138
+ readonly StartsWith: "starts_with";
3139
+ readonly EndsWith: "ends_with";
3140
+ readonly EqualTo: "=";
3141
+ readonly NotEquals: "!=";
3142
+ readonly GreaterThan: ">";
3143
+ readonly GreaterThanOrEqualTo: ">=";
3144
+ readonly LessThan: "<";
3145
+ readonly LessThanOrEqualTo: "<=";
3146
+ readonly IsEmpty: "is_empty";
3147
+ readonly IsNotEmpty: "is_not_empty";
3148
+ };
3149
+
3150
+ /**
3151
+ * This file was auto-generated by Fern from our API Definition.
3152
+ */
3153
+
3154
+ interface DatasetItemFilter {
3155
+ field?: string;
3156
+ operator?: DatasetItemFilterOperator;
3157
+ key?: string;
3158
+ value?: string;
3159
+ }
3160
+
3130
3161
  /**
3131
3162
  * This file was auto-generated by Fern from our API Definition.
3132
3163
  */
@@ -6611,7 +6642,6 @@ declare class Datasets {
6611
6642
  *
6612
6643
  * @example
6613
6644
  * await client.datasets.batchUpdateDatasetItems({
6614
- * ids: ["ids"],
6615
6645
  * update: {}
6616
6646
  * })
6617
6647
  */
@@ -10242,7 +10272,7 @@ type EvaluationTestResult = {
10242
10272
  scoreResults: EvaluationScoreResult[];
10243
10273
  };
10244
10274
 
10245
- declare abstract class BaseMetric<T extends z.AnyZodObject = z.AnyZodObject> {
10275
+ declare abstract class BaseMetric<T extends z.ZodObject<z.ZodRawShape> = z.ZodObject<z.ZodRawShape>> {
10246
10276
  /**
10247
10277
  * The name of the metric
10248
10278
  */
@@ -10786,17 +10816,17 @@ interface EvaluatePromptOptions extends Omit<EvaluateOptions, "task"> {
10786
10816
  */
10787
10817
  declare function evaluatePrompt(options: EvaluatePromptOptions): Promise<EvaluationResult>;
10788
10818
 
10789
- declare const validationSchema$7: z$1.ZodObject<{
10790
- output: z$1.ZodUnknown;
10791
- expected: z$1.ZodUnknown;
10792
- }, "strip", z$1.ZodTypeAny, {
10819
+ declare const validationSchema$7: z.ZodObject<{
10820
+ output: z.ZodUnknown;
10821
+ expected: z.ZodUnknown;
10822
+ }, "strip", z.ZodTypeAny, {
10793
10823
  output?: unknown;
10794
10824
  expected?: unknown;
10795
10825
  }, {
10796
10826
  output?: unknown;
10797
10827
  expected?: unknown;
10798
10828
  }>;
10799
- type Input$7 = z$1.infer<typeof validationSchema$7>;
10829
+ type Input$7 = z.infer<typeof validationSchema$7>;
10800
10830
  /**
10801
10831
  * ExactMatch metric - checks if the actual output exactly matches the expected output.
10802
10832
  * Simple metric for exact string matching.
@@ -10808,10 +10838,10 @@ declare class ExactMatch extends BaseMetric {
10808
10838
  * @param trackMetric Whether to track the metric
10809
10839
  */
10810
10840
  constructor(name?: string, trackMetric?: boolean);
10811
- validationSchema: z$1.ZodObject<{
10812
- output: z$1.ZodUnknown;
10813
- expected: z$1.ZodUnknown;
10814
- }, "strip", z$1.ZodTypeAny, {
10841
+ validationSchema: z.ZodObject<{
10842
+ output: z.ZodUnknown;
10843
+ expected: z.ZodUnknown;
10844
+ }, "strip", z.ZodTypeAny, {
10815
10845
  output?: unknown;
10816
10846
  expected?: unknown;
10817
10847
  }, {
@@ -10826,17 +10856,17 @@ declare class ExactMatch extends BaseMetric {
10826
10856
  score(input: Input$7): Promise<EvaluationScoreResult>;
10827
10857
  }
10828
10858
 
10829
- declare const validationSchema$6: z$1.ZodObject<{
10830
- output: z$1.ZodString;
10831
- substring: z$1.ZodString;
10832
- }, "strip", z$1.ZodTypeAny, {
10859
+ declare const validationSchema$6: z.ZodObject<{
10860
+ output: z.ZodString;
10861
+ substring: z.ZodString;
10862
+ }, "strip", z.ZodTypeAny, {
10833
10863
  substring: string;
10834
10864
  output: string;
10835
10865
  }, {
10836
10866
  substring: string;
10837
10867
  output: string;
10838
10868
  }>;
10839
- type Input$6 = z$1.infer<typeof validationSchema$6>;
10869
+ type Input$6 = z.infer<typeof validationSchema$6>;
10840
10870
  /**
10841
10871
  * Contains metric - checks if the actual output contains the substring string.
10842
10872
  * Simple metric for substring matching.
@@ -10850,10 +10880,10 @@ declare class Contains extends BaseMetric {
10850
10880
  * @param caseSensitive Whether the match should be case-sensitive (defaults to false)
10851
10881
  */
10852
10882
  constructor(name?: string, trackMetric?: boolean, caseSensitive?: boolean);
10853
- validationSchema: z$1.ZodObject<{
10854
- output: z$1.ZodString;
10855
- substring: z$1.ZodString;
10856
- }, "strip", z$1.ZodTypeAny, {
10883
+ validationSchema: z.ZodObject<{
10884
+ output: z.ZodString;
10885
+ substring: z.ZodString;
10886
+ }, "strip", z.ZodTypeAny, {
10857
10887
  substring: string;
10858
10888
  output: string;
10859
10889
  }, {
@@ -10914,14 +10944,14 @@ declare class RegexMatch extends BaseMetric {
10914
10944
  score(input: Input$5): Promise<EvaluationScoreResult>;
10915
10945
  }
10916
10946
 
10917
- declare const validationSchema$4: z$1.ZodObject<{
10918
- output: z$1.ZodUnknown;
10919
- }, "strip", z$1.ZodTypeAny, {
10947
+ declare const validationSchema$4: z.ZodObject<{
10948
+ output: z.ZodUnknown;
10949
+ }, "strip", z.ZodTypeAny, {
10920
10950
  output?: unknown;
10921
10951
  }, {
10922
10952
  output?: unknown;
10923
10953
  }>;
10924
- type Input$4 = z$1.infer<typeof validationSchema$4>;
10954
+ type Input$4 = z.infer<typeof validationSchema$4>;
10925
10955
  /**
10926
10956
  * IsJson metric - checks if a given output string is valid JSON.
10927
10957
  */
@@ -10932,9 +10962,9 @@ declare class IsJson extends BaseMetric {
10932
10962
  * @param trackMetric Whether to track the metric
10933
10963
  */
10934
10964
  constructor(name?: string, trackMetric?: boolean);
10935
- validationSchema: z$1.ZodObject<{
10936
- output: z$1.ZodUnknown;
10937
- }, "strip", z$1.ZodTypeAny, {
10965
+ validationSchema: z.ZodObject<{
10966
+ output: z.ZodUnknown;
10967
+ }, "strip", z.ZodTypeAny, {
10938
10968
  output?: unknown;
10939
10969
  }, {
10940
10970
  output?: unknown;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as stream from 'stream';
2
2
  import { Logger } from 'tslog';
3
- import z$1, { z } from 'zod';
3
+ import { z } from 'zod';
4
+ export { z } from 'zod';
4
5
  import { ModelMessage, SystemModelMessage, UserModelMessage, AssistantModelMessage, ToolModelMessage, LanguageModel } from 'ai';
5
6
  import { OpenAIProviderSettings } from '@ai-sdk/openai';
6
7
  import { OpenAIChatModelId } from '@ai-sdk/openai/internal';
@@ -190,15 +191,15 @@ declare const DatasetUpdateVisibility: {
190
191
  /**
191
192
  * @example
192
193
  * {
193
- * ids: ["ids"],
194
194
  * update: {}
195
195
  * }
196
196
  */
197
197
  interface DatasetItemBatchUpdate {
198
- /** List of dataset item IDs to update (max 1000) */
199
- ids: string[];
198
+ /** List of dataset item IDs to update (max 1000). Mutually exclusive with 'filters'. */
199
+ ids?: string[];
200
+ filters?: DatasetItemFilter[];
200
201
  update: DatasetItemUpdate;
201
- /** If true, merge tags with existing tags instead of replacing them. Default: false */
202
+ /** If true, merge tags with existing tags instead of replacing them. Default: false. When using 'filters', this is automatically set to true. */
202
203
  mergeTags?: boolean;
203
204
  }
204
205
 
@@ -3127,6 +3128,36 @@ interface DashboardPagePublic {
3127
3128
  total?: number;
3128
3129
  }
3129
3130
 
3131
+ /**
3132
+ * This file was auto-generated by Fern from our API Definition.
3133
+ */
3134
+ type DatasetItemFilterOperator = "contains" | "not_contains" | "starts_with" | "ends_with" | "=" | "!=" | ">" | ">=" | "<" | "<=" | "is_empty" | "is_not_empty";
3135
+ declare const DatasetItemFilterOperator: {
3136
+ readonly Contains: "contains";
3137
+ readonly NotContains: "not_contains";
3138
+ readonly StartsWith: "starts_with";
3139
+ readonly EndsWith: "ends_with";
3140
+ readonly EqualTo: "=";
3141
+ readonly NotEquals: "!=";
3142
+ readonly GreaterThan: ">";
3143
+ readonly GreaterThanOrEqualTo: ">=";
3144
+ readonly LessThan: "<";
3145
+ readonly LessThanOrEqualTo: "<=";
3146
+ readonly IsEmpty: "is_empty";
3147
+ readonly IsNotEmpty: "is_not_empty";
3148
+ };
3149
+
3150
+ /**
3151
+ * This file was auto-generated by Fern from our API Definition.
3152
+ */
3153
+
3154
+ interface DatasetItemFilter {
3155
+ field?: string;
3156
+ operator?: DatasetItemFilterOperator;
3157
+ key?: string;
3158
+ value?: string;
3159
+ }
3160
+
3130
3161
  /**
3131
3162
  * This file was auto-generated by Fern from our API Definition.
3132
3163
  */
@@ -6611,7 +6642,6 @@ declare class Datasets {
6611
6642
  *
6612
6643
  * @example
6613
6644
  * await client.datasets.batchUpdateDatasetItems({
6614
- * ids: ["ids"],
6615
6645
  * update: {}
6616
6646
  * })
6617
6647
  */
@@ -10242,7 +10272,7 @@ type EvaluationTestResult = {
10242
10272
  scoreResults: EvaluationScoreResult[];
10243
10273
  };
10244
10274
 
10245
- declare abstract class BaseMetric<T extends z.AnyZodObject = z.AnyZodObject> {
10275
+ declare abstract class BaseMetric<T extends z.ZodObject<z.ZodRawShape> = z.ZodObject<z.ZodRawShape>> {
10246
10276
  /**
10247
10277
  * The name of the metric
10248
10278
  */
@@ -10786,17 +10816,17 @@ interface EvaluatePromptOptions extends Omit<EvaluateOptions, "task"> {
10786
10816
  */
10787
10817
  declare function evaluatePrompt(options: EvaluatePromptOptions): Promise<EvaluationResult>;
10788
10818
 
10789
- declare const validationSchema$7: z$1.ZodObject<{
10790
- output: z$1.ZodUnknown;
10791
- expected: z$1.ZodUnknown;
10792
- }, "strip", z$1.ZodTypeAny, {
10819
+ declare const validationSchema$7: z.ZodObject<{
10820
+ output: z.ZodUnknown;
10821
+ expected: z.ZodUnknown;
10822
+ }, "strip", z.ZodTypeAny, {
10793
10823
  output?: unknown;
10794
10824
  expected?: unknown;
10795
10825
  }, {
10796
10826
  output?: unknown;
10797
10827
  expected?: unknown;
10798
10828
  }>;
10799
- type Input$7 = z$1.infer<typeof validationSchema$7>;
10829
+ type Input$7 = z.infer<typeof validationSchema$7>;
10800
10830
  /**
10801
10831
  * ExactMatch metric - checks if the actual output exactly matches the expected output.
10802
10832
  * Simple metric for exact string matching.
@@ -10808,10 +10838,10 @@ declare class ExactMatch extends BaseMetric {
10808
10838
  * @param trackMetric Whether to track the metric
10809
10839
  */
10810
10840
  constructor(name?: string, trackMetric?: boolean);
10811
- validationSchema: z$1.ZodObject<{
10812
- output: z$1.ZodUnknown;
10813
- expected: z$1.ZodUnknown;
10814
- }, "strip", z$1.ZodTypeAny, {
10841
+ validationSchema: z.ZodObject<{
10842
+ output: z.ZodUnknown;
10843
+ expected: z.ZodUnknown;
10844
+ }, "strip", z.ZodTypeAny, {
10815
10845
  output?: unknown;
10816
10846
  expected?: unknown;
10817
10847
  }, {
@@ -10826,17 +10856,17 @@ declare class ExactMatch extends BaseMetric {
10826
10856
  score(input: Input$7): Promise<EvaluationScoreResult>;
10827
10857
  }
10828
10858
 
10829
- declare const validationSchema$6: z$1.ZodObject<{
10830
- output: z$1.ZodString;
10831
- substring: z$1.ZodString;
10832
- }, "strip", z$1.ZodTypeAny, {
10859
+ declare const validationSchema$6: z.ZodObject<{
10860
+ output: z.ZodString;
10861
+ substring: z.ZodString;
10862
+ }, "strip", z.ZodTypeAny, {
10833
10863
  substring: string;
10834
10864
  output: string;
10835
10865
  }, {
10836
10866
  substring: string;
10837
10867
  output: string;
10838
10868
  }>;
10839
- type Input$6 = z$1.infer<typeof validationSchema$6>;
10869
+ type Input$6 = z.infer<typeof validationSchema$6>;
10840
10870
  /**
10841
10871
  * Contains metric - checks if the actual output contains the substring string.
10842
10872
  * Simple metric for substring matching.
@@ -10850,10 +10880,10 @@ declare class Contains extends BaseMetric {
10850
10880
  * @param caseSensitive Whether the match should be case-sensitive (defaults to false)
10851
10881
  */
10852
10882
  constructor(name?: string, trackMetric?: boolean, caseSensitive?: boolean);
10853
- validationSchema: z$1.ZodObject<{
10854
- output: z$1.ZodString;
10855
- substring: z$1.ZodString;
10856
- }, "strip", z$1.ZodTypeAny, {
10883
+ validationSchema: z.ZodObject<{
10884
+ output: z.ZodString;
10885
+ substring: z.ZodString;
10886
+ }, "strip", z.ZodTypeAny, {
10857
10887
  substring: string;
10858
10888
  output: string;
10859
10889
  }, {
@@ -10914,14 +10944,14 @@ declare class RegexMatch extends BaseMetric {
10914
10944
  score(input: Input$5): Promise<EvaluationScoreResult>;
10915
10945
  }
10916
10946
 
10917
- declare const validationSchema$4: z$1.ZodObject<{
10918
- output: z$1.ZodUnknown;
10919
- }, "strip", z$1.ZodTypeAny, {
10947
+ declare const validationSchema$4: z.ZodObject<{
10948
+ output: z.ZodUnknown;
10949
+ }, "strip", z.ZodTypeAny, {
10920
10950
  output?: unknown;
10921
10951
  }, {
10922
10952
  output?: unknown;
10923
10953
  }>;
10924
- type Input$4 = z$1.infer<typeof validationSchema$4>;
10954
+ type Input$4 = z.infer<typeof validationSchema$4>;
10925
10955
  /**
10926
10956
  * IsJson metric - checks if a given output string is valid JSON.
10927
10957
  */
@@ -10932,9 +10962,9 @@ declare class IsJson extends BaseMetric {
10932
10962
  * @param trackMetric Whether to track the metric
10933
10963
  */
10934
10964
  constructor(name?: string, trackMetric?: boolean);
10935
- validationSchema: z$1.ZodObject<{
10936
- output: z$1.ZodUnknown;
10937
- }, "strip", z$1.ZodTypeAny, {
10965
+ validationSchema: z.ZodObject<{
10966
+ output: z.ZodUnknown;
10967
+ }, "strip", z.ZodTypeAny, {
10938
10968
  output?: unknown;
10939
10969
  }, {
10940
10970
  output?: unknown;