MCPcopy
hub / github.com/triggerdotdev/trigger.dev / runTask

Method runTask

integrations/openai/src/index.ts:101–126  ·  view source on GitHub ↗
(
    key: IntegrationTaskKey,
    callback: (client: OpenAIApi, task: IOTask, io: IO) => Promise<TResult>,
    options?: RunTaskOptions,
    errorCallback?: RunTaskErrorCallback
  )

Source from the content-addressed store, hash-verified

99 }
100
101 runTask<T, TResult extends Json<T> | void>(
102 key: IntegrationTaskKey,
103 callback: (client: OpenAIApi, task: IOTask, io: IO) => Promise<TResult>,
104 options?: RunTaskOptions,
105 errorCallback?: RunTaskErrorCallback
106 ): Promise<TResult> {
107 if (!this._io)
108 throw new Error(
109 "Issue with running task: IO not found. It's possible that you forgot to prefix openai with io. inside a run"
110 );
111 if (!this._connectionKey) throw new Error("No connection key");
112 return this._io.runTask(
113 key,
114 (task, io) => {
115 if (!this._client) throw new Error("No client");
116 return callback(this._client, task, io);
117 },
118 {
119 icon: this._options.icon ?? "openai",
120 retry: retry.exponentialBackoff,
121 ...(options ?? {}),
122 connectionKey: this._connectionKey,
123 },
124 errorCallback
125 );
126 }
127
128 get models() {
129 return new Models(this.runTask.bind(this));

Callers 15

createMethod · 0.45
updateMethod · 0.45
listMethod · 0.45
delMethod · 0.45
retrieveMethod · 0.45
createAndRunMethod · 0.45
createMethod · 0.45
retrieveMethod · 0.45
updateMethod · 0.45
delMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected