langchain icon indicating copy to clipboard operation
langchain copied to clipboard

Pydantic output parser assumes JSON object

Open jmif opened this issue 1 year ago • 0 comments

With a schema such as:

class JsonList(BaseModel):
    __root__: List[str]

We can validate a JSON string in the form:

[ 'xxx', 'yyy', 'zzz' ]

But the Pydantic parser assumes the input is an object in its greedy search, so it fails with a validation error.

jmif avatar May 02 '23 17:05 jmif