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
33 changes: 33 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "Python 3",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bookworm",
"customizations": {
"codespaces": {
"openFiles": [
"README.md",
"sessions/session-01-ai-chatbots/starter-template/chatbot.py"
]
},
"vscode": {
"settings": {},
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance"
]
}
},
"updateContentCommand": "[ -f packages.txt ] && sudo apt update && sudo apt upgrade -y && sudo xargs apt install -y <packages.txt; [ -f requirements.txt ] && pip3 install --user -r requirements.txt; pip3 install --user streamlit; echo '✅ Packages installed and Requirements met'",
"postAttachCommand": {
"server": "streamlit run sessions/session-01-ai-chatbots/starter-template/chatbot.py --server.enableCORS false --server.enableXsrfProtection false"
},
"portsAttributes": {
"8501": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [
8501
]
}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,9 @@ cython_debug/
marimo/_static/
marimo/_lsp/
__marimo__/

# .gitignore
.env
.env.local
*.key

4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"python.analysis.autoImportCompletions": true,
"python.analysis.typeCheckingMode": "standard"
}
7 changes: 7 additions & 0 deletions getting-started/amna.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from dotenv import load_dotenv
import os

load_dotenv()

project_id = os.getenv("gen-lang-client-0919970423")
location = os.getenv("GCP_LOCATION")
16 changes: 16 additions & 0 deletions getting-started/quickstart.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from google.cloud import aiplatform

# Initialize Vertex AI
aiplatform.init(project="gen-lang-client-0919970423", location="us-central1")

# Import the generative model
from vertexai.generative_models import GenerativeModel

# Initialize the model
model = GenerativeModel("gemini-2.5-flash-lite")

# Make a simple request
response = model.generate_content("What is AI?")

print("Response:")
print(response.text)
23 changes: 23 additions & 0 deletions getting-started/test-gemini.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import os
from dotenv import load_dotenv
import google.generativeai as genai

# Load environment variables
load_dotenv()

# Configure API
api_key = os.getenv('GEMINI_API_KEY')
if not api_key:
print("❌ Error: GEMINI_API_KEY not found in .env file")
exit(1)

genai.configure(api_key=api_key)

# Test the API
try:
model = genai.GenerativeModel('gemini-2.5-flash-lite')
response = model.generate_content("What is AI? Explain to a novice.")
print("✅ API is working!")
print(f"Response: {response.text}")
except Exception as e:
print(f"❌ Error: {e}")
22 changes: 22 additions & 0 deletions getting-started/test-setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import sys
print(f"Python version: {sys.version}")

try:
from google.cloud import aiplatform
print("✅ google-cloud-aiplatform installed")
except ImportError:
print("❌ google-cloud-aiplatform not found")

try:
import streamlit
print("✅ streamlit installed")
except ImportError:
print("❌ streamlit not found")

try:
import dotenv
print("✅ python-dotenv installed")
except ImportError:
print("❌ python-dotenv not found")

print("\n✅ All packages installed successfully!")
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
# Session 1 (AI Fundamentals & LLM APIs) - REQUIRED
# ============================================================================

google-generativeai>=0.3.0
google-cloud-aiplatform>=1.26.0
vertexai>=0.1.0
python-dotenv>=1.0.0
streamlit>=1.28.0
requests>=2.31.0

# ============================================================================
# Optional: Alternative Platforms (Uncomment to use)
Expand Down
45 changes: 45 additions & 0 deletions sessions/session-01-ai-chatbots/starter-template/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import streamlit as st
import json
from chatbot import SimpleBot

st.set_page_config(page_title="WCC Info Bot", page_icon="🤖")

st.title("🤖 WCC Info Bot")
st.markdown("Ask me anything about Women Coding Community!")

# Load FAQs
with open("wcc_faqs.json") as f:
wcc_data = json.load(f)

faq_text = "\n".join([
f"Q: {faq['question']}\nA: {faq['answer']}"
for faq in wcc_data["faqs"]
])

system_prompt = f"""You are a friendly WCC assistant...
{faq_text}"""

# Initialize bot
if "bot" not in st.session_state:
st.session_state.bot = SimpleBot(system_prompt=system_prompt)

