Kaginawa
An unofficial client to Kagi APIs
Installation
pip install kaginawa
Usage
from kaginawa.client import Kaginawa
# You can also set the KAGI_API_KEY environment variable.
client = Kaginawa(token="YOUR_API_TOKEN")
response: KaginawaFastGPTResponse = client.generate(
"Write a logstash pipeline file to send a heartbeat to a server "
"https://example.com/heartbeat every 30 seconds"
)
print(response.output)
for reference in response.references:
print(reference.title)
print(reference.snippet)
print(reference.url)
response: KaginawaEnrichResponse = client.enrich_web(query="Best fermented hot sauce")
# or
response: KaginawaEnrichResponse = client.enrich_news(query="Is Oliver Tree okay?")
for result in response.results:
print(result.rank)
print(result.title)
print(result.url)
print(result.snippet)
print(result.published)
response: KaginawaSummarizationResponse = client.summarize(
url="https://example.com",
engine=KaginawaSummarizationEngine.AGNES,
summary_type=KaginawaSummaryType.TAKEAWAY,
target_language="FR"
)
print(response.output)
response: KaginawaSummarizationResponse = client.summarize(
text="The rain in Spain…",
engine=KaginawaSummarizationEngine.CECIL
)
print(response.output)
Async!
import asyncio
from kaginawa.async_client import AsyncKaginawa
async def amain():
kagi_client = AsyncKaginawa(...)
res = await kagi_client.generate(...)
print(res.output)
# If you want to explicitly close the client.
kagi_client.close()
if __name__ == "__main__":
asyncio.run(amain())
FAQ
- Do you support the search API?
- I would love to but I don't have enterprise.
- Why the name?
- Because it's like the only word that starts with Kagi
Authors
- Estelle Poulin dev@inspiredby.es
Metadata
Release files for kaginawa 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kaginawa-0.0.8.tar.gz | 606.1 kB | Without provenance | Details for kaginawa-0.0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kaginawa-0.0.8-py3-none-any.whl | Python 3 | none | any | Details for kaginawa-0.0.8-py3-none-any.whl |
Total release size: 614.2 kB
Release files / kaginawa-0.0.8.tar.gz
| Download URL | kaginawa-0.0.8.tar.gz |
|---|---|
| Size | 606.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0657d6b396fd207f93c45d2fe2c5ee055bbb4ddd83507cb2d656170fc0495bae
|
|
BLAKE2b-256 checksum How to use checksums |
7be841d8776841af36643573f660806fc5001202e0b208849b8234b24f398c3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.6
|
Release files / kaginawa-0.0.8-py3-none-any.whl
| Download URL | kaginawa-0.0.8-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc7e2b35e78842dee00ebcf22087536876dfd4d317da54ab443622248b9c12e2
|
|
BLAKE2b-256 checksum How to use checksums |
c1b935d53f076bc69a1a53b227f9e400c55b90717d025dfecd9d8313b50b722c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.6
|
Security for kaginawa 0.0.8
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.