Sample LLM traces by risk, errors, latency, and deterministic ids. Python port of @mukundakatta/llm-trace-sampler.
Project description
llm-trace-sampler-py
Sample LLM traces by risk, errors, latency, and deterministic ids. Pure Python, zero deps. Python port of @mukundakatta/llm-trace-sampler.
pip install llm-trace-sampler-py
from llm_trace_sampler import should_sample_trace, sample_traces
# Always sample errors / high-risk / slow traces; sample 10% of the rest.
should_sample_trace({"id": "abc", "error": "boom"})
# SampleDecision(sample=True, reason='priority')
sampled = sample_traces(my_traces, rate=0.1, risk_threshold=0.7, latency_ms=10_000)
Deterministic by trace id — the same id is always sampled / not sampled.
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
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 llm_trace_sampler_py-0.1.0.tar.gz.
File metadata
- Download URL: llm_trace_sampler_py-0.1.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acf7d2dd926a4897da7290994cb4ac7113c367a8935506e16edf2a31f5ba1d49
|
|
| MD5 |
5a4239a88ae608aae0f61c47381caf99
|
|
| BLAKE2b-256 |
0c8753a62532ca63bb32277ba68cd2a3242ad832cd18f1f94b566ad37126bf9b
|
File details
Details for the file llm_trace_sampler_py-0.1.0-py3-none-any.whl.
File metadata
- Download URL: llm_trace_sampler_py-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c906f717b9b00ce176dde6bb00ef13b8f45aaa58fad84ba82b25e72cf61b5e8
|
|
| MD5 |
954920b76fb404b8e3529e127a42b476
|
|
| BLAKE2b-256 |
dd1bc33a09ea453c7297fd7a177359442062cd12e303ebbcef3d492487215515
|