1- type Identifier = `${string } /${string } :${string } `;
2- type WebhookEventType = 'start' | 'output' | 'logs' | 'completed' ;
1+ declare module 'replicate' {
2+ type Status = 'starting' | 'processing' | 'succeeded' | 'failed' | 'canceled' ;
3+ type WebhookEventType = 'start' | 'output' | 'logs' | 'completed' ;
34
4- interface Page < T > {
5- previous ?: string ;
6- next ?: string ;
7- results : T [ ] ;
8- }
5+ interface Page < T > {
6+ previous ?: string ;
7+ next ?: string ;
8+ results : T [ ] ;
9+ }
910
10- declare module 'replicate' {
1111 export interface Collection {
12- id : string ;
1312 name : string ;
1413 slug : string ;
1514 description : string ;
16- created : string ;
17- updated : string ;
15+ models : Model [ ] ;
1816 }
1917
2018 export interface Model {
21- id : string ;
22- name : string ;
19+ url : string ;
2320 owner : string ;
24- created : string ;
25- updated : string ;
21+ name : string ;
22+ description : string ;
23+ visibility : 'public' | 'private' ;
24+ github_url : string ;
25+ paper_url : string ;
26+ license_url : string ;
27+ run_count : number ;
28+ cover_image_url : string ;
29+ default_example ?: Prediction ;
30+ latest_version ?: ModelVersion ;
2631 }
2732
2833 export interface ModelVersion {
2934 id : string ;
30- model : string ;
31- created : string ;
32- updated : string ;
35+ created_at : string ;
36+ cog_version : string ;
37+ openapi_schema : object ;
3338 }
3439
3540 export interface Prediction {
3641 id : string ;
42+ status : Status ;
3743 version : string ;
38- input : any ;
44+ input : object ;
3945 output : any ;
46+ source : 'api' | 'web' ;
47+ error ?: any ;
48+ logs ?: string ;
49+ metrics ?: {
50+ predicti_time ?: number ;
51+ }
4052 webhook ?: string ;
4153 webhook_events_filter ?: WebhookEventType [ ] ;
42- created : string ;
43- updated : string ;
54+ created_at : string ;
55+ updated_at : string ;
56+ completed_at ?: string ;
4457 }
4558
4659 export default class Replicate {
@@ -56,7 +69,7 @@ declare module 'replicate' {
5669 private instance : any ;
5770
5871 run (
59- identifier : Identifier ,
72+ identifier : `${ string } /${ string } :${ string } ` ,
6073 options : {
6174 input : object ;
6275 wait ?: boolean | { interval ?: number ; maxAttempts ?: number } ;
@@ -65,7 +78,7 @@ declare module 'replicate' {
6578 }
6679 ) : Promise < object > ;
6780 request ( route : string , parameters : any ) : Promise < any > ;
68- paginate < T > ( endpoint : ( ) => Promise < Page < T > > ) : AsyncGenerator < [ T ] > ;
81+ paginate < T > ( endpoint : ( ) => Promise < Page < T > > ) : AsyncGenerator < [ T ] > ;
6982 wait (
7083 prediction : Prediction ,
7184 options : {
@@ -93,7 +106,7 @@ declare module 'replicate' {
93106 predictions : {
94107 create ( options : {
95108 version : string ;
96- input : any ;
109+ input : object ;
97110 webhook ?: string ;
98111 webhook_events_filter ?: WebhookEventType [ ] ;
99112 } ) : Promise < Prediction > ;
0 commit comments