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

glm.FileData issue? with uris #357

Open
stephaniegoldman12 opened this issue May 24, 2024 · 2 comments
Open

glm.FileData issue? with uris #357

stephaniegoldman12 opened this issue May 24, 2024 · 2 comments
Assignees
Labels
component:python sdk Issue/PR related to Python SDK status:triaged Issue/PR triaged to the corresponding sub-team type:bug Something isn't working

Comments

@stephaniegoldman12
Copy link

Description of the bug:

google.api_core.exceptions.InvalidArgument: 400 Invalid or unsupported file uri:

glm.FileData with a uri doesn't seem to work? I need to use Part.from_uri from the old vertex.preview library, but that library does not let me use model = genai.GenerativeModel('gemini-1.5-pro-latest')

Actual vs expected behavior:

api_key = os.getenv("GEMINI_API_KEY")
genai.configure(api_key=api_key)
model = genai.GenerativeModel('gemini-1.5-pro-latest')
response = model.generate_content(
glm.Content(
parts = [
glm.Part(text="What is this image of?"),
glm.Part(
file_data=glm.FileData(
mime_type='image/png',
file_uri="gs://urihere.png"
)
),
],
),
stream=False)

print(response)

I'd expect this to work...but it says unsupported file uri (note: the uri is correct i just put a placeholder here for the example)

Any other information you'd like to share?

No response

@stephaniegoldman12 stephaniegoldman12 added component:python sdk Issue/PR related to Python SDK type:bug Something isn't working labels May 24, 2024
@zadiaz
Copy link

zadiaz commented May 24, 2024

same here
Screenshot 2024-05-24 at 11 29 39 AM

@singhniraj08 singhniraj08 added the status:triaged Issue/PR triaged to the corresponding sub-team label May 27, 2024
@va-mzaki
Copy link

@zadiaz i think the only supported URI is the URIs from google file manager that start with https://generativelanguage.googleapis.com/v1beta/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:python sdk Issue/PR related to Python SDK status:triaged Issue/PR triaged to the corresponding sub-team type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants