sdeul
Structural Data Extractor using LLMs
Installation
$ pip install -U sdeul
Usage
Command Line Interface
-
Create a JSON Schema file for the output
-
Prepare a local model GGUF file or model API key.
-
Extract structural data from given text using
sdeul extract.Example:
# Use OpenAI API $ sdeul extract --openai-model='gpt-4.1' \ test/data/medication_history.schema.json \ test/data/patient_medication_record.txt # Use Amazon Bedrock API $ sdeul extract --bedrock-model='us.anthropic.claude-sonnet-4-20250514-v1:0' \ test/data/medication_history.schema.json \ test/data/patient_medication_record.txt # Use Ollama API $ sdeul extract --ollama-model='gemma3:27b' \ test/data/medication_history.schema.json \ test/data/patient_medication_record.txt # Use a Llama.cpp GGUF model file $ sdeul extract --llamacpp-model-file='local_llm.gguf' \ test/data/medication_history.schema.json \ test/data/patient_medication_record.txt
Expected output:
{ "MedicationHistory": [ { "MedicationName": "Lisinopril", "Dosage": "10mg daily", "Frequency": "daily", "Purpose": "hypertension" }, { "MedicationName": "Metformin", "Dosage": "500mg twice daily", "Frequency": "twice daily", "Purpose": "type 2 diabetes" }, { "MedicationName": "Atorvastatin", "Dosage": "20mg at bedtime", "Frequency": "at bedtime", "Purpose": "high cholesterol" } ] }
REST API
SDEUL also provides a REST API for extracting structured data and validating JSON.
-
Start the API server:
$ sdeul serve
-
The API will be available at
http://localhost:8000with the following endpoints:POST /extract- Extract structured data from textPOST /validate- Validate JSON data against a schemaGET /health- Health check endpointGET /docs- Interactive API documentation
-
Example API usage:
# Extract data using OpenAI $ curl -X POST "http://localhost:8000/extract" \ -H "Content-Type: application/json" \ -d '{ "text": "Patient is taking Lisinopril 10mg daily for hypertension.", "json_schema": { "type": "object", "properties": { "medications": { "type": "array", "items": { "type": "object", "properties": { "name": {"type": "string"}, "dosage": {"type": "string"}, "condition": {"type": "string"} } } } } }, "openai_model": "gpt-4o-mini", "openai_api_key": "your-api-key" }' # Validate JSON data $ curl -X POST "http://localhost:8000/validate" \ -H "Content-Type: application/json" \ -d '{ "data": {"medications": [{"name": "Lisinopril", "dosage": "10mg", "condition": "hypertension"}]}, "json_schema": { "type": "object", "properties": { "medications": { "type": "array", "items": { "type": "object", "properties": { "name": {"type": "string"}, "dosage": {"type": "string"}, "condition": {"type": "string"} } } } } } }'
Release files for sdeul 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sdeul-0.2.0.tar.gz | 208.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sdeul-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 245.1 kB
Release files / sdeul-0.2.0.tar.gz
| Download URL | sdeul-0.2.0.tar.gz |
|---|---|
| Size | 208.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6918e0a6fcb90f2380a5d8fdca070497b4e058be94871db03813240b1ffd5aba
|
|
BLAKE2b-256 checksum How to use checksums |
c1d890ce11bd4c732a4efc6d68b7afa250525f476176497043e7170881af77ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / sdeul-0.2.0-py3-none-any.whl
| Download URL | sdeul-0.2.0-py3-none-any.whl |
|---|---|
| Size | 36.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d5d240809f77bfc831b6932fd9b5d0004d24559699e7fd308537440b89bdaeb
|
|
BLAKE2b-256 checksum How to use checksums |
05235fcd6ac7f8bf6274e4d2222f8ef9c7abdd257d1be4cdf1e71de2137bfa11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|