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:
+ import langwatch.openai
+ with langwatch.openai.OpenAITracer():
completion = openai.ChatCompletion.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.7.tar.gz
(9.8 kB
view hashes)
Built Distribution
langwatch-0.0.7-py3-none-any.whl
(11.6 kB
view hashes)
Close
Hashes for langwatch-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 277604d06cc156eca0413c8eea2b59b2d7e3284290c48d3c36d8b87e8a4af889 |
|
MD5 | 4337008faa73403296139c6a0afa9a91 |
|
BLAKE2b-256 | a42fdc7a49147e30143a9e9ed2a7eaf613bf7f8e7ff7a63f75dd9bd4db71ae93 |