Python SDK for LangWatch for monitoring your LLMs
Project description
LangWatch Python SDK
Go to https://langwatch.ai to setup your account.
To trace OpenAI calls:
from openai import OpenAI
+ import langwatch.openai
client = OpenAI()
+ with langwatch.openai.OpenAITracer(client):
completion = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[
{
"role": "system",
"content": "You are a helpful assistant that only reply in short tweet-like responses, using lots of emojis.",
},
{"role": "user", "content": message},
],
stream=True,
)
To trace LangChain agent:
+ import langwatch.langchain
# ...
chain = LLMChain(
llm=ChatOpenAI(),
prompt=chat_prompt,
output_parser=CommaSeparatedListOutputParser(),
)
+ with langwatch.langchain.LangChainTracer() as langWatchCallback:
- result = chain.run(text="colors")
+ result = chain.run(text="colors", callbacks=[langWatchCallback])
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
langwatch-0.0.18.tar.gz
(12.7 kB
view details)
Built Distribution
File details
Details for the file langwatch-0.0.18.tar.gz
.
File metadata
- Download URL: langwatch-0.0.18.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b644839809b4327cbe915d8dd01efbefbd5ae33d6fee9cc4c11a2a7fe2b17309 |
|
MD5 | f9e482deeab76a3d8e4b2b0d9de4744c |
|
BLAKE2b-256 | 8418acc979188b19099e92a1fc3b0f15e0e05530aad992dba40f07a1fb6424c8 |
File details
Details for the file langwatch-0.0.18-py3-none-any.whl
.
File metadata
- Download URL: langwatch-0.0.18-py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | db2c9d239ced5504003908660bec89b5598ed45e2d1fade43595d20431a54090 |
|
MD5 | a905ac7459ada7cdac46bfd2a6ee0066 |
|
BLAKE2b-256 | 3dce5f8dd4a5e4a41e102871db0507b63dcfdb64245357a2eabb674f43c9b539 |