opik 1.7.26 → 1.7.27

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.
@@ -388,6 +388,26 @@ interface ExperimentItemsDelete {
388
388
  ids: string[];
389
389
  }
390
390
 
391
+ /**
392
+ * This file was auto-generated by Fern from our API Definition.
393
+ */
394
+
395
+ /**
396
+ * @example
397
+ * {
398
+ * experimentName: "experiment_name",
399
+ * datasetName: "dataset_name",
400
+ * items: [{
401
+ * datasetItemId: "dataset_item_id"
402
+ * }]
403
+ * }
404
+ */
405
+ interface ExperimentItemBulkUploadWrite {
406
+ experimentName: string;
407
+ datasetName: string;
408
+ items: ExperimentItemBulkRecordWrite[];
409
+ }
410
+
391
411
  /**
392
412
  * This file was auto-generated by Fern from our API Definition.
393
413
  */
@@ -489,16 +509,6 @@ interface ProviderApiKeyUpdate {
489
509
  name?: string;
490
510
  }
491
511
 
492
- /**
493
- * This file was auto-generated by Fern from our API Definition.
494
- */
495
- type OptimizationWriteStatus = "running" | "completed" | "cancelled";
496
- declare const OptimizationWriteStatus: {
497
- readonly Running: "running";
498
- readonly Completed: "completed";
499
- readonly Cancelled: "cancelled";
500
- };
501
-
502
512
  /**
503
513
  * This file was auto-generated by Fern from our API Definition.
504
514
  */
@@ -524,27 +534,6 @@ interface FindOptimizationsRequest {
524
534
  datasetDeleted?: boolean;
525
535
  }
526
536
 
527
- /**
528
- * This file was auto-generated by Fern from our API Definition.
529
- */
530
-
531
- /**
532
- * @example
533
- * {
534
- * datasetName: "dataset_name",
535
- * objectiveName: "objective_name",
536
- * status: "running"
537
- * }
538
- */
539
- interface OptimizationWrite {
540
- id?: string;
541
- name?: string;
542
- datasetName: string;
543
- objectiveName: string;
544
- status: OptimizationWriteStatus;
545
- metadata?: JsonNodeWrite;
546
- }
547
-
548
537
  /**
549
538
  * This file was auto-generated by Fern from our API Definition.
550
539
  */
@@ -807,6 +796,17 @@ declare const GetSpansByProjectRequestType: {
807
796
  readonly Guardrail: "guardrail";
808
797
  };
809
798
 
799
+ /**
800
+ * This file was auto-generated by Fern from our API Definition.
801
+ */
802
+ type SpanUpdateType = "general" | "tool" | "llm" | "guardrail";
803
+ declare const SpanUpdateType: {
804
+ readonly General: "general";
805
+ readonly Tool: "tool";
806
+ readonly Llm: "llm";
807
+ readonly Guardrail: "guardrail";
808
+ };
809
+
810
810
  /**
811
811
  * This file was auto-generated by Fern from our API Definition.
812
812
  */
