You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importvertexaifromvertexai.generative_modelsimportGenerativeModel# TODO(developer): Update and un-comment below linePROJECT_ID="your-project-id"vertexai.init(project=PROJECT_ID, location="us-central1")
model=GenerativeModel("gemini-1.5-flash-002")
reveal_type(model)
response=model.generate_content(
"What's a good name for a flower shop that specializes in selling bouquets of dried flowers?"
)
reveal_type(response)
print(response.text)
►mypy
scripts/gc_sdk.py:1: error: Skipping analyzing "vertexai": module is installed, but missing library stubs or py.typed marker [import-untyped]
scripts/gc_sdk.py:2: error: Skipping analyzing "vertexai.generative_models": module is installed, but missing library stubs or py.typed marker [import-untyped]
scripts/gc_sdk.py:2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
scripts/gc_sdk.py:9: note: Revealed type is "Any"
scripts/gc_sdk.py:13: note: Revealed type is "Any"
And if I add the py.typed manually..
►mypy
scripts/gc_sdk.py:9: note: Revealed type is "vertexai.generative_models._generative_models.GenerativeModel"
scripts/gc_sdk.py:13: note: Revealed type is "vertexai.generative_models._generative_models.GenerationResponse"
Found 2 errors in 1 file (checked 48 source files)
This would help find issues using the lib, for example:
model = GenerativeModel("gemini-1.5-flash", version="002")
scripts/gc_sdk.py:8: error: Unexpected keyword argument "version" for "GenerativeModel" [call-arg]
Describe the solution you'd like
I would like you to consider adding a empty file py.typed inside the vertexai directory
Describe alternatives you've considered
I am considering creating the py.typed just before I ran mypy in my CI
This way, I could use this lib with type safety
Additional context
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Despite being typed, this package doesnt include a
py.typed
file.As a user, i am struggling to benefit from the defined types
Consider the code featured in the quickstart page
And if I add the py.typed manually..
This would help find issues using the lib, for example:
Describe the solution you'd like
I would like you to consider adding a empty file
py.typed
inside the vertexai directoryDescribe alternatives you've considered
I am considering creating the
py.typed
just before I ranmypy
in my CIThis way, I could use this lib with type safety
Additional context
The text was updated successfully, but these errors were encountered: