Enumerate, Search, Parse, and Iterate - A tool for structured data extraction from search results
Project description
espai (Enumerate, Search, Parse, and Iterate)
A powerful tool for structured data extraction from search results using Google Search or Exa.ai with Gemini AI.
Features
- Parse natural language queries into structured search parameters
- Automatically discover and enumerate search spaces
- Multiple search providers (Google Custom Search, Exa.ai)
- Extract structured data from search results using Gemini AI
- Store results in efficient Polars DataFrames
- Real-time progress tracking
- Multiple output formats (CSV, JSON, Parquet)
Installation
From PyPI
pip install espai
From Source
git clone https://github.com/yourusername/espai.git
cd espai
poetry install
API Key Setup
Google Custom Search
-
Create a Google Custom Search Engine:
- Go to Google Programmable Search Engine
- Click "Add" to create a new search engine
- Under "Sites to search", select "Search the entire web" for unrestricted search
- Click "Create"
- Copy your "Search engine ID" (this will be your GOOGLE_CSE_ID)
-
Get a Google API Key:
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable the "Custom Search API" for your project
- Go to "Credentials" and create an API key (this will be your GOOGLE_API_KEY)
-
Set environment variables:
export GOOGLE_API_KEY="your_google_api_key"
export GOOGLE_CSE_ID="your_search_engine_id"
Exa.ai (Optional)
- Sign up at Exa.ai
- Get your API key from the dashboard
- Set environment variable:
export EXA_API_KEY="your_exa_api_key"
Gemini AI
- Go to Google AI Studio API Keys
- Create an API key (no credit card required)
- Set environment variable:
export GEMINI_API_KEY="your_gemini_api_key"
Usage
Basic usage:
espai "Athletic center names and addresses in all California zip codes"
With options:
espai "Athletic center names and addresses in all California zip codes" \
--max-results=10 \
--output-format=csv \
--provider=exa
Available options:
--max-results,-n: Maximum number of results per search (default: 10)--output-format,-f: Output format: csv, json, or parquet (default: csv)--output-file,-o: Output file path (default: results.[format])--verbose,-v: Show verbose output--temperature,-t: Temperature for LLM generation (0.0 to 1.0)--provider,-p: Search provider: google or exa (default: google)
Search Provider Comparison
Google Custom Search
- Pros:
- More precise keyword matching
- Better for finding specific attributes
- Reliable and stable API
- Cons:
- Limited to 100 queries per day on free tier
- Maximum 10 results per query
- Requires setting up a custom search engine
Exa.ai
- Pros:
- Better semantic understanding
- Returns more context in results
- Up to 100 results per query
- No need to set up a search engine
- Cons:
- May be less precise for specific attribute searches
- API is newer and may change
- Requires paid subscription for production use
Example Queries
Find businesses:
espai "Coffee shop names and addresses in Seattle neighborhoods"
Research organizations:
espai "Research labs working on AI in Massachusetts universities"
Gather event information:
espai "Tech conferences and their dates in European cities in 2024"
License
MIT License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file espai-0.2.1.tar.gz.
File metadata
- Download URL: espai-0.2.1.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.1 Darwin/23.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbf0341ce2b784fd5bbf75bf4bd5665bfd99be4b1a8a0ae3c98decaacc6898f1
|
|
| MD5 |
d33522808e06d80d95519223d9449ecd
|
|
| BLAKE2b-256 |
46fb675889cd589b42428ae1ad5377595ffddefecb2878d18d88da29f59c053f
|
File details
Details for the file espai-0.2.1-py3-none-any.whl.
File metadata
- Download URL: espai-0.2.1-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.1 Darwin/23.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31015387fbbf451d45a73a496b22c521991dc78603935036487ad0bdc30e2bd5
|
|
| MD5 |
b6e142c19163c66399d69b3956508134
|
|
| BLAKE2b-256 |
0714bc16411ea46ed7c6286f5e60a50b019a14e7a95e26401a06c0948b7309a5
|