Google Gemini can book an Uber or order food for you on Pixel 10 and Galaxy S26
Back to Tutorials
toolsTutorialintermediate

Google Gemini can book an Uber or order food for you on Pixel 10 and Galaxy S26

February 25, 20263 views5 min read

Learn to build a basic AI task automation system that can order food or book rides, similar to Google's Gemini AI assistant.

Introduction

In this tutorial, you'll learn how to create a basic task automation system using AI that can perform simple actions like ordering food or booking rides. This builds upon the concept demonstrated by Google's Gemini AI, which can now automate tasks on smartphones. We'll create a simplified version that demonstrates the core principles of AI-powered task automation using Python and web APIs.

Prerequisites

  • Basic Python knowledge
  • Python 3.7 or higher installed
  • Access to a smartphone with internet connectivity
  • Basic understanding of REST APIs
  • Development environment (IDE or text editor)

Step-by-step instructions

Step 1: Set up your development environment

Install required Python packages

First, we need to install the necessary Python libraries for our automation system. Open your terminal or command prompt and run:

pip install requests python-dotenv

This installs the requests library for making HTTP requests and python-dotenv for managing environment variables.

Step 2: Create your project structure

Initialize your project directory

Create a new directory for your project and set up the following structure:

task_automation/
├── main.py
├── config.py
├── tasks/
│   ├── __init__.py
│   ├── food_ordering.py
│   └── ride_booking.py
└── .env

This structure organizes our code logically, separating concerns into different modules.

Step 3: Configure environment variables

Create your .env file

Create a .env file in your project root with placeholder API keys:

FOOD_API_KEY=your_food_api_key_here
RIDE_API_KEY=your_ride_api_key_here
USER_LOCATION=40.7128,-74.0060

This approach keeps sensitive information out of your code and makes it easy to switch between different environments.

Step 4: Implement basic task automation framework

Create the main automation logic

In main.py, implement the core automation logic:

import os
from dotenv import load_dotenv
from tasks.food_ordering import order_food
from tasks.ride_booking import book_ride

load_dotenv()

def main():
    print("AI Task Automation System")
    print("========================")
    
    # Simulate user input
    task = input("What would you like me to do? (food/ride): ").lower()
    
    if task == "food":
        order_food()
    elif task == "ride":
        book_ride()
    else:
        print("I don't understand that task.")

if __name__ == "__main__":
    main()

This sets up the main entry point that will route user requests to appropriate automation functions.

Step 5: Implement food ordering automation

Create the food ordering module

In tasks/food_ordering.py, create the food ordering automation:

import requests
import os
from dotenv import load_dotenv

load_dotenv()

def order_food():
    print("Starting food ordering process...")
    
    # Get user preferences
    restaurant = input("Which restaurant? ")
    items = input("What would you like to order? ")
    
    # Simulate API call to food delivery service
    api_key = os.getenv("FOOD_API_KEY")
    
    # This is a simplified example - real implementation would connect to actual APIs
    print(f"Ordering {items} from {restaurant}...")
    print("Order placed successfully!")
    
    # In a real implementation, you would make actual API calls here
    # Example: requests.post("https://api.foodservice.com/order", 
    #                      headers={"Authorization": f"Bearer {api_key}"},
    #                      json={"restaurant": restaurant, "items": items})

This simulates the process of ordering food, showing how an AI assistant would gather user preferences and send them to appropriate services.

Step 6: Implement ride booking automation

Create the ride booking module

In tasks/ride_booking.py, implement the ride booking automation:

import requests
import os
from dotenv import load_dotenv

load_dotenv()

def book_ride():
    print("Starting ride booking process...")
    
    # Get user preferences
    destination = input("Where would you like to go? ")
    ride_type = input("What type of ride? (uber/lyft) ")
    
    # Simulate API call to ride service
    api_key = os.getenv("RIDE_API_KEY")
    
    print(f"Booking {ride_type} to {destination}...")
    print("Ride booked successfully!")
    
    # In a real implementation, you would make actual API calls here
    # Example: requests.post("https://api.rideservice.com/book", 
    #                      headers={"Authorization": f"Bearer {api_key}"},
    #                      json={"destination": destination, "ride_type": ride_type})

This demonstrates how ride booking automation would work, collecting destination and ride type information from the user.

Step 7: Test your automation system

Run your automation system

Run your main script to test the automation system:

python main.py

When prompted, try ordering food or booking a ride to see how the system routes your requests to the appropriate automation functions.

Step 8: Extend with AI integration

Add natural language processing capabilities

To make this more like the Gemini AI system, you can integrate with an AI service like OpenAI's GPT:

import openai

# Add to your config.py
openai.api_key = os.getenv("OPENAI_API_KEY")

def interpret_user_request(user_input):
    response = openai.Completion.create(
        engine="text-davinci-003",
        prompt=f"Interpret this request: {user_input}. Should I order food or book a ride?",
        max_tokens=50
    )
    return response.choices[0].text.strip()

This shows how an AI system would interpret natural language requests and determine the appropriate action to take.

Summary

In this tutorial, you've learned how to create a basic task automation system that can handle simple tasks like ordering food or booking rides. While this is a simplified implementation, it demonstrates the core principles behind AI assistants like Google's Gemini that can automate daily tasks. The system uses modular design, environment variables for security, and simulates API interactions that would connect to real services. In a production environment, you would replace the simulated API calls with actual integrations to services like Uber, DoorDash, or other delivery platforms.

This foundation can be extended with more sophisticated AI capabilities, natural language processing, and integration with smartphone APIs to create truly assistant-like experiences.

Source: The Verge AI

Related Articles