Skip to content

kavsrd13/ai-toc-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📘 AI TOC Agent

The AI TOC Agent is a lightweight, intelligent tool built using OpenAI and Streamlit to generate a customized Table of Contents (TOC) for courses based on a topic keyword and duration. It leverages a structured prompt and LLMs to produce an educational outline tailored to user input.


🗂️ Project Files

ai_toc_agent/
│
├── app.py                 # Streamlit app entry point
├── toc_agent.py           # Core logic to generate TOC using OpenAI
├── prompt_template.txt    # Template prompt for generating TOC
├── requirements.txt       # Python dependencies
├── logo.png               # App logo
└── __pycache__/           # Compiled Python bytecode (auto-generated)

⚙️ Prerequisites

  • Python 3.9 or later
  • OpenAI API Key
  • VS Code or any Python IDE

🧑‍💻 Setup Instructions

1. Clone or Download the Project

If downloaded as a ZIP file, extract it into a working folder.

cd ai_toc_agent

2. Create a Virtual Environment (Recommended)

python -m venv venv
# For Windows:
venv\Scripts\activate
# For macOS/Linux:
source venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Set Up OpenAI API Key

Create a new file named .env in the root folder (same as app.py) and add:

OPENAI_API_KEY=your-api-key-here

Note: You can get your API key from Azure OpenAI Resouce from Azure

Or export it in your shell:

export OPENAI_API_KEY=your-api-key-here   # Linux/macOS
set OPENAI_API_KEY=your-api-key-here      # Windows CMD
$env:OPENAI_API_KEY="your-api-key-here"   # PowerShell

🚀 Run the Application

streamlit run app.py

Then open the URL shown in the terminal (usually http://localhost:8501) to access the web app.


🧠 How It Works

  1. Enter a topic and course duration.
  2. The app fills in a prompt template.
  3. OpenAI generates a detailed course TOC.
  4. The result is displayed in a formatted layout.

🖼️ UI Screenshot

App Logo


📌 Dependencies

  • streamlit
  • openai
  • python-dotenv

📬 Feedback

Feel free to share improvements or raise issues.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages