-
Notifications
You must be signed in to change notification settings - Fork 10
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
Fix initialization of google-generativeai
#76
Comments
Hey @NP4567-dev, are you using the latest version of EcoLogits (0.3.2) we have already fixed the issue with google in #62 ? Otherwise, I agree on the fact that we need to let the user choose which tracer to initialize, discussed in #65. We will update it very soon. |
I'm on version 0.3.2, I think the problem comes from having google.generativeai instead of google-generativeai (as the fix in #62 suggested) |
Changing Can you @NP4567-dev, please provide the full error trace and the output of the Thanks 🙏 |
google-generativeai
I believe it is related to the Here is as much stacktrace as I can provide:
|
Thanks, so probably changing to the following would fix that issue. First look for def init_google_instrumentor() -> None:
if importlib.util.find_spec("google") is not None \
and importlib.util.find_spec("google.generativeai") is not None:
from ecologits.tracers.google_tracer import GoogleInstrumentor
instrumentor = GoogleInstrumentor()
instrumentor.instrument() |
I applied this change locally and it works, this seems like a viable fix 🥳 |
Fixed by #77 |
Description
Problem:
Starting from a new venv, Ecologits.init() raises the following error when initiating google_instrumentor:
Relevant information:
Workaround:
Adding google-generativeai to my pyproject.toml solves the problem.
This works but is not perfect as I install a bunch of packages I'll never need.
"Easy fix":
if importlib.util.find_spec("google.generativeai") is not None:
becomes:
if importlib.util.find_spec("google-generativeai") is not None:
Everything works fine in my case but I have no way to validate it works for an user using google-generativeai.
New feature solution:
Enabling the user to choose which publisher to load at the init.
This could avert the occurrence of an environment-specific issue that renders the entire package unusable.
I started adding such a feature on my fork, let me know if you are interested on adding it to the main repo.
The text was updated successfully, but these errors were encountered: