Metadata-Version: 2.4
Name: jev-runner
Version: 0.1.0
Summary: Run Jev Choice and Noul questions over caller-defined states and return structured answers.
Author: Lakshya Gupta
License: MIT License
        
        Copyright (c) 2026 Lakshya Gupta
        
        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.
        
Keywords: jev,typesafe,decisions,openrouter,classification
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.27
Provides-Extra: demo
Requires-Dist: python-dotenv>=1.0; extra == "demo"
Provides-Extra: dev
Requires-Dist: build>=1.0; extra == "dev"
Requires-Dist: twine>=5.0; extra == "dev"
Requires-Dist: python-dotenv>=1.0; extra == "dev"
Dynamic: license-file

# jev-runner

Small Python library for calling [Jev](https://typesafe.ai/) decision APIs: you supply **states** and **questions** (Choice and Noul); the runner validates input, calls Jev, and returns parsed answers.

**Caller owns semantics** (what to ask, what counts as a match). **The runner owns execution** (HTTP, parsing, errors).

## Install

```bash
pip install jev-runner
```

From source (library only):

```bash
pip install .
```

Maintainers (build, publish, local `jev-run` with `.env` loading):

```bash
pip install -e ".[dev]"
```

End users who want `.env` loading without build tools:

```bash
pip install "jev-runner[demo]"
```

## Configuration

No credentials are bundled. Set `JEV_API_KEY` or pass `JevConfig` explicitly.

| Variable | Default |
|----------|---------|
| `JEV_API_KEY` | *(required)* |
| `JEV_BASE_URL` | `https://openrouter.ai/api` |
| `JEV_ENDPOINT_PATH` | `/alpha/decisions` |
| `JEV_MODEL` | `typesafe/jev-1.13` |
| `JEV_TIMEOUT_SECONDS` | `60` |

Copy `.env.example` to `.env` for local runs (never commit `.env`).

TypeSafe direct example:

```python
from jev_runner import JevConfig, JevRunner

runner = JevRunner(JevConfig(
    api_key="...",
    base_url="https://api.typesafe.ai",
    endpoint_path="/v1/systemone",
    model="jev-latest",
))
```

## Usage

```python
from jev_runner import (
    ChoiceQuestion,
    JevRunRequest,
    JevRunner,
    NoulQuestion,
)

runner = JevRunner()

result = runner.run(JevRunRequest(
    states=["Airindia plane emergency landing due to bird strike"],
    questions={
        "category": ChoiceQuestion(
            instructions="Which single category best describes the post?",
            criteria={
                "news": "News or current events.",
                "travel": "Air travel or airlines.",
            },
        ),
        "urgent": NoulQuestion(
            instructions="Is the post about an urgent or emergency situation?"
        ),
    },
))

r = result.results[0]
print(r.answers["category"].choice)
print(r.answers["urgent"].probability)
```

## Scenario CLI (manual output review)

With `python-dotenv` installed (`pip install "jev-runner[demo]"` or `".[dev]"` from source):

```bash
jev-run list
jev-run run
jev-run run -s multiple_states
```

## Publish checklist

- No `.env` or API keys in the repository or wheel
- Bump `version` in `pyproject.toml`
- `python -m build` and inspect `dist/` before upload

## License

MIT — see [LICENSE](LICENSE).
