MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / createAndAwait

Method createAndAwait

integrations/replicate/src/trainings.ts:51–84  ·  view source on GitHub ↗

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 }
  )

Source from the content-addressed store, hash-verified

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> {

Callers 2

runMethod · 0.45
replicate.tsFile · 0.45

Calls 4

modelPropertiesFunction · 0.90
callbackPropertiesFunction · 0.90
createMethod · 0.65
runTaskMethod · 0.45

Tested by

no test coverage detected