Topic

Pydantic

All digests tagged Pydantic

· 2:37:48

Build a Document Review App in 3 Hours (Python, React, Azure)

This video provides an end-to-end guide for building a sophisticated document review application designed for invoice and receipt processing. The solution utilizes a modern monorepo architecture, integrating Python (FastAPI) for the backend logic, React for the frontend UI, and Microsoft Azure services (Document Intelligence and Azure OpenAI) for core AI capabilities. The process demonstrates creating a robust, multi-stage pipeline that handles document classification, data extraction, business rule validation, and general ledger account suggestion.

Key takeaways

  1. Hybrid Document Processing Pipeline

    The application uses a hybrid approach by combining specialized pre-trained models (Azure Document Intelligence) for high accuracy/low cost extraction with general LLMs (Azure OpenAI) for complex tasks like classification and suggesting General Ledger accounts. This ensures robustness against edge cases.

  2. Structured Data Modeling

    Pydantic is used extensively to enforce strict schemas on extracted data, transforming raw JSON output into predictable Python objects for reliable business logic application.

  3. Modular Pipeline Design Pattern

    The backend implements a chainable pipeline pattern (Classification -> Extraction -> Validation -> GL Suggestion). This modular design allows individual steps to be easily added, swapped, or removed without breaking the overall workflow.

  4. Enterprise Cloud Setup

    The entire system is designed for enterprise readiness by utilizing Azure services and demonstrating deployment via Azure Container Apps (ACA), emphasizing best practices for production environments.

Watch on YouTube Full article

· 21:18

Why Agentic Systems Need Ontologies — Frank Coyle, UC Berkeley

The talk argues that while Large Language Models (LLMs) and agentic systems represent a powerful shift toward AI, their inherent probabilistic nature makes them unreliable for mission-critical tasks. To mitigate failures—such as incorrect order statuses or double refunds—the solution is 'Neurosymbolic AI': coupling the LLM's generative power with external, formal ontologies. An ontology acts as a logical guardrail, enforcing constraints (e.g., payment status must be one of three values) that are impossible to reliably enforce using prompt engineering alone.

Key takeaways

  1. The Problem with Probabilistic Agents

    LLMs reason probabilistically over domains they only half understand, leading to failures in brittle tools and fragile handoffs. These errors cannot be reliably stopped by mere instructions or prompt engineering.

  2. Neurosymbolic AI: Guardrails for LLMs 7:04

    This approach ties together neural networks (LLMs) with symbolic AI (rule-based systems and ontologies). The ontology provides the necessary guardrails to keep the probabilistic model constrained and honest.

  3. The Role of Ontologies 8:43

    An ontology is a formal specification of a shared conceptualization, defining typed entities, their relationships, and constraints. It allows systems to validate proposed actions (e.g., ensuring an order can only be refunded once).

Watch on YouTube Full article