Skip to main content

INarrator

Install the Package

pip install inarrator

Use the Package

Gmail

  1. In the Google Cloud console, enable the Gmail API.

  2. Register your App

    • In the Google Cloud console, go to OAuth Consent screen
    • Once on OAuth Consent Screen, select User Type External and then click create:
    • Now complete the registration of your app which is fairly simple. Just remember two things:
      • Since this is a Testing App, you will have to add some test users (ideally make it the same email through which you are registering the app)
      • Add .../auth/gmail.readonly scope
  3. Create "gmail_credentials.json" file:

    • Go to Credentials
    • Click + CREATE CREDENTIALS > OAuth client ID
    • SELECT Desktop app as application type
    • After this a pop up will appear which will have a option to DOWNLOAD OAuth Client JSON file.
    • Save the JSON and rename it to gmail_credentials.json
  4. Use the inarrator

  • Chat-GPT Example

    from inarrator.email import Gmail
    from inarrator.summarizer.gpt import GPTModel
    
    gmail = Gmail()
    gmail.authenticate(
        credentials_path="gmail_credentials.json",
        gmail_scope=["https://www.googleapis.com/auth/gmail.readonly"],
    )
    # https://support.google.com/mail/answer/7190 (You can read more about Gmail Filters)
    emails = gmail.get_latest_emails(
            gmail_filters="from:(-noreply -no-reply) is:unread -category:social -category:promotions -unsubscribe", # 
            gmail_max_emails="30",
        )
    model = GPTModel(model_name = 'gpt-3.5-turbo-16k',api_token = "") # OPENAI_API_KEY
    documents = []
    for email in emails:
        documents.append(email)
    print(model.summarize(documents))
    
  • Hugging Face Hub Example

    from inarrator.email import Gmail
    from inarrator.summarizer import HuggingFaceModel
    
    
    gmail = Gmail()
    gmail.authenticate(
        credentials_path="gmail_credentials.json",
        gmail_scope=["https://www.googleapis.com/auth/gmail.readonly"],
    )
    emails = gmail.get_latest_emails(
            gmail_filters="from:(-noreply -no-reply) is:unread -category:social -category:promotions -unsubscribe",
            gmail_max_emails="30",
        )
    model =  HuggingFaceModel(model_name="tuner007/pegasus_summarizer", api_token="") # HF_HUB_TOKEN
    print(model.summarize(emails[0])) # Hugging Face Hub Models currently can summarize one email at a time.
    

Outlook

  1. Create a New App Registration

  2. Request API permissions (Only Mail.Read)

  1. Configure the Platform

    • Add a Mobile and Desktop Application
    • Choose the Following Configuration
  2. Create a new client secret

    • Click on + New client secret.
    • Now create the following JSON and name it outlook_credentials.json. You can get Application (client) ID & Directory (tenant) ID from overview of your App.
    {"application_id":"Application (client) ID",
    "authority_url":"https://login.microsoftonline.com/{Directory (tenant) ID}",
    "outlook_scope":["Mail.Read"]}
    
  3. Since OAuth only work https but our redirect URI is localhost, we would have to make the following environment variable

export OAUTHLIB_INSECURE_TRANSPORT=1
  1. Use the inarrator
  • Chat-GPT Example

    from inarrator.email import OutLook
    from inarrator.summarizer.gpt import GPTModel
    
    outlook = OutLook()
    outlook.authenticate(
        credentials_path="outlook_credentials.json",
        outlook_scope=["Mail.Read"],
    )
    emails = outlook.get_latest_emails(
                outlook_max_emails=5,
            )
    model = GPTModel(model_name = 'gpt-3.5-turbo-16k',api_token = "") # OPENAI_API_KEY
    documents = []
    for email in emails:
        documents.append(email)
    print(model.summarize(documents))
    
  • Hugging Face Hub Example

    from inarrator.email import OutLook
    from inarrator.summarizer.huggingface import HuggingFaceModel
    
    
    outlook = OutLook()
    outlook.authenticate(
        credentials_path="outlook_credentials.json",
        outlook_scope=["Mail.Read"],
    )
    emails = outlook.get_latest_emails(
                outlook_max_emails=5,
            )
    model =  HuggingFaceModel(model_name="tuner007/pegasus_summarizer", api_token="") # HF_HUB_TOKEN
    print(model.summarize(emails[0])) # Hugging Face Hub Models currently can summarize one email at a time.    
    

Metadata

Release files for inarrator 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inarrator 0.0.3
File Size Uploaded Provenance Actions
inarrator-0.0.3.tar.gz 10.8 kB Without provenance Details for inarrator-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for inarrator 0.0.3
File Interpreter ABI Platform Actions
inarrator-0.0.3-py3-none-any.whl Python 3 none any Details for inarrator-0.0.3-py3-none-any.whl

Total release size: 22.9 kB

Release files / inarrator-0.0.3.tar.gz

Download URL inarrator-0.0.3.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0becc069be95d2d32edb3a61c62d954f5cdf08f1ae83b397db84cfd31ab103d5
BLAKE2b-256 checksum
How to use checksums
3d8ff8890d3cb6f2c568ab5035b5f3863df55c03ca719bb61341361113afbd52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.6 Linux/6.2.0-33-generic

Release files / inarrator-0.0.3-py3-none-any.whl

Download URL inarrator-0.0.3-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b3a5e36aa1dd0f16df62830d0a46dd2b7cd6104935937d43ab95393dd17019e
BLAKE2b-256 checksum
How to use checksums
523f5cf2e88fb5b85d30bf6da92e7b84c8e062a3bd3e6e19d92f31211323ca05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.6 Linux/6.2.0-33-generic

Security for inarrator 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page