Skip to content

Commit

Permalink
fix error message transformation for google gemini
Browse files Browse the repository at this point in the history
  • Loading branch information
narengogi committed Nov 27, 2024
1 parent 95591fa commit 559f164
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/providers/google/chatComplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ export const GoogleChatCompleteConfig: ProviderConfig = {

export interface GoogleErrorResponse {
error: {
code: number;
code: string;
message: string;
status: string;
details: Array<Record<string, any>>;
Expand Down Expand Up @@ -412,7 +412,7 @@ export const GoogleErrorResponseTransform: (
message: response.error.message ?? '',
type: response.error.status ?? null,
param: null,
code: response.error.status ?? null,
code: response.error.code ?? null,
},
provider
);
Expand All @@ -426,10 +426,10 @@ export const GoogleChatCompleteResponseTransform: (
responseStatus: number
) => ChatCompletionResponse | ErrorResponse = (response, responseStatus) => {
if (responseStatus !== 200) {
const errorResposne = GoogleErrorResponseTransform(
const errorResponse = GoogleErrorResponseTransform(
response as GoogleErrorResponse
);
if (errorResposne) return errorResposne;
if (errorResponse) return errorResponse;
}

if ('candidates' in response) {
Expand Down

0 comments on commit 559f164

Please sign in to comment.