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.10.tar.gz
(9.9 kB
view details)
Built Distribution
File details
Details for the file langwatch-0.0.10.tar.gz
.
File metadata
- Download URL: langwatch-0.0.10.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a637a5f777d743bba1840e687bc8411623ec8f537264d0c13e459b0fd0bb912 |
|
MD5 | 22ff9dc43df4405925630f3fd50de3b6 |
|
BLAKE2b-256 | 34672497c92da16f612fcf44145c1175ba18c4b0312bc58e66918e1f28efc877 |
Provenance
File details
Details for the file langwatch-0.0.10-py3-none-any.whl
.
File metadata
- Download URL: langwatch-0.0.10-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75799a7afdd0026a1bf6e60c4f3bc3d59f045becd3b0364a36bc665ef5b733a9 |
|
MD5 | cc281e69f8c3b492ff5142e9e56c8a6e |
|
BLAKE2b-256 | 9637815cca2d530e981611e5e58e867fe2e3f401d48e2d9c7f83e59c8fb731a1 |