Deterministic, explainable context optimization for LLM applications.
Project description
ContextOS
ContextOS — The right context. Every time.
ContextOS is an opinionated, open-source Python library for Context Engineering: building, selecting, and preparing high-quality context to include in prompts for Large Language Models (LLMs). It is model-agnostic and designed to work with hosted and local models.
Current release: v0.1.0
Highlights
- Opinionated pipeline for deterministic context selection
- Budget-aware token estimation and context trimming
- Pluggable ranking and optimization stages
- Strong type coverage (py.typed) and CI-tested code
Installation
Install the latest release from PyPI:
pip install piddi-os
Import the library:
from contextos import ContextEngine
Quick Start
from contextos import ContextEngine
engine = ContextEngine()
engine.add_text("Angular introduced Signals.")
engine.add_text("React introduced Hooks.")
prompt = engine.build(query="Explain Angular Signals", max_tokens=500)
print(prompt)
Features
- ContextEngine: simple, composable public API
- ContextStore: in-memory context management
- Pipeline stages: ranking, budgeting, optimization
- Token estimation and budget enforcement
- Explainable optimization and tracing
Examples & Docs
See the examples/ directory and the docs/ folder for usage patterns, architecture notes, and recipes.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Maintainers
Maintained by the Keshav Labs.
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
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
File details
Details for the file piddi_os-0.1.0.tar.gz.
File metadata
- Download URL: piddi_os-0.1.0.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c07638454323182ec6875865631abf19a84f2a95dba732b740cd80fa57dd0fe
|
|
| MD5 |
11c44af7808532165b8db47a9b4ce637
|
|
| BLAKE2b-256 |
2191bba6d0644a026bb9d6ea0540dc79fcc89e605fab493ca926e895e09c6176
|
File details
Details for the file piddi_os-0.1.0-py3-none-any.whl.
File metadata
- Download URL: piddi_os-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef673498a660b37dce19f2a40713bd9fca9e6edcf0f663c21b3a7879d6f95ae9
|
|
| MD5 |
069f464904cdbc8123ff8ff6b6122526
|
|
| BLAKE2b-256 |
e20da65fec39793ec1c2a3c98cb7e08fe02e687f258625099c4c8f2ee1c7fd05
|