Thin Python SDK for Latence TRACE.
Project description
Latence TRACE Python SDK
Real-time safety for knowledge agents. Groundedness verification, privacy redaction, and context compression — without replacing your stack.
PyPI · Quickstart · Integrations · Examples · Website
pip install latence
from latence import Latence
trace = Latence(api_key="lat_...")
score = trace.grounding.rag(
query="Can I promise this customer a refund?",
response_text="Yes, the refund will arrive within 48 hours.",
raw_context="Refunds require manual finance approval before timelines are promised.",
)
print(score.risk_band)
print(score.runtime_decision)
What TRACE Does
- Groundedness — verify RAG answers against retrieved context.
- Compression — reduce long context to what matters.
- Privacy — redact private data before it spreads through tools, logs, or prompts.
Getting Started
export LATENCE_TRACE_API_KEY="lat_..."
from latence import Latence
trace = Latence()
The SDK connects to https://api.latence.ai by default. Override with base_url or LATENCE_TRACE_URL.
API Surface
# Groundedness scoring
score = trace.grounding.rag(query=..., response_text=..., raw_context=...)
# Privacy redaction
redacted = trace.privacy.redact(text=...)
# Context compression
compressed = trace.compression.text(text=..., compression_rate=0.4)
Latence is synchronous. AsyncLatence exposes the same surface for asyncio services.
Base dependencies are only httpx and pydantic.
Integrations
Direct calls are the recommended path. Optional helpers live under
latence.integrations.
pip install "latence[langchain]"
pip install "latence[llama_index]"
pip install "latence[openai]"
pip install "latence[haystack]"
Docs: Integrations
More
Project details
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 latence-0.2.0.tar.gz.
File metadata
- Download URL: latence-0.2.0.tar.gz
- Upload date:
- Size: 47.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
440ddd321bc9964e1d58c4aa7def3adf4cebfd5ca13e7ff2f2880937abc206b0
|
|
| MD5 |
b386188e929aec220f6097b53bd98bb7
|
|
| BLAKE2b-256 |
0b915d93a19c77d0446c921ae537258e87fe8ad919cb6e3c92b51217230cd50e
|
Provenance
The following attestation bundles were made for latence-0.2.0.tar.gz:
Publisher:
publish.yml on latenceainew/latence-trace-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
latence-0.2.0.tar.gz -
Subject digest:
440ddd321bc9964e1d58c4aa7def3adf4cebfd5ca13e7ff2f2880937abc206b0 - Sigstore transparency entry: 1484871541
- Sigstore integration time:
-
Permalink:
latenceainew/latence-trace-python@f7cdc63ecd495b23c7fe33a514c64ebd1a73d8c2 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/latenceainew
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f7cdc63ecd495b23c7fe33a514c64ebd1a73d8c2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file latence-0.2.0-py3-none-any.whl.
File metadata
- Download URL: latence-0.2.0-py3-none-any.whl
- Upload date:
- Size: 43.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2da7095ba2258a126a51524467d4d251050cfb8f07cec5f145ae79fe576d845
|
|
| MD5 |
dbea94973850971f87d919fcea1228bb
|
|
| BLAKE2b-256 |
c80b64f91fa507eeaeecbf67e080cf6059175843fcadabed27ec151af94db0ea
|
Provenance
The following attestation bundles were made for latence-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on latenceainew/latence-trace-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
latence-0.2.0-py3-none-any.whl -
Subject digest:
e2da7095ba2258a126a51524467d4d251050cfb8f07cec5f145ae79fe576d845 - Sigstore transparency entry: 1484871562
- Sigstore integration time:
-
Permalink:
latenceainew/latence-trace-python@f7cdc63ecd495b23c7fe33a514c64ebd1a73d8c2 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/latenceainew
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f7cdc63ecd495b23c7fe33a514c64ebd1a73d8c2 -
Trigger Event:
release
-
Statement type: