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

bug in APIHandler _rename_pydantic_model #797

Open
Hacky-DH opened this issue Dec 2, 2024 · 1 comment
Open

bug in APIHandler _rename_pydantic_model #797

Hacky-DH opened this issue Dec 2, 2024 · 1 comment

Comments

@Hacky-DH
Copy link

Hacky-DH commented Dec 2, 2024

bug at this line https://github.com/langchain-ai/langserve/blob/main/langserve/api_handler.py#L316

TypeError: issubclass() arg 1 must be a class

when I use APIHandler with different input schema runnable.

My model is

from pydantic import BaseModel
class A(BaseModel):
    foo: list[str]

pydantic use V2.

Very simple to produce issue:

>>> from pydantic import BaseModel
>>> issubclass(list,BaseModel)
False
>>> issubclass(list[str],BaseModel)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../lib/python3.10/abc.py", line 123, in __subclasscheck__
    return _abc_subclasscheck(cls, subclass)
TypeError: issubclass() arg 1 must be a class
@Hacky-DH
Copy link
Author

Hacky-DH commented Dec 2, 2024

use isinstance instead issubclass?

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

1 participant