-
-
Notifications
You must be signed in to change notification settings - Fork 797
newly introduced google genai introduced unexpected dependency issue #1412
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
Comments
due to 567-labs/instructor#1412 Signed-off-by: Jingkai He <[email protected]>
+1, same issue |
+1, same (importing instructor[vertex]). version-fixing Instructor back to 1.7.4 fixed it. |
I've managed to reproduce the issue with this code snippet ( terminal output shown below ) import instructor
from openai import OpenAI
from pydantic import BaseModel
class User(BaseModel):
name: str
age: int
client = instructor.from_openai(
OpenAI(),
)
resp = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Ivan is 20 years old"}],
response_model=User,
)
print(resp) This was the set of terminal commands ivanleo@Ivans-MacBook-Pro ~/D/c/test (main)> uv venv
Using CPython 3.12.7
Creating virtual environment at: .venv
Activate with: source .venv/bin/activate.fish
ivanleo@Ivans-MacBook-Pro ~/D/c/test (main)> uv pip install googleapis-common-protos instructor
Resolved 40 packages in 16ms
Installed 40 packages in 86ms
...
+ instructor==1.7.5
...
+ urllib3==2.3.0
+ yarl==1.18.3
ivanleo@Ivans-MacBook-Pro ~/D/c/test (main)> python3 ./main.py
Traceback (most recent call last):
File "/Users/ivanleo/Documents/coding/test/./main.py", line 1, in <module>
import instructor
File "/Users/ivanleo/Documents/coding/test/.venv/lib/python3.12/site-packages/instructor/__init__.py", line 111, in <module>
from .client_genai import from_genai
File "/Users/ivanleo/Documents/coding/test/.venv/lib/python3.12/site-packages/instructor/client_genai.py", line 6, in <module>
from google.genai import Client
ModuleNotFoundError: No module named 'google.genai' I've just merged in a PR for #1414 that fixes this ( as seen below when I install from the main branch ) ivanleo@Ivans-MacBook-Pro ~/D/c/test (main) [1]> uv pip install git+https://github.com/instructor-ai/instructor.git@main
Updated https://github.com/instructor-ai/instructor.git (f1ba688)
Resolved 38 packages in 759ms
Uninstalled 1 package in 4ms
Installed 1 package in 2ms
- instructor==1.7.5
+ instructor==1.7.5 (from git+https://github.com/instructor-ai/instructor.git@f1ba688554aace535b6088789d4f0a4f7ad911cb)
ivanleo@Ivans-MacBook-Pro ~/D/c/test (main)> python3 ./main.py
name='Ivan' age=20
ivanleo@Ivans-MacBook-Pro ~/D/c/test (main)> |
Going to close this issue since 1.7.6 should solve it. Just verified on my end that with 1.7.6 this no longer gets thrown.
|
Feel free to re-open if the issue persists, will debug! :) |
can confirm the issue has been resolved. thanks for the speedy fix! |
Awesome great to hear! Thanks so much for opening an issue so we can
resolve this :)
…On Mon, Mar 17, 2025 at 10:27 AM Jingkai He ***@***.***> wrote:
can confirm the issue has been resolved. thanks for the speedy fix!
—
Reply to this email directly, view it on GitHub
<#1412 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AK5D6RUMACDO3NQ2EW3H4J32U2IPLAVCNFSM6AAAAABZDZ4BFKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMRYG42TSMRVHE>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
[image: jingkaihe]*jingkaihe* left a comment
(567-labs/instructor#1412)
<#1412 (comment)>
can confirm the issue has been resolved. thanks for the speedy fix!
—
Reply to this email directly, view it on GitHub
<#1412 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AK5D6RUMACDO3NQ2EW3H4J32U2IPLAVCNFSM6AAAAABZDZ4BFKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMRYG42TSMRVHE>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
Uh oh!
There was an error while loading. Please reload this page.
What Model are you using?
Describe the bug
In my project I have
googleapis-common-protos
used by the open telemetry library, which has agoogle
as the python package prefix.The recently introduced genai support #1393 import the genai package as soon as it noticed the existence of
google
package https://github.com/instructor-ai/instructor/blob/cffd696e75a12e8803f30e7101a0216ea4680376/instructor/__init__.py#L110-L113in this case without installing https://github.com/googleapis/python-genai library the instructor library failed to be initialised
To Reproduce
as soon as the instructor package is upgraded to ==1.7.5
I get
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
The text was updated successfully, but these errors were encountered: