Skip to main content

Prompt-AI is a Python library that automates the process of generating AI-powered newsletters. It scrapes content from a given URL, generates a structured newsletter using Google's Gemini API, and provides features for parsing content, sending emails, and creating blog page links.

Project description

Prompt-AI

Overview

Prompt-AI is a Python library that automates the process of generating AI-powered newsletters. It scrapes content from a given URL, generates a structured newsletter using Google's Gemini API, and provides features for parsing content, sending emails, and creating blog page links.

Features

  • AI Content Generation: Uses Google's Gemini API to generate newsletters based on scraped content.
  • Email Sending: Sends AI-generated newsletters via SMTP.
  • Blog Page Link Generation: Creates links for blog pages in both local and live environments.

Usage

1. Generate AI-Powered Newsletter

api_key:

link:

  • Enter reference link for which you want to generate newsletter and blog article.
from promptai import generate_content

api_key = "your-google-gemini-api-key"
title = "Latest Tech Trends"
category = "Technology"
link = "https://example.com/tech-news"

newsletter = generate_content(title, category, link, api_key)
print(newsletter)

Response (Success):

{
  "title": "generated-title",
  "content": [
    {
      "subtitle": "generated-subtitle",
      "paragraph": "generated-inner-paragraph"
    },
    {
      "subtitle": "generated-subtitle",
      "paragraph": "generated-inner-paragraph"
    },
    {},
    ...
    //and many more according to the reference URL
  ],
  "tags": "generated tags for the blog",
  "category": "assigned category"
}

Response (Failed):

{
  "status":203,
  "message":"Content not generated",
  "reason":"internal issue"
}

2. Send Newsletter via Email

SMTP Configuration

  • Update SMTP_SERVER and SMTP_PORT for your email provider and keep it in environment variables.
  • Use an app-specific password for secure email authentication.
from promptai import send_email

receiver_email = "recipient@example.com" or ["comma separated multiple emails"]
sender_email = "your-email@example.com"
email_app_password = "your-email-app-password"
link = "generated-link-of-blog"
title = "generated-title"
description = "first-para-of-first-subtitle"
subject = "Your-subject-here"

send_email(receiver_email, sender_email, email_app_password, link, title, description, subject)

Response (Success):

{"status":200, "message":"Email sent successfully"}

Response (Failed):

{
  "status":203, 
  "message":"error in sending mail", 
  "reason":"reason-of-error" // Particular reason will be sent
}

3. Create Blog Page Link

domain_name:

  • Enter only specific part of domain name.
  • For domain_type:"local" example: http://localhost:3000, then domain_name: localhost:3000, if your domain also has a path then domain_name: localhost:3000/path.
  • For domain_type:"live" example: https://example.com, then domain_name:example.com, if your domain also has a path then domain_name: example.com/path.

domain_type:

  • "local": Use this if you are using promptai on unsecured network or on localhost, example: http://localhost:3000
  • "live": For domains hosted on secured networks, https://your-domain.com

title:

  • Send the same title which you got as response on using generate_content function.
from promptai import create_blog_page

domain_name = "yourwebsite.com"
domain_type = "live"
title = "The Future of AI"

blog_link = create_blog_page(title, domain_type, domain_name)
print(blog_link)

Response (Success):

{
  "status": 200, 
  "message": "Link generated",
  "link": "generated_link"  // Link generated will already be passed here
}

Response (Failed):

{
  "status":203, 
  "message":"error generating link", 
  "reason":"domain type not specified" // If domain_type not specified
}

License

This project is licensed under the MIT License.

Contributions

Feel free to submit pull requests or report issues on GitHub.

Contact

For inquiries or support, reach out at gauravpatel29@outlook.in.

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

prompt_ai-0.2.3.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

prompt_ai-0.2.3-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file prompt_ai-0.2.3.tar.gz.

File metadata

  • Download URL: prompt_ai-0.2.3.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for prompt_ai-0.2.3.tar.gz
Algorithm Hash digest
SHA256 6c7adb119686d92a4be774dd6cf8854e7d0a98fb97900a5d2173b5e7c425a445
MD5 d2b529108c98720877033169b4b9a9a4
BLAKE2b-256 88012331c2369db6a6aa289c0df16242ad053602b54dc5a7fe6288b99c10bfea

See more details on using hashes here.

File details

Details for the file prompt_ai-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: prompt_ai-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for prompt_ai-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 459e60830df01856537cd7a5d0bdb4a6a847819391e120e7bbf780d5b1042ca8
MD5 81271676162b5e3004c2fbef75512bcb
BLAKE2b-256 39ab5a510a6a886453f2031fec58ab1f3162dd62716c7ea3db6d4f2ac929d408

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