Welcome to the GDGC Build with AI Workshop! This hands-on workshop will teach you how to use Google's Gemini API to create AI agents that can call custom functions based on natural language input.
- Python 3.11 or higher
- A Google Cloud account with access to Vertex AI
- Basic understanding of Python and async programming
- Your Google Cloud API key
-
Setup the codebase
Using Firebase Studio:
- Go to Firebase Studio
- Click "Import Repo"
- Enter the work repository URL:
https://github.com/Developer-Student-Club-UoA/build-with-ai-workshop-2025- Wait for the codebase to initialise and setup to complete. You will know once the README opens. While you wait for this, you can go to step 2 of the setup instructions (Get Gemini API key).
Setting up the project locally:
(if you setup with firebase, skip to step 2)-
Fork the Repository
-
Clone your forked repository
git clone https://github.com/Developer-Student-Club-UoA/build-with-ai-workshop-2025.git cd build-with-ai-workshop-2025 -
Set Up Your Python Environment
# Create a virtual environment python -m venv venv # Activate the virtual environment # On Windows: .\venv\Scripts\activate # On macOS/Linux: source venv/bin/activate # Install dependencies pip install -e .
-
Get Gemini API key
Note: university accounts do not support Google AI studio, we recommend signing up with your personal email.
Head to the AI studio website to get setup.
.
├── README.md
└── workshop/
├── module1 # Basic setup and configuration of Gemini agent
├── module2 # Single function calling implementation
└── module3 # Advanced function chaining and conversation flow
├── main.py # Main application with Gemini agent
└── tools.py # Function declarations and implementations
The tools.py file contains two key components for each function:
- A function declaration that tells Gemini what the function does and what parameters it expects
- The actual function implementation that executes when Gemini calls it
Example:
get_current_weather_declaration = {
"name": "get_current_weather",
"description": "Gets the current weather for a given location.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city name (e.g. 'San Francisco', 'New York', 'London')"
}
},
"required": ["location"]
}
}
def get_current_weather(location: str) -> dict:
"""
Corresponds to the get_current_weather_declaration.
Will fetch the weather given a location.
"""The main.py file contains the GeminiAgent class that:
- Initializes the Gemini client with system instructions
- Manages the conversation and function context
- Processes responses and chats
- Set up your environment variables and authentication
- Initialize the Gemini client with basic chat capabilities
- Test basic conversations with the agent
- Create new function declarations
- Implement the functions with context awareness
- Add them to the agent's available tools
- Learn how to chain multiple functions together to solve complex queries
- Handle function dependencies and order of operations
- Practice with example scenarios like:
- Getting weather for current location (chains location + weather)
- Converting temperatures between units (chains weather + conversion)
- Comparing weather in different cities (chains multiple weather calls)
-
Configure Gemini API Key:
# Create or edit your .env file echo "API_KEY=YOUR_GEMINI_API_KEY" > .env
-
Run the application:
python src/main.py
-
Try some example queries:
- "What's the current weather in the captial of Japan?"
- "How hot is it in my location?"
- Gemini API documentation
- Project IDX documentation
- Firebase documentation
- Google Cloud Authentication guide
After completing the workshop:
- Explore advanced Gemini features
- Add more complex function capabilities
- Add more complex function chains
- Implement persistent conversation storage
This workshop material is licensed under the MIT License. See the LICENSE file for details.