Structural Data Extractor using LLMs
Project description
sdeul
Structural Data Extractor using LLMs
Installation
$ pip install -U sdeul
Usage
-
Create a JSON Schema file for the output
-
Prepare a local model GGUF file or model API key.
Example:
# Set an OpenAI API key $ export OPENAI_API_KEY='sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' # Set a Groq API key $ export GROQ_API_KEY='sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' # Download a model GGUF file from Hugging Face $ curl -SLO https://huggingface.co/bartowski/Meta-Llama-3.1-8B-Instruct-GGUF/resolve/main/Meta-Llama-3.1-8B-Instruct-Q6_K_L.gguf
-
Extract structural data from given text using
sdeul extract
.Example:
# Use OpenAI API $ sdeul extract \ --openai-model=gpt-4o-mini \ test/data/medication_history.schema.json \ test/data/patient_medication_record.txt # Use Groq API $ sdeul extract \ --groq-model=llama-3.1-70b-versatile \ test/data/medication_history.schema.json \ test/data/patient_medication_record.txt # Use local LLM $ sdeul extract \ --model-file=Meta-Llama-3.1-8B-Instruct-Q6_K_L.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" } ] }
Run sdeul --help
for more details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
sdeul-0.1.4-py3-none-any.whl
(23.2 kB
view hashes)