Skip to main content

Python SDK for LangTrace

Project description

LangTrace

Looking for the Typescript version? Check out langtrace-typescript.

LangTrace is a set of extensions built on top of OpenTelemetry that gives you complete observability over your LLM application. Because it uses OpenTelemetry under the hood.

The repo contains standard OpenTelemetry instrumentations for LLM providers and Vector DBs, while still outputting standard OpenTelemetry data that can be connected to your observability stack. If you already have OpenTelemetry instrumented, you can just add any of our instrumentations directly.

🚀 Getting Started

The easiest way to get started is to use our SDK.

Install the SDK:

pip install langtrace-python-sdk

Then, to start instrumenting your code, just add this line to your code:

from langtrace_python_sdk import langtrace

langtrace.init()

That's it. You're now tracing your code with LangTrace! If you want to see the traces you can enable logging

langtrace.init(log_spans_to_console=True)

If you want to export traces to an external endpoint, you will need to add LANGTRACE_URL to .env file.

langtrace.init(write_to_remote_url=True)

🪗 What do we instrument?

LangTrace can instrument everything that OpenTelemetry already instruments - so things like your DB, API calls, and more. On top of that, we built a set of custom extensions that instrument things like your calls to OpenAI or Anthropic, or your Vector DB like Chroma, Pinecone

LLM Providers

  • ✅ OpenAI / Azure OpenAI
  • ✅ Anthropic

Vector DBs

  • ✅ Chroma
  • ✅ Pinecone

Frameworks

  • ✅ LangChain
  • ✅ LlamaIndex

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

langtrace-python-sdk-1.1.6.tar.gz (31.8 kB view hashes)

Uploaded Source

Built Distribution

langtrace_python_sdk-1.1.6-py3-none-any.whl (51.2 kB view hashes)

Uploaded Python 3

Supported by

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