Skip to main content

An integration package connecting CrustAPI (Google search and public LinkedIn 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) plus public LinkedIn data (profiles, companies, posts, jobs, and people search). 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()])

LinkedIn tool

CrustAPILinkedIn returns public LinkedIn data as the same clean JSON: a person's profile, a company page, recent posts, job listings, or people search. Pick the surface with linkedin_type and pass a LinkedIn URL or keywords.

from langchain_crustapi import CrustAPILinkedIn

# Profile (default)
profile = CrustAPILinkedIn()
profile.invoke({"url": "https://www.linkedin.com/in/satyanadella"})

# People search, with each person's full profile in the same call
people = CrustAPILinkedIn(linkedin_type="search", enrich=True)
people.invoke({"keywords": "growth marketer saas"})

Parameters

CrustAPISearch

  • 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.

CrustAPILinkedIn

  • linkedin_type: profile (default), company, posts, jobs, search.
  • limit: max results for posts, jobs, or people search.
  • start: result offset for jobs.
  • location: location filter for jobs, e.g. Austin, TX.
  • enrich: people search only, return each person's full profile in the same call.
  • employees: company only, include the employee list.
  • comments: posts only, include comments.

profile, company, and posts take a url. search takes keywords. jobs takes keywords (plus optional location) or a job url.

The API key is read from the CRUSTAPI_API_KEY environment variable, or you can pass crustapi_api_key when constructing either 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.2.0.tar.gz (6.1 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.2.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_crustapi-0.2.0.tar.gz
  • Upload date:
  • Size: 6.1 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.2.0.tar.gz
Algorithm Hash digest
SHA256 565c33ca292542666ef6fa2d5aee3bf2774eada2e2ad8969e34bd2f29ff5c138
MD5 fcf511a9ef800aa37d3f4bcc7f45b8bc
BLAKE2b-256 fac66db01b033a2c8da8fdc4ebc11d360285c8fc8af555d226b04d595cdfd599

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_crustapi-0.2.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.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_crustapi-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8f44d6b9d6770d68b01088c06dac85447a686b5d4f24c2f6ccbfb4ca37fbff45
MD5 1986609a3a4da3f173d93784b2d2a031
BLAKE2b-256 a12aea5339bc6d4413261f8591cde1706371e9efd2669f8a90306615d5694a6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_crustapi-0.2.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