Skip to main content

klawsearch (Python SDK)

pip install klawsearch

Quick start

from klawsearch import KlawSearch

client = KlawSearch(api_key="ks-live-...")  # or set KLAWSEARCH_API_KEY env var

r = client.search("latest LLM benchmarks", max_results=5)
print(r.answer)
for hit in r:
    print(hit.score, hit.url, hit.title)

Async

import asyncio
from klawsearch import AsyncKlawSearch

async def main():
    async with AsyncKlawSearch(api_key="ks-live-...") as client:
        r = await client.search("hacker news api")
        print(r.answer)

asyncio.run(main())

LangChain integration

A drop-in KlawSearchResults tool with the standard LangChain web-search interface (string/dict input → list[dict] output):

from klawsearch.langchain_compat import KlawSearchResults

tool = KlawSearchResults(max_results=5, api_key="ks-live-...")
result = tool.invoke("AAPL 10-K risk factors")
# [{"url": ..., "title": ..., "content": ..., "score": ..., "raw_content": ...}, ...]

Self-hosted endpoint

client = KlawSearch(api_key="...", base_url="https://klaw.your-domain.dev")
# or set KLAWSEARCH_BASE_URL env var

Errors

from klawsearch import KlawSearch, AuthError, QuotaExceededError, RateLimitError

try:
    client.search("...")
except QuotaExceededError:
    ...  # bump plan
except RateLimitError:
    ...  # back off
except AuthError:
    ...  # bad key

Download files

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

Source Distribution

klawsearch-0.1.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

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

klawsearch-0.1.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: klawsearch-0.1.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.9

File hashes

Hashes for klawsearch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9d4fe98575eab51ac0c6977b53365813e1ec589ad13dc98f15c1f5d483d1e7e2
MD5 fe94e7a06847ae8a0ce652e6c0aba3fc
BLAKE2b-256 d25b67f399d5d363d5f37b6e7fffa867e56a2fde0ef63b4494871f0527b1ac6d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: klawsearch-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.9

File hashes

Hashes for klawsearch-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d1b652940aa45c10b17fafca537c9cfd723894e2265d942dc868688cf4d4a37
MD5 cd5b5ab3a2dfeee665aa03eec5e080d6
BLAKE2b-256 a95e4e716d9fabffc81705ee3dccb149d921866aa8ca5cf6dc47cecb7dbfbdf6

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