Python SDK for Universal Knowledge & Action Schema (UKS) v3.0
Project description
uks-sdk (Python)
Python SDK for building and validating Universal Knowledge & Action Schema (UKS) v3.0 packets.
pip install uks-sdk
Usage
Validate a packet
from uks_sdk import validate, validate_file
# From a dict
result = validate(packet_dict)
print(result.valid, result.inferred_level, result.level_match)
if not result.valid:
for err in result.errors:
print(err)
# From a file
result = validate_file("my-packet.uks.json")
Build a packet with Pydantic models
from uks_sdk import UKSPacket, Source, Topic
packet = UKSPacket(
packet_id="uks-omega3-v1",
schema_version="3.0",
conformance_level="L1",
created_at="2026-06-16T00:00:00Z",
topic=Topic(title="Omega-3 Fatty Acids"), # topic is an object, not a bare string
sources=[
Source(
id="src_001",
title="Effect of EPA and DHA on cardiovascular risk",
source_type="research_paper",
credibility_score=9,
evidence_grade="high",
clinical_status="validated",
doi="10.1000/example",
license_label="CC BY 4.0",
rights_url="https://creativecommons.org/licenses/by/4.0/",
)
],
)
import json
# by_alias=True so `_extensions` (not `extensions`) is emitted
print(json.dumps(packet.model_dump(by_alias=True, exclude_none=True), indent=2))
Validate a built packet
result = validate(packet.model_dump(by_alias=True, exclude_none=True))
assert result.valid
Types
All UKS v3.0 types are available as Pydantic v2 models:
| Model | Description |
|---|---|
UKSPacket |
Root packet object |
Source |
Research source |
DataContract |
Layer A contract |
ScrapeTarget |
Layer B acquisition target |
ExtractionRule |
Layer C parsing rule |
Directive |
Layer D processing rule |
Action |
Layer E action |
ActionStep |
Individual action step |
AgentInstructions |
Agent behavior configuration |
KnowledgeNode |
Entity in the knowledge graph |
Evidence Grades
from uks_sdk import EvidenceGrade
EvidenceGrade.HIGH # "high" — meta-analyses of RCTs
EvidenceGrade.MODERATE # "moderate" — individual RCTs
EvidenceGrade.LOW # "low" — observational studies
EvidenceGrade.VERY_LOW # "very_low" — expert opinion
EvidenceGrade.NA # "n_a" — datasets, non-clinical
Requirements
- Python 3.10+
- pydantic >= 2.7
- jsonschema >= 4.22
Links
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
uks_sdk-1.0.0.tar.gz
(16.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
uks_sdk-1.0.0-py3-none-any.whl
(14.5 kB
view details)
File details
Details for the file uks_sdk-1.0.0.tar.gz.
File metadata
- Download URL: uks_sdk-1.0.0.tar.gz
- Upload date:
- Size: 16.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3f6c049cda0a9b8316fc7c3f7c768e33dbdcf7b6dea20336a0326fb0ef1d13d
|
|
| MD5 |
53308142b04bdea3f786724d02de727e
|
|
| BLAKE2b-256 |
00492b87a5ede873e01634a4f01b09920997befc56384648c9911866a6e4c541
|
File details
Details for the file uks_sdk-1.0.0-py3-none-any.whl.
File metadata
- Download URL: uks_sdk-1.0.0-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12abe64323c45089573a1c50a402e0b1eeb39ca41065017c778f88c5452e416c
|
|
| MD5 |
df9be118e2bcaafed91f7173a117fbcb
|
|
| BLAKE2b-256 |
9ff4c7c1b4cfb87f1aed711a993ea7a7e7eaa45e351e866aa4a18cd9bb22b7d1
|