{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "c660423f", "metadata": {}, "outputs": [], "source": [ "from dotenv import load_dotenv\n", "from openai import OpenAI\n", "import json\n", "import os\n", "import requests\n", "from pypdf import PdfReader\n", "import gradio as gr" ] }, { "cell_type": "code", "execution_count": 2, "id": "a4306b34", "metadata": {}, "outputs": [], "source": [ "\n", "load_dotenv(override=True)\n", "openai = OpenAI()" ] }, { "cell_type": "code", "execution_count": 3, "id": "3549cbdc", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Pushover user found and starts with u\n", "Pushover token found and starts with a\n" ] } ], "source": [ "pushover_user = os.getenv(\"PUSHOVER_USER\")\n", "pushover_token = os.getenv(\"PUSHOVER_TOKEN\")\n", "pushover_url = \"https://api.pushover.net/1/messages.json\"\n", "\n", "if pushover_user:\n", " print(f\"Pushover user found and starts with {pushover_user[0]}\")\n", "else:\n", " print(\"Pushover user not found\")\n", "\n", "if pushover_token:\n", " print(f\"Pushover token found and starts with {pushover_token[0]}\")\n", "else:\n", " print(\"Pushover token not found\")" ] }, { "cell_type": "code", "execution_count": 4, "id": "28bd6f40", "metadata": {}, "outputs": [], "source": [ "def push(message):\n", " print(f\"Push: {message}\")\n", " payload = {\"user\": pushover_user, \"token\": pushover_token, \"message\": message}\n", " requests.post(pushover_url, data=payload)" ] }, { "cell_type": "code", "execution_count": 5, "id": "82e90e1e", "metadata": {}, "outputs": [], "source": [ "system_prompt = \"You are a technologist focused on leading edge AI capabilites, technologies, and research. You have been hired to provide summary findings \"\n", "system_prompt += \"to Chief Financial Officers and leaders of Financial Planning and Analysis. Your role is to help bridge understanding \"\n", "system_prompt += \"of what is available now, what will be available in the future, and how to address installing technolgies and systems \"\n", "system_prompt += \"now that will help to provide world class finance teams and cutting edge analytical functions that reduce cost to employ \"\n", "system_prompt += \"while increasing efficacy of the finance function.\"" ] }, { "cell_type": "code", "execution_count": 9, "id": "f77cffd6", "metadata": {}, "outputs": [], "source": [ "user_prompt = \"Provide the latest cutting edge AI capabilities, technologies, and research the will have the greatest \"\n", "user_prompt += \"return to invest in now. Deliver response geared towards executive board delivery with citiations and appendices to \"\n", "user_prompt += \"explore for the various finance teams that may be impacted. Limit response to 200 characters.\"" ] }, { "cell_type": "code", "execution_count": 10, "id": "00e8ae7e", "metadata": {}, "outputs": [], "source": [ "messages = [{\"role\": \"system\", \"content\": system_prompt}] + [{\"role\": \"user\", \"content\": user_prompt}]\n", "response = openai.chat.completions.create(model=\"gpt-4o-mini\", messages=messages)\n", "reply = response.choices[0].message.content" ] }, { "cell_type": "code", "execution_count": 11, "id": "74fceb7e", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Push: Invest in AI-driven automation for forecasting, risk analysis, and reporting. Key technologies: ML models, NLP. Research shows 30-50% cost reduction. See Appendices A & B for deeper insights.\n" ] } ], "source": [ "push(reply)" ] } ], "metadata": { "kernelspec": { "display_name": ".venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.11" } }, "nbformat": 4, "nbformat_minor": 5 }