diff --git a/BaseCamp2/README.md b/BaseCamp2/README.md new file mode 100644 index 00000000..570925b2 --- /dev/null +++ b/BaseCamp2/README.md @@ -0,0 +1,25 @@ +# Set up virtual environment + +```bash +python -m venv genai_env +source genai_env/bin/activate # On Windows: genai_env\Scripts\activate +``` + +# 🔧 Common Setup Issues + +* **Fork sync issues**: Use "Sync fork" button on GitHub, then git pull +* **Missing BaseCamp2**: After forking, sync with upstream and pull changes +* **Package installation**: Update pip first: pip install --upgrade pip + +# 📖 Study Materials + +See STUDY-NOTES.md for detailed session notes including: + +* GitHub & VSCode troubleshooting +* Python fundamentals recap +* Environment setup best practices +* API security guidelines + +# Contributing + +Found something helpful? Add it to the session notes or create a new resource file! diff --git a/BaseCamp3/Day_1/6b_products.py b/BaseCamp3/Day_1/6b_products.py index 1f667932..29a4258f 100644 --- a/BaseCamp3/Day_1/6b_products.py +++ b/BaseCamp3/Day_1/6b_products.py @@ -58,7 +58,7 @@ def read_record_by_query(record_id: int): with open(CSV_FILE, mode='r', newline='') as file: reader = csv.DictReader(file) for row in reader: - if "product_id" in row and row["product_id"].isdigit() and int(row["product_id"]) == record_id: + if "product_id" in row and row["product_id"].isdigit() and int(row["product_id"]) == record_d: return row @app.get("/") diff --git a/Readme.md b/Readme.md new file mode 100644 index 00000000..87a04fb6 --- /dev/null +++ b/Readme.md @@ -0,0 +1,26 @@ +# GenAI Engineering Cohort 2 + +## Repository Contents + +- BaseCamp materials and assignments +- Student resources and guides + +## Quick Links + +- 📋 [BaseCamp Study Notes](STUDY-NOTES.md) - Curated tips and fixes +- 📚 [Resources](docs/resources.md) - Additional learning materials + +## Getting Started + +### Quick Setup + +1. **Fork this repository** +2. **Clone your fork:** + + ```bash + git clone https://github.com/YOUR-USERNAME/GenAIEngineering-Cohort2.git + +[Other basic setup instructions with Environment and Tool] + +--- +*For detailed session notes and troubleshooting tips, see [STUDY-NOTES.md](STUDY-NOTES.md)* diff --git a/STUDY-NOTES.md b/STUDY-NOTES.md new file mode 100644 index 00000000..164d7981 --- /dev/null +++ b/STUDY-NOTES.md @@ -0,0 +1,148 @@ +# Curated Notes from BaseCamp Sessions + +--- + +## 🔧 GitHub & VSCode Setup + +### **Common Issues and Fixes** + +* **Cloning errors (e.g., BaseCamp2 not found)**: Participants reported that after forking the repo, `BaseCamp2` was missing. + + * **Fix**: Use the “sync fork” option on GitHub, then run `git pull` or `git pull --rebase` in VS Code terminal. +* **Using GitHub Desktop**: Some got access errors. The fix was to clone the correct repo: + + ```bash + git clone https://github.com/outskill-git/GenAIEngineering-Cohort2.git + ``` + +> 💬 *ChatGPT-style Tip*: “If your fork doesn't reflect upstream changes, go to GitHub and hit ‘Sync fork’. Then, do a `git pull` to update your local copy.” + +--- + +## 🧠 Python Fundamentals & Environment Setup + +### **Why Python for AI/ML?** + +Common reasons shared: + +* Rich libraries (NumPy, Pandas, TensorFlow) +* Easy syntax +* Interpreted, dynamically typed +* Huge community and support + +> 💬 *ChatGPT-style Note*: “Python’s readability, extensive libraries, and low learning curve make it the go-to language for AI/ML.” + +### **Virtual Environment (venv)** + +* Create: `python -m venv ` +* Activate (Mac): `source /bin/activate` +* Activate (VS-Code Git Bash): `source /bin/activate` +* Activate (Windows CMD): `.\\Scripts\activate.bat` +* Deactivate: `deactivate` +* Delete: Just remove the folder + +> 💬 *ChatGPT-style Reminder*: “Always activate your virtual environment before installing packages. Use `.gitignore` to exclude `/` from Git commits.” + +--- + +## 💡 Programming Concepts Clarified + +### **Python Nature** + +* **Interpreted Language**: Executes line-by-line, no compilation needed. +* **No do-while Loop**: Simulate with: + + ```python + while True: + # logic + if condition: break + ``` + +### **Constants in Python** + +* No true constants; use UPPER\_CASE variable names by convention. + +> 💬 “Constants in Python rely on developer discipline—use all-caps and don’t reassign.” + +### **Data Types and Casting** + +* Dynamic typing allows flexibility, but beware of runtime type errors. +* Type hints (`-> int`) are non-enforced and meant for readability and tools like linters. + +--- + +## 🔍 Python OOP Clarifications + +### **Static Methods and Variables** + +* Use decorators: + + ```python + @staticmethod + def my_static(): + pass + ``` + +* Class variables are accessible via `ClassName.var_name`. + +### **Function Overloading** + +* Not supported. Use default arguments to simulate. + + ```python + def greet(name="User"): + print(f"Hello, {name}") + ``` + +> 💬 “Python uses default values instead of traditional method overloading.” + +--- + +## ⚙️ Tools & Extensions + +### **Installing Packages** + +* Use pip: + + ```bash + pip install groq + pip install ipykernel + ``` + +* Update pip if facing installation issues: + + ```bash + pip install --upgrade pip + ``` + +### **Groq & Gemini APIs** + +* API keys should be stored securely in a `.env` file. +* Use `.gitignore` to exclude `.env` from GitHub. + +> 💬 “Never hardcode API keys—store them in a `.env` file and load using `dotenv`.” + +--- + +## 🔐 .env and Security Best Practices + +* **Storing Secrets**: Place keys in `.env` file and reference using `os.getenv()`. +* **Hiding from Git**: Add `.env` to `.gitignore`. + +> 💬 “Using environment variables protects sensitive data and avoids hardcoding credentials.” + +--- + +## 🧪 Development & Debugging Tips + +* Use Python Notebooks (`.ipynb`) for development and `.py` files for production. +* To avoid memory issues, avoid loading very large files at once. Use `readline()` or `readlines()` with slicing. + +--- + +## 📖 Additional Notes + +* **Prompt Engineering** and **Gemini API Role Assignment** were briefly mentioned as follow-up areas. +* **Recordings & Slides** available via Circle community portal. + +--- diff --git a/docs/resources.md b/docs/resources.md new file mode 100644 index 00000000..0a75d5c1 --- /dev/null +++ b/docs/resources.md @@ -0,0 +1,6 @@ +# 📖 Additional Resources + +* [C++ to Python guide](https://python.pages.doc.ic.ac.uk/cpp/lessons/cpp/) +* [Java to Python guide](https://python.pages.doc.ic.ac.uk/java/lessons/java/) + +---