Metadata-Version: 2.4
Name: keiro-client
Version: 0.1.0
Summary: Python client SDK for Keiro — self-hostable adaptive RAG infrastructure
License: MIT License
        
        Copyright (c) 2025 Manas Ranjan Jena
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Repository, https://github.com/ManasRanjanJena253/Keiro
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: httpx>=0.27.0
Requires-Dist: pydantic>=2.7.0
Dynamic: license-file

# keiro-client

Python client SDK for [Keiro](https://github.com/yourusername/keiro) — a self-hostable adaptive RAG infrastructure.

## Installation

```bash
pip install keiro-client
```

## Quickstart

```python
from keiro import KeiroClient

client = KeiroClient(
    base_url="http://localhost:8080",
    secret="your-shared-secret",
    namespace="my-docs"
)

# Ingest a document
job_id = client.ingest("document.pdf")

# Poll until complete
while True:
    status = client.job_status(job_id)
    if status.is_terminal:
        break

# Query
response = client.query("What are the main compliance obligations?")
print(response.response)
print(f"Strategy used: {response.retrieval_details.tier_name}")
print(f"Cache hit: {response.cache_hit}")
print(f"Total tokens: {response.total_tokens}")
```

## Configuration

| Parameter | Description |
|-----------|-------------|
| `base_url` | URL of your Keiro gateway, e.g. `http://localhost:8080` |
| `secret` | Shared secret set in `KEIRO_SECRET` env var |
| `namespace` | Namespace identifier scoping all operations |
| `timeout` | Request timeout in seconds (default 120) |

## Exception Handling

```python
from keiro import (
    KeiroClient,
    AuthenticationError,
    RateLimitError,
    IngestionError,
    ConnectionError,
)

try:
    response = client.query("What is the refund policy?")
except AuthenticationError:
    print("Invalid secret")
except RateLimitError as e:
    print(f"Rate limited — retry after {e.retry_after}s")
except ConnectionError:
    print("Gateway unreachable")
```

## Links

- [Keiro repository](https://github.com/ManasRanjanJena253/Keiro)
- [Report issues](https://github.com/ManasRanjanJena253/Keiro/issues)
