Files
task-6a1d75e5fd30e81cf3126b1a/README.md
T

33 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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 LangChains 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 commandline 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.