@fastino-ai/pioneer-cli 0.2.5 → 0.2.6

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/src/api.ts CHANGED
@@ -163,8 +163,12 @@ export interface Dataset {
163
163
  sample_size?: number;
164
164
  version_number?: string;
165
165
  root_dataset_id?: string;
166
+ project_id?: string;
166
167
  schema?: Record<string, unknown>;
167
168
  schema_warnings?: string[];
169
+ annotation_status?: "none" | "in_progress" | "completed";
170
+ annotation_config?: Record<string, unknown>;
171
+ annotation_progress?: Record<string, unknown>;
168
172
  created_at: string;
169
173
  updated_at?: string;
170
174
  }
@@ -209,6 +213,51 @@ export async function deleteDataset(dataset: DatasetRef): Promise<ApiResult> {
209
213
  return request("DELETE", `/felix/datasets/${dataset.name}/${dataset.version}`);
210
214
  }
211
215
 
216
+ export async function deleteAllDatasetVersions(name: string): Promise<ApiResult> {
217
+ return request("DELETE", `/felix/datasets/${name}`);
218
+ }
219
+
220
+ export interface DatasetVersionsResponse {
221
+ success: boolean;
222
+ versions: Dataset[];
223
+ count: number;
224
+ }
225
+
226
+ export async function listDatasetVersions(
227
+ name: string
228
+ ): Promise<ApiResult<DatasetVersionsResponse>> {
229
+ return request<DatasetVersionsResponse>("GET", `/felix/datasets/${name}`);
230
+ }
231
+
232
+ export interface DatasetMetadataUpdate {
233
+ dataset_name?: string;
234
+ dataset_type?: "ner" | "classification" | "custom";
235
+ project_id?: string;
236
+ }
237
+
238
+ export async function updateDatasetMetadata(
239
+ dataset: DatasetRef,
240
+ update: DatasetMetadataUpdate
241
+ ): Promise<ApiResult<Dataset>> {
242
+ return request<Dataset>(
243
+ "PATCH",
244
+ `/felix/datasets/${dataset.name}/${dataset.version}`,
245
+ update
246
+ );
247
+ }
248
+
249
+ export async function previewDataset(
250
+ dataset: DatasetRef,
251
+ options: { limit?: number; offset?: number } = {}
252
+ ): Promise<ApiResult<Record<string, unknown>>> {
253
+ const params = new URLSearchParams();
254
+ if (options.limit) params.set("limit", String(options.limit));
255
+ if (options.offset) params.set("offset", String(options.offset));
256
+ const query = params.toString();
257
+ const url = `/felix/datasets/${dataset.name}/${dataset.version}/preview${query ? `?${query}` : ""}`;
258
+ return request<Record<string, unknown>>("GET", url);
259
+ }
260
+
212
261
  export interface DatasetUploadRequest {
213
262
  dataset_name: string;
214
263
  dataset_type?: "ner" | "classification" | "custom";
@@ -366,9 +415,95 @@ export interface DatasetAnalysisRequest {
366
415
  analyses: string[];
367
416
  }
368
417
 
418
+ // Diversity Analysis Types
419
+ export interface DiversityPoint {
420
+ x?: number;
421
+ y?: number;
422
+ z?: number;
423
+ w?: number;
424
+ coordinates: number[];
425
+ text?: string;
426
+ token_count?: number;
427
+ labels?: string[];
428
+ metadata?: Record<string, unknown>;
429
+ sample_index?: number;
430
+ similarity_to_centroid?: number;
431
+ embedding?: number[];
432
+ }
433
+
434
+ export interface DiversityVisualization {
435
+ method: "pca" | "tsne";
436
+ dimensions: number;
437
+ points: DiversityPoint[];
438
+ tsne_perplexity?: number;
439
+ similarity_range?: { min: number; max: number };
440
+ token_count_range?: { min: number; max: number };
441
+ }
442
+
443
+ export interface DiversityLLMAnalysis {
444
+ reasoning_trace: string;
445
+ summary: string;
446
+ diversity_rating: "low" | "moderate" | "high" | "excellent";
447
+ key_observations: string[];
448
+ recommendations: string[];
449
+ model_used: string;
450
+ }
451
+
452
+ export interface DiversityAnalysis {
453
+ vendi_score: number;
454
+ sample_size: number;
455
+ interpretation?: string;
456
+ visualization?: DiversityVisualization;
457
+ llm_analysis?: DiversityLLMAnalysis;
458
+ }
459
+
460
+ // Distribution Analysis Types
461
+ export interface DistributionAnalysis {
462
+ label_counts: Record<string, number>;
463
+ total_samples: number;
464
+ unique_labels: number;
465
+ most_common_label?: string;
466
+ least_common_label?: string;
467
+ imbalance_ratio?: number;
468
+ }
469
+
470
+ // Duplicates Analysis Types
471
+ export interface DuplicatesAnalysis {
472
+ total_duplicates: number;
473
+ duplicate_groups: number;
474
+ duplicate_percentage: number;
475
+ examples?: Array<{ text: string; count: number }>;
476
+ }
477
+
478
+ // Outliers Analysis Types
479
+ export interface OutliersAnalysis {
480
+ total_outliers: number;
481
+ outlier_percentage: number;
482
+ method: string;
483
+ threshold?: number;
484
+ examples?: Array<{ text: string; score: number; reason?: string }>;
485
+ }
486
+
487
+ // Splits Analysis Types
488
+ export interface SplitsAnalysis {
489
+ train_size: number;
490
+ validation_size: number;
491
+ test_size?: number;
492
+ train_percentage: number;
493
+ validation_percentage: number;
494
+ test_percentage?: number;
495
+ }
496
+
369
497
  export interface DatasetAnalysisResponse {
370
- success: boolean;
371
- analysis: unknown;
498
+ summary: Record<string, unknown>;
499
+ distribution?: DistributionAnalysis;
500
+ duplicates?: DuplicatesAnalysis;
501
+ outliers?: OutliersAnalysis;
502
+ correlations?: Record<string, unknown>;
503
+ splits?: SplitsAnalysis;
504
+ errors?: Record<string, unknown>;
505
+ diversity?: DiversityAnalysis;
506
+ natural_language_response?: string;
372
507
  }
373
508
 
374
509
  export async function analyzeDataset(
@@ -430,10 +565,13 @@ export interface GenerateNERRequest {
430
565
  num_examples?: number;
431
566
  domain_description?: string;
432
567
  seed?: number;
568
+ session_id?: string;
569
+ config_num_examples?: number;
433
570
  temperature?: number;
434
571
  constraints?: ConstraintRequest[];
435
572
  save_dataset?: boolean;
436
573
  dataset_name?: string;
574
+ project_id?: string;
437
575
  }
438
576
 
439
577
  export async function generateNER(
@@ -476,12 +614,15 @@ export interface GenerateClassificationRequest {
476
614
  domain_description?: string;
477
615
  seed?: number;
478
616
  class_balance?: Record<string, number>;
617
+ session_id?: string;
618
+ config_num_examples?: number;
479
619
  temperature?: number;
480
620
  batch_size?: number;
481
621
  constraints?: ConstraintRequest[];
482
622
  multi_label?: boolean;
483
623
  save_dataset?: boolean;
484
624
  dataset_name?: string;
625
+ project_id?: string;
485
626
  }
486
627
 
487
628
  export async function generateClassification(
@@ -523,14 +664,17 @@ export async function inferClassificationLabels(
523
664
  // Custom Generation
524
665
  export interface GenerateCustomRequest {
525
666
  prompt: string;
526
- output_format: Record<string, unknown>;
667
+ output_format?: Record<string, unknown>;
668
+ infer_output_format?: boolean;
527
669
  num_examples?: number;
528
670
  seed?: number;
671
+ session_id?: string;
529
672
  min_criteria?: number;
530
673
  temperature?: number;
531
674
  constraints?: ConstraintRequest[];
532
675
  save_dataset?: boolean;
533
676
  dataset_name?: string;
677
+ project_id?: string;
534
678
  }
535
679
 
536
680
  export async function generateCustom(
@@ -610,8 +754,7 @@ export interface TrainingJob {
610
754
  id: string;
611
755
  user_id: string;
612
756
  model_name?: string;
613
- dataset_ids: string[];
614
- train_dataset_paths: string[];
757
+ datasets: Array<{ name: string; version?: string }>;
615
758
  base_model: string;
616
759
  validation_data_percentage: number;
617
760
  nr_epochs: number;
@@ -619,12 +762,16 @@ export interface TrainingJob {
619
762
  batch_size: number;
620
763
  trained_model_path?: string;
621
764
  job_reference?: string;
765
+ instance_type?: string;
622
766
  status: string;
623
767
  error_message?: string;
624
768
  created_at: string;
625
769
  updated_at: string;
626
770
  started_at?: string;
627
771
  completed_at?: string;
772
+ model_auto_selected?: boolean;
773
+ model_selection_reason?: string;
774
+ metrics?: Record<string, unknown>;
628
775
  }
629
776
 
630
777
  export interface TrainingJobListResponse {
@@ -633,8 +780,14 @@ export interface TrainingJobListResponse {
633
780
  count: number;
634
781
  }
635
782
 
636
- export async function listJobs(): Promise<ApiResult<TrainingJobListResponse>> {
637
- return request<TrainingJobListResponse>("GET", "/felix/training-jobs");
783
+ export async function listJobs(
784
+ options: { status?: string } = {}
785
+ ): Promise<ApiResult<TrainingJobListResponse>> {
786
+ const params = new URLSearchParams();
787
+ if (options.status) params.set("status", options.status);
788
+ const query = params.toString();
789
+ const url = query ? `/felix/training-jobs?${query}` : "/felix/training-jobs";
790
+ return request<TrainingJobListResponse>("GET", url);
638
791
  }
639
792
 
640
793
  export async function getJob(jobId: string): Promise<ApiResult<TrainingJob>> {
@@ -645,10 +798,20 @@ export interface TrainingJobCreateRequest {
645
798
  model_name: string;
646
799
  datasets: DatasetRef[];
647
800
  base_model?: string;
801
+ auto_select_model?: boolean;
648
802
  validation_data_percentage?: number;
649
803
  nr_epochs?: number;
650
804
  learning_rate?: number;
651
805
  batch_size?: number;
806
+ save_steps?: number;
807
+ wandb_api_key?: string;
808
+ project_id?: string;
809
+ training_type?: "full" | "lora";
810
+ lora_r?: number;
811
+ lora_alpha?: number;
812
+ lora_dropout?: number;
813
+ enable_probe_override?: boolean;
814
+ probe_delta_threshold?: number;
652
815
  }
653
816
 
654
817
  export async function createJob(
@@ -661,15 +824,15 @@ export interface TrainingLog {
661
824
  id: string;
662
825
  job_id: string;
663
826
  timestamp: string;
664
- level: "INFO" | "WARNING" | "ERROR" | "DEBUG";
827
+ level: string;
665
828
  message: string;
666
- source: "stdout" | "stderr";
829
+ source: string;
667
830
  }
668
831
 
669
832
  export interface TrainingLogsResponse {
670
- success: boolean;
833
+ job_id: string;
671
834
  logs: TrainingLog[];
672
- count: number;
835
+ total_logs: number;
673
836
  }
674
837
 
675
838
  export async function getJobLogs(
@@ -682,6 +845,103 @@ export async function deleteJob(jobId: string): Promise<ApiResult> {
682
845
  return request("DELETE", `/felix/training-jobs/${jobId}`);
683
846
  }
684
847
 
848
+ export interface StopJobResponse {
849
+ success: boolean;
850
+ message: string;
851
+ job_id: string;
852
+ status: string;
853
+ }
854
+
855
+ export async function stopJob(
856
+ jobId: string
857
+ ): Promise<ApiResult<StopJobResponse>> {
858
+ return request<StopJobResponse>("POST", `/felix/training-jobs/${jobId}/stop`);
859
+ }
860
+
861
+ export interface TerminateJobResponse {
862
+ success: boolean;
863
+ message: string;
864
+ job_id: string;
865
+ deleted_checkpoints: number;
866
+ }
867
+
868
+ export async function terminateJob(
869
+ jobId: string
870
+ ): Promise<ApiResult<TerminateJobResponse>> {
871
+ return request<TerminateJobResponse>(
872
+ "POST",
873
+ `/felix/training-jobs/${jobId}/terminate`
874
+ );
875
+ }
876
+
877
+ export async function syncJob(jobId: string): Promise<ApiResult<TrainingJob>> {
878
+ return request<TrainingJob>("POST", `/felix/training-jobs/${jobId}/sync`);
879
+ }
880
+
881
+ export interface Checkpoint {
882
+ id: string;
883
+ job_id: string;
884
+ epoch: number;
885
+ step?: number;
886
+ training_loss?: number;
887
+ validation_loss?: number;
888
+ accuracy?: number;
889
+ learning_rate?: number;
890
+ gpu_memory_used?: number;
891
+ gpu_memory_total?: number;
892
+ }
893
+
894
+ export interface CheckpointListResponse {
895
+ success: boolean;
896
+ checkpoints: Checkpoint[];
897
+ count: number;
898
+ }
899
+
900
+ export async function listCheckpoints(
901
+ jobId: string
902
+ ): Promise<ApiResult<CheckpointListResponse>> {
903
+ return request<CheckpointListResponse>(
904
+ "GET",
905
+ `/felix/training-jobs/${jobId}/checkpoints`
906
+ );
907
+ }
908
+
909
+ export interface DeployCheckpointResponse {
910
+ success: boolean;
911
+ message: string;
912
+ job_id: string;
913
+ checkpoint_id: string;
914
+ mme_path: string;
915
+ }
916
+
917
+ export async function deployCheckpoint(
918
+ jobId: string,
919
+ checkpointId: string
920
+ ): Promise<ApiResult<DeployCheckpointResponse>> {
921
+ return request<DeployCheckpointResponse>(
922
+ "POST",
923
+ `/felix/training-jobs/${jobId}/checkpoints/${checkpointId}/deploy`
924
+ );
925
+ }
926
+
927
+ export interface UpdateModelNameResponse {
928
+ success: boolean;
929
+ message: string;
930
+ job_id: string;
931
+ model_name: string;
932
+ }
933
+
934
+ export async function updateModelName(
935
+ jobId: string,
936
+ modelName: string
937
+ ): Promise<ApiResult<UpdateModelNameResponse>> {
938
+ return request<UpdateModelNameResponse>(
939
+ "PATCH",
940
+ `/felix/training-jobs/${jobId}/model-name`,
941
+ { model_name: modelName }
942
+ );
943
+ }
944
+
685
945
  // ─────────────────────────────────────────────────────────────────────────────
686
946
  // Models
687
947
  // ─────────────────────────────────────────────────────────────────────────────
@@ -707,8 +967,16 @@ export interface DeployedModelsListResponse {
707
967
  count: number;
708
968
  }
709
969
 
710
- export async function listModels(): Promise<ApiResult<DeployedModelsListResponse>> {
711
- return request<DeployedModelsListResponse>("GET", "/felix/models");
970
+ export async function listModels(
971
+ options: { includeBase?: boolean } = {}
972
+ ): Promise<ApiResult<DeployedModelsListResponse>> {
973
+ const params = new URLSearchParams();
974
+ if (options.includeBase !== undefined) {
975
+ params.set("include_base", String(options.includeBase));
976
+ }
977
+ const query = params.toString();
978
+ const url = query ? `/felix/models?${query}` : "/felix/models";
979
+ return request<DeployedModelsListResponse>("GET", url);
712
980
  }
713
981
 
714
982
  export async function deleteModel(jobId: string): Promise<ApiResult> {
@@ -810,13 +1078,41 @@ export async function downloadModel(
810
1078
  export interface Evaluation {
811
1079
  id: string;
812
1080
  user_id: string;
813
- dataset_id: string;
814
- model_id?: string;
1081
+ project_id?: string;
1082
+ model_id: string;
1083
+ dataset_name: string;
1084
+ dataset_version: string;
1085
+ provider?: string;
1086
+ model_name?: string;
1087
+ f1_score?: number;
1088
+ precision_score?: number;
1089
+ recall_score?: number;
1090
+ accuracy?: number;
1091
+ validation_loss?: number;
1092
+ total_tokens?: number;
1093
+ total_cost_usd?: number;
1094
+ total_latency_ms?: number;
1095
+ max_examples?: number;
1096
+ seed?: number;
1097
+ sample_count?: number;
1098
+ evaluation_time_ms?: number;
815
1099
  status: string;
816
- results?: unknown;
1100
+ job_reference?: string;
1101
+ error_message?: string;
817
1102
  created_at: string;
818
1103
  completed_at?: string;
819
- predictions?: Array<Record<string, unknown>>;
1104
+ }
1105
+
1106
+ export interface EvaluationListResponse {
1107
+ success: boolean;
1108
+ evaluations: Evaluation[];
1109
+ count: number;
1110
+ }
1111
+
1112
+ export async function listEvaluations(): Promise<
1113
+ ApiResult<EvaluationListResponse>
1114
+ > {
1115
+ return request<EvaluationListResponse>("GET", "/felix/evaluations");
820
1116
  }
821
1117
 
822
1118
  export async function getEvaluation(
@@ -828,16 +1124,27 @@ export async function getEvaluation(
828
1124
  export interface EvaluationCreateRequest {
829
1125
  dataset: DatasetRef;
830
1126
  model_id: string;
1127
+ dataset_names?: string[];
1128
+ provider?: "felix" | "openai" | "together";
1129
+ max_examples?: number;
1130
+ seed?: number;
831
1131
  task_type?: string;
832
1132
  text_column?: string;
833
1133
  label_column?: string;
1134
+ project_id?: string;
1135
+ }
1136
+
1137
+ export interface EvaluationCreateResponse {
1138
+ success: boolean;
1139
+ evaluations: Evaluation[];
1140
+ count: number;
834
1141
  }
835
1142
 
836
1143
  export async function createEvaluation(
837
1144
  req: EvaluationCreateRequest
838
- ): Promise<ApiResult<Evaluation>> {
1145
+ ): Promise<ApiResult<EvaluationCreateResponse>> {
839
1146
  const { dataset, ...rest } = req;
840
- return request<Evaluation>("POST", "/felix/evaluations", {
1147
+ return request<EvaluationCreateResponse>("POST", "/felix/evaluations", {
841
1148
  ...rest,
842
1149
  dataset_name: dataset.name,
843
1150
  dataset_version: dataset.version,
@@ -853,8 +1160,8 @@ export interface ModelWithEvaluation {
853
1160
 
854
1161
  export interface DatasetEvaluationsResponse {
855
1162
  success: boolean;
856
- dataset_id: string;
857
1163
  dataset_name: string;
1164
+ dataset_version: string;
858
1165
  sample_count: number;
859
1166
  models: ModelWithEvaluation[];
860
1167
  count: number;
@@ -1088,13 +1395,15 @@ export interface HuggingFacePushRequest {
1088
1395
  hf_token: string;
1089
1396
  repo_id: string;
1090
1397
  private?: boolean;
1398
+ commit_message?: string;
1091
1399
  }
1092
1400
 
1093
1401
  export interface HuggingFacePushResponse {
1094
1402
  success: boolean;
1095
- repo_url: string;
1403
+ url: string;
1096
1404
  repo_id: string;
1097
- message?: string;
1405
+ version: string;
1406
+ message: string;
1098
1407
  }
1099
1408
 
1100
1409
  export async function pushDatasetToHub(
@@ -1112,13 +1421,15 @@ export interface HuggingFacePushModelRequest {
1112
1421
  hf_token: string;
1113
1422
  repo_id: string;
1114
1423
  private?: boolean;
1424
+ commit_message?: string;
1115
1425
  }
1116
1426
 
1117
1427
  export interface HuggingFacePushModelResponse {
1118
1428
  success: boolean;
1119
- repo_url: string;
1429
+ url: string;
1120
1430
  repo_id: string;
1121
- message?: string;
1431
+ job_id: string;
1432
+ message: string;
1122
1433
  }
1123
1434
 
1124
1435
  export async function pushModelToHub(
@@ -1133,26 +1444,525 @@ export async function pushModelToHub(
1133
1444
  }
1134
1445
 
1135
1446
  export interface HuggingFacePullRequest {
1136
- hf_token?: string;
1137
1447
  repo_id: string;
1138
- dataset_name?: string;
1448
+ hf_token: string;
1139
1449
  revision?: string;
1450
+ name?: string;
1451
+ }
1452
+
1453
+ export async function pullDatasetFromHub(
1454
+ options: HuggingFacePullRequest
1455
+ ): Promise<ApiResult<Dataset>> {
1456
+ return request<Dataset>(
1457
+ "POST",
1458
+ "/felix/datasets/pull-from-hub",
1459
+ options
1460
+ );
1461
+ }
1462
+
1463
+ // ─────────────────────────────────────────────────────────────────────────────
1464
+ // Constraints Generation
1465
+ // ─────────────────────────────────────────────────────────────────────────────
1466
+
1467
+ export interface GenerateNERConstraintsRequest {
1468
+ labels: string[];
1469
+ domain_description?: string;
1470
+ min_criteria?: number;
1471
+ }
1472
+
1473
+ export interface GenerateClassificationConstraintsRequest {
1474
+ labels: string[];
1475
+ domain_description?: string;
1476
+ min_criteria?: number;
1477
+ }
1478
+
1479
+ export interface GenerateRecordsConstraintsRequest {
1480
+ fields: RecordField[];
1481
+ domain_description?: string;
1482
+ min_criteria?: number;
1483
+ }
1484
+
1485
+ export interface GenerateConstraintsResponse {
1486
+ success: boolean;
1487
+ constraints: ConstraintRequest[];
1488
+ count: number;
1489
+ token_usage?: number;
1490
+ }
1491
+
1492
+ export async function generateNERConstraints(
1493
+ req: GenerateNERConstraintsRequest
1494
+ ): Promise<ApiResult<GenerateConstraintsResponse>> {
1495
+ return request<GenerateConstraintsResponse>(
1496
+ "POST",
1497
+ "/felix/constraints/ner",
1498
+ req
1499
+ );
1500
+ }
1501
+
1502
+ export async function generateClassificationConstraints(
1503
+ req: GenerateClassificationConstraintsRequest
1504
+ ): Promise<ApiResult<GenerateConstraintsResponse>> {
1505
+ return request<GenerateConstraintsResponse>(
1506
+ "POST",
1507
+ "/felix/constraints/classification",
1508
+ req
1509
+ );
1510
+ }
1511
+
1512
+ export async function generateRecordsConstraints(
1513
+ req: GenerateRecordsConstraintsRequest
1514
+ ): Promise<ApiResult<GenerateConstraintsResponse>> {
1515
+ return request<GenerateConstraintsResponse>(
1516
+ "POST",
1517
+ "/felix/constraints/records",
1518
+ req
1519
+ );
1520
+ }
1521
+
1522
+ export interface ExpandConstraintChoicesRequest {
1523
+ constraint: ConstraintRequest;
1524
+ task_description: string;
1525
+ max_count?: number;
1526
+ }
1527
+
1528
+ export interface ExpandConstraintChoicesResponse {
1529
+ success: boolean;
1530
+ constraint: ConstraintRequest;
1531
+ expanded_choices: string[];
1532
+ count: number;
1533
+ token_usage?: number;
1534
+ }
1535
+
1536
+ export async function expandConstraintChoices(
1537
+ req: ExpandConstraintChoicesRequest
1538
+ ): Promise<ApiResult<ExpandConstraintChoicesResponse>> {
1539
+ return request<ExpandConstraintChoicesResponse>(
1540
+ "POST",
1541
+ "/felix/constraints/expand",
1542
+ req
1543
+ );
1544
+ }
1545
+
1546
+ // ─────────────────────────────────────────────────────────────────────────────
1547
+ // Dataset Augmentation
1548
+ // ─────────────────────────────────────────────────────────────────────────────
1549
+
1550
+ export interface AugmentationOperation {
1551
+ type: "remove_duplicates" | "remove_outliers" | "balance";
1552
+ enabled: boolean;
1553
+ }
1554
+
1555
+ export interface DatasetAugmentationRequest {
1556
+ task_type: "ner" | "classification";
1557
+ operations: AugmentationOperation[];
1558
+ new_dataset_name: string;
1559
+ dataset_name?: string;
1560
+ dataset_version?: string;
1561
+ dataset?: Record<string, unknown>[];
1562
+ target_distribution?: Record<string, number>;
1563
+ domain_description?: string;
1564
+ labels?: string[];
1140
1565
  }
1141
1566
 
1142
- export interface HuggingFacePullResponse {
1567
+ export interface DatasetAugmentationResponse {
1143
1568
  success: boolean;
1569
+ original_dataset_name?: string;
1570
+ original_dataset_version?: string;
1571
+ new_dataset: Dataset;
1572
+ modifications: Record<string, unknown>;
1573
+ distribution_comparison: Record<string, unknown>[];
1574
+ message: string;
1575
+ }
1576
+
1577
+ export async function augmentDataset(
1578
+ req: DatasetAugmentationRequest
1579
+ ): Promise<ApiResult<DatasetAugmentationResponse>> {
1580
+ return request<DatasetAugmentationResponse>(
1581
+ "POST",
1582
+ "/felix/dataset/augment",
1583
+ req
1584
+ );
1585
+ }
1586
+
1587
+ // ─────────────────────────────────────────────────────────────────────────────
1588
+ // Dataset Query
1589
+ // ─────────────────────────────────────────────────────────────────────────────
1590
+
1591
+ export interface DatasetQueryRequest {
1592
+ dataset_name: string;
1593
+ code: string;
1594
+ version?: string;
1595
+ timeout?: number;
1596
+ max_rows_returned?: number;
1597
+ }
1598
+
1599
+ export interface DatasetQueryResponse {
1600
+ success: boolean;
1601
+ dataset_name: string;
1602
+ dataset_version: string;
1603
+ result: unknown;
1604
+ result_type: "dataframe" | "series" | "scalar" | "string" | "none";
1605
+ row_count?: number;
1606
+ columns?: string[];
1607
+ execution_time_ms: number;
1608
+ truncated: boolean;
1609
+ message: string;
1610
+ }
1611
+
1612
+ export async function queryDataset(
1613
+ req: DatasetQueryRequest
1614
+ ): Promise<ApiResult<DatasetQueryResponse>> {
1615
+ return request<DatasetQueryResponse>("POST", "/felix/dataset/query", req);
1616
+ }
1617
+
1618
+ // ─────────────────────────────────────────────────────────────────────────────
1619
+ // Dataset Grow
1620
+ // ─────────────────────────────────────────────────────────────────────────────
1621
+
1622
+ export interface GrowDatasetRequest {
1623
+ dataset_id: string;
1624
+ new_dataset_name: string;
1625
+ target_size: number;
1626
+ class_balance?: boolean;
1627
+ domain_description?: string;
1628
+ temperature?: number;
1629
+ session_id?: string;
1630
+ }
1631
+
1632
+ export interface GrowDatasetResponse {
1633
+ success: boolean;
1634
+ dataset: Record<string, unknown>;
1635
+ original_size: number;
1636
+ new_size: number;
1637
+ generated_count: number;
1638
+ distribution: Record<string, number>;
1639
+ token_usage?: number;
1640
+ }
1641
+
1642
+ export async function growDataset(
1643
+ req: GrowDatasetRequest
1644
+ ): Promise<ApiResult<GrowDatasetResponse>> {
1645
+ return request<GrowDatasetResponse>("POST", "/felix/dataset/grow", req);
1646
+ }
1647
+
1648
+ // ─────────────────────────────────────────────────────────────────────────────
1649
+ // Embeddings
1650
+ // ─────────────────────────────────────────────────────────────────────────────
1651
+
1652
+ export interface EmbeddingsRequest {
1653
+ text: string;
1654
+ model?: string;
1655
+ }
1656
+
1657
+ export interface EmbeddingsResponse {
1658
+ embedding: number[];
1659
+ }
1660
+
1661
+ export async function createEmbeddings(
1662
+ req: EmbeddingsRequest
1663
+ ): Promise<ApiResult<EmbeddingsResponse>> {
1664
+ return request<EmbeddingsResponse>("POST", "/felix/embeddings", req);
1665
+ }
1666
+
1667
+ // ─────────────────────────────────────────────────────────────────────────────
1668
+ // Activity
1669
+ // ─────────────────────────────────────────────────────────────────────────────
1670
+
1671
+ export interface ActivityEvent {
1672
+ id: string;
1673
+ type: "project" | "dataset" | "model" | "evaluation" | "notebook" | "deployment";
1674
+ name: string;
1675
+ item_id: string;
1676
+ created_by: string;
1677
+ created_at: string;
1678
+ project_id?: string;
1679
+ }
1680
+
1681
+ export interface ActivityLogResponse {
1682
+ success: boolean;
1683
+ events?: ActivityEvent[];
1684
+ count: number;
1685
+ }
1686
+
1687
+ export async function listActivity(
1688
+ options: { limit?: number } = {}
1689
+ ): Promise<ApiResult<ActivityLogResponse>> {
1690
+ const params = new URLSearchParams();
1691
+ if (options.limit) params.set("limit", String(options.limit));
1692
+ const query = params.toString();
1693
+ const url = query ? `/felix/activity?${query}` : "/felix/activity";
1694
+ return request<ActivityLogResponse>("GET", url);
1695
+ }
1696
+
1697
+ // ─────────────────────────────────────────────────────────────────────────────
1698
+ // Presets
1699
+ // ─────────────────────────────────────────────────────────────────────────────
1700
+
1701
+ export interface PresetMetadata {
1702
+ id: string;
1703
+ name: string;
1704
+ description: string;
1705
+ task_type: string;
1706
+ tags?: string[];
1707
+ }
1708
+
1709
+ export interface PresetDetail {
1710
+ id: string;
1711
+ name: string;
1712
+ description: string;
1713
+ task_type: string;
1714
+ config: Record<string, unknown>;
1715
+ tags?: string[];
1716
+ }
1717
+
1718
+ export async function listPresets(): Promise<ApiResult<PresetMetadata[]>> {
1719
+ return request<PresetMetadata[]>("GET", "/felix/presets");
1720
+ }
1721
+
1722
+ export async function getPreset(
1723
+ presetId: string
1724
+ ): Promise<ApiResult<PresetDetail>> {
1725
+ return request<PresetDetail>("GET", `/felix/presets/${presetId}`);
1726
+ }
1727
+
1728
+ // ─────────────────────────────────────────────────────────────────────────────
1729
+ // Adaptive Annotation
1730
+ // ─────────────────────────────────────────────────────────────────────────────
1731
+
1732
+ export interface StartAnnotationSessionRequest {
1733
+ column_name: string;
1734
+ input_columns: string[];
1735
+ task_description: string;
1736
+ task_type?: "classification" | "scoring" | "entity_extraction" | "json_extraction";
1737
+ output_dataset_name?: string;
1738
+ possible_labels?: Array<{ name: string; description?: string }>;
1739
+ scoring_criteria?: Array<Record<string, unknown>>;
1740
+ entity_types?: Array<{ name: string; description?: string }>;
1741
+ json_schema?: Array<Record<string, unknown>>;
1742
+ auto_accept_threshold?: number;
1743
+ }
1744
+
1745
+ export interface StartAnnotationSessionResponse {
1746
+ success: boolean;
1747
+ session_id: string;
1748
+ dataset_id: string;
1749
+ task_type: string;
1750
+ total_items: number;
1751
+ }
1752
+
1753
+ export async function startAnnotationSession(
1754
+ datasetId: string,
1755
+ req: StartAnnotationSessionRequest
1756
+ ): Promise<ApiResult<StartAnnotationSessionResponse>> {
1757
+ return request<StartAnnotationSessionResponse>(
1758
+ "POST",
1759
+ `/felix/datasets/annotate/${datasetId}/start`,
1760
+ req
1761
+ );
1762
+ }
1763
+
1764
+ export interface NextAnnotationItemResponse {
1765
+ complete: boolean;
1766
+ rate_limited?: boolean;
1767
+ auto_accepted_in_call?: number;
1768
+ item_id?: number;
1769
+ item_data?: Record<string, unknown>;
1770
+ task_type?: string;
1771
+ task_description?: string;
1772
+ possible_labels?: string[];
1773
+ scoring_criteria?: Array<Record<string, unknown>>;
1774
+ entity_types?: Array<Record<string, unknown>>;
1775
+ json_schema?: Array<Record<string, unknown>>;
1776
+ suggestion?: Record<string, unknown>;
1777
+ stats?: Record<string, unknown>;
1778
+ }
1779
+
1780
+ export async function getNextAnnotationItem(
1781
+ datasetId: string,
1782
+ options: { maxAutoAccept?: number } = {}
1783
+ ): Promise<ApiResult<NextAnnotationItemResponse>> {
1784
+ const params = new URLSearchParams();
1785
+ if (options.maxAutoAccept !== undefined) {
1786
+ params.set("max_auto_accept", String(options.maxAutoAccept));
1787
+ }
1788
+ const query = params.toString();
1789
+ const url = `/felix/datasets/annotate/${datasetId}/next${query ? `?${query}` : ""}`;
1790
+ return request<NextAnnotationItemResponse>("GET", url);
1791
+ }
1792
+
1793
+ export interface AnnotationFeedbackRequest {
1794
+ item_id: number;
1795
+ thumb: "up" | "down";
1796
+ corrected_label?: string;
1797
+ corrected_criteria?: Record<string, string>;
1798
+ corrected_entities?: string[][];
1799
+ corrected_json?: Record<string, unknown>;
1800
+ }
1801
+
1802
+ export interface AnnotationFeedbackResponse {
1803
+ success: boolean;
1804
+ item_id: number;
1805
+ action: "up" | "down";
1806
+ was_correct: boolean;
1807
+ similar_items_queued?: number;
1808
+ stats?: Record<string, unknown>;
1809
+ }
1810
+
1811
+ export async function submitAnnotationFeedback(
1812
+ datasetId: string,
1813
+ req: AnnotationFeedbackRequest
1814
+ ): Promise<ApiResult<AnnotationFeedbackResponse>> {
1815
+ return request<AnnotationFeedbackResponse>(
1816
+ "POST",
1817
+ `/felix/datasets/annotate/${datasetId}/feedback`,
1818
+ req
1819
+ );
1820
+ }
1821
+
1822
+ export interface AnnotationStatsResponse {
1823
+ total_items: number;
1824
+ annotated: number;
1825
+ remaining: number;
1826
+ auto_accepted: number;
1827
+ human_annotated: number;
1828
+ auto_accept_rate: number;
1829
+ label_stats?: Record<string, unknown>;
1830
+ }
1831
+
1832
+ export async function getAnnotationStats(
1833
+ datasetId: string
1834
+ ): Promise<ApiResult<AnnotationStatsResponse>> {
1835
+ return request<AnnotationStatsResponse>(
1836
+ "GET",
1837
+ `/felix/datasets/annotate/${datasetId}/stats`
1838
+ );
1839
+ }
1840
+
1841
+ export interface AnnotationDownloadResponse {
1842
+ data: Record<string, unknown>[];
1843
+ columns: string[];
1844
+ rows: number;
1845
+ stats?: AnnotationStatsResponse;
1846
+ }
1847
+
1848
+ export async function downloadAnnotatedData(
1849
+ datasetId: string
1850
+ ): Promise<ApiResult<AnnotationDownloadResponse>> {
1851
+ return request<AnnotationDownloadResponse>(
1852
+ "GET",
1853
+ `/felix/datasets/annotate/${datasetId}/download`
1854
+ );
1855
+ }
1856
+
1857
+ export interface EndAnnotationSessionResponse {
1858
+ success: boolean;
1859
+ message: string;
1860
+ final_stats?: AnnotationStatsResponse;
1861
+ }
1862
+
1863
+ export async function endAnnotationSession(
1864
+ datasetId: string
1865
+ ): Promise<ApiResult<EndAnnotationSessionResponse>> {
1866
+ return request<EndAnnotationSessionResponse>(
1867
+ "DELETE",
1868
+ `/felix/datasets/annotate/${datasetId}/session`
1869
+ );
1870
+ }
1871
+
1872
+ // ─────────────────────────────────────────────────────────────────────────────
1873
+ // Leaderboard / Competitions
1874
+ // ─────────────────────────────────────────────────────────────────────────────
1875
+
1876
+ export interface LeaderboardEntry {
1877
+ id: string;
1878
+ dataset_id: string;
1879
+ evaluation_id: string;
1880
+ user_id: string;
1881
+ display_name: string;
1882
+ model_name: string;
1883
+ model_id?: string;
1884
+ f1_score: number;
1885
+ precision_score?: number;
1886
+ recall_score?: number;
1887
+ accuracy?: number;
1888
+ created_at: string;
1889
+ updated_at: string;
1890
+ rank?: number;
1891
+ }
1892
+
1893
+ export interface CompetitionInfo {
1144
1894
  dataset_id: string;
1145
1895
  dataset_name: string;
1146
- sample_count: number;
1147
- message?: string;
1896
+ dataset_type: string;
1897
+ description?: string;
1898
+ sample_count?: number;
1899
+ labels?: string[];
1900
+ sample_rows?: Record<string, unknown>[];
1901
+ winner?: LeaderboardEntry;
1902
+ total_entries: number;
1148
1903
  }
1149
1904
 
1150
- export async function pullDatasetFromHub(
1151
- options: HuggingFacePullRequest
1152
- ): Promise<ApiResult<HuggingFacePullResponse>> {
1153
- return request<HuggingFacePullResponse>(
1905
+ export interface CompetitionsResponse {
1906
+ success: boolean;
1907
+ competitions: CompetitionInfo[];
1908
+ }
1909
+
1910
+ export interface CompetitionSamplesResponse {
1911
+ dataset_id: string;
1912
+ sample_rows: Record<string, unknown>[];
1913
+ }
1914
+
1915
+ export interface LeaderboardEntriesResponse {
1916
+ success: boolean;
1917
+ dataset_id: string;
1918
+ dataset_name: string;
1919
+ entries: LeaderboardEntry[];
1920
+ total_entries: number;
1921
+ }
1922
+
1923
+ export interface LeaderboardSubmission {
1924
+ evaluation_id: string;
1925
+ display_name: string;
1926
+ }
1927
+
1928
+ export interface LeaderboardSubmitResponse {
1929
+ success: boolean;
1930
+ entry: LeaderboardEntry;
1931
+ rank: number;
1932
+ is_new_best: boolean;
1933
+ }
1934
+
1935
+ export async function listCompetitions(): Promise<ApiResult<CompetitionsResponse>> {
1936
+ return request<CompetitionsResponse>("GET", "/leaderboard/competitions");
1937
+ }
1938
+
1939
+ export async function getCompetitionSamples(
1940
+ datasetId: string
1941
+ ): Promise<ApiResult<CompetitionSamplesResponse>> {
1942
+ return request<CompetitionSamplesResponse>(
1943
+ "GET",
1944
+ `/leaderboard/competitions/${datasetId}/samples`
1945
+ );
1946
+ }
1947
+
1948
+ export async function getLeaderboardEntries(
1949
+ datasetId: string,
1950
+ limit?: number
1951
+ ): Promise<ApiResult<LeaderboardEntriesResponse>> {
1952
+ const params = new URLSearchParams();
1953
+ if (limit) params.set("limit", String(limit));
1954
+ const query = params.toString();
1955
+ const url = `/leaderboard/datasets/${datasetId}/entries${query ? `?${query}` : ""}`;
1956
+ return request<LeaderboardEntriesResponse>("GET", url);
1957
+ }
1958
+
1959
+ export async function submitToLeaderboard(
1960
+ datasetId: string,
1961
+ submission: LeaderboardSubmission
1962
+ ): Promise<ApiResult<LeaderboardSubmitResponse>> {
1963
+ return request<LeaderboardSubmitResponse>(
1154
1964
  "POST",
1155
- "/felix/datasets/pull-from-hub",
1156
- options
1965
+ `/leaderboard/datasets/${datasetId}/submit`,
1966
+ submission
1157
1967
  );
1158
1968
  }