748 B
748 B
Structured Output Union Events API
Overview
This project demonstrates how to parse a raw log containing HTTP events into typed Pydantic models using LangChain’s structured output. It supports two event types – successful requests and errors – and aggregates them into a list.
Files
main.py– CLI entry point with example log and parsing logic.models.py– Pydantic v2 models for the events.requirements.txt– Dependencies.README.md– Project description.
Installation
pip install -r requirements.txt
Usage
Run the script:
python main.py
You can also pass a custom log via stdin or as an argument.
The output will be a table of parsed events and their JSON representations.