langflow-ai / langflow

Langflow is a low-code app builder for RAG and multi-agent AI applications. Itโ€™s Python-based and agnostic to any model, API, or database.
http://www.langflow.org
MIT License
28.57k stars 3.67k forks source link

use the new model_fields attribute instead of the deprecated __fields__ attribute #3666

Open tonybenny2020 opened 1 week ago

tonybenny2020 commented 1 week ago

Bug Description

When running pyhton3 -m flow langflow run and checking the playground for basic prompting(hello world) we are getting errors like "use the new model_fields attribute instead of the deprecated fields attribute".It actually relates to the Pydantic code .It would be great if the correct suite requirements are specified like python version , Pydantic version etc to resolve the issue for langflow.

Reproduction

Run the langflow with python3 -m langflow run and click on the playground for the Basic Prompting hello world.

Then ask questions in the chat , the session will be hung and no response will be there due to the error

/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/nest_asyncio.py:126: RuntimeWarning: coroutine 'TracingService._end_and_reset' was never awaited
  handle = ready.popleft()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pydantic/main.py:1059: PydanticDeprecatedSince20: The `__fields__` attribute is deprecated, use `model_fields` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.8/migration/
  warnings.warn(
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/nest_asyncio.py:139: RuntimeWarning: coroutine 'TracingService._end_and_reset' was never awaited
  handle = None
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/langchain_core/_api/beta_decorator.py:87: LangChainBetaWarning: The function `load` is in beta. It is actively being worked on, so the API may change.
  warn_beta(
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/nest_asyncio.py:139: RuntimeWarning: coroutine 'TracingService._end_and_reset' was never awaited
  handle = None
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/nest_asyncio.py:126: RuntimeWarning: coroutine 'TracingService._end_and_reset' was never awaited
  handle = ready.popleft()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

These are the warnings we get .Trying to resolve My current Python version 3.13 Pydantic version 2

Expected behavior

Expected behaviour is that we get the answers to the replies to the chat we give in Basic prompting

Who can help?

@ogabrielluiz @nico

Operating System

Mac

Langflow Version

1.0.16

Python Version

3.12.4

Screenshot

Screenshot 2024-09-03 at 4 00 11โ€ฏPM

Flow File

No response

dosubot[bot] commented 1 week ago

Hey @tonybenny2020! ๐Ÿ‘‹ I'm here to help you tackle bugs, answer questions, and become a contributor. Let's squash those pesky bugs together!

To resolve the issue with the deprecated __fields__ attribute in Pydantic when running Langflow, you should ensure that you are using the correct versions of Python and Pydantic as specified in the pyproject.toml file.

The correct suite requirements are:

Make sure your environment meets these requirements to avoid compatibility issues [1].

To continue talking to Dosu, mention @dosu.

tonybenny2020 commented 1 week ago

Hey @tonybenny2020! ๐Ÿ‘‹ I'm here to help you tackle bugs, answer questions, and become a contributor. Let's squash those pesky bugs together!

To resolve the issue with the deprecated __fields__ attribute in Pydantic when running Langflow, you should ensure that you are using the correct versions of Python and Pydantic as specified in the pyproject.toml file.

The correct suite requirements are:

  • Python version: >=3.10,<3.13
  • Pydantic version: ^2.7.0

Make sure your environment meets these requirements to avoid compatibility issues [1].

To continue talking to Dosu, mention @dosu.

My Python version is 3.12.4 and let me check the Pydantic one in 2.8.2 ,please guide me how to downgrade Pydantic if needed

tonybenny2020 commented 1 week ago

Downgrade the Pydantic version to pydantic2.7.4 , still the issue persists

tonybenny2020 commented 1 week ago

Downgrade the Pydantic version to pydantic2.7.4 , still the issue persists

Hey @tonybenny2020! ๐Ÿ‘‹ I'm here to help you tackle bugs, answer questions, and become a contributor. Let's squash those pesky bugs together!

To resolve the issue with the deprecated __fields__ attribute in Pydantic when running Langflow, you should ensure that you are using the correct versions of Python and Pydantic as specified in the pyproject.toml file.

The correct suite requirements are:

  • Python version: >=3.10,<3.13
  • Pydantic version: ^2.7.0

Make sure your environment meets these requirements to avoid compatibility issues [1].

To continue talking to Dosu, mention @dosu.

italojohnny commented 1 week ago

Hi, @tonybenny2020 . How are you?

Even though these warning messages are annoying, they shouldnโ€™t represent a real issue. Are you experiencing any actual problems?

Langflow has many dependencies that require specific versions, and it's a challenge to harmonize them without conflicts. This is why we're seeing these warning messages. However, they shouldnโ€™t prevent you from building and using your flows

tonybenny2020 commented 1 week ago

Hi, @tonybenny2020 . How are you?

Even though these warning messages are annoying, they shouldnโ€™t represent a real issue. Are you experiencing any actual problems?

Langflow has many dependencies that require specific versions, and it's a challenge to harmonize them without conflicts. This is why we're seeing these warning messages. However, they shouldnโ€™t prevent you from building and using your flows

@italojohnny I am fine, thank you, how are you? Yes, I am facing issue like the answer is not obtained when asking questions and I need to restart the Lang flow every time to get the AI answer, sometime AI not responding when clicking on the Playground, do we need to anything from our side to run it properly

tonybenny2020 commented 4 days ago

/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pydantic/_internal/_config.py:284: PydanticDeprecatedSince20: Support for class-based config is deprecated, use ConfigDict instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.7/migration/ warnings.warn(DEPRECATION_MESSAGE, DeprecationWarning) /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/litellm/utils.py:17: DeprecationWarning: 'imghdr' is deprecated and slated for removal in Python 3.13 import imghdr /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/litellm/utils.py:115: DeprecationWarning: open_text is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice. with resources.open_text("litellm.llms.tokenizers", "anthropic_tokenizer.json") as f: โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚ Welcome to โ›“ Langflow โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ A new version of langflow is available: 1.0.18 โ”‚ โ”‚ โ”‚ โ”‚ Run 'pip install langflow -U' to update. โ”‚ โ”‚ โ”‚ โ”‚ Collaborate, and contribute at our GitHub Repo ๐ŸŒŸ โ”‚ โ”‚ โ”‚ โ”‚ We collect anonymous usage data to improve Langflow. โ”‚ โ”‚ You can opt-out by setting DO_NOT_TRACK=true in your environment. โ”‚ โ”‚ โ”‚ โ”‚ Access http://127.0.0.1:7860 โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/nest_asyncio.py:126: RuntimeWarning: coroutine 'TracingService._end_and_reset' was never awaited handle = ready.popleft() RuntimeWarning: Enable tracemalloc to get the object allocation traceback /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pydantic/main.py:1042: PydanticDeprecatedSince20: The __fields__ attribute is deprecated, use model_fields instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.7/migration/ warnings.warn( /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/nest_asyncio.py:139: RuntimeWarning: coroutine 'TracingService._end_and_reset' was never awaited handle = None RuntimeWarning: Enable tracemalloc to get the object allocation traceback /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/langchain_core/_api/beta_decorator.py:87: LangChainBetaWarning: The function load is in beta. It is actively being worked on, so the API may change. warn_beta( /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/thread.py:94: RuntimeWarning: coroutine 'TracingService._end_and_reset' was never awaited del work_item RuntimeWarning: Enable tracemalloc to get the object allocation traceback /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/nest_asyncio.py:126: RuntimeWarning: coroutine 'TracingService._end_and_reset' was never awaited handle = ready.popleft() RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Kindly check into the issue and give a solution @italojohnny