export type CreateApiV1EvalsIdRunArgs = {id: string}; export type CreateApiV1EvalsIdRunOptions = {baseUrl?: string | undefined, ProjectPrivateApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Run the evaluation * * POST /v1/evals/{id}/run */ export const createApiV1EvalsIdRun = async (args: CreateApiV1EvalsIdRunArgs, options?: CreateApiV1EvalsIdRunOptions) => { const {baseUrl = "https://api.lunary.ai", fetch: fetchFn = fetch, ProjectPrivateApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (ProjectPrivateApiKeyAuth !== undefined) headers.set('authorization', `Bearer ${ProjectPrivateApiKeyAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/evals/${encodeURIComponent(String(args.id))}/run${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };