Skip to content
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

Google Vertex AI gives error about SafetySetting #4797

Closed
mieslep opened this issue Nov 22, 2024 · 2 comments
Closed

Google Vertex AI gives error about SafetySetting #4797

mieslep opened this issue Nov 22, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@mieslep
Copy link
Contributor

mieslep commented Nov 22, 2024

Bug Description

Changes in LangChain have broken the langchain-google-vertexai package, resulting in error:

"name": "PydanticUndefinedAnnotation",
"message": "name 'SafetySetting' is not defined

This is related to langchain-ai/langchain-google#610 (comment) and langchain-ai/langchain-google#613 , so presumably Langflow simply has a bad dependency.

Reproduction

[project]
name = "test"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"ipykernel>=6.29.5",
"ipywidgets>=8.1.5",
"python-dotenv>=1.0.1",
"pypdf>=5.1.0",
"langchain-core>=0.3.20",
"langchain-google-vertexai>=2.0.7",
]

from langchain_google_vertexai import VertexAI
model = VertexAI(model_name="gemini-1.5-flash-001")

Expected behavior

There should be no error.

Who can help?

No response

Operating System

Windows

Langflow Version

1.1.0

Python Version

None

Screenshot

No response

Flow File

No response

@mieslep mieslep added the bug Something isn't working label Nov 22, 2024
@edwinjosechittilappilly
Copy link
Collaborator

edwinjosechittilappilly commented Nov 22, 2024

Thank you for your feedback. We tested this on main and were not able to reproduce. Please reopen if you hit this and provide a trace.

@sahilgupta2105
Copy link

sahilgupta2105 commented Jan 5, 2025

I see the same error when trying to run the example notebook from GCP Gen-AI.

Edit: Upgrading the pip packages to the latest versions also results in the same error.

Error trace below,

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/pydantic/_internal/_generate_schema.py](https://localhost:8080/#) in _common_field_schema(self, name, field_info, decorators)
   1226             try:
-> 1227                 evaluated_type = _typing_extra.eval_type(field_info.annotation, *self._types_namespace)
   1228             except NameError as e:

29 frames
NameError: name 'SafetySetting' is not defined

The above exception was the direct cause of the following exception:

PydanticUndefinedAnnotation               Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/pydantic/_internal/_generate_schema.py](https://localhost:8080/#) in _common_field_schema(self, name, field_info, decorators)
   1227                 evaluated_type = _typing_extra.eval_type(field_info.annotation, *self._types_namespace)
   1228             except NameError as e:
-> 1229                 raise PydanticUndefinedAnnotation.from_name_error(e) from e
   1230             evaluated_type = replace_types(evaluated_type, self._typevars_map)
   1231             field_info.evaluated = True

PydanticUndefinedAnnotation: name 'SafetySetting' is not defined

For further information visit https://errors.pydantic.dev/2.10/u/undefined-annotation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants