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
1 change: 1 addition & 0 deletions ai-learning-series
Submodule ai-learning-series added at dd67a3
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!")
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
google-generativeai>=0.3.0
python-dotenv>=1.0.0
streamlit>=1.28.0
google-cloud-aiplatform>=1.26.0
vertexai>=0.1.0
requests>=2.31.0

# ============================================================================
# Optional: Alternative Platforms (Uncomment to use)
Expand Down
10 changes: 5 additions & 5 deletions sessions/session-01-ai-chatbots/live-demo/wcc_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
pass

# Configure Gemini API (done once at startup)
api_key = os.getenv('GEMINI_API_KEY') or os.getenv("GOOGLE_API_KEY")
api_key = os.getenv('API_KEY') or os.getenv("API_KEY")
if api_key:
genai.configure(api_key=api_key)
print(f"✓ API configured: {bool(api_key)}")
Expand Down Expand Up @@ -372,16 +372,16 @@ def step_5_streamlit_interface():
# Each step builds on the previous one, showing clear code differences!

# Step 1: Basic API integration with Gemini
# step_1_basic_api_call()
step_1_basic_api_call()

# Step 2: AI personality with system prompts
# step_2_add_personality()
step_2_add_personality()

# Step 3: Conversation memory management
# step_3_conversation_memory()
step_3_conversation_memory()

# Step 4: Model parameter experimentation
# step_4_model_parameters()
step_4_model_parameters()

# Step 5: Web interface with Streamlit (with personality + conversation history)
step_5_streamlit_interface() # Run with: streamlit run wcc_app.py
32 changes: 22 additions & 10 deletions sessions/session-01-ai-chatbots/live-demo/wcc_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import google.generativeai as genai
from datetime import datetime


#this sets the model to gemini 2.5
MODEL_ID = 'gemini-2.5-flash-lite'

# Load .env if available (dev convenience)
Expand All @@ -30,9 +30,10 @@
pass

# Configure Gemini API (done once at startup)
api_key = os.getenv('GEMINI_API_KEY') or 'your-gemini-api-key-here'
api_key = os.getenv('API_KEY') or "API_KEY"
genai.configure(api_key=api_key)


print("🚀 WCC AI Learning Series - Session 1 Demo")
print("=" * 50)

Expand Down Expand Up @@ -146,25 +147,34 @@ def step_3_conversation_memory():
print("STEP 3: Adding Conversation Memory")
print("=" * 60)

#defines the new class
class WCCChatBot:
"""Chatbot with conversation memory"""

#the init is the constructor, which is the first thing that runs, whenver a new object is created
def __init__(self):
#self.variable name is an instance variable, unique data that only belongs to one object
#creates the brain of the chatbot and saves it inside self.model
self.model = genai.GenerativeModel(
#includes the model's ID
MODEL_ID,
#the system prompt needed to instruct the model on what to do
system_instruction=WCC_SYSTEM_PROMPT
)
#this instance variable creates an empty list, this will act as the memory
self.conversation_history = []

#the chat method, is an instance method, a function that the object can perform
# is must take self as the first argument, then user input as the second variable
def chat(self, user_input):
"""Send message and get response with context"""
# this updates the memory with the user input
# Add user message to history
self.conversation_history.append({"role": "user", "parts": [user_input]})

# creates an instance variable that passes the history to the model to generate a response
# Generate response with full history
response = self.model.generate_content(self.conversation_history)

# Add assistant response to history
# the response is then added to the model's history
# Add assistant response to history, role indicates who said the message, parts indicates the context
self.conversation_history.append({"role": "model", "parts": [response.text]})

return response.text
Expand Down Expand Up @@ -230,6 +240,7 @@ def step_4_model_parameters():
generation_config = genai.types.GenerationConfig(
temperature=temp,
max_output_tokens=100,
top_p=0.9
)

model_temp = genai.GenerativeModel(
Expand Down Expand Up @@ -364,13 +375,14 @@ def step_5_streamlit_interface():
step_1_basic_api_call()

# Step 2: AI personality with system prompts
# step_2_add_personality()
step_2_add_personality()


# Step 3: Conversation memory management
# step_3_conversation_memory()
step_3_conversation_memory()

# Step 4: Model parameter experimentation
# step_4_model_parameters()
step_4_model_parameters()

# Step 5: Web interface with Streamlit
# step_5_streamlit_interface() # Run with: streamlit run wcc_demo.py
step_5_streamlit_interface() # Run with: streamlit run wcc_demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
Welcome! This **AI Chatbot** is your specialized mini-assistant for networking, community building, and finding relevant professional events near you.

## ✨ Project Overview

The **Event & Community Finder** is a conversational tool designed to streamline the process of finding local, relevant events from platforms like Meetup and Eventbrite.

### 🎯 The Core Functionality

The chatbot is specifically engineered to gather three key pieces of information from the user:

1. **📍 Location:** Where the user is.
2. **🗓️ Availability:** Which days the user is free.
3. **📚 Focus Area:** Whether they seek **Tech**, **Business**, or **Career-focused** events (with the ability to refine further, e.g., 'Tech events focused on AI agents').

Once the inputs are gathered, the chatbot searches external platforms for available events.

### 💡 Expected Output

The assistant returns a short, highly useful list of matches including:
Market size and potential Market size in the next 3-5 years
– Competitors (both big and small)
– Common customer pain points
– Current market conditions & Feasibility
– Recommendations on utilising Technology to stay ahead and Systems for efficiency
– Raising Capital / Funding (local perspective, most suitable way based on their scenario) - this is optional and only return if the user requests

# How to set up

### 1. Install Dependencies

```bash
pip install -r code/requirements.txt
```

### 2. Set Up Your API Key

Create a `.env` file in the project root:

```bash
GEMINI_API_KEY=your-gemini-api-key-here
```

Get your API key: [Gemini API Key Setup Guide](../../getting-started/gemini-api-key-setup.md)


#### what is included:
chatbot.py - building of the chatbot, where we call the api, create conversation memory, and add parameters
requirements.txt - ptyhon dependencies
.env - where the API key is kept


### 3. Run the Demo

```bash
python wcc_demo.py
```


# How to run it



# What i learned

Model Parameters: Explored the impact of parameters like temperature (controlling randomness and creativity), and the optimal use of Top P for token selection (e.g., setting probabilities to equal 85%).
Object-Oriented Programming (OOP): Had the opportunity to refresh and apply OOP principles in the code structure.
# Challenges faced
Initial System Prompt: The first system prompt was aiming to output a table which did not work so well when it was formatted, which made the response confusing.
Re-acquaintance: Getting back into the rhythm of Python coding after a break, and integrating with Streamlit for the first time as the chat interface.

# Future improvements 2.0

Enhanced UI/UX: Create a more intuitive and user-friendly interface.

Context Window Integration: Implement a context window for the AI model to access external, rich information, providing more tailored and well-rounded responses.

Performance: Optimize the model's setup to potentially reduce thinking/response time.

Feature Expansion: Add functionality for users to save preferences to a file or subscribe to weekly digests.

Framework Suggestions: Integrate the ability for the AI to provide relevant professional frameworks alongside event suggestions.



Loading