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

Function createBackgroundFetchUrl

integrations/openai/src/taskUtils.ts:184–216  ·  view source on GitHub ↗
(
  client: OpenAI,
  endpoint: string,
  defaultQuery: OpenAIRequestOptions["query"] = {},
  options: OpenAIRequestOptions = {}
)

Source from the content-addressed store, hash-verified

182}
183
184export function createBackgroundFetchUrl(
185 client: OpenAI,
186 endpoint: string,
187 defaultQuery: OpenAIRequestOptions["query"] = {},
188 options: OpenAIRequestOptions = {}
189) {
190 let baseURL = client.baseURL ?? "https://api.openai.com/v1";
191 if (baseURL.endsWith("/")) {
192 baseURL = baseURL.slice(0, -1);
193 }
194
195 const path = options.path ?? endpoint;
196
197 const url = new URL(`${baseURL}${path}`);
198
199 if (options.query) {
200 for (const [key, value] of Object.entries(options.query)) {
201 if (value !== undefined) {
202 url.searchParams.append(key, value);
203 }
204 }
205 }
206
207 for (const [key, value] of Object.entries(defaultQuery)) {
208 if (value !== undefined) {
209 url.searchParams.append(key, value);
210 } else {
211 url.searchParams.delete(key);
212 }
213 }
214
215 return url.href;
216}
217
218export function createBackgroundFetchHeaders(
219 client: OpenAI,

Callers 8

waitForCompletionMethod · 0.90
waitForProcessingMethod · 0.90
backgroundCreateMethod · 0.90
ChatClass · 0.90
backgroundGenerateMethod · 0.90

Calls 2

sliceMethod · 0.80
deleteMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…