LangWatch Python SDK, for monitoring your LLMs
Project description
LangWatch Python SDK ๐
A Python SDK to monitor and observe your LLM applications using LangWatch.
[!CAUTION] This SDK is currently being developed and is not yet ready for production use. Please use the legacy SDK until this notice is removed.
Migration progress
Legend
- โ : Complete
- ๐ง: Migration in progress
- โ: Pending migration
- โฐ: Deprecated
- ๐๏ธ: Removed
Migration progress
| Feature | Status | Tested | Description |
|---|---|---|---|
endpoint |
โ | ๐ | |
api_key |
โ | ๐ | |
enabled |
๐๏ธ | ๐ | |
sampling_rate |
โ | ๐ | |
logger |
โ | ๐ | |
trace |
โ | ๐ | |
span |
โ | ๐ | |
get_current_trace |
โ | ๐ | |
get_current_span |
โ | ๐ | |
create_span |
๐๏ธ | ๐ | This was marked for deprecation, and has been deprecated. |
capture_rag |
๐๏ธ | ๐ | This was marked for deprecation, and has been deprecated. |
langchain |
โ | ๐ | |
dspy |
โ | ๐ | |
login |
โ | ๐ | |
evaluations |
โ | ๐ | |
guardrails |
โ | ๐ | |
openai |
โ | ๐ | |
litellm |
โ | ๐ | |
ContextSpan |
โ | ๐ | |
ContextSpan.update |
โ | ๐ | |
ContextSpan.add_evaluation |
โ | ๐ | |
ContextSpan.evaluate |
โ | ๐ | |
ContextSpan.async_evaluate |
โ | ๐ | |
ContextSpan.end |
โ | ๐ | |
ContextTrace |
โ | ๐ | |
ContextTrace.update |
โ | ๐ | |
ContextTrace.add_evaluation |
โ | ๐ | |
ContextTrace.evaluate |
โ | ๐ | |
ContextTrace.async_evaluate |
โ | ๐ | |
ContextTrace.deferred_send_spans |
๐๏ธ | ๐ | |
ContextTrace.send_spans |
๐๏ธ | ๐ | |
ContextTrace.append_span |
๐๏ธ | ๐ | |
ContextTrace.get_parent_id |
๐๏ธ | ๐ | |
ContextTrace.get_current_span |
โ | ๐ | |
ContextTrace.set_current_span |
๐๏ธ | ๐ | |
ContextTrace.reset_current_span |
๐๏ธ | ๐ | |
ContextTrace.get_langchain_callback |
โ | ๐ | |
ContextTrace.autotrack_openai_calls |
โ | ๐ | |
ContextTrace.autotrack_litellm_calls |
โ | ๐ | |
ContextTrace.autotrack_dspy |
โ | ๐ | |
ContextTrace.share |
โ | ๐ | |
ContextTrace.unshare |
โ | ๐ |
Installation
pip install langwatch==0.3.0rc1
Usage
Set the following environment variables:
LANGWATCH_API_KEY: Your LangWatch API key.LANGWATCH_ENDPOINT: Your LangWatch endpoint, this is only required if you are using a self-hosted LangWatch instance.
import langwatch
import os
from openai import OpenAI
@langwatch.trace()
def main():
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
langwatch.get_current_trace().autotrack_openai_calls(client)
# Any calls to OpenAI will now be tracked by LangWatch
Contributing
We welcome contributions to LangWatch! Here's how you can help:
- Fork the repository
- Create a new branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run the tests (
pytest) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please make sure to update tests as appropriate and follow our coding standards.
Support
- Documentation: docs.langwatch.ai
- Issues: GitHub Issues
- Discord: Join our community
- Email: support@langwatch.ai
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langwatch-0.2.0rc5.tar.gz.
File metadata
- Download URL: langwatch-0.2.0rc5.tar.gz
- Upload date:
- Size: 994.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e52d29a3a73cf7cbed9ac2602cdb3b329936fd7c22f80e0027e4404b165e4e7
|
|
| MD5 |
f451cbc208402aa2ce76d4ef949b09ec
|
|
| BLAKE2b-256 |
ea5eaf62b3fd7cb97dadf2ec42654082ee60712007ad71c7ef3095e68c77ac64
|
File details
Details for the file langwatch-0.2.0rc5-py3-none-any.whl.
File metadata
- Download URL: langwatch-0.2.0rc5-py3-none-any.whl
- Upload date:
- Size: 54.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19473ec3f8dd6724f567d4c16dc05c79b9687d42d4aaef54cf78aa9bd51dbb39
|
|
| MD5 |
12c29ffcc07c116b24fb4d8c707bcd73
|
|
| BLAKE2b-256 |
6023aa0f51a858cb181c71f2fbc26468da062a5909fbe242f57ad9ff444557e0
|