Closed palladius closed 1 month ago
I proposed a patch both for Gemini and for Vertex. Even in vertex, changing that line helps.
Before the cure (ignore the file name, its solving a different issue from this):
/Users/ricc/git/ecommerce-ai-assistant-demo-gemini/lib/vertex_monkey_patch.rb:52:in `chat': #<Net::HTTPForbidden:0x000000013c914b18> (StandardError)
After the cure:
/Users/ricc/git/ecommerce-ai-assistant-demo-gemini/lib/vertex_monkey_patch.rb:52:in `chat': { (StandardError)
"error": {
"code": 403,
"message": "Permission denied on resource project palladius-genai-fake-project.",
"status": "PERMISSION_DENIED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"description": "Google developers console",
"url": "https://console.developers.google.com"
}
]
},
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "CONSUMER_INVALID",
"domain": "googleapis.com",
"metadata": {
"service": "aiplatform.googleapis.com",
"consumer": "projects/palladius-genai-fake-project"
}
}
]
}
}
another PR for Vertex: https://github.com/patterns-ai-core/langchainrb/pull/775
Fixed.
Every time Gemini calls fail, I find it very hard to troubleshoot. The error I get is something like this:
and the only info I get is that its probably a 400.
I found the culprit to be this code:
By changing it to
raise StandardError.new(response.body)
you get something like this:I think it's prety safe and much more meaningful to just raise the response body payload, since Google gives meaningful messages like "API KEY expired" or "API not available in this country".