Metadata-Version: 2.4
Name: tibabot-client
Version: 1.0.0
Summary: Typed Python client for the TibaBot Healthcare AI API
Author-email: TibaBot Health <dev@tibabot.health>
License-Expression: MIT
Project-URL: Homepage, https://tibabot.health
Project-URL: Documentation, https://tibabot.vitora.nexora.africa/docs
Project-URL: Source, https://github.com/nexora-africa-ltd/tibabot
Keywords: healthcare,ai,clinical,kenya,triage
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Healthcare Industry
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.26.0
Requires-Dist: pydantic>=2.0.0
Dynamic: license-file

# TibaBot Python Client

Typed Python SDK for the TibaBot Healthcare AI API.

## Installation

```bash
pip install tibabot-client
```

## Quick Start

```python
from tibabot import TibaBotClient, ChatRequest, TriageRequest, ClinicalAssistRequest

client = TibaBotClient(
    base_url="https://tibabot.vitora.nexora.africa",
    api_key="sk-your-api-key",
)

# Health check
print(client.health())

# Chat with the AI assistant
resp = client.chat(ChatRequest(message="I have a headache for 3 days"))
print(resp.reply)

# Triage symptoms
triage = client.triage(TriageRequest(symptoms=["headache", "fever", "neck stiffness"]))
print(f"Triage level: {triage.triage_level}")
print(f"Red flags: {triage.red_flags_detected}")

# Clinical decision support (provider)
assist = client.clinical_assist(
    ClinicalAssistRequest(query="Treat malaria in pregnancy 2nd trimester")
)
print(assist.recommendation)

# ICD-10 coding
codes = client.icd10_code({"text": "Type 2 diabetes with hypertension"})
print(codes.codes)

client.close()
```

## Authentication

```python
# API key (default)
client = TibaBotClient(base_url="...", api_key="sk-...")

# Bearer token
client = TibaBotClient(base_url="...", bearer_token="eyJ...")
```

## Error Handling

```python
from tibabot import (
    AuthenticationError,
    RateLimitError,
    ValidationError,
    ServerError,
)

try:
    resp = client.chat(ChatRequest(message="Hello"))
except AuthenticationError:
    print("Check your API key")
except RateLimitError as e:
    print(f"Slow down! Retry after {e.retry_after}s")
except ValidationError as e:
    print(f"Invalid request: {e.details}")
except ServerError:
    print("Something went wrong on the server")
```
