Skip to content

TheSpecialOne-web/article_writer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

article_writer

LLM-powered article generator built with LangChain and OpenAI.

A modular, OOP-based pipeline that takes high-level constraints and produces a fully-structured article — table of contents → outlines → sections → title → optional self-critique pass.

Architecture

article_generator/
├── article/                  # Article model
├── paragraph/                # Paragraph + Resource models
└── article_generator/
    ├── article_generator.py  # Main orchestrator
    └── prompts.py            # LangChain PromptTemplate factories

Pipeline

  1. Generate table of contents from a title
  2. Generate outlines for each section (what to include / exclude)
  3. Generate contents for each section
  4. Generate the final title
  5. Optional self-critique pass

Setup

python -m venv venv
source venv/bin/activate   # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env       # then add your OPENAI_API_KEY

Usage

from article_generator import ArticleGenerator
from article_generator.article import Article
from article_generator.paragraph import Paragraph
from langchain.chat_models import ChatOpenAI

llm = ChatOpenAI(model="gpt-3.5-turbo-16k", temperature=0.7, max_tokens=8000)
article = Article(title="", paragraphs=[Paragraph(index=1, header="")])
gen = ArticleGenerator(llm=llm, article=article)
print(gen.complete().to_markdown())

See main.py and sample.py for full examples.

Stack

  • Python 3.10+
  • LangChain
  • OpenAI
  • ChromaDB (optional, for resource grounding)

License

MIT

About

LangChain-powered article generator: TOC → outlines → sections → title → critique

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages