Skip to content

Commit 474e4ef

Browse files
frascuchonWauplin
andauthored
FIX: adapt error message extractor to the new format (#1507)
Recently, I've seen some chatCompletion errors rendered as "[object Object]". Doing some debugging, I see the returned error object does not contain `error` or `details` attributes, but `message` (See image attached). I've changed the codebase to support this attribute. <img width="1234" alt="Captura de pantalla 2025-06-02 a las 10 47 49" src="https://github.com/user-attachments/assets/cceeb418-1a9e-4729-8856-df50ba2224f2" /> Co-authored-by: Lucain <[email protected]>
1 parent 6e5ac81 commit 474e4ef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/inference/src/utils/request.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ export async function innerRequest<T>(
6565
{ requestId: response.headers.get("x-request-id") ?? "", status: response.status, body: output }
6666
);
6767
}
68-
if (typeof output.error === "string" || typeof output.detail === "string") {
68+
if (typeof output.error === "string" || typeof output.detail === "string" || typeof output.message === "string") {
6969
throw new InferenceClientProviderApiError(
70-
`Failed to perform inference: ${output.error ?? output.detail}`,
70+
`Failed to perform inference: ${output.error ?? output.detail ?? output.message}`,
7171
{
7272
url,
7373
method: info.method ?? "GET",

0 commit comments

Comments
 (0)