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
Metadata
Release files for klawsearch 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| klawsearch-0.1.0.tar.gz | 6.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| klawsearch-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.5 kB
Release files / klawsearch-0.1.0.tar.gz
| Download URL | klawsearch-0.1.0.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d4fe98575eab51ac0c6977b53365813e1ec589ad13dc98f15c1f5d483d1e7e2
|
|
BLAKE2b-256 checksum How to use checksums |
d25b67f399d5d363d5f37b6e7fffa867e56a2fde0ef63b4494871f0527b1ac6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|
Release files / klawsearch-0.1.0-py3-none-any.whl
| Download URL | klawsearch-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9d1b652940aa45c10b17fafca537c9cfd723894e2265d942dc868688cf4d4a37
|
|
BLAKE2b-256 checksum How to use checksums |
a95e4e716d9fabffc81705ee3dccb149d921866aa8ca5cf6dc47cecb7dbfbdf6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|