Metadata-Version: 2.4
Name: ie_schema
Version: 0.1.5
Requires-Dist: pydantic>=2.0.0,<3 ; extra == 'model'
Provides-Extra: model
Summary: A flexible schema specification and parser for information extraction tasks.
License-Expression: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

[![Crates.io](https://img.shields.io/crates/v/ie-schema)](https://crates.io/crates/ie-schema)
[![PyPI](https://img.shields.io/pypi/v/ie_schema)](https://pypi.org/project/ie-schema/)
[![Build](https://gitlab.com/paul/ie-schema/badges/main/pipeline.svg)](https://gitlab.com/paul/ie-schema/-/pipelines)
[![Latest Release](https://gitlab.com/paul/ie-schema/-/badges/release.svg)](https://gitlab.com/paul/ie-schema/-/releases)
[![Documentation](https://docs.rs/ie-schema/badge.svg)](https://docs.rs/ie-schema)
[![Dependency Status](https://deps.rs/repo/gitlab/paul/ie-schema/status.svg)](https://deps.rs/repo/gitlab/paul/ie-schema)
[![Docs](https://img.shields.io/readthedocs/ie-schema)](https://ie-schema.readthedocs.io)

# Information Extraction Schema



A flexible input schema for [GLiNER](https://github.com/fastino-ai/GLiNER2) style multi-task models.

## Python

```
uv add ie_schema  # or pip install
# To load from dataclasses / Pydantic models, install the optional dependency:
uv add 'ie_schema[model]'
```

``` python
from dataclasses import dataclass
from ie_schema import IESchema

@dataclass
class BusinessRecord:
    business_name: str
    address_line1: str
    address_line2: str | None
    email: str | None
    website: str | None
    phone: str | None

# From raw JSON (native ie-schema format):
schema = IESchema.loads(
    '{"json_structures":[{"name":"BusinessRecord","business_name":{"dtype":"str"}}]}'
)

# Or a root JSON Schema string (scalar object properties only in this conversion):
schema_from_js = IESchema.loads(
    '{"type":"object","properties":{"business_name":{"type":"string"}}}'
)

# Or pass a dataclass / Pydantic v2 model class or instance
# (requires `pydantic` — use the `model` extra):
from_schema = IESchema.loads(BusinessRecord)
from_instance = IESchema.loads(BusinessRecord("Acme", "Main", None, None, None, None))
print(schema, from_schema, from_instance)
```


## Rust

```
cargo add ie-schema
```

