@@ -26,15 +26,16 @@ func main() {
26
26
client := modzy .NewClient (baseURL ).WithAPIKey (apiKey )
27
27
28
28
if os .Getenv ("MODZY_DEBUG" ) == "1" {
29
- client = client .WithOptions (modzy .WithHTTPDebugging (false , false ))
29
+ client = client .WithOptions (modzy .WithHTTPDebugging (true , true ))
30
30
}
31
31
32
- // listJobsHistory(client)
32
+ listJobsHistory (client )
33
33
// errorChecking()
34
34
// submitExampleText(client, false)
35
+ // submitExampleTextWithFailures(client, false)
35
36
// submitExampleEmbedded(client, true)
36
37
// submitExampleChunked(client, false)
37
- submitExampleS3 (client , false )
38
+ // submitExampleS3(client, false)
38
39
// submitExampleJDBC(client, false)
39
40
// describeJob(client, "86b76e20-c506-485d-af4e-2072c41ca35b")
40
41
// describeModel(client, "ed542963de")
@@ -125,6 +126,30 @@ func submitExampleText(client modzy.Client, cancel bool) {
125
126
afterSubmit (client , cancel , submittedJob )
126
127
}
127
128
129
+ func submitExampleTextWithFailures (client modzy.Client , cancel bool ) {
130
+ logrus .Info ("Will submit example text job" )
131
+ submittedJob , err := client .Jobs ().SubmitJobText (ctx , & modzy.SubmitJobTextInput {
132
+ ModelIdentifier : "ed542963de" ,
133
+ ModelVersion : "0.0.27" ,
134
+ Timeout : time .Minute * 5 ,
135
+ Inputs : map [string ]modzy.TextInputItem {
136
+ "happy-text" : {
137
+ "not-input.txt" : "I love AI! :)" ,
138
+ },
139
+ "angry-text" : {
140
+ "input.txt" : "I hate AI! abysmal. adverse. alarming. angry. annoy. anxious :(" ,
141
+ },
142
+ },
143
+ })
144
+ if err != nil {
145
+ logrus .WithError (err ).Fatalf ("Failed to submit text job" )
146
+ return
147
+ }
148
+
149
+ logrus .WithField ("jobIdentifier" , submittedJob .Response .JobIdentifier ).Info ("text job submitted" )
150
+ afterSubmit (client , cancel , submittedJob )
151
+ }
152
+
128
153
//go:embed smiling_face.encoded
129
154
var SmilingFace string
130
155
@@ -240,6 +265,10 @@ func afterSubmit(client modzy.Client, cancel bool, job modzy.JobActions) {
240
265
return
241
266
}
242
267
logrus .Infof ("Job results: %s -> %d results" , jobResults .Results .JobIdentifier , jobResults .Results .Total )
268
+
269
+ if len (jobResults .Results .Failures ) > 0 {
270
+ logrus .Warnf ("Job had failures: %+v" , jobResults .Results .Failures )
271
+ }
243
272
}
244
273
}
245
274
0 commit comments