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"
model="gpt-4o-mini"
)
# 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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_article_generator-0.1.3.tar.gz.
File metadata
- Download URL: ai_article_generator-0.1.3.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcfa98eb83c70c530e7b7d18561d7ea6d8accdd9f429764542a48e80b2992c12
|
|
| MD5 |
86bc23937a32fd19d16aeff6ba2b7654
|
|
| BLAKE2b-256 |
7222e384e1b5725b6ef084463aa4c7cc7876db3018a448ffb8a588c18b11bf30
|
File details
Details for the file ai_article_generator-0.1.3-py3-none-any.whl.
File metadata
- Download URL: ai_article_generator-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae470dfa282531fe8b41a7bcbd6e23cf6a37b9602808144cf8605e2ded55cc72
|
|
| MD5 |
27033aab748238aaed3d63f3fe83f693
|
|
| BLAKE2b-256 |
be2a4db488fe59e4bcb50f0757a79d3c81722f6bd66be3fc6b2ba15886d8abc0
|