SlotMatch
SlotMatch is a lightweight Python package for extracting structured key-value pairs from unstructured or noisy LLM outputs. It supports regex-based parsing, fuzzy key recovery, schema validation, and confidence scoring. Perfect for production RAG, chatbot, and NLU pipelines.
Installation
pip install slotmatch
## Features
- Regex-based value extraction
- Fuzzy key mapping (e.g., intnt → intent)
- Schema validation for expected keys and types
- Type coercion (str, int, float, bool)
- Confidence scoring (regex = high, fuzzy = partial, fallback = 0)
- Lightweight, no external dependencies
## Usage
from slotmatch import SlotExtractor
schema = {
"name": str,
"intent": str,
"destination": str
}
llm_output = '''
Hi, I'm Alice.
{
"intnt": "book_flight",
"dest": "NYC",
"name": "Alice"
}
'''
extractor = SlotExtractor(schema)
print(extractor.extract(llm_output))
## Output
{
'name': {'value': 'Alice', 'confidence': 1.0},
'intent': {'value': 'book_flight', 'confidence': ~0.64},
'destination': {'value': None, 'confidence': 0.0}
}
## Example Use Cases
- Post-processing LLM outputs (chatbots, assistants, tools)
- Extracting form fields or user intents
- Structuring data for downstream APIs or storage
- Integrating LLMs with business logic (field validation, routing)
## License
This project is licensed under the MIT License.
Metadata
Release files for slotmatch 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| slotmatch-0.1.0.tar.gz | 2.0 kB | Without provenance | Details for slotmatch-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| slotmatch-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for slotmatch-0.1.0-py3-none-any.whl |
Total release size: 3.9 kB
Release files / slotmatch-0.1.0.tar.gz
| Download URL | slotmatch-0.1.0.tar.gz |
|---|---|
| Size | 2.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0befc55ef7d54506405f3482f16ecd09c6cdea49f91a65a957218745ef1d7a27
|
|
BLAKE2b-256 checksum How to use checksums |
69b82d8d2e1062d284defb96ba66611877fdbe7353b839da1cc5adfe483a6b93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|
Release files / slotmatch-0.1.0-py3-none-any.whl
| Download URL | slotmatch-0.1.0-py3-none-any.whl |
|---|---|
| Size | 1.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d6ed6ef1bdbeef379f3895ad38e6f4c67143007a1fb98f3f82dd0b4f4a12e7bd
|
|
BLAKE2b-256 checksum How to use checksums |
b508512c9bf1016b3a5b4fb3cc2a0f6c98863b46038e6fc2591fca38a0391817
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|
Security for slotmatch 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.