@@ -233,7 +233,7 @@ impl OpenAIClient {
233
233
Ok ( parsed) => {
234
234
self . headers = Some ( headers) ;
235
235
Ok ( parsed)
236
- } ,
236
+ }
237
237
Err ( e) => Err ( APIError :: CustomError {
238
238
message : format ! ( "Failed to parse JSON: {} / response {}" , e, text) ,
239
239
} ) ,
@@ -249,7 +249,10 @@ impl OpenAIClient {
249
249
}
250
250
}
251
251
252
- pub async fn completion ( & mut self , req : CompletionRequest ) -> Result < CompletionResponse , APIError > {
252
+ pub async fn completion (
253
+ & mut self ,
254
+ req : CompletionRequest ,
255
+ ) -> Result < CompletionResponse , APIError > {
253
256
self . post ( "completions" , & req) . await
254
257
}
255
258
@@ -264,7 +267,10 @@ impl OpenAIClient {
264
267
self . post ( "images/generations" , & req) . await
265
268
}
266
269
267
- pub async fn image_edit ( & mut self , req : ImageEditRequest ) -> Result < ImageEditResponse , APIError > {
270
+ pub async fn image_edit (
271
+ & mut self ,
272
+ req : ImageEditRequest ,
273
+ ) -> Result < ImageEditResponse , APIError > {
268
274
self . post ( "images/edits" , & req) . await
269
275
}
270
276
@@ -275,7 +281,10 @@ impl OpenAIClient {
275
281
self . post ( "images/variations" , & req) . await
276
282
}
277
283
278
- pub async fn embedding ( & mut self , req : EmbeddingRequest ) -> Result < EmbeddingResponse , APIError > {
284
+ pub async fn embedding (
285
+ & mut self ,
286
+ req : EmbeddingRequest ,
287
+ ) -> Result < EmbeddingResponse , APIError > {
279
288
self . post ( "embeddings" , & req) . await
280
289
}
281
290
@@ -298,7 +307,10 @@ impl OpenAIClient {
298
307
self . delete ( & format ! ( "files/{}" , req. file_id) ) . await
299
308
}
300
309
301
- pub async fn retrieve_file ( & mut self , file_id : String ) -> Result < FileRetrieveResponse , APIError > {
310
+ pub async fn retrieve_file (
311
+ & mut self ,
312
+ file_id : String ,
313
+ ) -> Result < FileRetrieveResponse , APIError > {
302
314
self . get ( & format ! ( "files/{}" , file_id) ) . await
303
315
}
304
316
@@ -486,7 +498,10 @@ impl OpenAIClient {
486
498
. await
487
499
}
488
500
489
- pub async fn delete_assistant ( & mut self , assistant_id : String ) -> Result < DeletionStatus , APIError > {
501
+ pub async fn delete_assistant (
502
+ & mut self ,
503
+ assistant_id : String ,
504
+ ) -> Result < DeletionStatus , APIError > {
490
505
self . delete ( & format ! ( "assistants/{}" , assistant_id) ) . await
491
506
}
492
507
@@ -546,7 +561,10 @@ impl OpenAIClient {
546
561
self . get ( & url) . await
547
562
}
548
563
549
- pub async fn create_thread ( & mut self , req : CreateThreadRequest ) -> Result < ThreadObject , APIError > {
564
+ pub async fn create_thread (
565
+ & mut self ,
566
+ req : CreateThreadRequest ,
567
+ ) -> Result < ThreadObject , APIError > {
550
568
self . post ( "threads" , & req) . await
551
569
}
552
570
@@ -730,7 +748,10 @@ impl OpenAIClient {
730
748
self . get ( & url) . await
731
749
}
732
750
733
- pub async fn create_batch ( & mut self , req : CreateBatchRequest ) -> Result < BatchResponse , APIError > {
751
+ pub async fn create_batch (
752
+ & mut self ,
753
+ req : CreateBatchRequest ,
754
+ ) -> Result < BatchResponse , APIError > {
734
755
self . post ( "batches" , & req) . await
735
756
}
736
757
0 commit comments