From 8155828271ea576d60f500d8ca1ae3d9cae5205c Mon Sep 17 00:00:00 2001 From: SBrandeis Date: Tue, 7 Jan 2025 17:26:28 +0100 Subject: [PATCH] stringify JSON error when chat completing --- packages/inference/src/tasks/custom/request.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/inference/src/tasks/custom/request.ts b/packages/inference/src/tasks/custom/request.ts index 1e5ddfc98..de25b8175 100644 --- a/packages/inference/src/tasks/custom/request.ts +++ b/packages/inference/src/tasks/custom/request.ts @@ -34,7 +34,7 @@ export async function request( ) { const output = await response.json(); if ([400, 422, 404, 500].includes(response.status) && options?.chatCompletion) { - throw new Error(`Server ${args.model} does not seem to support chat completion. Error: ${output.error}`); + throw new Error(`Server ${args.model} does not seem to support chat completion. Error: ${JSON.stringify(output.error)}`); } if (output.error || output.detail) { throw new Error(JSON.stringify(output.error ?? output.detail));