admin管理员组文章数量:1302266
I'm encountering an ImportError after upgrading the google-generativeai library. The error is: ImportError: cannot import name 'get_default_text_client' from 'google.generativeai.client' (/path/to/my/site-packages/google/generativeai/client.py) # Replace with your actual path!
I'm using Python [3.10] and installed the library using pip install --upgrade google-generativeai.
Here's a minimal code example that reproduces the error: Python
import os from google.generativeai import text
os.environ["GOOGLE_API_KEY"] = "xyz"
I'm not sure what's causing this issue. Any help would be greatly appreciated!
I have tried the following:
- Upgrading google-generativeai using pip install --upgrade google-generativeai.
- Uninstalling and reinstalling google-generativeai: pip uninstall google-generativeai followed by pip install google-generativeai.
- Restarting my Jupyter kernel/Python interpreter.
I'm encountering an ImportError after upgrading the google-generativeai library. The error is: ImportError: cannot import name 'get_default_text_client' from 'google.generativeai.client' (/path/to/my/site-packages/google/generativeai/client.py) # Replace with your actual path!
I'm using Python [3.10] and installed the library using pip install --upgrade google-generativeai.
Here's a minimal code example that reproduces the error: Python
import os from google.generativeai import text
os.environ["GOOGLE_API_KEY"] = "xyz"
I'm not sure what's causing this issue. Any help would be greatly appreciated!
I have tried the following:
- Upgrading google-generativeai using pip install --upgrade google-generativeai.
- Uninstalling and reinstalling google-generativeai: pip uninstall google-generativeai followed by pip install google-generativeai.
- Restarting my Jupyter kernel/Python interpreter.
2 Answers
Reset to default 0get_default_text_client
is no longer available after version 0.7.2. On this version it's on line 347 of client.py. From version 0.7.3 on it's not longer in client.py.
If you really want to use it and don't want to work around it I'd suggest downgrading back to v0.7.2
The text
part of the SDK was for the PaLM API. As Jesper pointed out, it's been removed from the SDK. Downgrading won't help though, because the API endpoints are no longer running either.
Consider migrating to the new google-genai
package that was built for Gemini 2.0 & supports both the natural Gemini API as well as Vertex.
本文标签:
版权声明:本文标题:python - ImportError: Cannot import name 'get_default_text_client' from 'google.generativeai.client& 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741670227a2391558.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论