Open ChristianWeyer opened 11 months ago
I was thinking about moving the serialization logic into a standalone function and implement something that doesn't rely as much on pydantic internals (and have pydantic only do the validation), but there's no solution yet.
Let me know if you're interested in working on it or have a solution in mind already.
For now, I could move back to Pydantic 1...
@ChristianWeyer Linked PR that adds support for pydantic v2. It's a breaking change w/ respect to format, could you check whether you'll be able to make it work w/ your data?
What is the progress on this, any updates?
I wrote a short progam, but there are neither errors nor parsed entities in the output, so I needed to do parsing myself:
schema, validator = from_pydantic(EntityExtraction)
chain = create_extraction_chain(llm, schema, encoder_or_encoder_class="json", validator=validator)
json_encoder = JSONEncoder(use_tags=True)
result = chain.invoke(text_input.text)
return json_encoder.decode(result['text']['raw'])
Hi!
based on this: https://eyurtsev.github.io/kor/schema_serialization.html#deserialization
I am trying to deserialize from a JSON schema into an Object like this:
Here, I get an error:
What would be the way to do this with Pydantic 2? Thanks!