forked from replicate/replicate-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
119 lines (102 loc) · 2.61 KB
/
index.d.ts
File metadata and controls
119 lines (102 loc) · 2.61 KB
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
type Identifier = `${string}/${string}:${string}`;
type WebhookEventType = "start" | "output" | "logs" | "completed";
declare module "replicate" {
export interface ReplicateOptions {
auth: string;
userAgent?: string;
baseUrl?: string;
}
export interface Collection {
id: string;
name: string;
slug: string;
description: string;
created: string;
updated: string;
}
export interface Model {
id: string;
name: string;
owner: string;
created: string;
updated: string;
}
export interface ModelVersion {
id: string;
model: string;
created: string;
updated: string;
}
export interface Prediction {
id: string;
version: string;
input: any;
output: any;
webhook?: string;
webhook_events_filter?: WebhookEventType[];
created: string;
updated: string;
}
export interface CollectionsGetOptions {
collection_slug: string;
}
export interface ModelsGetOptions {
model_owner: string;
model_name: string;
}
export interface ModelsVersionsListOptions {
model_owner: string;
model_name: string;
}
export interface ModelsVersionsGetOptions {
model_owner: string;
model_name: string;
id: string;
}
export interface PredictionsCreateOptions {
version: string;
input: any;
webhook?: string;
webhook_events_filter?: WebhookEventType[];
}
export interface PredictionsGetOptions {
predictionId: string;
}
export class Replicate {
constructor(options: ReplicateOptions);
run(
identifier: Identifier,
options: {
input: object;
wait?: boolean | { interval?: number; maxAttempts?: number };
webhook?: string;
webhook_events_filter?: WebhookEventType[];
}
): Promise<object>;
request(route: string, parameters: any): Promise<any>;
paginate<T>(endpoint: () => Promise<T>): AsyncGenerator<T[]>;
wait(
prediction: Prediction,
options: {
interval?: number;
maxAttempts?: number;
}
): Promise<Prediction>;
collections: {
get(options: CollectionsGetOptions): Promise<Collection>;
};
models: {
get(options: ModelsGetOptions): Promise<Model>;
versions: {
list(options: ModelsVersionsListOptions): Promise<ModelVersion[]>;
get(options: ModelsVersionsGetOptions): Promise<ModelVersion>;
};
};
predictions: {
create(options: PredictionsCreateOptions): Promise<Prediction>;
get(options: PredictionsGetOptions): Promise<Prediction>;
list(): Promise<Prediction[]>;
};
}
export default Replicate;
}