Skip to main content

An integration package connecting CrustAPI (Google search data) and LangChain

Project description

langchain-crustapi

This package connects CrustAPI to LangChain, giving your chains and agents clean, structured Google data from one endpoint: web search, Maps, News, Shopping, Images, Videos, Places, Scholar, and Patents. You only pay for successful results, and there's a free tier with no card.

Installation

pip install -U langchain-crustapi
export CRUSTAPI_API_KEY="your-key"   # free at https://crustapi.com

Usage

from langchain_crustapi import CrustAPISearch

# Web search (default)
tool = CrustAPISearch(max_results=5)
tool.invoke({"query": "best crm software"})

# Pick a Google surface
maps = CrustAPISearch(search_type="maps", location="Austin, TX")
maps.invoke({"query": "dentists"})

news = CrustAPISearch(search_type="news")
news.invoke({"query": "openai"})

Bind it to an agent like any other LangChain tool:

from langchain.chat_models import init_chat_model
from langchain_crustapi import CrustAPISearch

llm = init_chat_model("gpt-4o-mini")
agent_llm = llm.bind_tools([CrustAPISearch()])

Parameters

  • search_type: the Google surface — web (default), news, maps, places, shopping, images, videos, scholar, patents.
  • max_results: number of results to return (default 10).
  • gl: two-letter country code, e.g. us.
  • hl: two-letter language code, e.g. en.
  • location: city or region for local results, e.g. Austin, TX.

The API key is read from the CRUSTAPI_API_KEY environment variable, or you can pass crustapi_api_key when constructing the tool.

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

langchain_crustapi-0.1.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

langchain_crustapi-0.1.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for langchain_crustapi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 64424a9946564070eb0c069aa7772cb9c881c21a5c5ba6680622da1c78bed28b
MD5 280d3766d44eded4583b7b927708d008
BLAKE2b-256 2da78e9e5a6b7d4356f73e366337f19de3080a19f4a7147296b25adde2bf21c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_crustapi-0.1.0.tar.gz:

Publisher: publish.yml on CrustAPI/langchain-crustapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for langchain_crustapi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 259c431d53b487e22d2448776207b5dfbfd4cd48e8c9d6b81bf522cb21368df9
MD5 c73af9bb99d17c3687c3514dcc8ccd97
BLAKE2b-256 a5d2f61925e1ba64d020c2c284618088db810a106a94d2437e1937bb57ba0c8e

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_crustapi-0.1.0-py3-none-any.whl:

Publisher: publish.yml on CrustAPI/langchain-crustapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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