Week 1 exercise

This commit is contained in:
Elijah Rwothoromo
2025-08-05 20:42:50 +03:00
parent 3a042500d7
commit 9da9692a9b
7 changed files with 649 additions and 79 deletions

View File

@@ -40,10 +40,18 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "d296f9b6-8de4-44db-b5f5-9b653dfd3d81",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Connected to the internet and can reach Google\n"
]
}
],
"source": [
"import urllib.request\n",
"\n",
@@ -101,10 +109,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "7c8c0bb3-0e94-466e-8d1a-4dfbaa014cbe",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Virtualenv is active:\n",
"Environment Path: /Users/elijahsmac/Desktop/code/llm/llm_engineering/llms\n",
"Environment Name: llms\n"
]
}
],
"source": [
"# Some quick checks that your Conda environment or VirtualEnv is as expected\n",
"# The Environment Name should be: llms\n",
@@ -164,10 +182,22 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"id": "6c78b7d9-1eea-412d-8751-3de20c0f6e2f",
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'openai'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[8], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# This import should work if your environment is active and dependencies are installed!\u001b[39;00m\n\u001b[0;32m----> 3\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mopenai\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m OpenAI\n",
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'openai'"
]
}
],
"source": [
"# This import should work if your environment is active and dependencies are installed!\n",
"\n",
@@ -201,10 +231,19 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "caa4837e-b970-4f89-aa9a-8aa793c754fd",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
".env file found.\n",
"SUCCESS! OPENAI_API_KEY found and it has the right prefix\n"
]
}
],
"source": [
"from pathlib import Path\n",
"\n",
@@ -254,10 +293,18 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"id": "ab9ea6ef-49ee-4899-a1c7-75a8bd9ac36b",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"There is already a .env file - if you want me to create a new one, change the variable overwrite_if_already_exists to True above\n"
]
}
],
"source": [
"# Only run this code in this cell if you want to have a .env file created for you!\n",
"\n",
@@ -371,10 +418,22 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"id": "cccb58e7-6626-4033-9dc1-e7e3ff742f6b",
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'openai'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[9], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mopenai\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m OpenAI\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mdotenv\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m load_dotenv\n\u001b[1;32m 3\u001b[0m load_dotenv(override\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n",
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'openai'"
]
}
],
"source": [
"from openai import OpenAI\n",
"from dotenv import load_dotenv\n",
@@ -463,10 +522,110 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"id": "248204f0-7bad-482a-b715-fb06a3553916",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Starting diagnostics at 2025-08-02 23:16:47\n",
"\n",
"===== System Information =====\n",
"Operating System: Darwin\n",
"MacOS Version: 10.16\n",
"Architecture: ('64bit', 'Mach-O')\n",
"Machine: x86_64\n",
"Processor: i386\n",
"Total RAM: 16.00 GB\n",
"Available RAM: 6.04 GB\n",
"Free Disk Space: 315.94 GB\n",
"\n",
"===== File System Information =====\n",
"Current Directory: /Users/elijahsmac/Desktop/code/llm/llm_engineering/week1\n",
"Write permission: OK\n",
"\n",
"Files in Current Directory:\n",
" - .ipynb_checkpoints\n",
" - Guide to Jupyter.ipynb\n",
" - Intermediate Python.ipynb\n",
" - __pycache__\n",
" - community-contributions\n",
" - day1.ipynb\n",
" - day2 EXERCISE.ipynb\n",
" - day5.ipynb\n",
" - diagnostics.py\n",
" - report.txt\n",
" - solutions\n",
" - troubleshooting.ipynb\n",
" - week1 EXERCISE.ipynb\n",
"\n",
"===== Git Repository Information =====\n",
"Git Repository Root: /Users/elijahsmac/Desktop/code/llm/llm_engineering\n",
"Current Commit: 3a042500d7db3c0e8cde89f836a60e6cd7ab9ba1\n",
"Remote Origin: git@github.com:ed-donner/llm_engineering.git\n",
"\n",
"===== Environment File Check =====\n",
".env file exists at: /Users/elijahsmac/Desktop/code/llm/llm_engineering/.env\n",
"OPENAI_API_KEY found in .env file\n",
"\n",
"===== Anaconda Environment Check =====\n",
"No active Anaconda environment detected\n",
"\n",
"===== Virtualenv Check =====\n",
"Virtualenv is active:\n",
"Environment Path: /Users/elijahsmac/Desktop/code/llm/llm_engineering/llms\n",
"Environment Name: llms\n",
"\n",
"Python Environment:\n",
"Python Version: 3.13.5 | packaged by Anaconda, Inc. | (main, Jun 12 2025, 11:09:21) [Clang 14.0.6 ]\n",
"Python Executable: /Users/elijahsmac/anaconda3/bin/python\n",
"\n",
"Required Package Versions:\n",
"ERROR: Required package 'openai' is not installed\n",
"python-dotenv: 1.1.0\n",
"requests: 2.32.3\n",
"ERROR: Required package 'gradio' is not installed\n",
"ERROR: Required package 'transformers' is not installed\n",
"\n",
"===== Network Connectivity Check =====\n",
"SSL Version: OpenSSL 3.0.16 11 Feb 2025\n",
"ERROR: Required packages are not installed. Please install them using 'pip install requests speedtest-cli'\n",
"\n",
"===== Environment Variables Check =====\n",
"\n",
"PYTHONPATH is not set.\n",
"\n",
"Python sys.path:\n",
" - /Users/elijahsmac/anaconda3/lib/python313.zip\n",
" - /Users/elijahsmac/anaconda3/lib/python3.13\n",
" - /Users/elijahsmac/anaconda3/lib/python3.13/lib-dynload\n",
" - \n",
" - /Users/elijahsmac/anaconda3/lib/python3.13/site-packages\n",
" - /Users/elijahsmac/anaconda3/lib/python3.13/site-packages/aeosa\n",
" - /Users/elijahsmac/anaconda3/lib/python3.13/site-packages/setuptools/_vendor\n",
"OPENAI_API_KEY is set after calling load_dotenv()\n",
"\n",
"===== Additional Diagnostics =====\n",
"Temp directory is writable: /var/folders/_1/d6xg9lvd4lb714ry78xpc10w0000gn/T\n",
"\n",
"===== Errors Found =====\n",
"The following critical issues were detected. Please address them before proceeding:\n",
"- Required package 'openai' is not installed\n",
"- Required package 'gradio' is not installed\n",
"- Required package 'transformers' is not installed\n",
"- Required packages are not installed. Please install them using 'pip install requests speedtest-cli'\n",
"\n",
"\n",
"Completed diagnostics at 2025-08-02 23:16:47\n",
"\n",
"\n",
"Please send these diagnostics to me at ed@edwarddonner.com\n",
"Either copy & paste the above output into an email, or attach the file report.txt that has been created in this directory.\n"
]
}
],
"source": [
"# Run my diagnostics report to collect key information for debugging\n",
"# Please email me the results. Either copy & paste the output, or attach the file report.txt\n",
@@ -501,7 +660,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.11"
"version": "3.11.7"
}
},
"nbformat": 4,