Skip to main content

langchain-serpbit

Google Search for LangChain after Google's Custom Search JSON API stops searching the whole web on January 1, 2027. These are the Google Search tools of langchain-google-community, with the same calls, names and answers, served by Serpbit from Google's own results pages.

pip install langchain-serpbit

Moving is two lines: the import and the key. Make a key at https://app.serpbit.com/keys and set SERPBIT_API_KEY. The search engine id is gone, because the results come from the whole web.

# Before
from langchain_google_community import GoogleSearchAPIWrapper, GoogleSearchResults, GoogleSearchRun
search = GoogleSearchAPIWrapper(k=5)  # GOOGLE_API_KEY, GOOGLE_CSE_ID

# After
from langchain_serpbit import SerpbitSearchAPIWrapper, SerpbitSearchResults, SerpbitSearchRun
search = SerpbitSearchAPIWrapper(k=5)  # SERPBIT_API_KEY

search.run("espresso grinder")  # the results' snippets
search.results("espresso grinder", 3, search_params={"gl": "de", "dateRestrict": "m1"})

tools = [SerpbitSearchRun(api_wrapper=search), SerpbitSearchResults(api_wrapper=search, num_results=4)]

The tools keep Google's names, google_search and google_search_results_json, and Google's descriptions, so prompts, traces and evaluations stay as they are. search_params are Custom Search's own: gl, hl, lr, safe, dateRestrict, siteSearch, fileType, start, exactTerms and the rest (the full list).

What differs from Google's:

  • siterestrict=True is refused, because a Custom Search engine's own list of sites does not carry over. To search one site, pass search_params={"siteSearch": "example.com"}.
  • results() has no image or thumbnail, because Serpbit's answer has no pagemap.
  • A failed call raises the serpbit client's errors, such as serpbit.InsufficientCreditsError when the credits run out.
  • A search takes about 2 seconds, against under 1 on Google's API.

Each search costs 1 credit. The free plan gives 1,000 credits a month, with no card.

Metadata

Release files for langchain-serpbit 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-serpbit 0.1.0
File Size Uploaded Provenance Actions
langchain_serpbit-0.1.0.tar.gz 7.0 kB Without provenance Details for langchain_serpbit-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-serpbit 0.1.0
File Interpreter ABI Platform Actions
langchain_serpbit-0.1.0-py3-none-any.whl Python 3 none any Details for langchain_serpbit-0.1.0-py3-none-any.whl

Total release size: 12.9 kB

Release files / langchain_serpbit-0.1.0.tar.gz

Download URL langchain_serpbit-0.1.0.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2eaa65d28a7e637584d5dce97740881f0d019be59ef50b4abda4deab70cf6203
BLAKE2b-256 checksum
How to use checksums
f399d455e1f0197d86941bf56a89056b843282606087747e3e3d14e8d09b42e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.13

Release files / langchain_serpbit-0.1.0-py3-none-any.whl

Download URL langchain_serpbit-0.1.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5259440a4950246fa1c3dcace28b6b9702ffb3edb59d749dfa3a1dfbd6ae5604
BLAKE2b-256 checksum
How to use checksums
c249b1e374f7cb339eef0e5e72e98a011f95fdd8887e0406200d471eb9200d16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.13

Security for langchain-serpbit 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page