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.21.tar.gz
(13.5 kB
view details)
Built Distribution
File details
Details for the file langwatch-0.0.21.tar.gz
.
File metadata
- Download URL: langwatch-0.0.21.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dec4fb1e11e9e8fd6587ac82d413c9be7e08f3960667ac10e30df01734ccce5d |
|
MD5 | 21ee873d6607933d5f136427f5f0fc25 |
|
BLAKE2b-256 | 14f1e135510da3624069c8a68d9f0644d7088cb4669897d621d5680ca4626a37 |
File details
Details for the file langwatch-0.0.21-py3-none-any.whl
.
File metadata
- Download URL: langwatch-0.0.21-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb461c12a6f05ae8c1f4c8ae7ceca8ea3984e4f2a76a51cd3cf5461bdac777aa |
|
MD5 | a9743c01523240d9bf9ce15a1f34d0a7 |
|
BLAKE2b-256 | 4409d2b27118e01a868b445afbaf26ad1335cd80a8b4f3533be428d73dc5f3c1 |