🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
import { type NextApiRequest, type NextApiResponse } from "next";
import Cors from "cors";
export function runMiddleware(
req: NextApiRequest,
res: NextApiResponse,
fn: Function,
) {
return new Promise((resolve, reject) => {
fn(req, res, (result: unknown) => {
if (result instanceof Error) {
return reject(result);
}
return resolve(result);
});
});
}
export const cors = Cors({
origin: true,
//update: or "origin: true," if you don't wanna add a specific one
credentials: false,
});