semvec/pypi-packages huggingface dataset:
letsjson 0.1.6
Generate JSON that strictly matches a schema with automatic retries.
Requires Python: >=3.9

<p align="center">
  <img src="docs/logo.jpg" alt="LetsJSON Logo" width="230" height="200" />
</p>

# LetsJSON
Let LLMs generate exactly the JSON you define.

[中文文档](docs/zh.md)

Generate strongly constrained JSON from LLM outputs:
- Validate fields and types against your schema
- Auto-retry on invalid outputs (default: 3 attempts)
- Raise an error if all retries fail or return empty value
- It's very liteweight, with only 230+ lines of code.

## Installation

```bash
uv add letsjson
```

or:

```bash
pip install letsjson
```

## Usage

```python
import os
from letsjson import LetsJSON

generator = LetsJSON(
    base_url=os.getenv("OPENAI_BASE_URL"),
    model=os.getenv("OPENAI_MODEL"),
    api_key=os.getenv("OPENAI_API_KEY"),
    temperature=0.2,  # optional
)

schema = {
    "title": str,
    "steps": [{"time": str, "location": str, "detail": str}],
}
result = generator.gen("Give me a 2-day London travel plan", schema)
print(result)

# Streaming output (optional)
result = generator.gen_stream(
    "Give me a 2-day London travel plan",
    schema,
    on_chunk=lambda chunk: print(chunk, end="", flush=True),
)
print("\n--- parsed json ---")
print(result)

# return:
# {
#   "title": "2-Day London Travel Plan",
#   "steps": [
#     {"time": "Day 1 Morning",
#      "location": "British Museum", 
#      "detail": "Explore ancient artifacts and world history."},
#    {"time": "Day 1 Afternoon",
#     "location": "Covent Garden",
#     "detail": "Enjoy street performances and shopping."},
#   ...
#  ]
```

## Supported Schema Types

- Object: `{"name": str, "age": int}`
- List: `{"items": [str]}` (list schema must contain exactly one element type)
- Nested: `{"user": {"name": str}, "tags": [str]}`
- Strict type checks:
  - `int` does not accept `bool`
  - `float` accepts `int` and `float` (does not accept `bool`)
aircloudy 0.1.15
A library to pilot hitachi aircloud AC
Requires Python: >=3.13
Keywords: aircloud, SPX-WFG

# aircloudy

[![PyPI - Version](https://img.shields.io/pypi/v/aircloudy.svg)](https://pypi.org/project/aircloudy)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/aircloudy.svg)](https://pypi.org/project/aircloudy)

Aircloudy is an unofficial python library that allow management of RAC (Room Air Conditioner) compatible with Hitachi Air Cloud.

This project IS NOT endorsed by Hitachi and is distributed as-is without warranty.

-----

**Table of Contents**

- [Installation](#installation)
- [Usage](#usage)
- [License](#license)
- [Development](#development)

## Installation

```console
pip install aircloudy
```

## Usage

```python
from __future__ import annotations
import asyncio
from aircloudy import HitachiAirCloud, InteriorUnit, compute_interior_unit_diff_description


def print_changes(dict: dict[int, tuple[InteriorUnit|None, InteriorUnit|None]]) -> None:
    for (id, change) in dict.items():
        print(f"Change on interior unit {id}: "+compute_interior_unit_diff_description(change[0], change[1]))

async def main() -> None:
    async with HitachiAirCloud("your@email.com", "top_secret") as ac:
        ac.on_change = print_changes

        unit_bureau = next((iu for iu in ac.interior_units if iu.name == "Bureau"), None)
        if unit_bureau is None:
            raise Exception("No unit named `Bureau`")

        await ac.set(unit_bureau.id, "ON")
        await ac.set(unit_bureau.id, requested_temperature=21, fan_speed="LV3")

        await asyncio.sleep(30)


asyncio.run(main())
```

## License

`aircloudy` is distributed under modified HL3 license. See `LICENSE.txt`.

## Development

```shell
poetry run task lint
```

```shell
poetry run task check
```

```shell
poetry run task test
```

```shell
poetry run task coverage
```

```shell
poetry --build publish
```

## Notes

Not read/used field from notification :
```
iduFrostWashStatus: IduFrostWashStatus
        active: bool
        priority: int
        astUpdatedA: int
        subCategory = None
        errorCode = None
specialOperationStatus: SpecialOperationStatus
        active: bool
        priority: int
        lastUpdatedAt: int
        subCategory = None
        errorCode = None
errorStatus: ErrorStatus
        active: bool
        priority: int
        lastUpdatedAt: int
        subCategory: str
        errorCode = None
cloudId: str
opt4: int
holidayModeStatus: HolidayModeStatus
        active: bool
        priority: int
        lastUpdatedAt: int
        subCategory = None
        errorCode = None
SysType: int
```

Not read/used field from API:
```
userId: str
iduFrostWash: bool
specialOperation: bool
criticalError: bool
zoneId: str
```