From d27dfb3e0374191f9c45bc43d39a70027ce48184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=20=D0=9A=D1=83=D1=82?= =?UTF-8?q?=D0=BB=D0=B0=D1=85=D0=BC=D0=B5=D1=82=D0=BE=D0=B2?= Date: Thu, 28 May 2026 18:08:55 +0000 Subject: [PATCH] add README.md --- README.md | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 423e83f..453b44e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,38 @@ -# task-6a1865008a94f887e50d471c +# Structured Output Extraction with Pydantic +## What this project does +This repository demonstrates how to extract structured data from free‑form text using **LangChain** and **Pydantic**. Two schemas are supported: + +1. **PersonInfo** – name, optional age, profession, skills. +2. **MeetingNotes** – date, participants, topics, decisions, next steps. + +The extraction is performed in a single LLM call with `PydanticOutputParser` and the schema’s format instructions. + +## File structure +- `models.py` – Pydantic models with field descriptions. +- `agent.py` – Extraction logic: schema detection, prompt construction, LLM invocation. +- `main.py` – CLI demonstrating three example inputs. +- `requirements.txt` – Runtime dependencies. +- `README.md` – Project description (this file). + +## Installation +```bash +pip install -r requirements.txt +``` +Make sure the environment variable **JOURNAL_MCP_PAT** is set to your BroJS API key. + +## Usage examples +Run the script and follow the prompts: +```bash +python main.py +``` +You will see three pre‑defined inputs (person, meeting, custom) and the parsed JSON output. + +## How it works +1. **Schema detection** – a simple regex checks for words like *meeting* or *date* to choose between `PersonInfo` and `MeetingNotes`. +2. **Prompt** – the same template is used; format instructions are injected from the chosen parser. +3. **LLM call** – one request to BroJS GPT‑OSS‑20B. +4. **Parsing** – `PydanticOutputParser.parse()` validates and returns a Pydantic instance. + +## Extending +Add more schemas by creating new Pydantic models in `models.py` and extending `_detect_schema`. The rest of the pipeline remains unchanged.