Metadata-Version: 2.4
Name: homer_sdk
Version: 1.3.4
Summary: Homer SDK is a thin client. All governance, policy checks, and intelligence run on Homer Server.
Author: Homer Semantics
License: Proprietary
Project-URL: Homepage, https://homersemantics.com
Project-URL: Documentation, https://homersemantics.com/docs
Project-URL: Request Access, https://homersemantics.com
Project-URL: Issue Tracker, https://github.com/AnantDhavale/homer_core_sdk/issues
Project-URL: Support, https://homersemantics.com
Keywords: ai,llm,governance,compliance,middleware,audit
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.28.0
Requires-Dist: PyYAML>=6.0
Requires-Dist: psycopg2-binary>=2.9.0
Provides-Extra: openai
Requires-Dist: openai>=1.0.0; extra == "openai"
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.25.0; extra == "anthropic"
Provides-Extra: all
Requires-Dist: openai>=1.0.0; extra == "all"
Requires-Dist: anthropic>=0.25.0; extra == "all"
Dynamic: license-file

# Homer SDK (Thin Client)

Python SDK for Homer Server. Homer Server is the semantic control and governance runtime for AI. 

The SDK is intentionally thin. It forwards requests to Homer Server, where policy enforcement, semantic intelligence, runtime controls, and decision lineage are executed.

Note: CLI entrypoint issues were fixed in v1.3.4. If you tried earlier and saw errors, please upgrade and try again.

```bash
python3 -m pip install -U homer-sdk
homer-sdk --version
```


## Public Demo

- Demo server: `https://demo.homersemantics.com`
- Bootstrap key: `demo_public_v1`

```python
from homer_sdk import Homer

homer = Homer(
    server_url="https://demo.homersemantics.com",
    api_key="demo_public_v1",
)

# SDK auto-exchanges bootstrap key for a short-lived session key.
resp = homer.invoke(
    provider="openai",
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello from demo"}],
)
print(resp.raw_response["content"])
```

## Install

```bash
pip install homer-sdk
```

Verify CLI install:

```bash
homer-sdk --version
```

Optional provider extras:

```bash
pip install "homer-sdk[openai]"
pip install "homer-sdk[anthropic]"
pip install "homer-sdk[all]"
```

## Quick Start (Your Server)

```python
from homer_sdk import Homer

homer = Homer(
    server_url="https://your-homer-server",
    api_key="hk-...",
)

health = homer.health()
print(health["status"])
```

## Chat Invocation

```python
from homer_sdk import Homer

homer = Homer(server_url="https://your-homer-server", api_key="hk-...")
client = homer.openai()

resp = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Summarize this policy text."}],
)

print(resp.raw_response.choices[0].message.content)
print(resp.homer.classification)
print(resp.homer.policy)
print(resp.homer.audit)
```

## Runtime Execution (Server Connector Path)

Use `execute()` to run policy-gated actions through server connectors.

```python
resp = homer.execute(
    action="send_webhook",
    payload={
        "url": "https://hooks.example.com/ingest",
        "body": {"event": "policy_approved"},
    },
)
print(resp.raw_response["execution"])
```

## Core Methods

- `Homer.health()` -> `GET /v1/health`
- `Homer.invoke(...)` -> `POST /v1/invoke`
- `Homer.execute(...)` -> `POST /v1/invoke` with `execution` payload
- `Homer.analyze(text)` -> `POST /v1/analyze`
- `Homer.context.*` -> `/v1/context/...`
- Semantic/graph helpers -> `/v1/semantic/...`

## Support and Feedback

If you hit any issues, please share feedback or error details:

- Support: info@homersemantics.com
- Founder: anantdhavale@gmail.com
- GitHub Issues: https://github.com/AnantDhavale/homer_core_sdk/issues

Helpful details for issue reports:

- SDK version
- Python version
- Full traceback
- Request snippet (without secrets)
- Timestamp and timezone
