I'm a huge fan of https://github.com/jxnl/instructor, so the purpose of this library is to walk you through how to build your own. I think that it's worthwhile to understand the core concepts.
Check /tutorial/Tutorial.md.
git clone https://github.com/jbarrow/minstructor.git
pip install -Ue .