Skip to main content

Python SDK for LENS local LLM observability

Project description

LENS Python SDK

Python tracing SDK for LENS local LLM observability.

Repository: https://github.com/Daboss57/lens

Install

Core client only:

pip install lens-python

With provider SDKs:

pip install "lens-python[providers]"

Or install one provider extra at a time:

pip install "lens-python[openai]"
pip install "lens-python[anthropic]"
pip install "lens-python[gemini]"

Quick Start

from lens import LensClient

client = LensClient.from_env()

client.record(
    provider="openai",
    model="gpt-5.4",
    request={"messages": [{"role": "user", "content": "hello"}]},
    response={"content": "hi"},
    prompt_tokens=42,
    completion_tokens=8,
    latency_ms=512,
    status="success",
)

Release Status

The SDK package metadata is set up for PyPI publishing and GitHub Actions release automation.

Environment

  • LENS_ENABLED
  • LENS_API_URL
  • LENS_INGEST_PATH
  • LENS_TIMEOUT_SECONDS

Provider Wrappers

  • lens.openai
  • lens.anthropic
  • lens.gemini

Importing those modules patches the provider clients so model calls can be captured and forwarded to the LENS API.

Behavior

  • sync + async client support
  • silent-fail trace delivery when LENS is unavailable
  • compatible with OpenAI, Anthropic, and Gemini wrappers

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

lens_python-0.1.0.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

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

lens_python-0.1.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file lens_python-0.1.0.tar.gz.

File metadata

  • Download URL: lens_python-0.1.0.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lens_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 182ccb0c95b4b04d8f8563b7c5c4f7d45ba9a965d3bf009a859549a895020679
MD5 55a61abd2752d85abff29d40157cdb9e
BLAKE2b-256 ae759ff7e07cc9b5b6553addd2f1b346cf3e953288d1ab4832c430801c3e1bbe

See more details on using hashes here.

Provenance

The following attestation bundles were made for lens_python-0.1.0.tar.gz:

Publisher: publish-pypi.yml on Daboss57/lens

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

File details

Details for the file lens_python-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: lens_python-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lens_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 25ab524a800461de3b864b5b564309aa30bbbd4f3c7c78d2e9331f62a2ad2c76
MD5 749ee3f1159765db5b36f81f13af4bfe
BLAKE2b-256 ac6a464620cfc2ffac69c68efb55b6a1bec9f9950a733516b3577ecf085c3b2b

See more details on using hashes here.

Provenance

The following attestation bundles were made for lens_python-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on Daboss57/lens

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