Local AI agent for batch text summarization using OpenAI API. Reads .txt files from an input directory, generates concise 15-line summaries, and writes results to an output directory.
- Batch Processing: Automatically processes all
.txtfiles in theinput/directory - OpenAI Integration: Uses GPT-3.5 Turbo for fast and accurate summarization
- Korean Language Support: Optimized for Korean text input and output
- Simple Setup: Minimal configuration required — just add your API key and run
- Secure by Default: API key managed via
.envfile, never committed to version control
input/
└── your_file.txt ← Place text files here
│
▼
[OpenAI GPT-3.5] ← Summarize to 15 lines
│
▼
output/
└── summary_your_file.txt ← Summary saved here
- Python 3.9+
- pip
- OpenAI API Key
- Clone the repository:
git clone https://github.com/CrabAI/ai_local_agent_summary.git
cd ai_local_agent_summary- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Configure environment variables:
cp .env.example .envEdit .env with your API key:
OPENAI_API_KEY=your_openai_api_key_here- Place your
.txtfiles in theinput/directory - Run the script:
python run.py- Summaries will be saved in the
output/directory assummary_<original_filename>.txt
Input (input/sample.txt):
[Long text content...]
Output (output/summary_sample.txt):
1. ...
2. ...
...
15. ...
ai_local_agent_summary/
├── input/ # Place source .txt files here
├── output/ # Generated summaries (git-ignored)
├── .env # Your API key (git-ignored)
├── .env.example # Environment variable template
├── requirements.txt # Python dependencies
├── run.py # Main script
└── README.md
| Variable | Required | Description |
|---|---|---|
OPENAI_API_KEY |
Yes | Your OpenAI API key from platform.openai.com |
To change the summarization behavior, edit the system prompt in run.py:
{"role": "system", "content": "텍스트를 15줄로 요약해줘."}To use a different model, change:
model="gpt-3.5-turbo"- Check that
.txtfiles exist in theinput/directory - Verify
output/directory exists (create it manually if needed)
- Confirm
.envfile exists with a validOPENAI_API_KEY - Check your API key at platform.openai.com/api-keys
- Ensure virtual environment is activated
- Run:
pip install -r requirements.txt
MIT