Metadata-Version: 2.5
Name: jev-lite
Version: 0.0.1
Summary: OpenAI-style sync and async Pydantic client for TypeSafe Jev (System One).
Project-URL: Documentation, https://github.com/allen2c/jev-lite#readme
Project-URL: Homepage, https://github.com/allen2c/jev-lite
Project-URL: Issues, https://github.com/allen2c/jev-lite/issues
Project-URL: Repository, https://github.com/allen2c/jev-lite
Author-email: Allen Chou <f1470891079@gmail.com>
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: jev,openai,opentelemetry,pydantic,system-one,typesafe
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: httpx>=0.23
Requires-Dist: opentelemetry-api>=1.20
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.20
Requires-Dist: opentelemetry-sdk>=1.20
Requires-Dist: pydantic>=2
Provides-Extra: distill
Requires-Dist: datasets>=2; extra == 'distill'
Provides-Extra: ml
Requires-Dist: pillow>=9; extra == 'ml'
Requires-Dist: torch>=2.1; extra == 'ml'
Requires-Dist: torchvision>=0.16; extra == 'ml'
Requires-Dist: transformers>=4.40; extra == 'ml'
Description-Content-Type: text/markdown

# jev-lite

OpenAI-style Python client for [TypeSafe Jev](https://typesafe.ai/) (System One).

Jev does not generate text. Send `state` plus typed questions; get structured
decisions with probabilities. This first release (`v0.0.1`) is the official
TypeSafe HTTP client — sync and async, same shape as the OpenAI Python SDK.

```bash
pip install jev-lite
# or: uv add jev-lite
```

Python 3.11+. Set `TYPESAFE_API_KEY`. Docs: <https://docs.typesafe.ai/>

## Usage

```python
from jev_lite import Choice, Noul, Score, TypeSafe

client = TypeSafe()  # TYPESAFE_API_KEY

result = client.system_one.create(
    state="I was charged twice. Please fix this ASAP.",
    questions={
        "billing": Noul(instructions="Is this ticket about billing?"),
        "tone": Choice(
            instructions="What is the customer's tone?",
            criteria={"calm": None, "frustrated": None, "angry": None},
        ),
        "urgency": Score(
            instructions="How urgent is this ticket?",
            criteria=["can wait", "this week", "today"],
        ),
    },
)

print(result.nouls["billing"].noul)
print(result.choices["tone"].choice)
print(result.scores["urgency"].score)
print(result.elapsed_ms, result.request_id, result.usage)
print(client.models.list())  # GET /v1/models
```

Async is the same surface with `await`:

```python
from jev_lite import AsyncTypeSafe, Noul

async with AsyncTypeSafe() as client:
    result = await client.system_one.create(
        state="I was charged twice. Please fix this ASAP.",
        questions={"billing": Noul(instructions="Is this ticket about billing?")},
    )
    models = await client.models.list()
```

Pin the model with `TypeSafe(model="jev-1.13.0")` (or `TYPESAFE_DEFAULT_MODEL`);
`jev-latest` moves. Prefer one `system_one.create` with many questions over a
loop of calls.

## Tracing

Off by default. Opt in and pick the destination:

```python
from jev_lite import instrument

instrument(endpoint="http://127.0.0.1:4318")  # local Grafana LGTM
```

Or set `OTEL_EXPORTER_OTLP_ENDPOINT` and call `instrument()`, or install your
own `TracerProvider` first (Logfire, etc.). Spans record prompt, result, and
latency.

## Develop

```bash
uv sync --dev
uv run ruff check . && uv run pytest
```

The supported public API is the TypeSafe client. Optional local engines live
under `jev_lite.engine` (`pip install 'jev-lite[ml]'`). See
[docs/](https://github.com/allen2c/jev-lite/tree/main/docs).

## License

Apache-2.0
