Skip to content

Handle Vertex embedding errors in different formats

Madelein van Niekerk requested to merge fix/vertex-response-error into master

What does this MR do and why?

Responses from the AI Gateway are formatted by response modifiers. The modifier for text embeddings expects errors to be in the format

{ error: { message: "" } }

e.g.

{"error"=>{"code"=>400, "message"=>"The text content is empty.", "status"=>"INVALID_ARGUMENT"}}

but the AI Gateway also can respond with errors in the format

{ error: "" }

We need to handle both cases in the response modifier.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Madelein van Niekerk

Merge request reports