Name | kaginawa JSON |
Version |
0.0.8
JSON |
| download |
home_page | |
Summary | *Unofficial* client for the Kagi API |
upload_time | 2023-11-18 21:48:19 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.9 |
license | GPLv3 |
keywords |
kaginawa
|
VCS |
|
bugtrack_url |
|
requirements |
httpx
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Kaginawa
![project icon](project_icon.png)
An *unofficial* client to Kagi APIs
## Installation
```bash
pip install kaginawa
```
## Usage
```python
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!
```python
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
<dl>
<dt>Do you support the search API?</dt>
<dd>I would love to but I don't have enterprise.</dd>
<dt>Why the name?</dt>
<dd>Because it's like the only word that starts with Kagi</dd>
</dl>
![kagi_meme](kagi_meme.png)
## Authors
* Estelle Poulin <dev@inspiredby.es>
Raw data
{
"_id": null,
"home_page": "",
"name": "kaginawa",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "",
"keywords": "kaginawa",
"author": "",
"author_email": "Estelle Poulin <dev@inspiredby.es>",
"download_url": "https://files.pythonhosted.org/packages/7b/e8/41d8776841af36643573f660806fc5001202e0b208849b8234b24f398c3a/kaginawa-0.0.8.tar.gz",
"platform": null,
"description": "# Kaginawa\n\n![project icon](project_icon.png)\n\nAn *unofficial* client to Kagi APIs\n\n## Installation\n\n```bash\npip install kaginawa\n```\n\n## Usage\n\n```python\nfrom kaginawa.client import Kaginawa\n\n# You can also set the KAGI_API_KEY environment variable.\nclient = Kaginawa(token=\"YOUR_API_TOKEN\")\n\nresponse: KaginawaFastGPTResponse = client.generate(\n \"Write a logstash pipeline file to send a heartbeat to a server \"\n \"https://example.com/heartbeat every 30 seconds\"\n)\n\nprint(response.output)\n\nfor reference in response.references:\n print(reference.title)\n print(reference.snippet)\n print(reference.url)\n\nresponse: KaginawaEnrichResponse = client.enrich_web(query=\"Best fermented hot sauce\")\n# or \nresponse: KaginawaEnrichResponse = client.enrich_news(query=\"Is Oliver Tree okay?\")\n\nfor result in response.results:\n print(result.rank)\n print(result.title)\n print(result.url)\n print(result.snippet)\n print(result.published)\n\n\nresponse: KaginawaSummarizationResponse = client.summarize(\n url=\"https://example.com\",\n engine=KaginawaSummarizationEngine.AGNES,\n summary_type=KaginawaSummaryType.TAKEAWAY,\n target_language=\"FR\"\n)\n\nprint(response.output)\n\nresponse: KaginawaSummarizationResponse = client.summarize(\n text=\"The rain in Spain\u2026\",\n engine=KaginawaSummarizationEngine.CECIL\n)\n\nprint(response.output)\n```\n\n\n## Async!\n\n```python\nimport asyncio\nfrom kaginawa.async_client import AsyncKaginawa\n\nasync def amain():\n kagi_client = AsyncKaginawa(...)\n res = await kagi_client.generate(...)\n print(res.output)\n\n # If you want to explicitly close the client.\n kagi_client.close()\n\nif __name__ == \"__main__\":\n asyncio.run(amain()) \n```\n\n## FAQ\n\n<dl>\n <dt>Do you support the search API?</dt>\n <dd>I would love to but I don't have enterprise.</dd>\n\n <dt>Why the name?</dt>\n <dd>Because it's like the only word that starts with Kagi</dd>\n</dl>\n\n![kagi_meme](kagi_meme.png)\n\n## Authors\n\n* Estelle Poulin <dev@inspiredby.es>\n",
"bugtrack_url": null,
"license": "GPLv3",
"summary": "*Unofficial* client for the Kagi API",
"version": "0.0.8",
"project_urls": {
"changelog": "https://github.com/estheruary/kaginawa/-/blob/main/CHANGELOG.md",
"homepage": "https://github.com/estheruary/kaginawa",
"repository": "https://github.com/estheruary/kaginawa"
},
"split_keywords": [
"kaginawa"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c1b935d53f076bc69a1a53b227f9e400c55b90717d025dfecd9d8313b50b722c",
"md5": "0b16d351a63d5508983bc573b881f14c",
"sha256": "fc7e2b35e78842dee00ebcf22087536876dfd4d317da54ab443622248b9c12e2"
},
"downloads": -1,
"filename": "kaginawa-0.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0b16d351a63d5508983bc573b881f14c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 8073,
"upload_time": "2023-11-18T21:48:17",
"upload_time_iso_8601": "2023-11-18T21:48:17.907524Z",
"url": "https://files.pythonhosted.org/packages/c1/b9/35d53f076bc69a1a53b227f9e400c55b90717d025dfecd9d8313b50b722c/kaginawa-0.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7be841d8776841af36643573f660806fc5001202e0b208849b8234b24f398c3a",
"md5": "724ebeca8f7290b8015811190ebdb689",
"sha256": "0657d6b396fd207f93c45d2fe2c5ee055bbb4ddd83507cb2d656170fc0495bae"
},
"downloads": -1,
"filename": "kaginawa-0.0.8.tar.gz",
"has_sig": false,
"md5_digest": "724ebeca8f7290b8015811190ebdb689",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 606148,
"upload_time": "2023-11-18T21:48:19",
"upload_time_iso_8601": "2023-11-18T21:48:19.676592Z",
"url": "https://files.pythonhosted.org/packages/7b/e8/41d8776841af36643573f660806fc5001202e0b208849b8234b24f398c3a/kaginawa-0.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-18 21:48:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "estheruary",
"github_project": "kaginawa",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "httpx",
"specs": [
[
">=",
"0.25.0"
]
]
}
],
"lcname": "kaginawa"
}