33 lines
1.0 KiB
Markdown
33 lines
1.0 KiB
Markdown
# Structured Output – Union Events API
|
||
|
||
## Installation
|
||
|
||
```bash
|
||
# Create a virtual environment (optional but recommended)
|
||
python -m venv venv
|
||
source venv/bin/activate # On Windows use `venv\Scripts\activate`
|
||
|
||
# Install dependencies
|
||
pip install -r requirements.txt
|
||
```
|
||
|
||
The repository contains a single `main.py` script that demonstrates how to parse a raw log into a list of typed events using LangChain’s structured output and Pydantic v2. The only external dependency required is **langchain-openai** (or **langchain-ollama** if you prefer a local model). The `deepagents` package has been removed because it is not part of the allowed stack.
|
||
|
||
## Usage
|
||
|
||
```bash
|
||
python main.py
|
||
```
|
||
|
||
You can also pass a custom log file path as a command‑line argument:
|
||
|
||
```bash
|
||
python main.py --log custom_log.txt
|
||
```
|
||
|
||
The script will output a table of parsed events and their JSON representations.
|
||
|
||
---
|
||
|
||
**Note**: If you encounter any issues with the OpenAI API key, set the environment variable `OPENAI_API_KEY` before running the script.
|