Spaces:
Sleeping
Sleeping
File size: 4,427 Bytes
33a6083 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | {
"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
}
|