Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: throw openai error response #77

Merged
merged 3 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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