Python SDK for LangTrace
Project description
What is Langtrace?
Langtrace stands as a developer-centric, open-source solution, fully compatible with OpenTelemetry. It enables developers to effortlessly trace, monitor, and debug their LLM applications, offering robust support for automatic instrumentation.
Supported LLM Modules
Langtrace supports a comprehensive range of LLMs, VectorDBs, and frameworks, ensuring wide coverage for your development needs:
LLMs
- OpenAI
- Anthropic
- Azure OpenAI
VectorDBs
- Pinecone
- Chromadb
Frameworks
- LangChain
- LlamaIndex
- Haystack
We are actively working to extend our support to additional libraries!
Getting Started
To begin utilizing Langtrace, follow these straightforward steps:
- Install the package using
pip install langtrace-python-sdk
. - Incorporate Langtrace into your project with
from langtrace_python_sdk import langtrace
.- This import should precede any other LLM module imports (such as OpenAI, LlamaIndex, etc.) to ensure proper functionality.
- Initialize Langtrace by adding
langtrace.init({ write_to_remote_url: false})
to your code. - Congratulations, you've completed the basic setup! You will now begin to see traces from your LLM modules logged directly to the console.
Exporting Traces to Langtrace
To configure trace exporting, you have two options:
You'll need both a Langtrace api_key
and a remote_url
, which can be acquired by logging into your Langtrace account.
- Direct Initialization: Utilize
langtrace.init(batch=True, api_key=<YOUR_API_KEY>, remote_url=<YOUR_REMOTE_URL>)
. - Environment Variables: Set
API_KEY
andURL
, then addLangTrace.init(batch=True)
at the beginning of your file.
Langtrace Cloud
Currently under development 🚧
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
Built Distribution
File details
Details for the file langtrace-python-sdk-1.1.20.tar.gz
.
File metadata
- Download URL: langtrace-python-sdk-1.1.20.tar.gz
- Upload date:
- Size: 34.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 021596b4cb6e6831d844c6bdd4777b0af56808b303e3d5936030eae327a6f088 |
|
MD5 | 9e5cfe4a1f149300c8857f85e47bce0c |
|
BLAKE2b-256 | 785ca154f43dec08cd90007959adc17a22eb07aa19d6c88d1bb961bef3d7d9b3 |
File details
Details for the file langtrace_python_sdk-1.1.20-py3-none-any.whl
.
File metadata
- Download URL: langtrace_python_sdk-1.1.20-py3-none-any.whl
- Upload date:
- Size: 53.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 169f54e7e3e39f8b6561e7977d15d42320bad720fc66cb2fe31764e1e68832d9 |
|
MD5 | fc6715b391fbccee9cb07c239b361c6a |
|
BLAKE2b-256 | dc27aed4f3fa91ad284f038a43c888422205ed4e9f87d0450efcc3bb3a7ef325 |