export type PatchApiV1EvalsCriteriaIdArgs = {id: string, body: {name?: string | undefined, metric?: string | undefined, threshold?: (number | null) | undefined, weighting?: number | undefined, parameters?: Record | undefined}}; export type PatchApiV1EvalsCriteriaIdOptions = {baseUrl?: string | undefined, ProjectPrivateApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a criterion * * PATCH /v1/evals/criteria/{id} */ export const patchApiV1EvalsCriteriaId = async (args: PatchApiV1EvalsCriteriaIdArgs, options?: PatchApiV1EvalsCriteriaIdOptions) => { const {baseUrl = "https://api.lunary.ai", fetch: fetchFn = fetch, ProjectPrivateApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ProjectPrivateApiKeyAuth !== undefined) headers.set('authorization', `Bearer ${ProjectPrivateApiKeyAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/evals/criteria/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };