I am encountering a hillarious error, working in google cloud shell, trying to query gemini-pro vertexai (genai currently not accessible for europeans...!).
I am just taking the python code created by the testbed,
and try to run it in a python file in google cloud shell.
When trying to print the response (print(response.text, end="")) I just get an error:
It produces the error:
Here is the code:
Of course exactly the same code runs perfectly fine in the colab.
How could I completely reset the google cloud shell? (I guess the problem is a collision with some other package there).
i have the same problem , do you find the solution ?
This is my workaround:
i have the same problem
the issue i got it that the server unicorn or the way I run using the FASTAPI
If anyone is facing the same issue, GenerativeModel seems to work differently when you set "stream=True" vs "stream=False". If you use True, the function model.generate_content() returns a 'generator' object which I think generates responses in text once. Once you run through the object, it is spent, and can't be processed further.
If you set to stream = false, you get GenerationResponse object back and then you can parse through that.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |