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.12.tar.gz
(9.9 kB
view details)
Built Distribution
File details
Details for the file langwatch-0.0.12.tar.gz
.
File metadata
- Download URL: langwatch-0.0.12.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 187286e74e5ec62898e17879c5ca42b5f51fd94b0e46fed8a6d3c555b0887b2e |
|
MD5 | d65c82cb3105b977172127ff48c89970 |
|
BLAKE2b-256 | 3b717166938e71f8bb3832288a754d8ac31139f516edf8a01964cb0698bab74e |
File details
Details for the file langwatch-0.0.12-py3-none-any.whl
.
File metadata
- Download URL: langwatch-0.0.12-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d57c635a802b94a58bb4df530e5d62f675c4eecb6c3a37a25a58278977163f22 |
|
MD5 | 6aa9e03d354772c86cc0bb721c20515b |
|
BLAKE2b-256 | b9a9d5baf6acb29bf5c8b93f89091633648438eea983c3f6d6d8b6d8ccc6acdc |