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
Hashes for langtrace-python-sdk-1.1.23.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a29254763745dd902652f1880c509829c580668821c4da9c271c8fa8e3be109d |
|
MD5 | 81901a027572ea274818f607339e887a |
|
BLAKE2b-256 | 364ab1cb76ad4401c6aa47404fb4df7682618b51d253813bcbc357dc3345bbad |
Hashes for langtrace_python_sdk-1.1.23-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a6b8b81eafeb7bf4004d1940391a046c700849af5a29968ca995aa14c010bac |
|
MD5 | de46f122201a26c53c71bdd295ceb746 |
|
BLAKE2b-256 | 439414cba4c18e1a703c414a46cee8b25ca38c4a70c7d9172f8b9a6a4cc6c461 |