Skip to content

Commit

Permalink
stringify JSON error when chat completing
Browse files Browse the repository at this point in the history
  • Loading branch information
SBrandeis committed Jan 7, 2025
1 parent 43f739f commit 8155828
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/inference/src/tasks/custom/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function request<T>(
) {
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));
Expand Down

0 comments on commit 8155828

Please sign in to comment.