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.30.tar.gz
(17.6 kB
view details)
Built Distribution
File details
Details for the file langwatch-0.0.30.tar.gz
.
File metadata
- Download URL: langwatch-0.0.30.tar.gz
- Upload date:
- Size: 17.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bbbe45a13f366a6a156fc92a92945ff671322091209b75cde127045c1840210 |
|
MD5 | c0177ff86cfe99f2a34a90452d1a2443 |
|
BLAKE2b-256 | edb4525d7f47bf4752aad2128a9cb0cdee7995a4f920bf2730b58a6afa822495 |
File details
Details for the file langwatch-0.0.30-py3-none-any.whl
.
File metadata
- Download URL: langwatch-0.0.30-py3-none-any.whl
- Upload date:
- Size: 21.4 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 | f7b10a80c3ea1f00cfce6ca11e6ed771fa8e13d3f72edc30e66f1650e022e2c6 |
|
MD5 | cbab122a12a833c056f906ecbaf56e20 |
|
BLAKE2b-256 | 5b8b28b5caa5b7245ef9df26169294fc1dbf823e570c9e35bddcf6d9d2fc3c6e |