Code.
Capstone Project Code Snippets
Gen AI Capabilities include:
1. Agent
2. Function Calling
3. Grounding
4. Structured output / JSON
5. System Instruction tuning
Create local SQLite database and add synthetic data
Populate local SQLite database with a curated list of my favorite restaurants in downtown Palo Alto and details with my dining preferences
Function Calling: defining ‘list_tables’ to list all tables in database
Function Calling: defining ‘describe_table’ to look up table schema
Function Calling: defining ‘execute_query’ to execute an SQL statement, then return result
System Instruction: set rules and guidelines for model behavior
Model used: gemini-1.5-pro
Start Chat with Eat.Where.Now
Continue Chat with Eat.Where.Now
Inspect Chat History on calls that the model makes
The responses that client returns in Chat History
First check if model can access real-time weather information
Confirmed, It can’t!
Add Google Search Grounding capability to check for real-time weather condition “if sunny”
Initialize Gen AI Model
Model = gemini-2.0-flash
Function Calling: defining ‘get_lunchtime_weather’ to query model if it is sunny, set temperature=0.0 for deterministic output
Design Prompt: to query model to check if weather “is sunny” for specific date and time period (including late lunch schedule)
Structured Output in JSON: Check output in JSON structure if any reference to “is sunny” from real-time weather check
Function Calling: define function "find-restaurants-with-outdoor-seating” if weather is sunny
Main logic to determine if Eat.Where.Now. should recommend restaurants with out door seating if date and time period is sunny
Output: Yes, it is sunny!
Eat.Where.Now. recommends three restaurants that have outdoor seating!