Skip to main content

Unofficial Python client for Google AI Search with multi-tab chat support

Project description

Google AI Search - Python Client

PyPI version Python 3.12+ License: MIT

Unofficial Python client for Google AI Search with support for multiple independent chat sessions using browser automation.

Features

Key Features:

  • 🤖 Interact with Google AI Search using Python
  • 💬 Create multiple independent chat sessions
  • 🖼️ Send images along with text messages
  • 🌐 Browser-based automation with Playwright
  • 📝 Simple and intuitive API
  • 🔐 Support for user profiles and cookie persistence

Installation

From PyPI (Recommended)

pip install google-ai-search-chat

From GitHub (Latest Development Version)

pip install git+https://github.com/yourusername/google-ai-search-chat.git

From Source

git clone https://github.com/yourusername/google-ai-search-chat.git
cd google-ai-search-chat
pip install -e .

Browser Driver Setup

The library uses Playwright for browser automation. Install required browsers:

playwright install chromium

Quick Start

Basic Usage

from google_ai_chat import GoogleAISession

# Create a session
session = GoogleAISession(user_data_dir=r"C:\chrome-profile", headless=False)

# Create a new chat
chat = session.new_chat()

# Send a message and get response
response = chat.send_message("Hello, what's the weather like?")
print(response)

# Create another independent chat in a new tab
chat2 = session.new_chat()
response2 = chat2.send_message("What is Python?")
print(response2)

# Cleanup
session.close()

Sending Images

from google_ai_chat import GoogleAISession

session = GoogleAISession(user_data_dir=r"C:\chrome-profile")
chat = session.new_chat()

# Send image with message
with open("image.jpg", "rb") as f:
    response = chat.send_message("What's in this image?", f.read())
    print(response)

session.close()

Headless Mode

# Headless mode (no browser window shown)
session = GoogleAISession(user_data_dir=r"C:\chrome-profile", headless=True)
chat = session.new_chat()
response = chat.send_message("Test message")
session.close()

API Reference

GoogleAISession

Main class for managing browser sessions and multiple chats.

GoogleAISession(user_data_dir: str = r"C:\chrome-profile", headless: bool = True)

Parameters:

  • user_data_dir (str): Path to Chrome profile directory for cookie persistence
  • headless (bool): Run browser in headless mode (default: True)

Methods:

  • new_chat() -> ChatGoogleAI: Create a new independent chat session
  • close_all_chats() -> None: Close all open chats
  • close() -> None: Close all chats and the browser session

ChatGoogleAI

Represents a single chat session.

Methods:

  • send_message(message: str, photo: bytes | None = None) -> str: Send a message (with optional image)
  • close() -> None: Close the chat

Requirements

  • Python 3.12+
  • Chromium browser (installed via Playwright)
  • At least 500MB disk space for browser installation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

google_ai_search_chat-0.1.0.tar.gz (35.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

google_ai_search_chat-0.1.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file google_ai_search_chat-0.1.0.tar.gz.

File metadata

  • Download URL: google_ai_search_chat-0.1.0.tar.gz
  • Upload date:
  • Size: 35.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for google_ai_search_chat-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e481467f5bbe5f3bbd6b3de98e2ebe802afcac13390f53b4472a44f03bc2b554
MD5 9e1ebf654a62c56bcdea077332d4fc38
BLAKE2b-256 0ae8c3fe4008a9819b2502a44ed9fc5b0dc16b414c2acf571ace4781cf4eac28

See more details on using hashes here.

File details

Details for the file google_ai_search_chat-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for google_ai_search_chat-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e995ee3e6c20c8c08fec0211c9cea7c59c7d4939d366f14bb5ac1b09031c615e
MD5 af330a1e263b6fd5c24e9c3c51118ac4
BLAKE2b-256 e5dccef05e48e93572f42cb078d6a0a1d4bcece0eca6550c01ec02bddcb0da09

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page