-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdatasets.go
1227 lines (1080 loc) · 31.9 KB
/
datasets.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// This file was auto-generated by Fern from our API Definition.
package api
import (
json "encoding/json"
fmt "fmt"
internal "github.com/cohere-ai/cohere-go/v2/internal"
time "time"
)
type DatasetsCreateRequest struct {
// The name of the uploaded dataset.
Name string `json:"-" url:"name"`
// The dataset type, which is used to validate the data. Valid types are `embed-input`, `reranker-finetune-input`, `single-label-classification-finetune-input`, `chat-finetune-input`, and `multi-label-classification-finetune-input`.
Type DatasetType `json:"-" url:"type"`
// Indicates if the original file should be stored.
KeepOriginalFile *bool `json:"-" url:"keep_original_file,omitempty"`
// Indicates whether rows with malformed input should be dropped (instead of failing the validation check). Dropped rows will be returned in the warnings field.
SkipMalformedInput *bool `json:"-" url:"skip_malformed_input,omitempty"`
// List of names of fields that will be persisted in the Dataset. By default the Dataset will retain only the required fields indicated in the [schema for the corresponding Dataset type](https://docs.cohere.com/docs/datasets#dataset-types). For example, datasets of type `embed-input` will drop all fields other than the required `text` field. If any of the fields in `keep_fields` are missing from the uploaded file, Dataset validation will fail.
KeepFields []*string `json:"-" url:"keep_fields,omitempty"`
// List of names of fields that will be persisted in the Dataset. By default the Dataset will retain only the required fields indicated in the [schema for the corresponding Dataset type](https://docs.cohere.com/docs/datasets#dataset-types). For example, Datasets of type `embed-input` will drop all fields other than the required `text` field. If any of the fields in `optional_fields` are missing from the uploaded file, Dataset validation will pass.
OptionalFields []*string `json:"-" url:"optional_fields,omitempty"`
// Raw .txt uploads will be split into entries using the text_separator value.
TextSeparator *string `json:"-" url:"text_separator,omitempty"`
// The delimiter used for .csv uploads.
CsvDelimiter *string `json:"-" url:"csv_delimiter,omitempty"`
// flag to enable dry_run mode
DryRun *bool `json:"-" url:"dry_run,omitempty"`
}
type DatasetsListRequest struct {
// optional filter by dataset type
DatasetType *string `json:"-" url:"datasetType,omitempty"`
// optional filter before a date
Before *time.Time `json:"-" url:"before,omitempty"`
// optional filter after a date
After *time.Time `json:"-" url:"after,omitempty"`
// optional limit to number of results
Limit *float64 `json:"-" url:"limit,omitempty"`
// optional offset to start of results
Offset *float64 `json:"-" url:"offset,omitempty"`
// optional filter by validation status
ValidationStatus *DatasetValidationStatus `json:"-" url:"validationStatus,omitempty"`
}
type ChatDataMetrics struct {
// The sum of all turns of valid train examples.
NumTrainTurns *int64 `json:"num_train_turns,omitempty" url:"num_train_turns,omitempty"`
// The sum of all turns of valid eval examples.
NumEvalTurns *int64 `json:"num_eval_turns,omitempty" url:"num_eval_turns,omitempty"`
// The preamble of this dataset.
Preamble *string `json:"preamble,omitempty" url:"preamble,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (c *ChatDataMetrics) GetNumTrainTurns() *int64 {
if c == nil {
return nil
}
return c.NumTrainTurns
}
func (c *ChatDataMetrics) GetNumEvalTurns() *int64 {
if c == nil {
return nil
}
return c.NumEvalTurns
}
func (c *ChatDataMetrics) GetPreamble() *string {
if c == nil {
return nil
}
return c.Preamble
}
func (c *ChatDataMetrics) GetExtraProperties() map[string]interface{} {
return c.extraProperties
}
func (c *ChatDataMetrics) UnmarshalJSON(data []byte) error {
type unmarshaler ChatDataMetrics
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*c = ChatDataMetrics(value)
extraProperties, err := internal.ExtractExtraProperties(data, *c)
if err != nil {
return err
}
c.extraProperties = extraProperties
c.rawJSON = json.RawMessage(data)
return nil
}
func (c *ChatDataMetrics) String() string {
if len(c.rawJSON) > 0 {
if value, err := internal.StringifyJSON(c.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(c); err == nil {
return value
}
return fmt.Sprintf("%#v", c)
}
type ClassifyDataMetrics struct {
LabelMetrics []*LabelMetric `json:"label_metrics,omitempty" url:"label_metrics,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (c *ClassifyDataMetrics) GetLabelMetrics() []*LabelMetric {
if c == nil {
return nil
}
return c.LabelMetrics
}
func (c *ClassifyDataMetrics) GetExtraProperties() map[string]interface{} {
return c.extraProperties
}
func (c *ClassifyDataMetrics) UnmarshalJSON(data []byte) error {
type unmarshaler ClassifyDataMetrics
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*c = ClassifyDataMetrics(value)
extraProperties, err := internal.ExtractExtraProperties(data, *c)
if err != nil {
return err
}
c.extraProperties = extraProperties
c.rawJSON = json.RawMessage(data)
return nil
}
func (c *ClassifyDataMetrics) String() string {
if len(c.rawJSON) > 0 {
if value, err := internal.StringifyJSON(c.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(c); err == nil {
return value
}
return fmt.Sprintf("%#v", c)
}
type Dataset struct {
// The dataset ID
Id string `json:"id" url:"id"`
// The name of the dataset
Name string `json:"name" url:"name"`
// The creation date
CreatedAt time.Time `json:"created_at" url:"created_at"`
// The last update date
UpdatedAt time.Time `json:"updated_at" url:"updated_at"`
DatasetType DatasetType `json:"dataset_type" url:"dataset_type"`
ValidationStatus DatasetValidationStatus `json:"validation_status" url:"validation_status"`
// Errors found during validation
ValidationError *string `json:"validation_error,omitempty" url:"validation_error,omitempty"`
// the avro schema of the dataset
Schema *string `json:"schema,omitempty" url:"schema,omitempty"`
RequiredFields []string `json:"required_fields,omitempty" url:"required_fields,omitempty"`
PreserveFields []string `json:"preserve_fields,omitempty" url:"preserve_fields,omitempty"`
// the underlying files that make up the dataset
DatasetParts []*DatasetPart `json:"dataset_parts,omitempty" url:"dataset_parts,omitempty"`
// warnings found during validation
ValidationWarnings []string `json:"validation_warnings,omitempty" url:"validation_warnings,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (d *Dataset) GetId() string {
if d == nil {
return ""
}
return d.Id
}
func (d *Dataset) GetName() string {
if d == nil {
return ""
}
return d.Name
}
func (d *Dataset) GetCreatedAt() time.Time {
if d == nil {
return time.Time{}
}
return d.CreatedAt
}
func (d *Dataset) GetUpdatedAt() time.Time {
if d == nil {
return time.Time{}
}
return d.UpdatedAt
}
func (d *Dataset) GetDatasetType() DatasetType {
if d == nil {
return ""
}
return d.DatasetType
}
func (d *Dataset) GetValidationStatus() DatasetValidationStatus {
if d == nil {
return ""
}
return d.ValidationStatus
}
func (d *Dataset) GetValidationError() *string {
if d == nil {
return nil
}
return d.ValidationError
}
func (d *Dataset) GetSchema() *string {
if d == nil {
return nil
}
return d.Schema
}
func (d *Dataset) GetRequiredFields() []string {
if d == nil {
return nil
}
return d.RequiredFields
}
func (d *Dataset) GetPreserveFields() []string {
if d == nil {
return nil
}
return d.PreserveFields
}
func (d *Dataset) GetDatasetParts() []*DatasetPart {
if d == nil {
return nil
}
return d.DatasetParts
}
func (d *Dataset) GetValidationWarnings() []string {
if d == nil {
return nil
}
return d.ValidationWarnings
}
func (d *Dataset) GetExtraProperties() map[string]interface{} {
return d.extraProperties
}
func (d *Dataset) UnmarshalJSON(data []byte) error {
type embed Dataset
var unmarshaler = struct {
embed
CreatedAt *internal.DateTime `json:"created_at"`
UpdatedAt *internal.DateTime `json:"updated_at"`
}{
embed: embed(*d),
}
if err := json.Unmarshal(data, &unmarshaler); err != nil {
return err
}
*d = Dataset(unmarshaler.embed)
d.CreatedAt = unmarshaler.CreatedAt.Time()
d.UpdatedAt = unmarshaler.UpdatedAt.Time()
extraProperties, err := internal.ExtractExtraProperties(data, *d)
if err != nil {
return err
}
d.extraProperties = extraProperties
d.rawJSON = json.RawMessage(data)
return nil
}
func (d *Dataset) MarshalJSON() ([]byte, error) {
type embed Dataset
var marshaler = struct {
embed
CreatedAt *internal.DateTime `json:"created_at"`
UpdatedAt *internal.DateTime `json:"updated_at"`
}{
embed: embed(*d),
CreatedAt: internal.NewDateTime(d.CreatedAt),
UpdatedAt: internal.NewDateTime(d.UpdatedAt),
}
return json.Marshal(marshaler)
}
func (d *Dataset) String() string {
if len(d.rawJSON) > 0 {
if value, err := internal.StringifyJSON(d.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(d); err == nil {
return value
}
return fmt.Sprintf("%#v", d)
}
type DatasetPart struct {
// The dataset part ID
Id string `json:"id" url:"id"`
// The name of the dataset part
Name string `json:"name" url:"name"`
// The download url of the file
Url *string `json:"url,omitempty" url:"url,omitempty"`
// The index of the file
Index *int `json:"index,omitempty" url:"index,omitempty"`
// The size of the file in bytes
SizeBytes *int `json:"size_bytes,omitempty" url:"size_bytes,omitempty"`
// The number of rows in the file
NumRows *int `json:"num_rows,omitempty" url:"num_rows,omitempty"`
// The download url of the original file
OriginalUrl *string `json:"original_url,omitempty" url:"original_url,omitempty"`
// The first few rows of the parsed file
Samples []string `json:"samples,omitempty" url:"samples,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (d *DatasetPart) GetId() string {
if d == nil {
return ""
}
return d.Id
}
func (d *DatasetPart) GetName() string {
if d == nil {
return ""
}
return d.Name
}
func (d *DatasetPart) GetUrl() *string {
if d == nil {
return nil
}
return d.Url
}
func (d *DatasetPart) GetIndex() *int {
if d == nil {
return nil
}
return d.Index
}
func (d *DatasetPart) GetSizeBytes() *int {
if d == nil {
return nil
}
return d.SizeBytes
}
func (d *DatasetPart) GetNumRows() *int {
if d == nil {
return nil
}
return d.NumRows
}
func (d *DatasetPart) GetOriginalUrl() *string {
if d == nil {
return nil
}
return d.OriginalUrl
}
func (d *DatasetPart) GetSamples() []string {
if d == nil {
return nil
}
return d.Samples
}
func (d *DatasetPart) GetExtraProperties() map[string]interface{} {
return d.extraProperties
}
func (d *DatasetPart) UnmarshalJSON(data []byte) error {
type unmarshaler DatasetPart
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*d = DatasetPart(value)
extraProperties, err := internal.ExtractExtraProperties(data, *d)
if err != nil {
return err
}
d.extraProperties = extraProperties
d.rawJSON = json.RawMessage(data)
return nil
}
func (d *DatasetPart) String() string {
if len(d.rawJSON) > 0 {
if value, err := internal.StringifyJSON(d.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(d); err == nil {
return value
}
return fmt.Sprintf("%#v", d)
}
// The type of the dataset
type DatasetType string
const (
DatasetTypeEmbedInput DatasetType = "embed-input"
DatasetTypeEmbedResult DatasetType = "embed-result"
DatasetTypeClusterResult DatasetType = "cluster-result"
DatasetTypeClusterOutliers DatasetType = "cluster-outliers"
DatasetTypeRerankerFinetuneInput DatasetType = "reranker-finetune-input"
DatasetTypeSingleLabelClassificationFinetuneInput DatasetType = "single-label-classification-finetune-input"
DatasetTypeChatFinetuneInput DatasetType = "chat-finetune-input"
DatasetTypeMultiLabelClassificationFinetuneInput DatasetType = "multi-label-classification-finetune-input"
)
func NewDatasetTypeFromString(s string) (DatasetType, error) {
switch s {
case "embed-input":
return DatasetTypeEmbedInput, nil
case "embed-result":
return DatasetTypeEmbedResult, nil
case "cluster-result":
return DatasetTypeClusterResult, nil
case "cluster-outliers":
return DatasetTypeClusterOutliers, nil
case "reranker-finetune-input":
return DatasetTypeRerankerFinetuneInput, nil
case "single-label-classification-finetune-input":
return DatasetTypeSingleLabelClassificationFinetuneInput, nil
case "chat-finetune-input":
return DatasetTypeChatFinetuneInput, nil
case "multi-label-classification-finetune-input":
return DatasetTypeMultiLabelClassificationFinetuneInput, nil
}
var t DatasetType
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (d DatasetType) Ptr() *DatasetType {
return &d
}
// The validation status of the dataset
type DatasetValidationStatus string
const (
DatasetValidationStatusUnknown DatasetValidationStatus = "unknown"
DatasetValidationStatusQueued DatasetValidationStatus = "queued"
DatasetValidationStatusProcessing DatasetValidationStatus = "processing"
DatasetValidationStatusFailed DatasetValidationStatus = "failed"
DatasetValidationStatusValidated DatasetValidationStatus = "validated"
DatasetValidationStatusSkipped DatasetValidationStatus = "skipped"
)
func NewDatasetValidationStatusFromString(s string) (DatasetValidationStatus, error) {
switch s {
case "unknown":
return DatasetValidationStatusUnknown, nil
case "queued":
return DatasetValidationStatusQueued, nil
case "processing":
return DatasetValidationStatusProcessing, nil
case "failed":
return DatasetValidationStatusFailed, nil
case "validated":
return DatasetValidationStatusValidated, nil
case "skipped":
return DatasetValidationStatusSkipped, nil
}
var t DatasetValidationStatus
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (d DatasetValidationStatus) Ptr() *DatasetValidationStatus {
return &d
}
type FinetuneDatasetMetrics struct {
// The number of tokens of valid examples that can be used for training.
TrainableTokenCount *int64 `json:"trainable_token_count,omitempty" url:"trainable_token_count,omitempty"`
// The overall number of examples.
TotalExamples *int64 `json:"total_examples,omitempty" url:"total_examples,omitempty"`
// The number of training examples.
TrainExamples *int64 `json:"train_examples,omitempty" url:"train_examples,omitempty"`
// The size in bytes of all training examples.
TrainSizeBytes *int64 `json:"train_size_bytes,omitempty" url:"train_size_bytes,omitempty"`
// Number of evaluation examples.
EvalExamples *int64 `json:"eval_examples,omitempty" url:"eval_examples,omitempty"`
// The size in bytes of all eval examples.
EvalSizeBytes *int64 `json:"eval_size_bytes,omitempty" url:"eval_size_bytes,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (f *FinetuneDatasetMetrics) GetTrainableTokenCount() *int64 {
if f == nil {
return nil
}
return f.TrainableTokenCount
}
func (f *FinetuneDatasetMetrics) GetTotalExamples() *int64 {
if f == nil {
return nil
}
return f.TotalExamples
}
func (f *FinetuneDatasetMetrics) GetTrainExamples() *int64 {
if f == nil {
return nil
}
return f.TrainExamples
}
func (f *FinetuneDatasetMetrics) GetTrainSizeBytes() *int64 {
if f == nil {
return nil
}
return f.TrainSizeBytes
}
func (f *FinetuneDatasetMetrics) GetEvalExamples() *int64 {
if f == nil {
return nil
}
return f.EvalExamples
}
func (f *FinetuneDatasetMetrics) GetEvalSizeBytes() *int64 {
if f == nil {
return nil
}
return f.EvalSizeBytes
}
func (f *FinetuneDatasetMetrics) GetExtraProperties() map[string]interface{} {
return f.extraProperties
}
func (f *FinetuneDatasetMetrics) UnmarshalJSON(data []byte) error {
type unmarshaler FinetuneDatasetMetrics
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*f = FinetuneDatasetMetrics(value)
extraProperties, err := internal.ExtractExtraProperties(data, *f)
if err != nil {
return err
}
f.extraProperties = extraProperties
f.rawJSON = json.RawMessage(data)
return nil
}
func (f *FinetuneDatasetMetrics) String() string {
if len(f.rawJSON) > 0 {
if value, err := internal.StringifyJSON(f.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(f); err == nil {
return value
}
return fmt.Sprintf("%#v", f)
}
type LabelMetric struct {
// Total number of examples for this label
TotalExamples *int64 `json:"total_examples,omitempty" url:"total_examples,omitempty"`
// value of the label
Label *string `json:"label,omitempty" url:"label,omitempty"`
// samples for this label
Samples []string `json:"samples,omitempty" url:"samples,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (l *LabelMetric) GetTotalExamples() *int64 {
if l == nil {
return nil
}
return l.TotalExamples
}
func (l *LabelMetric) GetLabel() *string {
if l == nil {
return nil
}
return l.Label
}
func (l *LabelMetric) GetSamples() []string {
if l == nil {
return nil
}
return l.Samples
}
func (l *LabelMetric) GetExtraProperties() map[string]interface{} {
return l.extraProperties
}
func (l *LabelMetric) UnmarshalJSON(data []byte) error {
type unmarshaler LabelMetric
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*l = LabelMetric(value)
extraProperties, err := internal.ExtractExtraProperties(data, *l)
if err != nil {
return err
}
l.extraProperties = extraProperties
l.rawJSON = json.RawMessage(data)
return nil
}
func (l *LabelMetric) String() string {
if len(l.rawJSON) > 0 {
if value, err := internal.StringifyJSON(l.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(l); err == nil {
return value
}
return fmt.Sprintf("%#v", l)
}
type Metrics struct {
FinetuneDatasetMetrics *FinetuneDatasetMetrics `json:"finetune_dataset_metrics,omitempty" url:"finetune_dataset_metrics,omitempty"`
EmbedData *MetricsEmbedData `json:"embed_data,omitempty" url:"embed_data,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (m *Metrics) GetFinetuneDatasetMetrics() *FinetuneDatasetMetrics {
if m == nil {
return nil
}
return m.FinetuneDatasetMetrics
}
func (m *Metrics) GetEmbedData() *MetricsEmbedData {
if m == nil {
return nil
}
return m.EmbedData
}
func (m *Metrics) GetExtraProperties() map[string]interface{} {
return m.extraProperties
}
func (m *Metrics) UnmarshalJSON(data []byte) error {
type unmarshaler Metrics
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*m = Metrics(value)
extraProperties, err := internal.ExtractExtraProperties(data, *m)
if err != nil {
return err
}
m.extraProperties = extraProperties
m.rawJSON = json.RawMessage(data)
return nil
}
func (m *Metrics) String() string {
if len(m.rawJSON) > 0 {
if value, err := internal.StringifyJSON(m.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(m); err == nil {
return value
}
return fmt.Sprintf("%#v", m)
}
type MetricsEmbedData struct {
// the fields in the dataset
Fields []*MetricsEmbedDataFieldsItem `json:"fields,omitempty" url:"fields,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (m *MetricsEmbedData) GetFields() []*MetricsEmbedDataFieldsItem {
if m == nil {
return nil
}
return m.Fields
}
func (m *MetricsEmbedData) GetExtraProperties() map[string]interface{} {
return m.extraProperties
}
func (m *MetricsEmbedData) UnmarshalJSON(data []byte) error {
type unmarshaler MetricsEmbedData
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*m = MetricsEmbedData(value)
extraProperties, err := internal.ExtractExtraProperties(data, *m)
if err != nil {
return err
}
m.extraProperties = extraProperties
m.rawJSON = json.RawMessage(data)
return nil
}
func (m *MetricsEmbedData) String() string {
if len(m.rawJSON) > 0 {
if value, err := internal.StringifyJSON(m.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(m); err == nil {
return value
}
return fmt.Sprintf("%#v", m)
}
type MetricsEmbedDataFieldsItem struct {
// the name of the field
Name *string `json:"name,omitempty" url:"name,omitempty"`
// the number of times the field appears in the dataset
Count *float64 `json:"count,omitempty" url:"count,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (m *MetricsEmbedDataFieldsItem) GetName() *string {
if m == nil {
return nil
}
return m.Name
}
func (m *MetricsEmbedDataFieldsItem) GetCount() *float64 {
if m == nil {
return nil
}
return m.Count
}
func (m *MetricsEmbedDataFieldsItem) GetExtraProperties() map[string]interface{} {
return m.extraProperties
}
func (m *MetricsEmbedDataFieldsItem) UnmarshalJSON(data []byte) error {
type unmarshaler MetricsEmbedDataFieldsItem
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*m = MetricsEmbedDataFieldsItem(value)
extraProperties, err := internal.ExtractExtraProperties(data, *m)
if err != nil {
return err
}
m.extraProperties = extraProperties
m.rawJSON = json.RawMessage(data)
return nil
}
func (m *MetricsEmbedDataFieldsItem) String() string {
if len(m.rawJSON) > 0 {
if value, err := internal.StringifyJSON(m.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(m); err == nil {
return value
}
return fmt.Sprintf("%#v", m)
}
type ParseInfo struct {
Separator *string `json:"separator,omitempty" url:"separator,omitempty"`
Delimiter *string `json:"delimiter,omitempty" url:"delimiter,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (p *ParseInfo) GetSeparator() *string {
if p == nil {
return nil
}
return p.Separator
}
func (p *ParseInfo) GetDelimiter() *string {
if p == nil {
return nil
}
return p.Delimiter
}
func (p *ParseInfo) GetExtraProperties() map[string]interface{} {
return p.extraProperties
}
func (p *ParseInfo) UnmarshalJSON(data []byte) error {
type unmarshaler ParseInfo
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*p = ParseInfo(value)
extraProperties, err := internal.ExtractExtraProperties(data, *p)
if err != nil {
return err
}
p.extraProperties = extraProperties
p.rawJSON = json.RawMessage(data)
return nil
}
func (p *ParseInfo) String() string {
if len(p.rawJSON) > 0 {
if value, err := internal.StringifyJSON(p.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(p); err == nil {
return value
}
return fmt.Sprintf("%#v", p)
}
type RerankerDataMetrics struct {
// The number of training queries.
NumTrainQueries *int64 `json:"num_train_queries,omitempty" url:"num_train_queries,omitempty"`
// The sum of all relevant passages of valid training examples.
NumTrainRelevantPassages *int64 `json:"num_train_relevant_passages,omitempty" url:"num_train_relevant_passages,omitempty"`
// The sum of all hard negatives of valid training examples.
NumTrainHardNegatives *int64 `json:"num_train_hard_negatives,omitempty" url:"num_train_hard_negatives,omitempty"`
// The number of evaluation queries.
NumEvalQueries *int64 `json:"num_eval_queries,omitempty" url:"num_eval_queries,omitempty"`
// The sum of all relevant passages of valid eval examples.
NumEvalRelevantPassages *int64 `json:"num_eval_relevant_passages,omitempty" url:"num_eval_relevant_passages,omitempty"`
// The sum of all hard negatives of valid eval examples.
NumEvalHardNegatives *int64 `json:"num_eval_hard_negatives,omitempty" url:"num_eval_hard_negatives,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (r *RerankerDataMetrics) GetNumTrainQueries() *int64 {
if r == nil {
return nil
}
return r.NumTrainQueries
}
func (r *RerankerDataMetrics) GetNumTrainRelevantPassages() *int64 {
if r == nil {
return nil
}
return r.NumTrainRelevantPassages
}
func (r *RerankerDataMetrics) GetNumTrainHardNegatives() *int64 {
if r == nil {
return nil
}
return r.NumTrainHardNegatives
}
func (r *RerankerDataMetrics) GetNumEvalQueries() *int64 {
if r == nil {
return nil
}
return r.NumEvalQueries
}
func (r *RerankerDataMetrics) GetNumEvalRelevantPassages() *int64 {
if r == nil {
return nil
}
return r.NumEvalRelevantPassages
}
func (r *RerankerDataMetrics) GetNumEvalHardNegatives() *int64 {
if r == nil {
return nil
}
return r.NumEvalHardNegatives
}
func (r *RerankerDataMetrics) GetExtraProperties() map[string]interface{} {
return r.extraProperties
}
func (r *RerankerDataMetrics) UnmarshalJSON(data []byte) error {
type unmarshaler RerankerDataMetrics
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*r = RerankerDataMetrics(value)
extraProperties, err := internal.ExtractExtraProperties(data, *r)
if err != nil {
return err
}
r.extraProperties = extraProperties
r.rawJSON = json.RawMessage(data)
return nil
}
func (r *RerankerDataMetrics) String() string {
if len(r.rawJSON) > 0 {
if value, err := internal.StringifyJSON(r.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(r); err == nil {
return value
}
return fmt.Sprintf("%#v", r)
}
type DatasetsCreateResponse struct {
// The dataset ID
Id *string `json:"id,omitempty" url:"id,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (d *DatasetsCreateResponse) GetId() *string {
if d == nil {
return nil
}
return d.Id
}
func (d *DatasetsCreateResponse) GetExtraProperties() map[string]interface{} {
return d.extraProperties
}
func (d *DatasetsCreateResponse) UnmarshalJSON(data []byte) error {
type unmarshaler DatasetsCreateResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*d = DatasetsCreateResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *d)
if err != nil {
return err
}
d.extraProperties = extraProperties
d.rawJSON = json.RawMessage(data)