Skip to content

Commit

Permalink
fix: throw openai error response (#77)
Browse files Browse the repository at this point in the history
Co-authored-by: Saikat Mitra <saikatmitra91@gmail.com>
  • Loading branch information
KaustubhKumar05 and saikatmitra91 authored Apr 3, 2024
1 parent fa1c0c3 commit a9e840a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/gold-hounds-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@empiricalrun/ai": patch
---

fix: openai errors not getting captured
4 changes: 2 additions & 2 deletions packages/ai/src/providers/openai/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const createChatCompletion: ICreateChatCompletion = async (body) => {
retry(err);
throw err;
}
return err;
throw err;
});
},
{
Expand All @@ -48,7 +48,7 @@ const createChatCompletion: ICreateChatCompletion = async (body) => {
} catch (err) {
throw new AIError(
AIErrorEnum.FAILED_CHAT_COMPLETION,
`failed chat completion for model openai ${body.model} with error code: ${(err as OpenAI.ErrorObject).code}`,
`failed chat completion for model openai "${body.model}" with the error message: ${(err as any)?.error?.message}`,
);
}
};
Expand Down

0 comments on commit a9e840a

Please sign in to comment.