@@ -870,8 +870,6 @@ interface GetSpansByProjectRequest {
870
870
  * {
871
871
  * spans: [{
872
872
  * traceId: "trace_id",
873
- * name: "name",
874
- * type: "general",
875
873
  * startTime: "2024-01-15T09:30:00Z"
876
874
  * }]
877
875
  * }
@@ -897,6 +895,8 @@ interface SpanUpdate$1 {
897
895
  projectId?: string;
898
896
  traceId: string;
899
897
  parentSpanId?: string;
898
+ name?: string;
899
+ type?: SpanUpdateType;
900
900
  endTime?: Date;
901
901
  input?: JsonListString;
902
902
  output?: JsonListString;
@@ -2365,6 +2365,238 @@ interface DeleteIdsHolder {
2365
2365
  ids: string[];
2366
2366
  }
2367
2367
 
2368
+ /**
2369
+ * This file was auto-generated by Fern from our API Definition.
2370
+ */
2371
+ type CheckName = "TOPIC" | "PII";
2372
+ declare const CheckName: {
2373
+ readonly Topic: "TOPIC";
2374
+ readonly Pii: "PII";
2375
+ };
2376
+
2377
+ /**
2378
+ * This file was auto-generated by Fern from our API Definition.
2379
+ */
2380
+ type CheckResult = "passed" | "failed";
2381
+ declare const CheckResult: {
2382
+ readonly Passed: "passed";
2383
+ readonly Failed: "failed";
2384
+ };
2385
+
2386
+ /**
2387
+ * This file was auto-generated by Fern from our API Definition.
2388
+ */
2389
+
2390
+ interface Check$1 {
2391
+ name?: CheckName;
2392
+ result?: CheckResult;
2393
+ }
2394
+
2395
+ /**
2396
+ * This file was auto-generated by Fern from our API Definition.
2397
+ */
2398
+ interface ErrorInfo {
2399
+ exceptionType: string;
2400
+ message?: string;
2401
+ traceback: string;
2402
+ }
2403
+
2404
+ /**
2405
+ * This file was auto-generated by Fern from our API Definition.
2406
+ */
2407
+
2408
+ interface GuardrailsValidation {
2409
+ spanId?: string;
2410
+ checks?: Check$1[];
2411
+ }
2412
+
2413
+ /**
2414
+ * This file was auto-generated by Fern from our API Definition.
2415
+ */
2416
+ type SpanType = "general" | "tool" | "llm" | "guardrail";
2417
+ declare const SpanType: {
2418
+ readonly General: "general";
2419
+ readonly Tool: "tool";
2420
+ readonly Llm: "llm";
2421
+ readonly Guardrail: "guardrail";
2422
+ };
2423
+
2424
+ /**
2425
+ * This file was auto-generated by Fern from our API Definition.
2426
+ */
2427
+
2428
+ interface Span$1 {
2429
+ id?: string;
2430
+ /** If null, the default project is used */
2431
+ projectName?: string;
2432
+ projectId?: string;
2433
+ traceId: string;
2434
+ parentSpanId?: string;
2435
+ name?: string;
2436
+ type?: SpanType;
2437
+ startTime: Date;
2438
+ endTime?: Date;
2439
+ input?: JsonListString;
2440
+ output?: JsonListString;
2441
+ metadata?: JsonNode;
2442
+ model?: string;
2443
+ provider?: string;
2444
+ tags?: string[];
2445
+ usage?: Record<string, number>;
2446
+ errorInfo?: ErrorInfo;
2447
+ createdAt?: Date;
2448
+ lastUpdatedAt?: Date;
2449
+ createdBy?: string;
2450
+ lastUpdatedBy?: string;
2451
+ feedbackScores?: FeedbackScore[];
2452
+ comments?: Comment[];
2453
+ totalEstimatedCost?: number;
2454
+ totalEstimatedCostVersion?: string;
2455
+ /** Duration in milliseconds as a decimal number to support sub-millisecond precision */
2456
+ duration?: number;
2457
+ }
2458
+
2459
+ /**
2460
+ * This file was auto-generated by Fern from our API Definition.
2461
+ */
2462
+
2463
+ interface Trace$1 {
2464
+ id?: string;
2465
+ /** If null, the default project is used */
2466
+ projectName?: string;
2467
+ projectId?: string;
2468
+ name?: string;
2469
+ startTime: Date;
2470
+ endTime?: Date;
2471
+ input?: JsonListString;
2472
+ output?: JsonListString;
2473
+ metadata?: JsonNode;
2474
+ tags?: string[];
2475
+ errorInfo?: ErrorInfo;
2476
+ usage?: Record<string, number>;
2477
+ createdAt?: Date;
2478
+ lastUpdatedAt?: Date;
2479
+ createdBy?: string;
2480
+ lastUpdatedBy?: string;
2481
+ feedbackScores?: FeedbackScore[];
2482
+ comments?: Comment[];
2483
+ guardrailsValidations?: GuardrailsValidation[];
2484
+ totalEstimatedCost?: number;
2485
+ spanCount?: number;
2486
+ /** Duration in milliseconds as a decimal number to support sub-millisecond precision */
2487
+ duration?: number;
2488
+ threadId?: string;
2489
+ }
2490
+
2491
+ /**
2492
+ * This file was auto-generated by Fern from our API Definition.
2493
+ */
2494
+ interface ErrorInfoWrite {
2495
+ exceptionType: string;
2496
+ message?: string;
2497
+ traceback: string;
2498
+ }
2499
+
2500
+ /**
2501
+ * This file was auto-generated by Fern from our API Definition.
2502
+ */
2503
+
2504
+ interface ExperimentItemBulkRecordWrite {
2505
+ datasetItemId: string;
2506
+ trace?: TraceWrite;
2507
+ spans?: SpanWrite[];
2508
+ feedbackScores?: FeedbackScoreWrite[];
2509
+ }
2510
+
2511
+ /**
2512
+ * This file was auto-generated by Fern from our API Definition.
2513
+ */
2514
+ type FeedbackScoreWriteSource = "ui" | "sdk" | "online_scoring";
2515
+ declare const FeedbackScoreWriteSource: {
2516
+ readonly Ui: "ui";
2517
+ readonly Sdk: "sdk";
2518
+ readonly OnlineScoring: "online_scoring";
2519
+ };
2520
+
2521
+ /**
2522
+ * This file was auto-generated by Fern from our API Definition.
2523
+ */
2524
+
2525
+ interface FeedbackScoreWrite {
2526
+ name: string;
2527
+ categoryName?: string;
2528
+ value: number;
2529
+ reason?: string;
2530
+ source: FeedbackScoreWriteSource;
2531
+ createdAt?: Date;
2532
+ lastUpdatedAt?: Date;
2533
+ createdBy?: string;
2534
+ lastUpdatedBy?: string;
2535
+ }
2536
+
2537
+ /**
2538
+ * This file was auto-generated by Fern from our API Definition.
2539
+ */
2540
+ type JsonListStringWrite = Record<string, unknown> | Record<string, unknown>[] | string;
2541
+
2542
+ /**
2543
+ * This file was auto-generated by Fern from our API Definition.
2544
+ */
2545
+ type SpanWriteType = "general" | "tool" | "llm" | "guardrail";
2546
+ declare const SpanWriteType: {
2547
+ readonly General: "general";
2548
+ readonly Tool: "tool";
2549
+ readonly Llm: "llm";
2550
+ readonly Guardrail: "guardrail";
2551
+ };
2552
+
2553
+ /**
2554
+ * This file was auto-generated by Fern from our API Definition.
2555
+ */
2556
+
2557
+ interface SpanWrite {
2558
+ id?: string;
2559
+ /** If null, the default project is used */
2560
+ projectName?: string;
2561
+ traceId: string;
2562
+ parentSpanId?: string;
2563
+ name?: string;
2564
+ type?: SpanWriteType;
2565
+ startTime: Date;
2566
+ endTime?: Date;
2567
+ input?: JsonListStringWrite;
2568
+ output?: JsonListStringWrite;
2569
+ metadata?: JsonNodeWrite;
2570
+ model?: string;
2571
+ provider?: string;
2572
+ tags?: string[];
2573
+ usage?: Record<string, number>;
2574
+ errorInfo?: ErrorInfoWrite;
2575
+ lastUpdatedAt?: Date;
2576
+ totalEstimatedCost?: number;
2577
+ totalEstimatedCostVersion?: string;
2578
+ }
2579
+
2580
+ /**
2581
+ * This file was auto-generated by Fern from our API Definition.
2582
+ */
2583
+
2584
+ interface TraceWrite {
2585
+ id?: string;
2586
+ /** If null, the default project is used */
2587
+ projectName?: string;
2588
+ name?: string;
2589
+ startTime: Date;
2590
+ endTime?: Date;
2591
+ input?: JsonListStringWrite;
2592
+ output?: JsonListStringWrite;
2593
+ metadata?: JsonNodeWrite;
2594
+ tags?: string[];
2595
+ errorInfo?: ErrorInfoWrite;
2596
+ lastUpdatedAt?: Date;
2597
+ threadId?: string;
2598
+ }
2599
+
2368
2600
  /**
2369
2601
  * This file was auto-generated by Fern from our API Definition.
2370
2602
  */
@@ -2722,6 +2954,30 @@ interface ProviderApiKeyPublic {
2722
2954
  lastUpdatedBy?: string;
2723
2955
  }
2724
2956
 
2957
+ /**
2958
+ * This file was auto-generated by Fern from our API Definition.
2959
+ */
2960
+ type OptimizationWriteStatus = "running" | "completed" | "cancelled";
2961
+ declare const OptimizationWriteStatus: {
2962
+ readonly Running: "running";
2963
+ readonly Completed: "completed";
2964
+ readonly Cancelled: "cancelled";
2965
+ };
2966
+
2967
+ /**
2968
+ * This file was auto-generated by Fern from our API Definition.
2969
+ */
2970
+
2971
+ interface OptimizationWrite {
2972
+ id?: string;
2973
+ name?: string;
2974
+ datasetName: string;
2975
+ objectiveName: string;
2976
+ status: OptimizationWriteStatus;
2977
+ metadata?: JsonNodeWrite;
2978
+ lastUpdatedAt?: Date;
2979
+ }
2980
+
2725
2981
  /**
2726
2982
  * This file was auto-generated by Fern from our API Definition.
2727
2983
  */
@@ -2884,6 +3140,7 @@ interface ProjectStatsSummaryItem {
2884
3140
  feedbackScores?: FeedbackScoreAverage[];
2885
3141
  duration?: PercentageValues;
2886
3142
  totalEstimatedCost?: number;
3143
+ totalEstimatedCostSum?: number;
2887
3144
  usage?: Record<string, number>;
2888
3145
  traceCount?: number;
2889
3146
  guardrailsFailedCount?: number;
@@ -2932,6 +3189,7 @@ interface ProjectDetailed {
2932
3189
  feedbackScores?: FeedbackScoreAverageDetailed[];
2933
3190
  duration?: PercentageValuesDetailed;
2934
3191
  totalEstimatedCost?: number;
3192
+ totalEstimatedCostSum?: number;
2935
3193
  usage?: Record<string, number>;
2936
3194
  traceCount?: number;
2937
3195
  guardrailsFailedCount?: number;
@@ -3057,113 +3315,6 @@ interface ServiceTogglesConfig {
3057
3315
  guardrailsEnabled: boolean;
3058
3316
  }
3059
3317
 
3060
- /**
3061
- * This file was auto-generated by Fern from our API Definition.
3062
- */
3063
- interface ErrorInfo {
3064
- exceptionType: string;
3065
- message?: string;
3066
- traceback: string;
3067
- }
3068
-
3069
- /**
3070
- * This file was auto-generated by Fern from our API Definition.
3071
- */
3072
- type SpanType = "general" | "tool" | "llm" | "guardrail";
3073
- declare const SpanType: {
3074
- readonly General: "general";
3075
- readonly Tool: "tool";
3076
- readonly Llm: "llm";
3077
- readonly Guardrail: "guardrail";
3078
- };
3079
-
3080
- /**
3081
- * This file was auto-generated by Fern from our API Definition.
3082
- */
3083
-
3084
- interface Span$1 {
3085
- id?: string;
3086
- /** If null, the default project is used */
3087
- projectName?: string;
3088
- projectId?: string;
3089
- traceId: string;
3090
- parentSpanId?: string;
3091
- name: string;
3092
- type: SpanType;
3093
- startTime: Date;
3094
- endTime?: Date;
3095
- input?: JsonListString;
3096
- output?: JsonListString;
3097
- metadata?: JsonNode;
3098
- model?: string;
3099
- provider?: string;
3100
- tags?: string[];
3101
- usage?: Record<string, number>;
3102
- errorInfo?: ErrorInfo;
3103
- createdAt?: Date;
3104
- lastUpdatedAt?: Date;
3105
- createdBy?: string;
3106
- lastUpdatedBy?: string;
3107
- feedbackScores?: FeedbackScore[];
3108
- comments?: Comment[];
3109
- totalEstimatedCost?: number;
3110
- totalEstimatedCostVersion?: string;
3111
- /** Duration in milliseconds as a decimal number to support sub-millisecond precision */
3112
- duration?: number;
3113
- }
3114
-
3115
- /**
3116
- * This file was auto-generated by Fern from our API Definition.
3117
- */
3118
- interface ErrorInfoWrite {
3119
- exceptionType: string;
3120
- message?: string;
3121
- traceback: string;
3122
- }
3123
-
3124
- /**
3125
- * This file was auto-generated by Fern from our API Definition.
3126
- */
3127
- type JsonListStringWrite = Record<string, unknown> | Record<string, unknown>[] | string;
3128
-
3129
- /**
3130
- * This file was auto-generated by Fern from our API Definition.
3131
- */
3132
- type SpanWriteType = "general" | "tool" | "llm" | "guardrail";
3133
- declare const SpanWriteType: {
3134
- readonly General: "general";
3135
- readonly Tool: "tool";
3136
- readonly Llm: "llm";
3137
- readonly Guardrail: "guardrail";
3138
- };
3139
-
3140
- /**
3141
- * This file was auto-generated by Fern from our API Definition.
3142
- */
3143
-
3144
- interface SpanWrite {
3145
- id?: string;
3146
- /** If null, the default project is used */
3147
- projectName?: string;
3148
- traceId: string;
3149
- parentSpanId?: string;
3150
- name: string;
3151
- type: SpanWriteType;
3152
- startTime: Date;
3153
- endTime?: Date;
3154
- input?: JsonListStringWrite;
3155
- output?: JsonListStringWrite;
3156
- metadata?: JsonNodeWrite;
3157
- model?: string;
3158
- provider?: string;
3159
- tags?: string[];
3160
- usage?: Record<string, number>;
3161
- errorInfo?: ErrorInfoWrite;
3162
- lastUpdatedAt?: Date;
3163
- totalEstimatedCost?: number;
3164
- totalEstimatedCostVersion?: string;
3165
- }
3166
-
3167
3318
  /**
3168
3319
  * This file was auto-generated by Fern from our API Definition.
3169
3320
  */
@@ -3233,8 +3384,8 @@ interface SpanPublic {
3233
3384
  projectId?: string;
3234
3385
  traceId: string;
3235
3386
  parentSpanId?: string;
3236
- name: string;
3237
- type: SpanPublicType;
3387
+ name?: string;
3388
+ type?: SpanPublicType;
3238
3389
  startTime: Date;
3239
3390
  endTime?: Date;
3240
3391
  input?: JsonListStringPublic;
@@ -3382,94 +3533,6 @@ interface SpanFilterPublic {
3382
3533
  value?: string;
3383
3534
  }
3384
3535
 
3385
- /**
3386
- * This file was auto-generated by Fern from our API Definition.
3387
- */
3388
- type CheckName = "TOPIC" | "PII";
3389
- declare const CheckName: {
3390
- readonly Topic: "TOPIC";
3391
- readonly Pii: "PII";
3392
- };
3393
-
3394
- /**
3395
- * This file was auto-generated by Fern from our API Definition.
3396
- */
3397
- type CheckResult = "passed" | "failed";
3398
- declare const CheckResult: {
3399
- readonly Passed: "passed";
3400
- readonly Failed: "failed";
3401
- };
3402
-
3403
- /**
3404
- * This file was auto-generated by Fern from our API Definition.
3405
- */
3406
-
3407
- interface Check$1 {
3408
- name?: CheckName;
3409
- result?: CheckResult;
3410
- }
3411
-
3412
- /**
3413
- * This file was auto-generated by Fern from our API Definition.
3414
- */
3415
-
3416
- interface GuardrailsValidation {
3417
- spanId?: string;
3418
- checks?: Check$1[];
3419
- }
3420
-
3421
- /**
3422
- * This file was auto-generated by Fern from our API Definition.
3423
- */
3424
-
3425
- interface Trace$1 {
3426
- id?: string;
3427
- /** If null, the default project is used */
3428
- projectName?: string;
3429
- projectId?: string;
3430
- name?: string;
3431
- startTime: Date;
3432
- endTime?: Date;
3433
- input?: JsonListString;
3434
- output?: JsonListString;
3435
- metadata?: JsonNode;
3436
- tags?: string[];
3437
- errorInfo?: ErrorInfo;
3438
- usage?: Record<string, number>;
3439
- createdAt?: Date;
3440
- lastUpdatedAt?: Date;
3441
- createdBy?: string;
3442
- lastUpdatedBy?: string;
3443
- feedbackScores?: FeedbackScore[];
3444
- comments?: Comment[];
3445
- guardrailsValidations?: GuardrailsValidation[];
3446
- totalEstimatedCost?: number;
3447
- spanCount?: number;
3448
- /** Duration in milliseconds as a decimal number to support sub-millisecond precision */
3449
- duration?: number;
3450
- threadId?: string;
3451
- }
3452
-
3453
- /**
3454
- * This file was auto-generated by Fern from our API Definition.
3455
- */
3456
-
3457
- interface TraceWrite {
3458
- id?: string;
3459
- /** If null, the default project is used */
3460
- projectName?: string;
3461
- name?: string;
3462
- startTime: Date;
3463
- endTime?: Date;
3464
- input?: JsonListStringWrite;
3465
- output?: JsonListStringWrite;
3466
- metadata?: JsonNodeWrite;
3467
- tags?: string[];
3468
- errorInfo?: ErrorInfoWrite;
3469
- lastUpdatedAt?: Date;
3470
- threadId?: string;
3471
- }
3472
-
3473
3536
  /**
3474
3537
  * This file was auto-generated by Fern from our API Definition.
3475
3538
  */
@@ -4502,6 +4565,26 @@ declare class Experiments {
4502
4565
  */
4503
4566
  deleteExperimentsById(request: DeleteIdsHolder, requestOptions?: Experiments.RequestOptions): HttpResponsePromise<void>;
4504
4567
  private __deleteExperimentsById;
4568
+ /**
4569
+ * Record experiment items in bulk with traces, spans, and feedback scores. Maximum request size is 4MB.
4570
+ *
4571
+ * @param {OpikApi.ExperimentItemBulkUploadWrite} request
4572
+ * @param {Experiments.RequestOptions} requestOptions - Request-specific configuration.
4573
+ *
4574
+ * @throws {@link OpikApi.BadRequestError}
4575
+ * @throws {@link OpikApi.UnprocessableEntityError}
4576
+ *
4577
+ * @example
4578
+ * await client.experiments.experimentItemsBulk({
4579
+ * experimentName: "experiment_name",
4580
+ * datasetName: "dataset_name",
4581
+ * items: [{
4582
+ * datasetItemId: "dataset_item_id"
4583
+ * }]
4584
+ * })
4585
+ */
4586
+ experimentItemsBulk(request: ExperimentItemBulkUploadWrite, requestOptions?: Experiments.RequestOptions): HttpResponsePromise<void>;
4587
+ private __experimentItemsBulk;
4505
4588
  /**
4506
4589
  * Find Feedback Score names
4507
4590
  *
@@ -4957,6 +5040,21 @@ declare class Optimizations {
4957
5040
  */
4958
5041
  createOptimization(request: OptimizationWrite, requestOptions?: Optimizations.RequestOptions): HttpResponsePromise<void>;
4959
5042
  private __createOptimization;
5043
+ /**
5044
+ * Upsert optimization
5045
+ *
5046
+ * @param {OpikApi.OptimizationWrite} request
5047
+ * @param {Optimizations.RequestOptions} requestOptions - Request-specific configuration.
5048
+ *
5049
+ * @example
5050
+ * await client.optimizations.upsertOptimization({
5051
+ * datasetName: "dataset_name",
5052
+ * objectiveName: "objective_name",
5053
+ * status: "running"
5054
+ * })
5055
+ */
5056
+ upsertOptimization(request: OptimizationWrite, requestOptions?: Optimizations.RequestOptions): HttpResponsePromise<void>;
5057
+ private __upsertOptimization;
4960
5058
  /**
4961
5059
  * Delete optimizations by id
4962
5060
  *
@@ -5496,8 +5594,6 @@ declare class Spans {
5496
5594
  * @example
5497
5595
  * await client.spans.createSpan({
5498
5596
  * traceId: "trace_id",
5499
- * name: "name",
5500
- * type: "general",
5501
5597
  * startTime: "2024-01-15T09:30:00Z"
5502
5598
  * })
5503
5599
  */
@@ -5513,8 +5609,6 @@ declare class Spans {
5513
5609
  * await client.spans.createSpans({
5514
5610
  * spans: [{
5515
5611
  * traceId: "trace_id",
5516
- * name: "name",
5517
- * type: "general",
5518
5612
  * startTime: "2024-01-15T09:30:00Z"
5519
5613
  * }]
5520
5614
  * })