if "messages" not in st.session_state:
st.session_state.messages = []

# Display chat history
for message in st.session_state.messages:
with st.chat_message(message["role"]):
st.markdown(message["content"])

# Chat input
if user_input := st.chat_input("Ask me about WCC..."):
st.session_state.messages.append({"role": "user", "content": user_input})

with st.chat_message("user"):
st.markdown(user_input)

response = st.session_state.bot.chat(user_input)
st.session_state.messages.append({"role": "assistant", "content": response})

with st.chat_message("assistant"):
st.markdown(response)
36 changes: 35 additions & 1 deletion sessions/session-01-ai-chatbots/starter-template/chatbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
load_dotenv()

# Configure Gemini API
API_KEY = os.getenv("GEMINI_API_KEY")
API_KEY ="AIzaSyBbKBVBiiMuQzfI8CSiIqC02bNXJ_1-nI0"
if not API_KEY:
raise ValueError(
"GEMINI_API_KEY not found in environment variables. "
Expand Down Expand Up @@ -115,3 +115,37 @@ def main():

if __name__ == "__main__":
main()
import json

# Load WCC FAQs
with open("wcc_faqs.json") as f:
wcc_data = json.load(f)

# Create FAQ context
faq_text = "\n".join([
f"Q: {faq['question']}\nA: {faq['answer']}"
for faq in wcc_data["faqs"]
])

# Create system prompt with WCC knowledge
system_prompt = f"""You are Maya, the enthusiastic WCC assistant!
You love helping women in tech and are passionate about community.
Always be encouraging and supportive.
Use emojis occasionally to add warmth and supportiveness.
Also be kind and inclusive in your responses.

Here are the FAQs you should reference:
{faq_text}

Be warm, encouraging, and inclusive. If you don't know something, suggest they contact the WCC team.
"""

import logging

logging.basicConfig(filename='chatbot.log', level=logging.INFO)

def log_conversation(user_msg, bot_response):
logging.info(f"User: {user_msg}")
logging.info(f"Bot: {bot_response}")

bot = SimpleBot(system_prompt=system_prompt)
37 changes: 37 additions & 0 deletions sessions/session-01-ai-chatbots/starter-template/scraper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import requests
from bs4 import BeautifulSoup
import json

def scrape_wcc_events():
"""Scrape upcoming events from WCC website"""
# Replace with actual WCC website URL
url = "https://womencoding.community/events"

try:
response = requests.get(url)
soup = BeautifulSoup(response.content, 'html.parser')

events = []
for event in soup.find_all('div', class_='event'):
events.append({
"title": event.find('h3').text,
"date": event.find('span', class_='date').text,
"description": event.find('p').text
})

return events
except Exception as e:
print(f"Error scraping: {e}")
return []

# Use in chatbot
events = scrape_wcc_events()
events_text = "\n".join([
f"- {e['title']} on {e['date']}: {e['description']}"
for e in events
])

system_prompt = f"""You are a WCC assistant.
Upcoming events:
{events_text}
"""
18 changes: 18 additions & 0 deletions sessions/session-01-ai-chatbots/starter-template/test_bot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from chatbot import SimpleBot

def test_wcc_bot():
bot = SimpleBot(system_prompt="You are a WCC assistant.")

# Test basic response
response = bot.chat("What is WCC?")
assert len(response) > 0

# Test conversation memory
bot.chat("I'm interested in AI")
response = bot.chat("Can you recommend a session?")
assert "AI" in response or "session" in response.lower()

print("✅ All tests passed!")

if __name__ == "__main__":
test_wcc_bot()
20 changes: 20 additions & 0 deletions sessions/session-01-ai-chatbots/starter-template/wcc_faqs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"faqs": [
{
"question": "What is WCC?",
"answer": "Women Coding Community is a global community of women in tech..."
},
{
"question": "How do I join WCC?",
"answer": "Visit our website and sign up for free..."
},
{
"question": "When are the sessions?",
"answer": "Sessions are held every other Wednesday at 7 PM EST..."
},
{
"question": "Can I volunteer?",
"answer": "Absolutely! We're always looking for volunteers..."
}
]
}