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

Running into validation error from pydantic #1

Closed
sanzgiri opened this issue Sep 10, 2023 · 2 comments
Closed

Running into validation error from pydantic #1

sanzgiri opened this issue Sep 10, 2023 · 2 comments

Comments

@sanzgiri
Copy link

sanzgiri commented Sep 10, 2023

I am getting the following error running the code. Python 3.9 on a Mac, latest versions of all packages in requirements.txt

Traceback (most recent call last):
  File "/Users/sanzgiri/spotify-chat/main.py", line 2, in <module>
    from ai_tools import music_player_tools
  File "/Users/sanzgiri/spotify-chat/ai_tools.py", line 21, in <module>
    def by_lyrics(lyrics: str) -> str:
  File "/Users/sanzgiri/miniconda3/envs/spangchain/lib/python3.9/site-packages/langchain/tools/base.py", line 767, in _make_tool
    return StructuredTool.from_function(
  File "/Users/sanzgiri/miniconda3/envs/spangchain/lib/python3.9/site-packages/langchain/tools/base.py", line 711, in from_function
    return cls(
  File "/Users/sanzgiri/miniconda3/envs/spangchain/lib/python3.9/site-packages/pydantic/v1/main.py", line 341, in __init__
    raise validation_error
pydantic.v1.error_wrappers.ValidationError: 1 validation error for StructuredTool
args_schema
  subclass of BaseModel expected (type=type_error.subclass; expected_class=BaseModel)

Would appreciate any help. Thanks!

@trancethehuman
Copy link
Owner

@sanzgiri hey this looks like a pydantic error. I'll take a look at some point but maybe check out this thread about LangChain moving to Pydantic 2: langchain-ai/langchain#6841

@sanzgiri
Copy link
Author

Hi @trancethehuman - thanks for the pointers. The app works for me if I replace pydantic with pydantic.v1 on line 1 in ai_tools.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants