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.14.tar.gz
(10.6 kB
view details)
Built Distribution
File details
Details for the file langwatch-0.0.14.tar.gz
.
File metadata
- Download URL: langwatch-0.0.14.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9cf949d6857467cfe7179c8baabbd6cdadaf3c917d2f684a48275b75481505d |
|
MD5 | 21e872cdd4f22444ec2efb23bc7fde3d |
|
BLAKE2b-256 | 4275425da6fa3eb7c7d4f2f7ae8c10d2fcea5274a443c9547f812a2883e85675 |
File details
Details for the file langwatch-0.0.14-py3-none-any.whl
.
File metadata
- Download URL: langwatch-0.0.14-py3-none-any.whl
- Upload date:
- Size: 12.7 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 | f685a597abdfd1d88d3ca1426ac577a7b0bbb4c0a55a1d2c40ffff26181776b5 |
|
MD5 | eecd782a0a7532141e15758e9f20bdd2 |
|
BLAKE2b-256 | 75df97faff84e1c3034e1133bb989b9427af7ea9eef572f3cdf106ebd8fed92c |