Skip to content

bug in APIHandler _rename_pydantic_model #797

@Hacky-DH

Description

@Hacky-DH

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions