Skip to main content

Self-hostable LLM observability SDK — trace, cost, and hallucination monitoring in one line.

Project description

llmscope SDK

Python SDK for llm-scope — self-hostable LLM observability.

Installation

pip install llmscope
# With all integrations:
pip install "llmscope[all]"

Quick Start

import llmscope
from openai import OpenAI

llmscope.init(
    endpoint="http://localhost:4317",
    service_name="my-app",
)

client = OpenAI()

with llmscope.trace_context(user_id="u_123", feature="chat"):
    response = client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[{"role": "user", "content": "Hello!"}],
    )

LangChain Integration

from llmscope.integrations.langchain import LLMScopeCallbackHandler

handler = LLMScopeCallbackHandler(judge_faithfulness=True)
chain.invoke({"input": "..."}, config={"callbacks": [handler]})

FastAPI Integration

from fastapi import FastAPI
from llmscope.integrations.fastapi import LLMScopeMiddleware

app = FastAPI()
app.add_middleware(
    LLMScopeMiddleware,
    user_id_extractor=lambda req: req.headers.get("X-User-Id"),
)

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

llmscope_kresnapandu-0.1.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

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

llmscope_kresnapandu-0.1.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llmscope_kresnapandu-0.1.0.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for llmscope_kresnapandu-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f8ddafc0c73f546dbd7b64cfe4ded8500884c7c40e0a53bd7cd23b93bf3b155a
MD5 e253d9dcdc2c67051c8d0ffb8835bae3
BLAKE2b-256 6e44acbdea096cb276a8aaf26898674c2da7f73aeef0c63a65ea416b0f945968

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llmscope_kresnapandu-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e4bf1a157f7fbd73e5a8d0265da003e4d742a4e83e124ffcfbab053a23066515
MD5 e918c90115ac5b09d5d9b0e9ccb41074
BLAKE2b-256 e50402196182119144f18c9826196459892b4e46c86eec9077e10d2f18ca38f6

See more details on using hashes here.

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