Skip to main content

A Python library for generating articles using AI.

Project description

ai_article_generator

A Python library for generating articles using AI. This library provides tools and utilities to automate the creation of articles, leveraging machine learning and natural language processing techniques.

Installation

Install the library from PyPI:

pip install ai-article-generator

Or, for development, clone the repository and install dependencies:

pip install -r requirements.txt

Usage

Import and use the library in your Python code:

from ai_article_generator.generator import ArticleGenerator

Example Usage

from ai_article_generator.generator import ArticleGenerator

# Example instructions for article sections
instructions = {
    "Article Header": {
        "instructions": "Write a header.",
        "response_format": {"title": "Title", "subtitle": "Subtitle"},
        "html_template": "<h1>{title}: {subtitle}</h1>",
    }
}

# Any additional data your sections might need
additional_data = {"keywords": ["AI", "journalism", "technology"]}

# Create the generator (article_type can be 'review', 'news', 'guide', 'feature', or 'generic')
generator = ArticleGenerator(
    instructions=instructions,
    additional_data=additional_data,
    article_type="feature"
)

# Generate the article sections as HTML
try:
    html_sections = generator.generate()
    for section, html in html_sections.items():
        print(f"Section: {section}\n{html}\n")
except Exception as e:
    print(f"Error generating article: {e}")

Examples

See the example usage script:

lib/examples/article_generator_example.py

You can run it with:

python lib/examples/article_generator_example.py

Project Structure

lib/
├── article_generator/   # Main library code
├── examples/            # Example scripts
├── tests/               # Unit tests
├── README.md            # Project documentation
├── pyproject.toml       # Build system and metadata
├── requirements.txt     # Development dependencies

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_article_generator-0.1.2.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_article_generator-0.1.2-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file ai_article_generator-0.1.2.tar.gz.

File metadata

  • Download URL: ai_article_generator-0.1.2.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.17

File hashes

Hashes for ai_article_generator-0.1.2.tar.gz
Algorithm Hash digest
SHA256 837b9b95f407b39eb060b8632ac2f22d8e398086ca1f7b75205f52ab845eb1df
MD5 64d4abd1047a2ddd9c4b0ec266f8c3f3
BLAKE2b-256 78228b2d9fdb084258c6b3457a7e1ad68f69b5888acc83c0d4f9aaeabfa2a488

See more details on using hashes here.

File details

Details for the file ai_article_generator-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for ai_article_generator-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6533f99a1fd79033b8b2d090f891d4f8a09c7ef7083df4bb032812ace1382890
MD5 bb7bd7b8317223d7fe06008d8a40e77d
BLAKE2b-256 b7d7c2c4cb6b576585c52ec09d47dd6083ca2fb7a11da840084836cac9d2d163

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page