from langchain_core.messages import HumanMessage, SystemMessage
from langchain_core.prompts import ChatPromptTemplate
from langchain_openai import ChatOpenAI
import asyncio

async def main():
    prompt_template = ChatPromptTemplate.from_messages(
        [
            (
                "system",
                "You're a mail summary expert that summarizes mails in 150 chars or less. HIDE SENSITIVE INFO (LIKE OTPS) FROM THE SUMMARY."
            ),
            (
                "user",
                "Please summarize this mail: \"\"\"{mail}\"\"\""
            )
        ]
    )

    model = ChatOpenAI(
        model = "gpt-4o-mini",
        openai_api_key = r"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"
    )

    prompt = prompt_template.invoke({"mail": r"Find your next favourite\r\n\r\n===================\r\nAmazon Prime Video\r\nhttps://www.primevideo.com?ref_=LHD\r\n===================\r\n\r\n\r\n\r\n\r\n\r\n\r\n===================\r\n\r\n\r\nHere's your guide to blockbuster movies, TV shows & Amazon Originals available on Prime Video. There's always something new for everyone, so get started now!\r\n#FDFDFD\r\nblack\r\n\r\nFind your next favourite\r\nhttps://app.primevideo.com/landing?pageId=completedseriesormovie&pageType=AVCustomerEngagement&ref_=LTC_P2_WB\r\n\r\n\r\n\r\n\r\n===================\r\n\r\nThe Rana Daggubati Show\r\nhttps://www.primevideo.com/dp/detail/amzn1.dv.gti.de3c27de-4339-4faf-873a-1067fe6d0a72?ref_=LHC_P3_IM_P1D_LMnUKb\r\nFeaturing genuine conversations, fun moments and a healthy dose of quirk- this is The Rana Daggubati Show. It\u2019s not just another show, it\u2019s an experience\u2014one that dares to break norms and redefine entertainment by featuring fun and exciting conversations with stars from telugu industry and beyond. Is it a Talk Show? is it a reality show? Find out for yourself.\r\nTalk Show and Variety \u2022 Unscripted 13+\r\n2024, \r\n\r\n\r\n===================\r\n\r\nTV shows we think you'll like\r\n--------------\r\n\r\nCitadel Honey Bunny - Season 1\r\nhttps://www.primevideo.com/dp/detail/amzn1.dv.gti.6223e70b-6b53-4dec-ab7d-3f7b5c3c9ef5?ref_=LGC_P4_I1_IM\r\n\r\n\r\n--------------\r\n\r\nCross - Season 1\r\nhttps://www.primevideo.com/dp/detail/amzn1.dv.gti.2d4ade33-2c00-49c6-aba8-ab96fc6bff2f?ref_=LGC_P4_I2_IM\r\n\r\n\r\n--------------\r\n\r\nREACHER (TV) - SEASON 01\r\nhttps://www.primevideo.com/dp/detail/amzn1.dv.gti.d62095f9-f33c-429b-a8a6-fd74c0461704?ref_=LGC_P4_I3_IM\r\n\r\n\r\n--------------\r\n\r\nFarzi - Season 1\r\nhttps://www.primevideo.com/dp/detail/amzn1.dv.gti.257b2a28-5e4f-44cf-b94f-74ec7795ca3e?ref_=LGC_P4_I4_IM\r\n\r\n\r\n--------------\r\n\r\n\r\n===================\r\n\r\nVettaiyan\r\nhttps://www.primevideo.com/dp/detail/amzn1.dv.gti.17ca7f09-4f84-4d9c-aa90-3c552ef1cc7d?ref_=LHC_P5_IM_P2D_67t3Ma\r\nA sought-after supercop gets caught in a series of unexpected events when he guns down a criminal in a murder case. Amidst his struggle to justify the act, he must confront his moral compass while fighting corrupt, larger-than-life forces. Vettaiyan explores the underbelly of crime investigations with one man's fight against a world, where justice is a rare commodity.\r\nDrama \u2022 Action 16+\r\n2024, 2 h 41 min\r\n\r\n\r\n===================\r\n\r\nRecommended movies\r\n--------------\r\n\r\nThe Ministry of Ungentlemanly Warfare\r\nhttps://www.primevideo.com/dp/detail/amzn1.dv.gti.50a6ea07-f4a9-4191-a343-5f6887a93572?ref_=LGC_P6_I1_IM\r\n\r\n\r\n--------------\r\n\r\nStree 2: Sarkate Ka Aatank\r\nhttps://www.primevideo.com/dp/detail/amzn1.dv.gti.648f1205-89c6-4039-835d-6fdf85dca7ab?ref_=LGC_P6_I2_IM\r\n\r\n\r\n--------------\r\n\r\nGladiator\r\nhttps://www.primevideo.com/dp/detail/amzn1.dv.gti.f2a9f680-2275-2949-77fd-e67f07b680f0?ref_=LGC_P6_I3_IM\r\n\r\n\r\n--------------\r\n\r\nA Quiet Place: Day One\r\nhttps://www.primevideo.com/dp/detail/amzn1.dv.gti.9e833c01-8299-4ebf-823e-b5b24a67bd9d?ref_=LGC_P6_I4_IM\r\n\r\n\r\n--------------\r\n\r\n\r\n===================\r\n\r\n\r\n\r\nFind us on:\r\n* YouTube\r\n  https://youtube.com/PrimeVideoIN\r\n* Facebook\r\n  https://facebook.com/PrimeVideoIN\r\n* Twitter\r\n  https://twitter.com/PrimeVideoIN\r\n* Instagram\r\n  https://instagram.com/primevideoin\r\n\r\n\r\nPrime Video provides occasional email updates about new and noteworthy movies and TV shows. We are sensitive to your time and remain committed to limiting our emails to important news, as well as critical information about your account. If you do not want to receive future e-mails of this sort from Prime Video, please modify your account settings here.\r\nhttps://www.primevideo.com/optout/1OWT7V8FxqNel.OoNdzOJmq5-yEpFvPkCDwn3ExI4Dho?ref_=LFT\r\n\r\nThis message is sent to you by the Amazon entity noted here.\r\nhttps://www.primevideo.com/help?ref_=LFT_dv_web_footer_terms&nodeId=202064890\r\n\r\n\u00a92024 Amazon.com, Inc. or its affiliates. Amazon, Prime, Prime Video, Twitch, Fire, and all related logos are trademarks of Amazon.com, Inc. or its affiliates.\r\n\r\nPlease note that this email was sent to pskhushal@gmail.com from a notification-only address that can't accept incoming emails. Please do not reply to this message. If you have any questions and wish to contact us, click here.\r\nhttps://www.primevideo.com/help/contact-us?ref_=LFT\r\n\r\nReference: 1218235951\r\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nFind your next favourite\n\n\r\n        \u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\r\n        \u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\r\n        \u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\u034f\u200c\r\n      \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nHere's your guide to blockbuster movies, TV shows & Amazon Originals available on Prime Video. There's always something new for everyone, so get started now!\n\n\n\n\n\n\nFind your next favourite\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nThe Rana Daggubati Show\n\n\n\n\nFeaturing genuine conversations, fun moments and a healthy dose of quirk- this is The Rana Daggubati Show. It\u2019s not just another show, it\u2019s an experience\u2014one that dares to break norms and redefine entertainment by featuring fun and exciting conversations with stars from telugu industry and beyond. Is it a Talk Show? is it a reality show? Find out for yourself.\n\n\nTalk Show and Variety \u2022 Unscripted\n13+\n\n\n\n2024\n\n\n\n\n\n\nTV shows we think you'll like\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nVettaiyan\n\n\n\n\nA sought-after supercop gets caught in a series of unexpected events when he guns down a criminal in a murder case. Amidst his struggle to justify the act, he must confront his moral compass while fighting corrupt, larger-than-life forces. Vettaiyan explores the underbelly of crime investigations with one man's fight against a world, where justice is a rare commodity.\n\n\nDrama \u2022 Action\n16+\n\n\n\n2024\n2 h 41 min\n\n\n\n\n\n\nRecommended movies\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nPrime Video provides occasional email updates about new and noteworthy movies and TV shows. We are sensitive to your time and remain committed to limiting our emails to important news, as well as critical information about your account. If you do not want to receive future e-mails of this sort from Prime Video, please modify your account settings here.\nThis message is sent to you by the Amazon entity noted here.\n\u00a92024 Amazon.com, Inc. or its affiliates. Amazon, Prime, Prime Video, Twitch, Fire, and all related logos are trademarks of Amazon.com, Inc. or its affiliates.\nPlease note that this email was sent to pskhushal@gmail.com from a notification-only address that can't accept incoming emails. Please do not reply to this message. If you have any questions and wish to contact us, click here.\nReference: 1218235951\n\n\n\n\n\n\n\n\n\r\n  \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\r\n  \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\r\n\n\n\n"})
    # print(prompt)
    print("Going to OpenAI...")
    response = await model.ainvoke(prompt)
    print(response.content)
    print(response)

asyncio.run(main())
