forked from cohere-ai/cohere-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
datasets.go
160 lines (140 loc) · 5.26 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
// This file was auto-generated by Fern from our API Definition.
package api
import (
json "encoding/json"
fmt "fmt"
core "github.com/cohere-ai/cohere-go/v2/core"
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.
Type DatasetType `json:"-" url:"type,omitempty"`
// 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"`
}
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"`
}
type DatasetsCreateResponse struct {
// The dataset ID
Id *string `json:"id,omitempty" url:"id,omitempty"`
_rawJSON json.RawMessage
}
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)
d._rawJSON = json.RawMessage(data)
return nil
}
func (d *DatasetsCreateResponse) String() string {
if len(d._rawJSON) > 0 {
if value, err := core.StringifyJSON(d._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(d); err == nil {
return value
}
return fmt.Sprintf("%#v", d)
}
type DatasetsGetResponse struct {
Dataset *Dataset `json:"dataset,omitempty" url:"dataset,omitempty"`
_rawJSON json.RawMessage
}
func (d *DatasetsGetResponse) UnmarshalJSON(data []byte) error {
type unmarshaler DatasetsGetResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*d = DatasetsGetResponse(value)
d._rawJSON = json.RawMessage(data)
return nil
}
func (d *DatasetsGetResponse) String() string {
if len(d._rawJSON) > 0 {
if value, err := core.StringifyJSON(d._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(d); err == nil {
return value
}
return fmt.Sprintf("%#v", d)
}
type DatasetsGetUsageResponse struct {
// The total number of bytes used by the organization.
OrganizationUsage *string `json:"organization_usage,omitempty" url:"organization_usage,omitempty"`
_rawJSON json.RawMessage
}
func (d *DatasetsGetUsageResponse) UnmarshalJSON(data []byte) error {
type unmarshaler DatasetsGetUsageResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*d = DatasetsGetUsageResponse(value)
d._rawJSON = json.RawMessage(data)
return nil
}
func (d *DatasetsGetUsageResponse) String() string {
if len(d._rawJSON) > 0 {
if value, err := core.StringifyJSON(d._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(d); err == nil {
return value
}
return fmt.Sprintf("%#v", d)
}
type DatasetsListResponse struct {
Datasets []*Dataset `json:"datasets,omitempty" url:"datasets,omitempty"`
_rawJSON json.RawMessage
}
func (d *DatasetsListResponse) UnmarshalJSON(data []byte) error {
type unmarshaler DatasetsListResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*d = DatasetsListResponse(value)
d._rawJSON = json.RawMessage(data)
return nil
}
func (d *DatasetsListResponse) String() string {
if len(d._rawJSON) > 0 {
if value, err := core.StringifyJSON(d._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(d); err == nil {
return value
}
return fmt.Sprintf("%#v", d)
}