const apiResponse = await fetch(apiUrl, { method: "POST", headers: { "Content-Type": "application/json", "x-portkey-api-key": process.env.PORTKEY_API_KEY, "x-portkey-provider": "cerebras", "x-portkey-trace-id": metadata.traceID, "x-portkey-metadata": JSON.stringify(metadata), }, body: JSON.stringify(logData), });
async function logPortkeyRequest(request, response, metadata) { const apiUrl = "https://api.portkey.ai/v1/logs"; const logData = { request, response, }; try { const apiResponse = await fetch(apiUrl, { method: "POST", headers: { "Content-Type": "application/json", "x-portkey-api-key": process.env.PORTKEY_API_KEY, "x-portkey-provider": "cerebras", "x-portkey-trace-id": metadata.traceID, "x-portkey-metadata": JSON.stringify(metadata), }, body: JSON.stringify(logData), }); if (!apiResponse.ok) { console.error("Failed to log request:", apiResponse.statusText); } } catch (error) { console.error("Error logging request:", error); Sentry.captureException(error); } }
async function logPortkeyRequest(request, response, metadata) { const apiUrl = "https://api.portkey.ai/v1/logs"; const logData = { request, response, metadata }; try { const apiResponse = await fetch(apiUrl, { method: "POST", headers: { "Content-Type": "application/json", "x-portkey-api-key": process.env.PORTKEY_API_KEY, "x-portkey-provider": "cerebras", "x-portkey-trace-id": metadata.traceID, }, body: JSON.stringify(logData), }); if (!apiResponse.ok) { console.error("Failed to log request:", apiResponse.statusText); } } catch (error) { console.error("Error logging request:", error); Sentry.captureException(error); } }