Metadata-Version: 2.1
Name: langwatch
Version: 0.0.19
Summary: Python SDK for LangWatch for monitoring your LLMs
Home-page: https://github.com/langwatch/langwatch
License: MIT
Author: Rogerio Chaves
Author-email: rogerio@langwatch.ai
Requires-Python: >=3.9,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Provides-Extra: langchain
Provides-Extra: openai
Requires-Dist: httpx (>=0.27.0,<0.28.0)
Requires-Dist: langchain (>=0.1.20,<0.2.0) ; extra == "langchain"
Requires-Dist: nanoid (>=2.0.0,<3.0.0)
Requires-Dist: openai (>=1.3.7,<2.0.0) ; extra == "openai"
Requires-Dist: pandas (>=2.2.2,<3.0.0)
Requires-Dist: pydantic (>=2.5.2)
Requires-Dist: requests (>=2.31.0,<3.0.0)
Requires-Dist: retry (>=0.9.2,<0.10.0)
Requires-Dist: tqdm (>=4.66.2,<5.0.0)
Project-URL: Documentation, https://langwatch.ai/docs
Project-URL: Issue Tracker, https://github.com/langwatch/langwatch/issues
Project-URL: Source Code, https://github.com/langwatch/langwatch
Description-Content-Type: text/markdown

# LangWatch Python SDK

Go to [https://langwatch.ai](https://langwatch.ai) to setup your account.

To trace OpenAI calls:

```diff
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:

```diff
+ 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])
```
