Create a new training and await the result.
(
key: IntegrationTaskKey,
params: {
model_owner: string;
model_name: string;
version_id: string;
} & Omit<
Parameters<ReplicateClient["trainings"]["create"]>[3],
"webhook" | "webhook_events_filter"
>,
options: CallbackTimeout = { timeoutInSeconds: 3600 }
)
| 49 | |
| 50 | /** Create a new training and await the result. */ |
| 51 | createAndAwait( |
| 52 | key: IntegrationTaskKey, |
| 53 | params: { |
| 54 | model_owner: string; |
| 55 | model_name: string; |
| 56 | version_id: string; |
| 57 | } & Omit< |
| 58 | Parameters<ReplicateClient["trainings"]["create"]>[3], |
| 59 | "webhook" | "webhook_events_filter" |
| 60 | >, |
| 61 | options: CallbackTimeout = { timeoutInSeconds: 3600 } |
| 62 | ): ReplicateReturnType<Training> { |
| 63 | return this.runTask( |
| 64 | key, |
| 65 | (client, task) => { |
| 66 | const { model_owner, model_name, version_id, ...options } = params; |
| 67 | |
| 68 | return client.trainings.create(model_owner, model_name, version_id, { |
| 69 | ...options, |
| 70 | webhook: task.callbackUrl ?? "", |
| 71 | webhook_events_filter: ["completed"], |
| 72 | }); |
| 73 | }, |
| 74 | { |
| 75 | name: "Create And Await Training", |
| 76 | params, |
| 77 | properties: [...modelProperties(params), ...callbackProperties(options)], |
| 78 | callback: { |
| 79 | enabled: true, |
| 80 | timeoutInSeconds: options.timeoutInSeconds, |
| 81 | }, |
| 82 | } |
| 83 | ); |
| 84 | } |
| 85 | |
| 86 | /** Fetch a training. */ |
| 87 | get(key: IntegrationTaskKey, params: { id: string }): ReplicateReturnType<Training> { |
no test coverage detected