Given the stateless nature of LLMs, Agents act as just massive state models so Pydantic is a natural fit. Look at the Swarm system and see how that is all that is needed to get agents that can drive themselves without any other framework, interpreting functions into a schema and driving tool calls. Swarm did the dynamic prompt and tool injection discussed here. All that was needed was a larger model to help manage state/context better (inputs in/inputs out/shareability between agents), and here is Pydantic to do just that. All with built in validation... and retries to deal with the non-deterministic life of an AI.... I would not bet against Pydantic!! Love it.
@Karl-Asger11 күн бұрын
Really happy that you made a video on pydanticai, its exciting to see it be released. The Pydantic team and PydanticAI is unrelated to instructor as far as I know, I'm not sure where you got that but just needed to let you know since you focused on this in the beginning.
@IdPreferNot111 күн бұрын
Jason Liu is Instructor guy, famous for his "P:ydantic is all you need" speech.
@Karl-Asger11 күн бұрын
@IdPreferNot1 yup correct!
@irbsurfer158511 күн бұрын
So use pydantic for defining the schema > if you need structured output then use Instructor for generating the response from the LLM to produce it > if structured output is incomplete, Instctor queries the LLM again and again until it is properly formatted and conforms to the schema definition. It is worth considering augmenting the system with Error handling and Validation, Data Transformation to analyze and transform structured outputs validated by Pydantic, and some form of a security enhancement to ensure security at every level of the pipleine (to protect against injection attacks). And likely some form of logging and monitoring. Pydantic + Pydantic AI + Instructor +Jinja = Win Win WIn for MAS Engineers and clients who need structured output.