purpleriann's picture
Upload folder using huggingface_hub
a22e84b verified
raw
history blame contribute delete
371 Bytes
from langchain.output_parsers import PydanticOutputParser
class ListPydanticOutputParser(PydanticOutputParser):
def _parse_obj(self, obj: dict | list):
if isinstance(obj, list):
return [super(ListPydanticOutputParser, self)._parse_obj(obj_) for obj_ in obj]
else:
return super(ListPydanticOutputParser, self)._parse_obj(obj)