Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.REPL.enableREPLSmartSend": false
}
265 changes: 243 additions & 22 deletions 1_foundations/1_lab1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -96,9 +96,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Next it's time to load the API keys into environment variables\n",
"# If this returns false, see the next cell!\n",
Expand Down Expand Up @@ -141,9 +152,17 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"OpenAI API Key exists and begins sk-proj-\n"
]
}
],
"source": [
"# Check the key - if you're not using OpenAI, check whichever key you're using! Ollama doesn't need a key.\n",
"\n",
Expand All @@ -159,7 +178,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -172,7 +191,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -186,7 +205,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -197,9 +216,17 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2 + 2 equals 4.\n"
]
}
],
"source": [
"# And now call it! Any problems, head to the troubleshooting guide\n",
"# This uses GPT 4.1 nano, the incredibly cheap model\n",
Expand All @@ -216,7 +243,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -228,9 +255,17 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"If five machines take five minutes to make five widgets, how long would 100 machines take to make 100 widgets?\n"
]
}
],
"source": [
"# ask it - this uses GPT 4.1 mini, still cheap but more powerful than nano\n",
"\n",
Expand All @@ -246,7 +281,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -258,7 +293,48 @@
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Let's analyze the problem step-by-step:\n",
"\n",
"- **Given:** \n",
" Five machines take five minutes to make five widgets.\n",
"\n",
"- **Question:** \n",
" How long would 100 machines take to make 100 widgets?\n",
"\n",
"---\n",
"\n",
"### Step 1: Understand the rate of production\n",
"\n",
"If 5 machines make 5 widgets in 5 minutes, then:\n",
"\n",
"- **Rate per machine:** \n",
" Each machine makes 1 widget in 5 minutes.\n",
"\n",
"This is because 5 machines × (widgets per machine) = 5 widgets in 5 minutes \n",
"⇒ (widgets per machine) in 5 minutes = 1 widget \n",
"⇒ 1 machine makes 1 widget in 5 minutes.\n",
"\n",
"---\n",
"\n",
"### Step 2: Calculate production time for 100 machines and 100 widgets\n",
"\n",
"Since each machine makes a widget in 5 minutes, having 100 machines means:\n",
"\n",
"- They can make 100 widgets *in the same 5 minutes*, because every machine simultaneously makes 1 widget in 5 minutes.\n",
"\n",
"---\n",
"\n",
"### **Answer:**\n",
"\n",
"**100 machines take 5 minutes to make 100 widgets.**\n"
]
}
],
"source": [
"# Ask it again\n",
"\n",
Expand All @@ -275,7 +351,53 @@
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/markdown": [
"Let's analyze the problem step-by-step:\n",
"\n",
"- **Given:** \n",
" Five machines take five minutes to make five widgets.\n",
"\n",
"- **Question:** \n",
" How long would 100 machines take to make 100 widgets?\n",
"\n",
"---\n",
"\n",
"### Step 1: Understand the rate of production\n",
"\n",
"If 5 machines make 5 widgets in 5 minutes, then:\n",
"\n",
"- **Rate per machine:** \n",
" Each machine makes 1 widget in 5 minutes.\n",
"\n",
"This is because 5 machines × (widgets per machine) = 5 widgets in 5 minutes \n",
"⇒ (widgets per machine) in 5 minutes = 1 widget \n",
"⇒ 1 machine makes 1 widget in 5 minutes.\n",
"\n",
"---\n",
"\n",
"### Step 2: Calculate production time for 100 machines and 100 widgets\n",
"\n",
"Since each machine makes a widget in 5 minutes, having 100 machines means:\n",
"\n",
"- They can make 100 widgets *in the same 5 minutes*, because every machine simultaneously makes 1 widget in 5 minutes.\n",
"\n",
"---\n",
"\n",
"### **Answer:**\n",
"\n",
"**100 machines take 5 minutes to make 100 widgets.**"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from IPython.display import Markdown, display\n",
"\n",
Expand Down Expand Up @@ -318,22 +440,121 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 14,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Implementing Agentic AI—AI systems capable of autonomous decision-making and action—can add significant value across various industries. Here are some promising sectors where Agentic AI could be particularly impactful:\n",
"\n",
"1. **Financial Services and Investment Management** \n",
" - Autonomous trading and portfolio management \n",
" - Fraud detection and risk assessment \n",
" - Personalized financial advising \n",
"\n",
"2. **Healthcare and Medical Diagnostics** \n",
" - Automated patient monitoring and response systems \n",
" - Diagnostic assistance and treatment planning \n",
" - Managing supply chains and inventory \n",
"\n",
"3. **Manufacturing and Supply Chain Optimization** \n",
" - Autonomous production line management \n",
" - Predictive maintenance of equipment \n",
" - Logistics planning and inventory control \n",
"\n",
"4. **Smart Cities and Infrastructure** \n",
" - Traffic management and urban planning \n",
" - Utilities and energy distribution systems \n",
" - Public safety and emergency response coordination \n",
"\n",
"5. **Customer Service and Support** \n",
" - Intelligent, autonomous chatbots and virtual assistants that handle complex interactions \n",
" - Proactive customer engagement based on behavioral insights \n",
"\n",
"6. **Cybersecurity** \n",
" - Autonomous threat detection and response systems \n",
" - Adaptive security protocols that evolve with emerging threats \n",
"\n",
"**Considerations for Implementation:** \n",
"- Ethical and safety frameworks are crucial given the autonomous nature of Agentic AI. \n",
"- Industry-specific compliance and regulatory requirements should be addressed. \n",
"- Integration with existing systems and data infrastructure is key for success.\n",
"\n",
"**Summary:** \n",
"Industries like finance, healthcare, manufacturing, smart city infrastructure, and cybersecurity are particularly well-suited for Agentic AI due to their reliance on complex decision-making, automation, and data-driven processes. Selecting the right industry depends on your organization's expertise, infrastructure, and strategic goals.\n"
]
},
{
"data": {
"text/markdown": [
"Implementing Agentic AI—AI systems capable of autonomous decision-making and action—can add significant value across various industries. Here are some promising sectors where Agentic AI could be particularly impactful:\n",
"\n",
"1. **Financial Services and Investment Management** \n",
" - Autonomous trading and portfolio management \n",
" - Fraud detection and risk assessment \n",
" - Personalized financial advising \n",
"\n",
"2. **Healthcare and Medical Diagnostics** \n",
" - Automated patient monitoring and response systems \n",
" - Diagnostic assistance and treatment planning \n",
" - Managing supply chains and inventory \n",
"\n",
"3. **Manufacturing and Supply Chain Optimization** \n",
" - Autonomous production line management \n",
" - Predictive maintenance of equipment \n",
" - Logistics planning and inventory control \n",
"\n",
"4. **Smart Cities and Infrastructure** \n",
" - Traffic management and urban planning \n",
" - Utilities and energy distribution systems \n",
" - Public safety and emergency response coordination \n",
"\n",
"5. **Customer Service and Support** \n",
" - Intelligent, autonomous chatbots and virtual assistants that handle complex interactions \n",
" - Proactive customer engagement based on behavioral insights \n",
"\n",
"6. **Cybersecurity** \n",
" - Autonomous threat detection and response systems \n",
" - Adaptive security protocols that evolve with emerging threats \n",
"\n",
"**Considerations for Implementation:** \n",
"- Ethical and safety frameworks are crucial given the autonomous nature of Agentic AI. \n",
"- Industry-specific compliance and regulatory requirements should be addressed. \n",
"- Integration with existing systems and data infrastructure is key for success.\n",
"\n",
"**Summary:** \n",
"Industries like finance, healthcare, manufacturing, smart city infrastructure, and cybersecurity are particularly well-suited for Agentic AI due to their reliance on complex decision-making, automation, and data-driven processes. Selecting the right industry depends on your organization's expertise, infrastructure, and strategic goals."
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# First create the messages:\n",
"\n",
"messages = [{\"role\": \"user\", \"content\": \"Something here\"}]\n",
"messages = [{\"role\": \"user\", \"content\": \"What is a good business industry to implement Agentic AI into?\"}]\n",
"\n",
"# Then make the first call:\n",
"\n",
"response =\n",
"response = openai.chat.completions.create(\n",
" model=\"gpt-4.1-nano\",\n",
" messages=messages\n",
")\n",
"\n",
"# Then read the business idea:\n",
"\n",
"business_idea = response.\n",
"business_idea = response.choices[0].message.content\n",
"print(business_idea)\n",
"\n",
"from IPython.display import Markdown, display\n",
"\n",
"display(Markdown(business_idea))\n",
"# And repeat! In the next message, include the business idea within the message"
]
},
Expand All @@ -359,7 +580,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.9"
"version": "3.12.11"
}
},
"nbformat": 4,
Expand Down
Loading