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

Quickstart script is not working as expected #604

Closed
codewithnick opened this issue Oct 17, 2024 · 5 comments
Closed

Quickstart script is not working as expected #604

codewithnick opened this issue Oct 17, 2024 · 5 comments
Assignees
Labels
component:python sdk Issue/PR related to Python SDK status:awaiting user response Awaiting a response from the author type:help Support-related issues

Comments

@codewithnick
Copy link

Description of the bug:

I am following the quickstart script to generate content

import os
import google.generativeai as genai
import dotenv
dotenv.load_dotenv()
GEMINI_API_KEY = os.getenv('GEMINI_API_KEY')
#print(GEMINI_API_KEY)
genai.configure(api_key=GEMINI_API_KEY)
model = genai.GenerativeModel("gemini-1.5-flash")
response = model.generate_content("Write a story about a magic backpack.")
print(response.text)

Actual vs expected behavior:

Actual behaviour :
image
nothing is being printed, no error nothing, gemini has got stuck i have no idea how to debug this

Expected behavior:
response must be printed

Any other information you'd like to share?

GEMINI_API_KEY is corrrect and new , even tried printing it and it prints correctly
python version: 3.12.6
OS: mac

@manojssmk manojssmk added component:python sdk Issue/PR related to Python SDK type:help Support-related issues labels Oct 17, 2024
@manojssmk
Copy link

Hi @codewithnick

I ran the same code with the same versions in VS Code, and it worked fine. The output may take time since there's an API call involved. Have you tried running it in Google Colab?

Thanks

@manojssmk manojssmk added the status:awaiting user response Awaiting a response from the author label Oct 17, 2024
@manojssmk manojssmk self-assigned this Oct 17, 2024
@codewithnick
Copy link
Author

I tried making a postman request with the same api key and it worked,probably something is wrong with the python module , the biggest problem is i don't know how to debug this ,there is no response no error at all it just gets stuck.

@manojssmk
Copy link

Can you try downgrading or rolling back to python <= 3.11.x.

@codewithnick
Copy link
Author

tried that, same problem

@codewithnick
Copy link
Author

ok i fixed that after some trail and error , looks like my venv and python version were different i reinstalled and resetup everything

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:awaiting user response Awaiting a response from the author type:help Support-related issues
Projects
None yet
Development

No branches or pull requests

2 participants