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

Prompting with videos return 403 error #737

Closed
kadzaki opened this issue Aug 2, 2024 · 3 comments
Closed

Prompting with videos return 403 error #737

kadzaki opened this issue Aug 2, 2024 · 3 comments
Assignees

Comments

@kadzaki
Copy link

kadzaki commented Aug 2, 2024

Prompting with videos return the following error, while it works with classic Gemini API:
HTTP error downloading media 'https://generativelanguage.googleapis.com/v1beta/files/uu320af6jeh8': {
"error": {
"code": 403,
"message": "Method doesn't allow unregistered callers (callers without established identity). Please use API Key or other form of API consumer identity to call this API.",
"status": "PERMISSION_DENIED"
}
}

With Genkit (not working):
const response = await generate({
model: gemini15Pro,
prompt: [
{ text: prompt },
{
media: {
url: uploadResponse.file.uri,
contentType: uploadResponse.file.mimeType,
},
},
]
});

With classic Gemini API (works):
const result = await model.generateContent([
{
fileData: {
mimeType: uploadResponse.file.mimeType,
fileUri: uploadResponse.file.uri
}
},
{ text: "Summarize this video." },
]);

@mbleigh
Copy link
Collaborator

mbleigh commented Aug 2, 2024

I suspect this is because Genkit attempts to download https URLs and inline them as base64-encoded data for Gemini APIs since Gemini hasn't traditionally supports https URLs directly.

We may need to special case the File API URLs.

Can you show me the code that you are running that gave you uploadResponse?

@kadzaki
Copy link
Author

kadzaki commented Aug 3, 2024

const uploadResponse = await fileManager.uploadFile("test-video.mp4", {
mimeType: "video/mp4",
displayName: "Test video",
});
....
const response = await generate({
model: gemini15Pro,
prompt: [
{ text: prompt },
{
media: {
url: uploadResponse.file.uri,
contentType: uploadResponse.file.mimeType,
},
},
]
});

@mbleigh
Copy link
Collaborator

mbleigh commented Aug 3, 2024

This should be fixed by #742 and will be included in the next release after it's merged!

@mbleigh mbleigh self-assigned this Aug 3, 2024
@mbleigh mbleigh closed this as completed in 19a6223 Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants