Skip to main content

Thin Python SDK for Latence TRACE.

Project description

Latence

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

latence-0.2.0.tar.gz (47.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

latence-0.2.0-py3-none-any.whl (43.3 kB view details)

Uploaded Python 3

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

Hashes for latence-0.2.0.tar.gz
Algorithm Hash digest
SHA256 440ddd321bc9964e1d58c4aa7def3adf4cebfd5ca13e7ff2f2880937abc206b0
MD5 b386188e929aec220f6097b53bd98bb7
BLAKE2b-256 0b915d93a19c77d0446c921ae537258e87fe8ad919cb6e3c92b51217230cd50e

See more details on using hashes here.

Provenance

The following attestation bundles were made for latence-0.2.0.tar.gz:

Publisher: publish.yml on latenceainew/latence-trace-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for latence-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e2da7095ba2258a126a51524467d4d251050cfb8f07cec5f145ae79fe576d845
MD5 dbea94973850971f87d919fcea1228bb
BLAKE2b-256 c80b64f91fa507eeaeecbf67e080cf6059175843fcadabed27ec151af94db0ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for latence-0.2.0-py3-none-any.whl:

Publisher: publish.yml on latenceainew/latence-trace-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page