diff --git a/README.md b/README.md index 2f64c12..1627eec 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,26 @@ -# task-6a1d75e5fd30e81cf3126b1a +# Structured Output with Discriminated Union -Повторный экзамен: Structured output — Union событий API \ No newline at end of file +This repository demonstrates how to parse raw API logs into typed events using **Pydantic v2** and **LangChain ≥1.0**. The solution showcases: + +* A discriminated union of two event types (`HttpOkEvent` and `HttpErrorEvent`). +* Structured output from an LLM via `ChatOpenAI.with_structured_output`. +* Batch parsing of multiple log lines. +* A simple CLI that prints the parsed events and a summary table. + +## Installation + +```bash +pip install -r requirements.txt +``` + +## Usage + +```bash +# Run with the default example log +python -m src.main + +# Or provide your own raw log string +python -m src.main --log "GET /api/test 200 30ms\nPOST /api/submit 500 Internal Server Error" +``` + +The script prints each parsed event as a dictionary and a tabular summary. \ No newline at end of file