aurelio-labs / semantic-router

Superfast AI decision making and intelligent processing of multi-modal data.
https://www.aurelio.ai/semantic-router
MIT License
1.66k stars 167 forks source link

Migration to Pydantic V2 #147

Open maxyousif15 opened 4 months ago

maxyousif15 commented 4 months ago

The Route object still uses pydantic V1. Are there plans to migrate to V2?

Out of curiosity, is there a reason why Route was based on pydantic V1 and not pydantic V2?

bruvduroiu commented 3 months ago

Inscoping this as part of our backlog

pratiksinghchauhan commented 3 months ago

@bruvduroiu there are so many projects that use pydantic v1 and upgrading to pydantic v2 is not an option for them due to the amount of change it requires. Currently, I am resorting to maintaining my own fork of this library and supporting v1 as in the following snippet. Do you think there is a way to keep supporting both the versions in the library itself for some time at least to make this project actually useful?

try:
    from pydantic.v1 import BaseModel  # type: ignore
except ImportError:
    from pydantic import BaseModel  # type: ignore  

Pydantic just released 1.10.15 like 7 hours ago, so I think we must support it. I can make a PR from my fork if this is on the roadmap.