Skip to content

CrabAI/ai_local_agent_summary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Local Agent Summary

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.

Features

  • Batch Processing: Automatically processes all .txt files in the input/ 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 .env file, never committed to version control

How It Works

input/
  └── your_file.txt        ← Place text files here
          │
          ▼
    [OpenAI GPT-3.5]       ← Summarize to 15 lines
          │
          ▼
output/
  └── summary_your_file.txt ← Summary saved here

Installation

Prerequisites

  • Python 3.9+
  • pip
  • OpenAI API Key

Setup

  1. Clone the repository:
git clone https://github.com/CrabAI/ai_local_agent_summary.git
cd ai_local_agent_summary
  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Configure environment variables:
cp .env.example .env

Edit .env with your API key:

OPENAI_API_KEY=your_openai_api_key_here

Running the Agent

  1. Place your .txt files in the input/ directory
  2. Run the script:
python run.py
  1. Summaries will be saved in the output/ directory as summary_<original_filename>.txt

Example

Input (input/sample.txt):

[Long text content...]

Output (output/summary_sample.txt):

1. ...
2. ...
...
15. ...

Project Structure

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

Configuration

Environment Variables

Variable Required Description
OPENAI_API_KEY Yes Your OpenAI API key from platform.openai.com

Customization

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"

Troubleshooting

No output files generated

  • Check that .txt files exist in the input/ directory
  • Verify output/ directory exists (create it manually if needed)

API key error

Import errors

  • Ensure virtual environment is activated
  • Run: pip install -r requirements.txt

License

MIT

About

OpenAI API를 이용한 로컬 텍스트 요약 에이전트

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages